27#include <osl/diagnose.h> 
   37        const lang::Locale& rSourceLocale,
 
   38        const lang::Locale& rTargetLocale,
 
   44    HangulHanjaConversion( pWindow, rxContext, rSourceLocale, rTargetLocale, pTargetFont, nOptions, bIsInteractive )
 
   52    , m_bStartDone(bIsStart)
 
   54    , m_bAllowChange(false)
 
   56    DBG_ASSERT( pWindow, 
"TextConvWrapper: window missing" );
 
  195        OSL_FAIL( 
"ConvStart_impl: Unknown Area!" );
 
  216    const vcl::Font *pFont,  sal_uInt16 nFontWhichId )
 
  236        aNewSet.
Put( aFontItem );
 
  247        const sal_Int32 nUnitStart,
 
  248        const sal_Int32 nUnitEnd )
 
  250    const bool bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd;
 
  257        "paragraph mismatch in selection" );
 
  265        OUString&  rNextPortion,
 
  267        bool  _bAllowImplicitChangesForNotConvertibleText )
 
  278            "paragraph mismatch in selection" );
 
  280            "start pos > end pos" );
 
  286        const sal_Int32 nUnitStart,
 
  287        const sal_Int32 nUnitEnd )
 
  298        return (HangulHanjaConversion::IsTraditional(nLang1) && HangulHanjaConversion::IsTraditional(nLang2)) ||
 
  299               (HangulHanjaConversion::IsSimplified(nLang1)  && HangulHanjaConversion::IsSimplified(nLang2));
 
  305        const sal_Int32 nUnitStart, 
const sal_Int32 nUnitEnd,
 
  306        const OUString& rOrigText,
 
  307        const OUString& rReplaceWith,
 
  308        const css::uno::Sequence< sal_Int32 > &rOffsets,
 
  312    const bool bOK = 0 <= nUnitStart && 0 <= nUnitEnd && nUnitStart <= nUnitEnd;
 
  321    OUString aNewTxt( rReplaceWith );
 
  327            aNewTxt = aOrigTxt + 
"(" + rReplaceWith + 
")";
 
  330            aNewTxt = rReplaceWith + 
"(" + aOrigTxt + 
")";
 
  336            OSL_FAIL( 
"Rubies not supported" );
 
  339            OSL_FAIL( 
"unexpected case" );
 
  358    if (bIsChineseConversion)
 
  359        ChangeText( aNewTxt, rOrigText, &rOffsets, &aOldSel );
 
  361        ChangeText( aNewTxt, rOrigText, 
nullptr, 
nullptr );
 
  364    if (bIsChineseConversion)
 
  367                "TextConvWrapper::ReplaceUnit : unexpected target language" );
 
  372        if (pNewUnitLanguage)
 
  375            DBG_ASSERT(!IsSimilarChinese( *pNewUnitLanguage, nOldLang ),
 
  376                    "similar language should not be changed!");
 
  388    sal_Int32 nDelta = aNewTxt.getLength() - aOrigTxt.getLength();
 
  404        std::u16string_view rOrigText,
 
  405        const uno::Sequence< sal_Int32 > *pOffsets,
 
  410    DBG_ASSERT( !rNewText.isEmpty(), 
"unexpected empty string" );
 
  411    if (rNewText.isEmpty())
 
  414    if (pOffsets && pESelection)  
 
  419        const sal_Int32 nStartIndex = pESelection->
nStartPos;
 
  421        const sal_Int32  nIndices = pOffsets->getLength();
 
  422        const sal_Int32 *pIndices = pOffsets->getConstArray();
 
  423        const sal_Int32  nConvTextLen = rNewText.getLength();
 
  425        sal_Int32 nChgPos = -1;
 
  426        sal_Int32 nConvChgPos = -1;
 
  431        sal_Int32 nCorrectionOffset = 0;
 
  433        DBG_ASSERT(nIndices == 0 || nIndices == nConvTextLen,
 
  434                "mismatch between string length and sequence length!" );
 
  441            if (
nPos < nConvTextLen)
 
  446                nIndex = rOrigText.size();
 
  453                if (nChgPos>=0 && nConvChgPos>=0)
 
  455                    const sal_Int32 nChgLen = 
nIndex - nChgPos;
 
  456                    const sal_Int32 nConvChgLen = 
