22#include <com/sun/star/linguistic2/XLinguProperties.hpp>
32#define HYPH_POS_CHAR '='
34#define CUR_HYPH_POS_CHAR '-'
41 m_xWordEdit->get_selection_bounds(nStart, nEnd);
42 if (nStart == m_nOldPos && nEnd == m_nOldPos + 1)
45 if (nStart <= m_nOldPos)
46 bReSelect = !SelLeft();
48 bReSelect = !SelRight();
50 select_region(m_nOldPos, m_nOldPos + 1);
121 sal_Int32 nLen = aHyphenationPositions.getLength();
122 const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray();
126 sal_Int32
nPos = 0, nPos1 = 0;
129 sal_Int32 nStart = 0;
130 for (sal_Int32
i = 0;
i < nLen; ++
i)
149 DBG_ASSERT(nIdx != -1,
"no usable hyphenation position");
152 nPos = nIdx == -1 ? 0 : nIdx + 1;
158 aTxt = aTxt.replaceFirst( aTmp,
"", &
nPos);
162 const std::u16string_view aSearchRange( aTxt.subView( 0, nPos1 ) );
163 size_t nPos2 = aSearchRange.rfind(
'-' );
164 if (nPos2 != std::u16string_view::npos && nPos2 != 0)
166 OUString aLeft( aSearchRange.substr( 0, nPos2 ) );
171 aLeft = aLeft.replaceFirst( aTmp,
"", &
nPos );
175 aTxt = aTxt.replaceAt( 0, nPos2, aLeft );
207 sal_Int32 nIdxPos = -1;
208 for (sal_Int32
i = 0;
i <= nInsPos; ++
i)
218 sal_Int32 nLen =
aSeq.getLength();
220 DBG_ASSERT(0 <= nIdxPos && nIdxPos < nLen,
"index out of range");
221 if (nLen && 0 <= nIdxPos && nIdxPos < nLen)
223 nInsPos =
aSeq.getConstArray()[ nIdxPos ];
264 DBG_ASSERT(
i <= aTxt.getLength(),
"index out of range");
286 for ( sal_Int32
i =
m_nOldPos + 1;
i < aTxt.getLength(); ++
i )
309 ContinueHyph_Impl( m_nOldPos );
323 xProp->setIsHyphAuto(
true );
326 ContinueHyph_Impl( m_nOldPos );
329 xProp->setIsHyphAuto(
false );
331 catch (uno::Exception &)
333 SAL_WARN(
"cui.dialogs",
"Hyphenate All failed" );
342 ContinueHyph_Impl( 0 );
400 select_region(m_nOldPos, m_nOldPos + 1);
411 , m_pHyphWrapper(pWrapper)
412 , m_aActWord(
std::move(aWord))
413 , m_nActLanguage(nLang)
414 , m_nMaxHyphenationPos(0)
416 , m_nHyphenationPositionsOffset(0)
418 , m_xWordEdit(m_xBuilder->weld_entry(
"worded"))
419 , m_xLeftBtn(m_xBuilder->weld_button(
"left"))
420 , m_xRightBtn(m_xBuilder->weld_button(
"right"))
421 , m_xOkBtn(m_xBuilder->weld_button(
"ok"))
422 , m_xContBtn(m_xBuilder->weld_button(
"continue"))
423 , m_xDelBtn(m_xBuilder->weld_button(
"delete"))
424 , m_xHyphAll(m_xBuilder->weld_button(
"hyphall"))
425 , m_xCloseBtn(m_xBuilder->weld_button(
"close"))
433 DBG_ASSERT( xHyphWord.is(),
"hyphenation result missing" );
Reference< XExecutableDialog > m_xDialog
LanguageType getLanguageType(bool bResolveSystem=true) const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet()
static OUString GetLanguageString(const LanguageType eType)
std::unique_ptr< weld::Button > m_xRightBtn
void SetWindowTitle(LanguageType nLang)
LanguageType m_nActLanguage
SvxSpellWrapper *const m_pHyphWrapper
css::uno::Reference< css::linguistic2::XPossibleHyphens > m_xPossHyph
std::unique_ptr< weld::Button > m_xOkBtn
std::unique_ptr< weld::Button > m_xLeftBtn
OUString EraseUnusableHyphens_Impl()
void ContinueHyph_Impl(sal_Int32 nInsPos=-1)
css::uno::Reference< css::linguistic2::XHyphenator > m_xHyphenator
std::unique_ptr< weld::Button > m_xDelBtn
SvxHyphenWordDialog(OUString aWord, LanguageType nLang, weld::Widget *pParent, css::uno::Reference< css::linguistic2::XHyphenator > const &xHyphen, SvxSpellWrapper *pWrapper)
void select_region(int nStart, int nEnd)
virtual ~SvxHyphenWordDialog() override
std::unique_ptr< weld::Button > m_xCloseBtn
std::unique_ptr< weld::Button > m_xHyphAll
sal_Int32 m_nHyphenationPositionsOffset
std::unique_ptr< weld::Button > m_xContBtn
std::unique_ptr< weld::Entry > m_xWordEdit
sal_Int16 m_nMaxHyphenationPos
const css::uno::Reference< css::uno::XInterface > & GetLast() const
virtual void InsertHyphen(const sal_Int32 nPos)
#define DBG_ASSERT(sCon, aError)
#define CUR_HYPH_POS_CHAR
IMPL_LINK_NOARG(SvxHyphenWordDialog, CursorChangeHdl_Impl, weld::Entry &, void)
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)