23#include <rtl/ustrbuf.hxx>
32#include <editeng/editeng.hxx>
44#include <com/sun/star/i18n/TextConversionOption.hpp>
45#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
46#include <com/sun/star/lang/XInitialization.hpp>
47#include <com/sun/star/beans/XPropertySet.hpp>
48#include <com/sun/star/awt/XWindow.hpp>
49#include <com/sun/star/uno/XComponentContext.hpp>
51#include <osl/diagnose.h>
61#define ShellClass_SwDrawTextShell
82 GetStaticInterface()->RegisterPopupMenu(
"drawtext");
84 GetStaticInterface()->RegisterObjectBar(
SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Draw_Text_Toolbox_Sw);
86 GetStaticInterface()->RegisterChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
100 nCtrl |= EEControlBits::AUTOCORRECT;
109 nCtrl |= EEControlBits::ONLINESPELLING|EEControlBits::ALLOWBIGOBJS;
114 pOutliner->SetControlWord(nCtrl);
134 if (
GetView().GetCurShell() ==
this )
181 rVFrame.
SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
193 const sal_uInt16
nId = SvxFontWorkChildWindow::GetChildWindowId();
218 rTempView.AttrChangedNotify(
nullptr);
238 const bool bDeactivate(
277 case SID_HANGUL_HANJA_CONVERSION:
280 i18n::TextConversionOption::CHARACTER_BY_CHARACTER,
true,
false);
283 case SID_CHINESE_CONVERSION:
290 Reference<lang::XMultiComponentFactory> xMCF(xContext->getServiceManager());
294 Reference<ui::dialogs::XExecutableDialog> xDialog(
295 xMCF->createInstanceWithContext(
"com.sun.star.linguistic2.ChineseTranslationDialog", xContext), UNO_QUERY);
297 Reference<lang::XInitialization> xInit(xDialog, UNO_QUERY);
305 {
"ParentWindow",
uno::Any(Reference<awt::XWindow>())}
307 xInit->initialize( aSequence );
310 sal_Int16 nDialogRet = xDialog->execute();
314 bool bToSimplified =
true;
315 bool bUseVariants =
true;
316 bool bCommonTerms =
true;
317 Reference<beans::XPropertySet> xPropertySet(xDialog, UNO_QUERY);
318 if (xPropertySet.is())
322 xPropertySet->getPropertyValue(
"IsDirectionToSimplified") >>= bToSimplified;
323 xPropertySet->getPropertyValue(
"IsUseCharacterVariants") >>= bUseVariants;
324 xPropertySet->getPropertyValue(
"IsTranslateCommonTerms") >>= bCommonTerms;
334 sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
336 nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
343 Reference<lang::XComponent> xComponent(xDialog, UNO_QUERY);
345 xComponent->dispose();
350 OSL_ENSURE(
false,
"unexpected slot-id");
362 case FN_INSERT_SOFT_HYPHEN:
363 case FN_INSERT_HARDHYPHEN:
364 case FN_INSERT_HARD_SPACE:
365 case FN_INSERT_NNBSP:
366 case SID_INSERT_RLM :
367 case SID_INSERT_LRM :
369 case SID_INSERT_ZWSP:
377 case FN_INSERT_NNBSP: cIns =
CHAR_NNBSP;
break;
378 case SID_INSERT_RLM : cIns =
CHAR_RLM ;
break;
379 case SID_INSERT_LRM : cIns =
CHAR_LRM ;
break;
380 case SID_INSERT_ZWSP : cIns =
CHAR_ZWSP ;
break;
381 case SID_INSERT_WJ: cIns =
CHAR_WJ;
break;
395 sal_uInt16 nSlot = rReq.
GetSlot();
410 sal_Int32 nParaCount = pOutliner->GetParagraphCount();
417 case FN_FORMAT_RESET:
444 sal_uInt16 nResult = pDlg->Execute();
451 rReq.
Done(*(pDlg->GetOutputItemSet()));
456 case SID_TABLE_VERT_NONE:
457 case SID_TABLE_VERT_CENTER:
458 case SID_TABLE_VERT_BOTTOM:
460 sal_uInt16 nSId = rReq.
GetSlot();
464 if (nSId == SID_TABLE_VERT_CENTER)
466 else if (nSId == SID_TABLE_VERT_BOTTOM)
480 OSL_ENSURE(
false,
"unexpected slot-id");
497 bool bCallBase =
true;
514 if( SID_UNDO ==
nId )
516 pUndoManager->
Undo();
519 pUndoManager->
Redo();
548 case SID_GETUNDOSTRINGS:
549 case SID_GETREDOSTRINGS:
554 OUString (
SfxUndoManager::*fnGetComment)( size_t,
bool const )
const;
557 if( SID_GETUNDOSTRINGS == nWhich )
569 OUStringBuffer sList;
574 aItem.
SetString( sList.makeStringAndClear() );
585 auto* pUndoManager =
dynamic_cast<IDocumentUndoRedo*
>(
GetUndoManager());
587 pUndoManager->SetView(&
GetView());
590 pUndoManager->SetView(
nullptr);
603 using namespace i18n;
609 case SID_TRANSLITERATE_SENTENCE_CASE:
610 nMode = TransliterationFlags::SENTENCE_CASE;
612 case SID_TRANSLITERATE_TITLE_CASE:
613 nMode = TransliterationFlags::TITLE_CASE;
615 case SID_TRANSLITERATE_TOGGLE_CASE:
616 nMode = TransliterationFlags::TOGGLE_CASE;
618 case SID_TRANSLITERATE_UPPER:
619 nMode = TransliterationFlags::LOWERCASE_UPPERCASE;
621 case SID_TRANSLITERATE_LOWER:
622 nMode = TransliterationFlags::UPPERCASE_LOWERCASE;
625 case SID_TRANSLITERATE_HALFWIDTH:
626 nMode = TransliterationFlags::FULLWIDTH_HALFWIDTH;
628 case SID_TRANSLITERATE_FULLWIDTH:
629 nMode = TransliterationFlags::HALFWIDTH_FULLWIDTH;
632 case SID_TRANSLITERATE_HIRAGANA:
633 nMode = TransliterationFlags::KATAKANA_HIRAGANA;
635 case SID_TRANSLITERATE_KATAKANA:
636 nMode = TransliterationFlags::HIRAGANA_KATAKANA;
640 OSL_ENSURE(
false,
"wrong dispatcher");
643 if( nMode != TransliterationFlags::NONE )
656 if( rReq.
GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
694 std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(
RES_CHRATR_FONT));
697 aSetItem.GetItemSet().Put( aSet,
false );
707 aSetDlgFont.reset(aSet.
Get( nFontWhich ).
Clone());
709 if (sFontName.isEmpty())
710 sFontName = aSetDlgFont->GetFamilyName();
721 if( !sSymbolFont.isEmpty() )
724 aAllSet.
Put(
SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) );
737 pOutliner->SetUpdateLayout(
false);
743 aFontSet.Set( aOldSet );
749 SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
755 if( SvtScriptType::LATIN & nScript )
756 aFontAttribSet.
Put( aFontItem );
757 if( SvtScriptType::ASIAN & nScript )
760 aFontAttribSet.
Put( aFontItem );
762 if( SvtScriptType::COMPLEX & nScript )
765 aFontAttribSet.
Put( aFontItem );
779 pOutliner->SetUpdateLayout(
true);
794 return &pOutliner->GetUndoManager();
815 case SID_TABLE_VERT_NONE:
816 case SID_TABLE_VERT_CENTER:
817 case SID_TABLE_VERT_BOTTOM:
818 bool bContour =
false;
820 if( eConState != SfxItemState::DONTCARE )
830 if(SfxItemState::DONTCARE != eVState)
sal_uInt16 GetValue() const
const OUString & GetValue() const
void RemoveFields(const std::function< bool(const SvxFieldData *)> &isFieldData=[](const SvxFieldData *){return true;})
EditEngine * GetEditEngine() const
void SetSelection(const ESelection &)
SvtScriptType GetSelectedScriptType() const
void StartTextConversion(weld::Widget *pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc)
void InsertText(const OUString &rNew, bool bSelect=false)
void TransliterateText(TransliterationFlags nTransliterationMode)
tools::Rectangle const & GetOutputArea() const
EESpellState StartThesaurus(weld::Widget *pDialogParent)
void HideCursor(bool bDeactivate=false)
ESelection GetSelection() const
Outliner * GetOutliner() const
void SetAttribs(const SfxItemSet &)
void RemoveAttribsKeepLanguages(bool bRemoveParaAttribs)
void SelectRange(sal_Int32 nFirst, sal_Int32 nCount)
EditView & GetEditView() const
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
TransliterationFlags getNextMode()
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrObject * GetMarkedSdrObj() const
const SfxItemPool & GetItemPool() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
const OutlinerView * GetTextEditOutlinerView() const
virtual bool IsTextEdit() const final override
const SdrOutliner * GetTextEditOutliner() const
SdrModel & GetModel() const
virtual bool HasText() const override
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
void Invalidate(sal_uInt16 nId)
void InvalidateAll(bool bWithMsg)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SfxItemPool * GetSecondaryPool() const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
static bool IsWhich(sal_uInt16 nId)
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void AppendItem(const SfxPoolItem &)
weld::Window * GetFrameWeld() const
void Done(bool bRemove=false)
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
void SetUndoManager(SfxUndoManager *pNewUndoMgr)
SfxItemPool & GetPool() const
void SetContextName(const OUString &rsContextName)
virtual SfxInterface * GetInterface() const
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
void SetString(const OUString &)
OUString GetRedoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
OUString GetUndoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
static bool const TopLevel
virtual size_t GetRedoActionCount(bool const i_currentLevel=CurrentLevel) const
virtual size_t GetUndoActionCount(bool const i_currentLevel=CurrentLevel) const
void ToggleChildWindow(sal_uInt16)
SfxBindings & GetBindings()
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
SfxFrame & GetFrame() const
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
virtual VclPtr< SfxAbstractDialog > CreateCharMapDialog(weld::Window *pParent, const SfxItemSet &rAttr, const css::uno::Reference< css::frame::XFrame > &rFrame)=0
virtual VclPtr< SfxAbstractTabDialog > CreateTextTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet, SdrView *pView)=0
static SvxAbstractDialogFactory * Create()
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
SvtScriptType GetAllScriptsOfText(const OUString &rText) const
SfxShell subclass that is used while interacting with the editeng-based text of a shape.
void ExecDrawLingu(SfxRequest const &rReq)
void ExecTransliteration(SfxRequest const &)
void ExecUndo(SfxRequest &rReq)
SwDrawTextShell(SwView &rView)
void GetFormTextState(SfxItemSet &rSet)
void ExecRotateTransliteration(SfxRequest const &)
virtual SfxUndoManager * GetUndoManager() override
void GetStatePropPanelAttr(SfxItemSet &)
void ExecDraw(SfxRequest &)
virtual ~SwDrawTextShell() override
void ExecFormText(SfxRequest const &rReq)
void SetAttrToMarked(const SfxItemSet &rAttr)
void StateUndo(SfxItemSet &rSet)
void StateFontWork(SfxItemSet &rSet)
static void StateDisableItems(SfxItemSet &)
void InsertSymbol(SfxRequest &rReq)
void ExecFontWork(SfxRequest const &rReq)
RotateTransliteration m_aRotateCase
void EndTextEdit()
Deletes object if required.
const OUString & GetSymbolFont() const
bool IsOnlineSpell() const
const SwViewOption * GetViewOptions() const
const SfxItemPool & GetAttrPool() const
SwWrtShell & GetWrtShell() const
Used by the UI to modify the document model.
const SwView & GetView() const
static const OUString & GetContextName(const Context eContext)
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
rtl_TextEncoding GetCharSet() const
#define FN_DRAWTEXT_ATTR_DLG
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
LanguageType GetAppLanguage()
#define LANGUAGE_CHINESE_TRADITIONAL
#define LANGUAGE_CHINESE_SIMPLIFIED
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
Reference< XComponentContext > getProcessComponentContext()
#define SFX_OBJECTBAR_OBJECT
#define SFX_IMPL_INTERFACE(Class, SuperClass)
Reference< XFrame > xFrame
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
constexpr TypedWhichId< XFormTextMirrorItem > XATTR_FORMTXTMIRROR(XATTR_TEXT_FIRST+4)
constexpr TypedWhichId< XFormTextStyleItem > XATTR_FORMTXTSTYLE(XATTR_TEXT_FIRST)
constexpr TypedWhichId< XFormTextStartItem > XATTR_FORMTXTSTART(XATTR_TEXT_FIRST+3)
constexpr TypedWhichId< XFormTextShadowYValItem > XATTR_FORMTXTSHDWYVAL(XATTR_TEXT_FIRST+9)
constexpr TypedWhichId< XFormTextHideFormItem > XATTR_FORMTXTHIDEFORM(XATTR_TEXT_FIRST+10)
constexpr TypedWhichId< XFormTextDistanceItem > XATTR_FORMTXTDISTANCE(XATTR_TEXT_FIRST+2)
constexpr TypedWhichId< XFormTextShadowItem > XATTR_FORMTXTSHADOW(XATTR_TEXT_FIRST+6)
constexpr TypedWhichId< XFormTextOutlineItem > XATTR_FORMTXTOUTLINE(XATTR_TEXT_FIRST+5)
constexpr TypedWhichId< XFormTextShadowXValItem > XATTR_FORMTXTSHDWXVAL(XATTR_TEXT_FIRST+8)
constexpr TypedWhichId< XFormTextShadowColorItem > XATTR_FORMTXTSHDWCOLOR(XATTR_TEXT_FIRST+7)
constexpr TypedWhichId< XFormTextAdjustItem > XATTR_FORMTXTADJUST(XATTR_TEXT_FIRST+1)