nPos - nConvChgPos;
 
  457                    OUString aInNew( rNewText.copy( nConvChgPos, nConvChgLen ) );
 
  461                    sal_Int32 nChgInNodeStartIndex = nStartIndex + nCorrectionOffset + nChgPos;
 
  463                    aSel.
nEndPos   = nChgInNodeStartIndex + nChgLen;
 
  471                    nCorrectionOffset += nConvChgLen - nChgLen;
 
  480                if (nChgPos<0 && nConvChgPos<0)
 
  486            if (
nPos >= nConvTextLen)
 
EditPaM GetEndPaM() const
 
EditPaM GetStartPaM() const
 
virtual bool ConvertNextDocument()
 
ImpEditView * GetImpEditView() const
 
ESelection GetSelection() const
 
void RemoveAttribs(bool bRemoveParaAttribs=false, sal_uInt16 nWhich=0)
 
void SetSelection(const ESelection &rNewSel)
 
void InsertText(const OUString &rNew, bool bSelect=false, bool bLOKShowSelect=true)
 
const SfxItemSet & GetEmptyItemSet() const
 
EditEngine * GetEditEngine() const
 
ImpEditEngine * GetImpEditEngine() const
 
OUString GetSelected() const
 
void SetAttribs(const SfxItemSet &rSet)
 
void UndoActionStart(sal_uInt16 nId)
 
EPaM CreateEPaM(const EditPaM &rPaM) const
 
editeng::LanguageSpan GetLanguage(const EditPaM &rPaM, sal_Int32 *pEndPos=nullptr) const
 
EditSelection CreateSel(const ESelection &rSel)
 
ConvInfo * GetConvInfo() const
 
void ImpConvert(OUString &rConvTxt, LanguageType &rConvTxtLang, EditView *pEditView, LanguageType nSrcLang, const ESelection &rConvRange, bool bAllowImplicitChangesForNotConvertibleText, LanguageType nTargetLang, const vcl::Font *pTargetFont)
 
void SetEditSelection(const EditSelection &rEditSelection)
 
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
 
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
 
This item describes a Font.
 
void SetStyleName(const OUString &rStyleName)
 
void SetFamily(FontFamily _eFamily)
 
void SetPitch(FontPitch _ePitch)
 
void SetFamilyName(const OUString &rFamilyName)
 
void SetCharSet(rtl_TextEncoding _eEncoding)
 
virtual ~TextConvWrapper() override
 
virtual void ReplaceUnit(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd, const OUString &rOrigText, const OUString &rReplaceWith, const css::uno::Sequence< sal_Int32 > &rOffsets, ReplacementAction eAction, LanguageType *pNewUnitLanguage) override
replaces a text unit within a text portion with a new text
 
virtual bool HasRubySupport() const override
specifies if rubies are supported by the document implementing this class.
 
TextConvWrapper(const TextConvWrapper &)=delete
 
void ConvStart_impl(SvxSpellArea eSpell)
 
void SetLanguageAndFont(const ESelection &rESel, LanguageType nLang, sal_uInt16 nLangWhichId, const vcl::Font *pFont, sal_uInt16 nFontWhichId)
 
void SelectNewUnit_impl(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd)
 
virtual void GetNextPortion(OUString &rNextPortion, LanguageType &rLangOfPortion, bool _bAllowImplicitChangesForNotConvertibleText) override
retrieves the next text portion which is to be analyzed
 
virtual void HandleNewUnit(const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd) override
announces a new "current unit"
 
void ChangeText_impl(const OUString &rNewText, bool bKeepAttributes)
 
LanguageType m_nConvTextLang
 
void ChangeText(const OUString &rNewText, std::u16string_view rOrigText, const css::uno::Sequence< sal_Int32 > *pOffsets, ESelection *pESelection)
 
const vcl::Font * GetTargetFont() const
 
LanguageType GetSourceLanguage() const
 
static bool IsChinese(LanguageType nLang)
 
LanguageType GetTargetLanguage() const
 
FontFamily GetFamilyType()
 
const OUString & GetStyleName() const
 
const OUString & GetFamilyName() const
 
rtl_TextEncoding GetCharSet() const
 
#define DBG_ASSERT(sCon, aError)
 
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
 
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
 
#define LANGUAGE_CHINESE_TRADITIONAL
 
#define LANGUAGE_CHINESE_SIMPLIFIED
 
void GetSelection(struct ESelection &rSel, SvxTextForwarder const *pForwarder) noexcept