i18npool/Library_i18npool.mk                            |    4 
 i18npool/inc/breakiteratorImpl.hxx                      |   15 --
 i18npool/source/breakiterator/breakiteratorImpl.cxx     |   33 +++-
 include/i18npool/breakiterator.hxx                      |  111 ++++++++++++++++
 include/i18npool/i18npooldllapi.h                       |   30 ++++
 sd/source/ui/view/viewshe2.cxx                          |    3 
 sw/CppunitTest_sw_uwriter.mk                            |    1 
 sw/Library_sw.mk                                        |    1 
 sw/inc/breakit.hxx                                      |    7 -
 sw/source/core/access/accpara.cxx                       |    2 
 sw/source/core/access/accportions.cxx                   |    2 
 sw/source/core/bastyp/breakit.cxx                       |    3 
 sw/source/core/crsr/callnk.cxx                          |    2 
 sw/source/core/crsr/swcrsr.cxx                          |    2 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    2 
 sw/source/core/doc/docfmt.cxx                           |    2 
 sw/source/core/doc/docruby.cxx                          |    2 
 sw/source/core/docnode/node.cxx                         |    2 
 sw/source/core/edit/edattr.cxx                          |    2 
 sw/source/core/text/guess.cxx                           |    2 
 sw/source/core/text/itratr.cxx                          |    2 
 sw/source/core/text/porfld.cxx                          |    2 
 sw/source/core/text/porlay.cxx                          |    2 
 sw/source/core/text/pormulti.cxx                        |    2 
 sw/source/core/text/portxt.cxx                          |    2 
 sw/source/core/text/txtdrop.cxx                         |    2 
 sw/source/core/text/txthyph.cxx                         |    2 
 sw/source/core/txtnode/fntcache.cxx                     |    2 
 sw/source/core/txtnode/fntcap.cxx                       |    2 
 sw/source/core/txtnode/txatritr.cxx                     |    2 
 sw/source/core/txtnode/txtedt.cxx                       |   12 -
 sw/source/filter/html/htmlatr.cxx                       |    2 
 sw/source/filter/html/htmlfldw.cxx                      |    2 
 sw/source/filter/html/swhtml.cxx                        |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx            |    2 
 sw/source/filter/ww8/writerwordglue.cxx                 |    2 
 sw/source/filter/ww8/wrtw8esh.cxx                       |    2 
 sw/source/filter/ww8/wrtw8nds.cxx                       |    2 
 sw/source/filter/ww8/ww8atr.cxx                         |    2 
 sw/source/filter/ww8/ww8par5.cxx                        |    2 
 sw/source/uibase/docvw/edtwin.cxx                       |    5 
 sw/source/uibase/lingu/hhcwrp.cxx                       |    2 
 42 files changed, 222 insertions(+), 63 deletions(-)

New commits:
commit 26d80567e7759e4a6358d88a173e603e16ca4517
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Jan 28 11:07:10 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jan 29 08:44:35 2026 +0100

    tdf#148218 reduce OUString allocations in SwScanner::NextWord
    
    since we only use one break-iterator these days,
    expose a additional C++ interface to that, as well as the existing UNO 
interface,
    and add a method which allows us to avoid allocating an OUString when 
