45 #include <osl/diagnose.h>
67 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
79 bool bDeselect =
false;
81 sal_uInt16 nSlotId = rReq.
GetSlot();
83 pStringItem = dynamic_cast< const SfxStringItem*>(pItem);
86 if (nSlotId == SID_FM_CREATE_CONTROL)
93 if (nSlotId == SID_OBJECT_SELECT &&
m_nFormSfxId == nSlotId)
97 else if (nSlotId == SID_FM_CREATE_CONTROL)
105 else if (nSlotId == SID_FM_CREATE_FIELDCONTROL)
111 OSL_ENSURE( pDescriptorItem,
"SwView::ExecDraw(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
112 if( pDescriptorItem )
121 Point aStartPos = rVisArea.Center();
122 if(rVisArea.Width() > aDocSize.Width())
123 aStartPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
124 if(rVisArea.Height() > aDocSize.Height())
125 aStartPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
128 if(pObj->IsGroupObject())
131 aStartPos.AdjustX( -(rBoundRect.
GetWidth()/2) );
132 aStartPos.AdjustY( -(rBoundRect.
GetHeight()/2) );
137 m_pWrtShell->SwFEShell::InsertDrawObj( *(pObj.release()), aStartPos );
142 else if ( nSlotId == SID_FONTWORK_GALLERY_FLOATER )
154 std::shared_ptr<svx::FontWorkGalleryDialog> pDlg = std::make_shared<svx::FontWorkGalleryDialog>(rWin.
GetFrameWeld(), *pSdrView);
155 pDlg->SetSdrObjectRef( pSdrView->
GetModel() );
159 SdrObject* pObj = pDlg->GetSdrObjectRef();
165 Point aPos( rVisArea.Center() );
168 if ( rVisArea.Width() > aDocSize.Width())
169 aPos.
setX( aDocSize.Width() / 2 + rVisArea.Left() );
170 else if (aPos.getX() > aObjRect.GetWidth() / 2)
171 aPos.AdjustX( -(aObjRect.GetWidth() / 2) );
173 if (rVisArea.Height() > aDocSize.Height())
174 aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
175 else if (aPos.getY() > aObjRect.GetHeight() / 2)
176 aPos.AdjustY( -(aObjRect.GetHeight() / 2) );
179 m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
191 if( nSlotId == SID_DRAW_CS_ID )
195 if( pFuncPtr && pFuncPtr->
GetSlotId() == SID_DRAW_CS_ID )
199 const OUString& aOld = pConstCustomShape->
GetShapeType();
210 && (nSlotId != SID_DRAW_CS_ID) ) )
222 AttrChangedNotify(
nullptr);
231 std::unique_ptr<SwDrawBase> pFuncPtr;
234 bool bCreateDirectly =
false;
238 case SID_OBJECT_SELECT:
239 case SID_DRAW_SELECT:
245 case SID_LINE_ARROW_END:
246 case SID_LINE_ARROW_CIRCLE:
247 case SID_LINE_ARROW_SQUARE:
248 case SID_LINE_ARROW_START:
249 case SID_LINE_CIRCLE_ARROW:
250 case SID_LINE_SQUARE_ARROW:
251 case SID_LINE_ARROWS:
254 case SID_DRAW_MEASURELINE:
256 case SID_DRAW_ELLIPSE:
258 case SID_DRAW_TEXT_VERTICAL:
259 case SID_DRAW_TEXT_MARQUEE:
260 case SID_DRAW_CAPTION:
261 case SID_DRAW_CAPTION_VERTICAL:
267 case SID_DRAW_XPOLYGON_NOFILL:
268 case SID_DRAW_XPOLYGON:
269 case SID_DRAW_POLYGON_NOFILL:
270 case SID_DRAW_POLYGON:
271 case SID_DRAW_BEZIER_NOFILL:
272 case SID_DRAW_BEZIER_FILL:
273 case SID_DRAW_FREELINE_NOFILL:
274 case SID_DRAW_FREELINE:
282 case SID_DRAW_CIRCLECUT:
288 case SID_FM_CREATE_CONTROL:
296 case SID_DRAWTBX_CS_BASIC :
297 case SID_DRAWTBX_CS_SYMBOL :
298 case SID_DRAWTBX_CS_ARROW :
299 case SID_DRAWTBX_CS_FLOWCHART :
300 case SID_DRAWTBX_CS_CALLOUT :
301 case SID_DRAWTBX_CS_STAR :
302 case SID_DRAW_CS_ID :
309 if ( nSlotId != SID_DRAW_CS_ID )
328 bool bEndTextEdit =
true;
336 auto pTempFuncPtr = pFuncPtr.get();
338 AttrChangedNotify(
nullptr);
340 pTempFuncPtr->Activate(nSlotId);
348 else if (dynamic_cast<ConstCustomShape*>(pTempFuncPtr))
350 pTempFuncPtr->CreateDefaultObject();
354 pTempFuncPtr->CreateDefaultObject();
355 pTempFuncPtr->Deactivate();
362 (SID_DRAW_TEXT == nSlotId || SID_DRAW_TEXT_VERTICAL == nSlotId ||
363 SID_DRAW_TEXT_MARQUEE == nSlotId ))
367 bEndTextEdit =
false;
378 if(bEndTextEdit && pSdrView && pSdrView->
IsTextEdit())
381 AttrChangedNotify(
nullptr);
399 pTest = pDispatch->
GetShell(nIdx++);
401 while( pTest && pTest !=
this && pTest !=
m_pShell);
405 dynamic_cast< const SwDrawBaseShell *>(
m_pShell ) ==
nullptr &&
406 dynamic_cast< const SwBezierShell *>(
m_pShell ) ==
nullptr &&
407 dynamic_cast< const svx::ExtrusionBar *>(
m_pShell ) ==
nullptr &&
408 dynamic_cast< const svx::FontworkBar *>(
m_pShell ) ==
nullptr))
443 const SfxBoolItem aTmp( SID_OBJECT_ROTATE,
false );
464 OSL_ENSURE( pSdrView,
"EnterDrawTextMode without DrawView?" );
466 bool bReturn =
false;
474 pObj = pSdrView->
PickObj(aDocPos, pSdrView->
getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT);
480 if ( (pVirtObj && dynamic_cast< const SdrTextObj *>(&pVirtObj->GetReferencedObj() ) !=
nullptr &&
482 dynamic_cast< const SdrTextObj *>( pObj ) != nullptr )
505 bool bIsNewObj,
bool bSetSelectionToStart)
509 std::unique_ptr<SdrOutliner> pOutliner = ::SdrMakeOutliner(OutlinerMode::TextObject, *pSdrView->
GetModel());
510 uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::
GetSpellChecker() );
514 pOutliner->SetSpeller(xSpell);
515 uno::Reference<linguistic2::XHyphenator> xHyphenator( ::
GetHyphenator() );
516 pOutliner->SetHyphenator( xHyphenator );
520 nCntrl |= EEControlBits::ALLOWBIGOBJS;
525 nCntrl |= EEControlBits::MARKFIELDS;
530 nCntrl |= EEControlBits::ONLINESPELLING;
534 pOutliner->SetControlWord(nCntrl);
536 pOutliner->SetDefaultLanguage(static_cast<const SvxLanguageItem&>(rItem).
GetLanguage());
539 pOutliner->SetVertical( SID_DRAW_TEXT_VERTICAL ==
m_nDrawSfxId ||
545 pOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
557 Point aNewTextEditOffset(0, 0);
559 if (
SwDrawVirtObj* pVirtObj = dynamic_cast<SwDrawVirtObj *>(pObj))
561 pToBeActivated = &
const_cast<SdrObject&
>(pVirtObj->GetReferencedObj());
562 aNewTextEditOffset = pVirtObj->GetOffset();
566 static_cast<SdrTextObj*
>(pToBeActivated)->SetTextEditOffset(aNewTextEditOffset);
568 bool bRet(pSdrView->
SdrBeginTextEdit( pToBeActivated, pPV, pWin,
true, pOutliner.
release(),
nullptr,
false,
false, false ));
586 if (bSetSelectionToStart)
609 OSL_ENSURE( pSdrView,
"IsTextTool without DrawView?" );
615 return nInvent == SdrInventor::Default;
663 for (
size_t i = 0;
i < nCount; ++
i)
670 if (!
HasOnlyObj(pSdrObj, SdrInventor::FmForm))
692 for (
size_t i = 0;
i < nCnt; ++
i)
708 if (rInfo.nCommand == SpellCallbackCommand::STARTSPELLDLG)
710 else if (rInfo.nCommand == SpellCallbackCommand::AUTOCORRECT_OPTIONS)
711 GetViewFrame()->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON );
733 bool bHyphenate =
false;
SfxViewFrame * GetViewFrame() const
#define LINK(Instance, Class, Member)
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
void ExecDraw(SfxRequest &)
SdrObjKind m_eFormObjKind
size_t GetMarkCount() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
constexpr sal_uInt16 KEY_MOD1
bool BeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false)
void SetState(const SfxItemSet &rSet)
bool IsBezierEditMode() const
bool AreOnlyFormsSelected() const
std::unique_ptr< SwWrtShell > m_pWrtShell
#define FN_HYPHENATE_OPT_DLG
tools::Rectangle const & GetOutputArea() const
SfxDispatcher * GetDispatcher()
void SetHitTolerancePixel(sal_uInt16 nVal)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
#define EE_INDEX_NOT_FOUND
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
sal_uInt16 GetValue() const
SdrMark * GetMark(size_t nNum) const
Of course Writer needs its own rectangles.
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
bool EnterShapeDrawTextMode(SdrObject *pObject)
Same as EnterDrawTextMode(), but takes an SdrObject instead of guessing it by document position...
virtual SdrObjList * GetSubList() const
SwWrtShell & GetWrtShell() const
void SetDrawFuncPtr(std::unique_ptr< SwDrawBase > pFuncPtr)
Used by the UI to modify the document model.
#define EE_PARA_NOT_FOUND
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
weld::Window * GetFrameWeld() const
ESelection aNewSelection(GetSelection())
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
SfxShell * GetShell(sal_uInt16 nIdx) const
void ExecuteSpellPopup(const Point &rPosPixel, const Link< SpellCallbackInfo &, void > &rCallBack)
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
bool EnterDrawTextMode(const Point &aDocPos)
void TakeCurrentObj(SdrObjKind &nIdent, SdrInventor &nInvent) const
SAL_DLLPRIVATE bool IsTextTool() const
const css::uno::Any & GetValue() const
bool IsMarkedHit(const Point &rPnt, short nTol=-2) const
std::unique_ptr< SwDrawBase > m_pDrawActual
virtual void Deactivate()
SAL_DLLPRIVATE void HyphenateDrawText()
VclPtr< SwEditWin > m_pEditWin
bool IsDrawSelMode() const
SfxItemPool & GetPool() const
SdrObject * GetMarkedSdrObj() const
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
bool IsShapeDefaultHoriTextDirR2L() const
Is default horizontal text direction for selected drawing object right-to-left.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
sal_uInt16 GetModifier() const
static OUString GetShapeTypeFromRequest(SfxRequest const &rReq)
static bool lcl_isTextBox(SdrObject const *pObject)
SfxBindings & GetBindings()
bool IsWrongSpelledWordAtPos(const Point &rPosPixel)
const OUString & GetValue() const
const SdrMarkList & GetMarkedObjectList() const
const T * GetArg(sal_uInt16 nSlotId) const
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true)
EEHorizontalTextDirection
IMPL_LINK(SwView, OnlineSpellCallback, SpellCallbackInfo &, rInfo, void)
bool IsInsertForm() const
SdrHdl * PickHandle(const Point &rPnt) const
bool IsGroupObject() const
const OutlinerView * GetTextEditOutlinerView() const
bool IsDrawRotate() const
bool IsOnlineSpell() const
void SetCalcFieldValueHdl(Outliner *pOutliner)
SwDrawBase * GetDrawFuncPtr() const
static bool IsFieldShadings()
bool IsCreateMode() const
virtual SdrInventor GetObjInventor() const
void Update(sal_uInt16 nId)
uno::Reference< linguistic2::XSpellChecker1 > GetSpellChecker()
void SetPointer(PointerStyle)
sal_uInt16 GetSlot() const
void SetSelection(const ESelection &)
virtual bool IsTextEdit() const final override
#define FN_SPELL_GRAMMAR_DIALOG
const SwViewOption * GetViewOptions() const
sal_uInt16 GetSlotId() const
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
const OUString & GetShapeType() const
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
void SetBackgroundColor(const Color &rColor)
bool HasOnlyObj(SdrObject const *pSdrObj, SdrInventor eObjInventor) const
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object...
sal_uInt16 GetHitTolerancePixel() const
void SetCreateMode(bool bOn=true)
constexpr TypedWhichId< SfxBoolItem > EE_PARA_HYPHENATE(EE_PARA_START+6)
SAL_DLLPRIVATE bool IsDrawTextHyphenate()
virtual OutputDevice * getReferenceDevice(bool bCreate) const =0
Returns the current reference device.
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
SdrPageView * GetSdrPageView() const
bool ExecDrwTextSpellPopup(const Point &rPt)
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
const SfxItemPool & GetItemPool() const
virtual const tools::Rectangle & GetLogicRect() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
virtual SdrView * GetDrawView() const override
sal_uInt16 getHitTolLog() const
SdrModel * GetModel() const
SdrObjUserCall * GetUserCall() const
bool IsGroupEntered() const
Color GetShapeBackgrd() const
SwFEShell::GetShapeBackgrd.