calling endOfScript().
    
    Shaves off 20% of the temporary allocations.
    
    Change-Id: I7092affc1820555353e8bf6498e11c9eff42cfad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198276
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk
index df7f141475ce..6302ed45b931 100644
--- a/i18npool/Library_i18npool.mk
+++ b/i18npool/Library_i18npool.mk
@@ -26,6 +26,10 @@ $(eval $(call gb_Library_set_include,i18npool,\
 
 $(eval $(call gb_Library_use_sdk_api,i18npool))
 
+$(eval $(call gb_Library_add_defs,i18npool,\
+       -DI18NPOOL_DLLIMPLEMENTATION \
+))
+
 $(eval $(call gb_Library_use_libraries,i18npool,\
        comphelper \
        cppu \
diff --git a/i18npool/inc/breakiteratorImpl.hxx 
b/i18npool/inc/breakiteratorImpl.hxx
index a2700b7a9bf9..ad835f5407be 100644
--- a/i18npool/inc/breakiteratorImpl.hxx
+++ b/i18npool/inc/breakiteratorImpl.hxx
@@ -18,9 +18,7 @@
  */
 #pragma once
 
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
-#include <cppuhelper/implbase.hxx>
+#include <i18npool/breakiterator.hxx>
 
 #include <utility>
 #include <vector>
@@ -29,13 +27,7 @@ namespace com::sun::star::uno { class XComponentContext; }
 
 namespace i18npool {
 
-
-
-class BreakIteratorImpl : public cppu::WeakImplHelper
-<
-    css::i18n::XBreakIterator,
-    css::lang::XServiceInfo
->
+class BreakIteratorImpl : public BreakIterator
 {
 public:
     BreakIteratorImpl( const css::uno::Reference < css::uno::XComponentContext 
>& rxContext );
@@ -97,6 +89,9 @@ public:
     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
+    virtual sal_Int32 endOfScript( std::u16string_view Text, sal_Int32 
nStartPos, sal_Int16 ScriptType ) override;
+    virtual sal_Int32 beginOfScript( std::u16string_view Text, sal_Int32 
nStartPos, sal_Int16 ScriptType ) override;
+
     static sal_Int16 getScriptClass(sal_uInt32 currentChar);
 protected:
     css::i18n::Boundary result; // for word break iterator
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx 
b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index 790f4824836a..aa5e35c837b1 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -38,6 +38,9 @@ using namespace ::com::sun::star::lang;
 
 namespace i18npool {
 
+BreakIterator::BreakIterator() {}
+BreakIterator::~BreakIterator() {}
+
 BreakIteratorImpl::BreakIteratorImpl( const Reference < XComponentContext >& 
rxContext ) : m_xContext( rxContext )
 {
 }
@@ -274,13 +277,13 @@ sal_Int16 SAL_CALL BreakIteratorImpl::getScriptType( 
const OUString& Text, sal_I
 /** Increments/decrements position first, then obtains character.
     @return current position, may be -1 or text length if string was consumed.
  */
-static sal_Int32 iterateCodePoints(const OUString& Text, sal_Int32 &nStartPos, 
sal_Int32 inc, sal_uInt32& ch) {
-        sal_Int32 nLen = Text.getLength();
+static sal_Int32 iterateCodePoints(std::u16string_view Text, sal_Int32 
&nStartPos, sal_Int32 inc, sal_uInt32& ch) {
+        sal_Int32 nLen = Text.size();
         if (nStartPos + inc < 0 || nStartPos + inc >= nLen) {
             ch = 0;
             nStartPos = nStartPos + inc < 0 ? -1 : nLen;
         } else {
-            ch = Text.iterateCodePoints(&nStartPos, inc);
+            ch = o3tl::iterateCodePoints(Text, &nStartPos, inc);
             // Fix for #i80436#.
             // erAck: 2009-06-30T21:52+0200  This logic looks somewhat
             // suspicious as if it cures a symptom... anyway, had to add
@@ -292,7 +295,7 @@ static sal_Int32 iterateCodePoints(const OUString& Text, 
sal_Int32 &nStartPos, s
             // With surrogates, nStartPos may actually point behind string
             // now, even if inc is only +1
             if (inc > 0)
-                ch = (nStartPos < nLen ? Text.iterateCodePoints(&nStartPos, 0) 
: 0);
+                ch = (nStartPos < nLen ? o3tl::iterateCodePoints(Text, 
&nStartPos, 0) : 0);
         }
         return nStartPos;
 }
@@ -301,10 +304,16 @@ static sal_Int32 iterateCodePoints(const OUString& Text, 
sal_Int32 &nStartPos, s
 sal_Int32 SAL_CALL BreakIteratorImpl::beginOfScript( const OUString& Text,
         sal_Int32 nStartPos, sal_Int16 ScriptType )
 {
-    if (nStartPos < 0 || nStartPos >= Text.getLength())
+    return beginOfScript(std::u16string_view(Text), nStartPos, ScriptType);
+}
+
+sal_Int32 BreakIteratorImpl::beginOfScript( std::u16string_view Text,
+        sal_Int32 nStartPos, sal_Int16 ScriptType )
+{
+    if (nStartPos < 0 || nStartPos >= static_cast<sal_Int32>(Text.size()))
         return -1;
 
-    if(ScriptType != getScriptClass(Text.iterateCodePoints(&nStartPos, 0)))
+    if(ScriptType != getScriptClass(o3tl::iterateCodePoints(Text, &nStartPos, 
0)))
         return -1;
 
     if (nStartPos == 0) return 0;
@@ -319,13 +328,19 @@ sal_Int32 SAL_CALL BreakIteratorImpl::beginOfScript( 
const OUString& Text,
 sal_Int32 SAL_CALL BreakIteratorImpl::endOfScript( const OUString& Text,
         sal_Int32 nStartPos, sal_Int16 ScriptType )
 {
-    if (nStartPos < 0 || nStartPos >= Text.getLength())
+    return endOfScript(std::u16string_view(Text), nStartPos, ScriptType);
+}
+
+sal_Int32 BreakIteratorImpl::endOfScript( std::u16string_view Text,
+        sal_Int32 nStartPos, sal_Int16 ScriptType )
+{
+    if (nStartPos < 0 || nStartPos >= static_cast<sal_Int32>(Text.size()))
         return -1;
 
-    if(ScriptType != getScriptClass(Text.iterateCodePoints(&nStartPos, 0)))
+    if(ScriptType != getScriptClass(o3tl::iterateCodePoints(Text, &nStartPos, 
0)))
         return -1;
 
-    sal_Int32 strLen = Text.getLength();
+    sal_Int32 strLen = Text.size();
     sal_uInt32 ch=0;
     while(iterateCodePoints(Text, nStartPos, 1, ch) < strLen ) {
         sal_Int16 currentCharScriptType = getScriptClass(ch);
diff --git a/include/i18npool/breakiterator.hxx 
b/include/i18npool/breakiterator.hxx
new file mode 100644
index 000000000000..6e90ddcdb75d
--- /dev/null
+++ b/include/i18npool/breakiterator.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <cppuhelper/implbase.hxx>
+#include "i18npooldllapi.h"
+
+namespace i18npool
+{
+class I18NPOOL_DLLPUBLIC BreakIterator
+    : public cppu::WeakImplHelper<css::i18n::XBreakIterator, 
css::lang::XServiceInfo>
+{
+public:
+    BreakIterator();
+    virtual ~BreakIterator() override;
+
+    virtual sal_Int32 SAL_CALL nextCharacters(const OUString& Text, sal_Int32 
nStartPos,
+                                              const css::lang::Locale& rLocale,
+                                              sal_Int16 
nCharacterIteratorMode, sal_Int32 nCount,
+                                              sal_Int32& nDone) override = 0;
+    virtual sal_Int32 SAL_CALL previousCharacters(const OUString& Text, 
sal_Int32 nStartPos,
+                                                  const css::lang::Locale& 
nLocale,
+                                                  sal_Int16 
nCharacterIteratorMode,
+                                                  sal_Int32 nCount, sal_Int32& 
nDone) override = 0;
+
+    virtual css::i18n::Boundary SAL_CALL previousWord(const OUString& Text, 
sal_Int32 nStartPos,
+                                                      const css::lang::Locale& 
nLocale,
+                                                      sal_Int16 WordType) 
override = 0;
+    virtual css::i18n::Boundary SAL_CALL nextWord(const OUString& Text, 
sal_Int32 nStartPos,
+                                                  const css::lang::Locale& 
nLocale,
+                                                  sal_Int16 WordType) override 
= 0;
+    virtual css::i18n::Boundary SAL_CALL getWordBoundary(const OUString& Text, 
sal_Int32 nPos,
+                                                         const 
css::lang::Locale& nLocale,
+                                                         sal_Int16 WordType,
+                                                         sal_Bool bDirection) 
override = 0;
+
+    virtual sal_Bool SAL_CALL isBeginWord(const OUString& Text, sal_Int32 nPos,
+                                          const css::lang::Locale& nLocale,
+                                          sal_Int16 WordType) override = 0;
+    virtual sal_Bool SAL_CALL isEndWord(const OUString& Text, sal_Int32 nPos,
+                                        const css::lang::Locale& nLocale,
+                                        sal_Int16 WordType) override = 0;
+    virtual sal_Int16 SAL_CALL getWordType(const OUString& Text, sal_Int32 
nPos,
+                                           const css::lang::Locale& nLocale) 
override = 0;
+
+    virtual sal_Int32 SAL_CALL beginOfSentence(const OUString& Text, sal_Int32 
nStartPos,
+                                               const css::lang::Locale& 
nLocale) override = 0;
+    virtual sal_Int32 SAL_CALL endOfSentence(const OUString& Text, sal_Int32 
nStartPos,
+                                             const css::lang::Locale& nLocale) 
override = 0;
+
+    virtual css::i18n::LineBreakResults SAL_CALL
+    getLineBreak(const OUString& Text, sal_Int32 nStartPos, const 
css::lang::Locale& nLocale,
+                 sal_Int32 nMinBreakPos, const 
css::i18n::LineBreakHyphenationOptions& hOptions,
+                 const css::i18n::LineBreakUserOptions& bOptions) override = 0;
+
+    virtual sal_Int16 SAL_CALL getScriptType(const OUString& Text, sal_Int32 
nPos) override = 0;
+    virtual sal_Int32 SAL_CALL beginOfScript(const OUString& Text, sal_Int32 
nStartPos,
+                                             sal_Int16 ScriptType) override = 
0;
+    virtual sal_Int32 SAL_CALL endOfScript(const OUString& Text, sal_Int32 
nStartPos,
+                                           sal_Int16 ScriptType) override = 0;
+    virtual sal_Int32 SAL_CALL previousScript(const OUString& Text, sal_Int32 
nStartPos,
+                                              sal_Int16 ScriptType) override = 
0;
+    virtual sal_Int32 SAL_CALL nextScript(const OUString& Text, sal_Int32 
nStartPos,
+                                          sal_Int16 ScriptType) override = 0;
+
+    virtual sal_Int32 SAL_CALL beginOfCharBlock(const OUString& Text, 
sal_Int32 nStartPos,
+                                                const css::lang::Locale& 
nLocale,
+                                                sal_Int16 CharType) override = 
0;
+    virtual sal_Int32 SAL_CALL endOfCharBlock(const OUString& Text, sal_Int32 
nStartPos,
+                                              const css::lang::Locale& nLocale,
+                                              sal_Int16 CharType) override = 0;
+    virtual sal_Int32 SAL_CALL previousCharBlock(const OUString& Text, 
sal_Int32 nStartPos,
+                                                 const css::lang::Locale& 
nLocale,
+                                                 sal_Int16 CharType) override 
= 0;
+    virtual sal_Int32 SAL_CALL nextCharBlock(const OUString& Text, sal_Int32 
nStartPos,
+                                             const css::lang::Locale& nLocale,
+                                             sal_Int16 CharType) override = 0;
+
+    //XServiceInfo
+    virtual OUString SAL_CALL getImplementationName() override = 0;
+    virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override = 0;
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() 
override = 0;
+
+    // optimised variants that do not require the call-site to allocate a 
temporary OUString
+    virtual sal_Int32 endOfScript(std::u16string_view Text, sal_Int32 
nStartPos,
+                                  sal_Int16 ScriptType)
+        = 0;
+    virtual sal_Int32 beginOfScript(std::u16string_view Text, sal_Int32 
nStartPos,
+                                    sal_Int16 ScriptType)
+        = 0;
+};
+
+} // namespace i18npool
diff --git a/include/i18npool/i18npooldllapi.h 
b/include/i18npool/i18npooldllapi.h
new file mode 100644
index 000000000000..ca996fdda574
--- /dev/null
+++ b/include/i18npool/i18npooldllapi.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <sal/types.h>
+
+#if defined(I18NPOOL_DLLIMPLEMENTATION)
+#define I18NPOOL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define I18NPOOL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define I18NPOOL_DLLPRIVATE SAL_DLLPRIVATE
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk
index 325fe3412bcf..d48edbf943b0 100644
--- a/sw/CppunitTest_sw_uwriter.mk
+++ b/sw/CppunitTest_sw_uwriter.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uwriter, \
     editeng \
     fwk \
     i18nlangtag \
+    i18npool \
     i18nutil \
     lng \
     msfilter \
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 7e4cd65039a0..f03bd8192b23 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -64,6 +64,7 @@ $(eval $(call gb_Library_use_libraries,sw,\
     editeng \
     fwk \
     i18nlangtag \
+    i18npool \
     i18nutil \
     lng \
     msfilter \
diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx
index 64e63aa3a8e2..d7f6eba15b1d 100644
--- a/sw/inc/breakit.hxx
+++ b/sw/inc/breakit.hxx
@@ -24,16 +24,17 @@
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/i18n/ForbiddenCharacters.hpp>
 #include <i18nlangtag/languagetag.hxx>
+#include <rtl/ref.hxx>
+#include <i18npool/breakiterator.hxx>
 #include "swdllapi.h"
 
 enum class SvtScriptType : sal_uInt8;
-namespace com::sun::star::i18n { class XBreakIterator; }
 namespace com::sun::star::uno { class XComponentContext; }
 
 class SW_DLLPUBLIC SwBreakIt
 {
     css::uno::Reference< css::uno::XComponentContext > m_xContext;
-    css::uno::Reference<css::i18n::XBreakIterator> m_xBreak;
+    rtl::Reference<i18npool::BreakIterator> m_xBreak;
 
     std::unique_ptr<LanguageTag> m_xLanguageTag;   ///< language tag of the 
current locale
     std::optional<css::i18n::ForbiddenCharacters> m_oForbidden;
@@ -59,7 +60,7 @@ public:
 public:
     static SwBreakIt * Get();
 
-    css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() 
const
+    rtl::Reference< i18npool::BreakIterator > const & GetBreakIter() const
     {
         return m_xBreak;
     }
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index c02933dc034b..447cf75cfe3b 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -42,10 +42,10 @@
 #include <com/sun/star/i18n/Boundary.hpp>
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <com/sun/star/beans/UnknownPropertyException.hpp>
 #include <breakit.hxx>
+#include <i18npool/breakiterator.hxx>
 #include "accpara.hxx"
 #include "accportions.hxx"
 #include <sfx2/viewsh.hxx>
diff --git a/sw/source/core/access/accportions.cxx 
b/sw/source/core/access/accportions.cxx
index afbae5a9a47a..a0b59d23775e 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -23,7 +23,7 @@
 #include <osl/diagnose.h>
 #include <rtl/ustring.hxx>
 #include <com/sun/star/i18n/Boundary.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <txttypes.hxx>
 
 // for portion replacement in Special()
diff --git a/sw/source/core/bastyp/breakit.cxx 
b/sw/source/core/bastyp/breakit.cxx
index e911e5d7cdf9..a4a74ea09837 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -52,9 +52,10 @@ SwBreakIt * SwBreakIt::Get()
 
 SwBreakIt::SwBreakIt( uno::Reference<uno::XComponentContext> xContext )
     : m_xContext(std::move(xContext))
-    , m_xBreak(i18n::BreakIterator::create(m_xContext))
+    , 
m_xBreak(dynamic_cast<i18npool::BreakIterator*>(i18n::BreakIterator::create(m_xContext).get()))
     , m_aForbiddenLang(LANGUAGE_DONTKNOW)
 {
+    assert(m_xBreak);
 }
 
 void SwBreakIt::GetLocale_( const LanguageType aLang )
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 4127006b1bed..01b8142a7405 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <osl/diagnose.h>
 #include <fmtcntnt.hxx>
 #include <txatbase.hxx>
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 37236d04c309..51a695fc8194 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -20,7 +20,7 @@
 #include <hintids.hxx>
 #include <editeng/protitem.hxx>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <unotools/charclass.hxx>
 #include <svl/ctloptions.hxx>
 #include <svl/srchitem.hxx>
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index f1ac409c525b..b6664477f370 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -93,9 +93,9 @@
 #include <editeng/autodiritem.hxx>
 #include <editeng/formatbreakitem.hxx>
 #include <editeng/frmdiritem.hxx>
+#include <i18npool/breakiterator.hxx>
 #include <com/sun/star/i18n/Boundary.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
 
 #include <tuple>
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 7da2c1394705..3a7a2ce6998d 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -34,7 +34,7 @@
 #include <unotools/configmgr.hxx>
 #include <sal/log.hxx>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <fmtpdsc.hxx>
 #include <fmthdft.hxx>
 #include <fmtcntnt.hxx>
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index ffaccd803981..6e059288e1e3 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -22,9 +22,9 @@
 
 #include <com/sun/star/i18n/UnicodeType.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 
 #include <unotools/charclass.hxx>
+#include <i18npool/breakiterator.hxx>
 
 #include <hintids.hxx>
 #include <doc.hxx>
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 8f5d6230f2ee..e846b56b87a9 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -23,7 +23,7 @@
 #include <osl/diagnose.h>
 #include <tools/gen.hxx>
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <fmtcntnt.hxx>
 #include <fmtanchr.hxx>
 #include <frmfmt.hxx>
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 8b6188d917ef..349cbbcd6560 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -22,7 +22,7 @@
 #include <editeng/tstpitem.hxx>
 #include <editeng/lrspitem.hxx>
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <osl/diagnose.h>
 #include <txatbase.hxx>
 #include <txtftn.hxx>
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index efe7f4f5506a..b8f66e0150dc 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -26,8 +26,8 @@
 #include <tgrditem.hxx>
 #include <com/sun/star/i18n/BreakType.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <com/sun/star/text/ParagraphHyphenationKeepType.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <unotools/charclass.hxx>
 #include <svl/urihelper.hxx>
 #include "porfld.hxx"
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index b4b04a333ea3..94ca008db390 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -56,7 +56,7 @@
 #include "itrtxt.hxx"
 #include <breakit.hxx>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <editeng/lrspitem.hxx>
 #include <calbck.hxx>
 #include <frameformats.hxx>
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index f95b04c2009e..899db3f0a785 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -20,9 +20,9 @@
 #include <hintids.hxx>
 
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <utility>
 
+#include <i18npool/breakiterator.hxx>
 #include <comphelper/string.hxx>
 #include <editeng/brushitem.hxx>
 #include <o3tl/deleter.hxx>
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 78f15f923aa2..2e55426e365f 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -35,7 +35,7 @@
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
 #include <com/sun/star/i18n/UnicodeType.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <paratr.hxx>
 #include <sal/log.hxx>
 #include <optional>
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 07dee93ea31d..0048e6193c70 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -33,7 +33,7 @@
 #include <SwPortionHandler.hxx>
 #include <EnhancedPDFExportHelper.hxx>
 #include <com/sun/star/i18n/BreakType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <breakit.hxx>
 #include "pormulti.hxx"
 #include "inftxt.hxx"
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 4049124403aa..04d425687ea0 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -18,10 +18,10 @@
  */
 
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <com/sun/star/uno/Reference.hxx>
 #include <editeng/unolingu.hxx>
 #include <i18nlangtag/mslangid.hxx>
+#include <i18npool/breakiterator.hxx>
 #include <breakit.hxx>
 #include <hintids.hxx>
 #include <EnhancedPDFExportHelper.hxx>
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 0dc3d3950841..229a06b2433f 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -30,7 +30,7 @@
 #include <breakit.hxx>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <editeng/langitem.hxx>
 #include <charatr.hxx>
 #include <editeng/fhgtitem.hxx>
diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index 510654a74f82..a640096d3157 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -20,7 +20,7 @@
 #include <breakit.hxx>
 #include <editeng/unolingu.hxx>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <viewopt.hxx>
 #include <viewsh.hxx>
 #include <SwPortionHandler.hxx>
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index a0ce3ebf396d..f0b14aa01118 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -32,7 +32,7 @@
 #include <vcl/fontcapabilities.hxx>
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <breakit.hxx>
 #include <paintfrm.hxx>
 #include <viewsh.hxx>
diff --git a/sw/source/core/txtnode/fntcap.cxx 
b/sw/source/core/txtnode/fntcap.cxx
index c3ea94b54bff..14c9bb2f19a7 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -22,7 +22,7 @@
 #include <vcl/outdev.hxx>
 #include <com/sun/star/i18n/CharType.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 
 #include <fntcache.hxx>
 #include <swfont.hxx>
diff --git a/sw/source/core/txtnode/txatritr.cxx 
b/sw/source/core/txtnode/txatritr.cxx
index 1bc97b62b2e5..66ecfbbf07b1 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -20,7 +20,7 @@
 #include <txatritr.hxx>
 
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <fchrfmt.hxx>
 #include <charfmt.hxx>
 #include <breakit.hxx>
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index ff5ddf3f68d0..b2441e0f5e5e 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -69,10 +69,10 @@
 #include <istyleaccess.hxx>
 #include <unicode/uchar.h>
 #include <DocumentSettingManager.hxx>
+#include <i18npool/breakiterator.hxx>
 
 #include <com/sun/star/i18n/WordType.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 
 #include <vector>
 
@@ -696,7 +696,7 @@ OUString SwTextFrame::GetCurWord(SwPosition const& rPos) 
const
         return OUString();
 
     assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
-    const uno::Reference< XBreakIterator > &rxBreak = 
g_pBreakIt->GetBreakIter();
+    const rtl::Reference< i18npool::BreakIterator > &rxBreak = 
g_pBreakIt->GetBreakIter();
     sal_Int16 nWordType = WordType::DICTIONARY_WORD;
     lang::Locale aLocale( 
g_pBreakIt->GetLocale(pTextNode->GetLang(rPos.GetContentIndex())) );
     Boundary aBndry =
@@ -805,7 +805,7 @@ forceEachCJCodePointToWord(const OUString& rText, sal_Int32 
nBegin, sal_Int32 nL
 {
     if (nLen > 1)
     {
-        const uno::Reference<XBreakIterator>& rxBreak = 
g_pBreakIt->GetBreakIter();
+        const rtl::Reference<i18npool::BreakIterator>& rxBreak = 
g_pBreakIt->GetBreakIter();
 
         sal_uInt16 nCurrScript = rxBreak->getScriptType(rText, nBegin);
 
@@ -936,7 +936,7 @@ bool SwScanner::NextWord()
 
             // restrict boundaries to script boundaries and nEndPos
             const sal_uInt16 nCurrScript = 
g_pBreakIt->GetBreakIter()->getScriptType( m_aText, m_nBegin );
-            OUString aTmpWord = m_aText.copy( m_nBegin, aBound.endPos - 
m_nBegin );
+            std::u16string_view aTmpWord = m_aText.subView( m_nBegin, 
aBound.endPos - m_nBegin );
             const sal_Int32 nScriptEnd = m_nBegin +
                 g_pBreakIt->GetBreakIter()->endOfScript( aTmpWord, 0, 
nCurrScript );
             const sal_Int32 nEnd = std::min( aBound.endPos, nScriptEnd );
@@ -946,7 +946,7 @@ bool SwScanner::NextWord()
             if ( aBound.startPos < m_nBegin )
             {
                 // search from nBegin backwards until the next script change
-                aTmpWord = m_aText.copy( aBound.startPos,
+                aTmpWord = m_aText.subView( aBound.startPos,
                                        m_nBegin - aBound.startPos + 1 );
                 nScriptBegin = aBound.startPos +
                     g_pBreakIt->GetBreakIter()->beginOfScript( aTmpWord, 
m_nBegin - aBound.startPos,
@@ -959,7 +959,7 @@ bool SwScanner::NextWord()
         else
         {
             const sal_uInt16 nCurrScript = 
g_pBreakIt->GetBreakIter()->getScriptType( m_aText, aBound.startPos );
-            OUString aTmpWord = m_aText.copy( aBound.startPos,
+            std::u16string_view aTmpWord = m_aText.subView( aBound.startPos,
                                              aBound.endPos - aBound.startPos );
             const sal_Int32 nScriptEnd = aBound.startPos +
                 g_pBreakIt->GetBreakIter()->endOfScript( aTmpWord, 0, 
nCurrScript );
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index 0918a5032aea..1a5076dc1fa3 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -19,7 +19,7 @@
 
 #include <hintids.hxx>
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <comphelper/string.hxx>
 #include <utility>
 #include <vcl/svapp.hxx>
diff --git a/sw/source/filter/html/htmlfldw.cxx 
b/sw/source/filter/html/htmlfldw.cxx
index 4d2297bbb9a5..6441128154e0 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <comphelper/string.hxx>
 #include <comphelper/xmlencode.hxx>
 #include <svtools/htmlkywd.hxx>
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 21df7b17225c..71722bdb4324 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -26,7 +26,7 @@
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <comphelper/string.hxx>
 #include <o3tl/safeint.hxx>
 #include <rtl/ustrbuf.hxx>
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index e1a2e450ee14..ef1cb159c7fa 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -146,9 +146,9 @@
 #include <utility>
 #include <vcl/embeddedfontsmanager.hxx>
 #include <vcl/vectorgraphicdata.hxx>
+#include <i18npool/breakiterator.hxx>
 
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/drawing/ShadingPattern.hpp>
 #include <com/sun/star/text/GraphicCrop.hpp>
diff --git a/sw/source/filter/ww8/writerwordglue.cxx 
b/sw/source/filter/ww8/writerwordglue.cxx
index 01e5eaeeafe6..09e4dc3ed64f 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -34,8 +34,8 @@
 #include <unicode/ubidi.h>
 #include <tools/tenccvt.hxx>
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 
+#include <i18npool/breakiterator.hxx>
 #include <editeng/lrspitem.hxx>
 #include <editeng/ulspitem.hxx>
 #include <editeng/boxitem.hxx>
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 808e89ff2d58..4aa10826e4a9 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -70,7 +70,7 @@
 #include <poolfmt.hxx>
 #include "ww8par.hxx"
 #include <breakit.hxx>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include "attributeoutputbase.hxx"
 #include "writerhelper.hxx"
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 2f492db9a614..cde29c380202 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -87,11 +87,11 @@
 #include <com/sun/star/awt/FontRelief.hpp>
 #include <com/sun/star/awt/FontStrikeout.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/i18n/BreakIterator.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
 #include <com/sun/star/text/RubyPosition.hpp>
 #include <com/sun/star/style/CaseMap.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <oox/export/vmlexport.hxx>
 #include <sal/log.hxx>
 #include <comphelper/propertysequence.hxx>
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 5f0fba6349d3..e2b1749abe9a 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -120,7 +120,7 @@
 #include <fmtftntx.hxx>
 #include <breakit.hxx>
 #include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <svx/unobrushitemhelper.hxx>
 #include <tgrditem.hxx>
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index e858d05c7c05..3efd41ca4572 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -44,7 +44,7 @@
 #include <ucbhelper/content.hxx>
 #include <ucbhelper/commandenvironment.hxx>
 
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <hintids.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/fhgtitem.hxx>
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 9c527c9f1976..05742c344aef 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -25,7 +25,6 @@
 #include <com/sun/star/accessibility/XAccessible.hpp>
 #include <com/sun/star/awt/PopupMenuDirection.hpp>
 #include <com/sun/star/awt/XPopupMenu.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
 #include <com/sun/star/i18n/UnicodeScript.hpp>
@@ -34,7 +33,7 @@
 
 #include <comphelper/scopeguard.hxx>
 #include <comphelper/string.hxx>
-
+#include <i18npool/breakiterator.hxx>
 #include <vcl/dialoghelper.hxx>
 #include <vcl/inputctx.hxx>
 #include <vcl/help.hxx>
@@ -813,7 +812,7 @@ bool SwEditWin::IsInputSequenceCheckingRequired( const 
OUString &rText, const Sw
         return false;
 
     SwBreakIt *pBreakIter = SwBreakIt::Get();
-    uno::Reference < i18n::XBreakIterator > xBI = pBreakIter->GetBreakIter();
+    rtl::Reference < i18npool::BreakIterator > xBI = 
pBreakIter->GetBreakIter();
     assert(xBI.is());
     tools::Long nCTLScriptPos = -1;
 
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx 
b/sw/source/uibase/lingu/hhcwrp.cxx
index c2a909b0231d..d94639e4f6ca 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -27,7 +27,7 @@
 #include <editeng/fontitem.hxx>
 #include <rtl/ustring.hxx>
 #include <com/sun/star/text/RubyAdjust.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <i18npool/breakiterator.hxx>
 #include <osl/diagnose.h>
 #include <hhcwrp.hxx>
 #include "sdrhhcwrap.hxx"
commit e61af384e0fe7e9a9f32dd5a7f5830b430b23e78
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jan 29 08:12:30 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jan 29 08:44:20 2026 +0100

    ubsan: call on null pointer in CppunitTest_sd_uiimpress
    
    probably after
      commit 829544185d6dbfaaca95c9e88eab7ec57d3c518d
      Author: Mohit Marathe <[email protected]>
      Date:   Mon Nov 3 16:39:05 2025 +0530
      sd: remember canvas page zoom
    
    [_RUN_____] testTdf129346::TestBody
    /sd/source/ui/view/viewshe2.cxx:647:27: runtime error: member call on null 
pointer of type 'SdPage'
    in sd::ViewShell::RememberPageZoom(unsigned short) 
/sd/source/ui/view/viewshe2.cxx:647:27
    in sd::ViewShell::SetZoom(long) /sd/source/ui/view/viewshe2.cxx:408:5
    in sd::NotesPanelViewShell::SetZoom(long) 
/sd/source/ui/view/NotesPanelViewShell.cxx:369:16
    in sd::NotesPanelViewShell::Construct() 
/sd/source/ui/view/NotesPanelViewShell.cxx:158:5
    
    Change-Id: If2b61f5a51d069b27ec84c1a4b859ba7a2c442a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198333
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index aeee29008f2b..7f74dbd8bcc6 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -644,7 +644,8 @@ sal_uInt16 ViewShell::GetPageZoom() const
 
 void ViewShell::RememberPageZoom(const sal_uInt16 nZoom)
 {
-    if (getCurrentPage()->IsCanvasPage())
+    SdPage* pPage = getCurrentPage();
+    if (pPage && pPage->IsCanvasPage())
         mnCanvasPageZoom = nZoom;
     else
         mnNonCanvasPageZoom = nZoom;

Reply via email to