66 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
78 bool bDeselect =
false;
80 sal_uInt16 nSlotId = rReq.
GetSlot();
82 pStringItem = dynamic_cast< const SfxStringItem*>(pItem);
85 if (nSlotId == SID_FM_CREATE_CONTROL)
92 if (nSlotId == SID_OBJECT_SELECT &&
m_nFormSfxId == nSlotId)
96 else if (nSlotId == SID_FM_CREATE_CONTROL)
104 else if (nSlotId == SID_FM_CREATE_FIELDCONTROL)
110 OSL_ENSURE( pDescriptorItem,
"SwView::ExecDraw(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
111 if( pDescriptorItem )
120 Point aStartPos = rVisArea.Center();
121 if(rVisArea.Width() > aDocSize.Width())
122 aStartPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
123 if(rVisArea.Height() > aDocSize.Height())
124 aStartPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
127 if(pObj->IsGroupObject())
130 aStartPos.AdjustX( -(rBoundRect.
GetWidth()/2) );
131 aStartPos.AdjustY( -(rBoundRect.
GetHeight()/2) );
136 m_pWrtShell->SwFEShell::InsertDrawObj( *(pObj.release()), aStartPos );
141 else if ( nSlotId == SID_FONTWORK_GALLERY_FLOATER )
161 Point aPos( rVisArea.Center() );
165 if( rVisArea.Width() > aDocSize.Width())
166 aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
168 if(rVisArea.Height() > aDocSize.Height())
169 aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
171 if( aPrefSize.Width() && aPrefSize.Height() )
174 aSize =
Size( 2835, 2835 );
177 m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
186 if( nSlotId == SID_DRAW_CS_ID )
190 if( pFuncPtr && pFuncPtr->
GetSlotId() == SID_DRAW_CS_ID )
194 const OUString& aOld = pConstCustomShape->
GetShapeType();
205 && (nSlotId != SID_DRAW_CS_ID) ) )
217 AttrChangedNotify(
nullptr);
226 std::unique_ptr<SwDrawBase> pFuncPtr;
229 bool bCreateDirectly =
false;
233 case SID_OBJECT_SELECT:
234 case SID_DRAW_SELECT:
240 case SID_LINE_ARROW_END:
241 case SID_LINE_ARROW_CIRCLE:
242 case SID_LINE_ARROW_SQUARE:
243 case SID_LINE_ARROW_START:
244 case SID_LINE_CIRCLE_ARROW:
245 case SID_LINE_SQUARE_ARROW:
246 case SID_LINE_ARROWS:
249 case SID_DRAW_MEASURELINE:
251 case SID_DRAW_ELLIPSE:
253 case SID_DRAW_TEXT_VERTICAL:
254 case SID_DRAW_TEXT_MARQUEE:
255 case SID_DRAW_CAPTION:
256 case SID_DRAW_CAPTION_VERTICAL:
262 case SID_DRAW_XPOLYGON_NOFILL:
263 case SID_DRAW_XPOLYGON:
264 case SID_DRAW_POLYGON_NOFILL:
265 case SID_DRAW_POLYGON:
266 case SID_DRAW_BEZIER_NOFILL:
267 case SID_DRAW_BEZIER_FILL:
268 case SID_DRAW_FREELINE_NOFILL:
269 case SID_DRAW_FREELINE:
277 case SID_DRAW_CIRCLECUT:
283 case SID_FM_CREATE_CONTROL:
291 case SID_DRAWTBX_CS_BASIC :
292 case SID_DRAWTBX_CS_SYMBOL :
293 case SID_DRAWTBX_CS_ARROW :
294 case SID_DRAWTBX_CS_FLOWCHART :
295 case SID_DRAWTBX_CS_CALLOUT :
296 case SID_DRAWTBX_CS_STAR :
297 case SID_DRAW_CS_ID :
304 if ( nSlotId != SID_DRAW_CS_ID )
323 bool bEndTextEdit =
true;
331 auto pTempFuncPtr = pFuncPtr.get();
333 AttrChangedNotify(
nullptr);
335 pTempFuncPtr->Activate(nSlotId);
343 else if (dynamic_cast<ConstCustomShape*>(pTempFuncPtr))
345 pTempFuncPtr->CreateDefaultObject();
349 pTempFuncPtr->CreateDefaultObject();
350 pTempFuncPtr->Deactivate();
357 (SID_DRAW_TEXT == nSlotId || SID_DRAW_TEXT_VERTICAL == nSlotId ||
358 SID_DRAW_TEXT_MARQUEE == nSlotId ))
362 bEndTextEdit =
false;
373 if(bEndTextEdit && pSdrView && pSdrView->
IsTextEdit())
376 AttrChangedNotify(
nullptr);
394 pTest = pDispatch->
GetShell(nIdx++);
396 while( pTest && pTest !=
this && pTest !=
m_pShell);
400 dynamic_cast< const SwDrawBaseShell *>(
m_pShell ) ==
nullptr &&
401 dynamic_cast< const SwBezierShell *>(
m_pShell ) ==
nullptr &&
402 dynamic_cast< const svx::ExtrusionBar *>(
m_pShell ) ==
nullptr &&
403 dynamic_cast< const svx::FontworkBar *>(
m_pShell ) ==
nullptr))
438 const SfxBoolItem aTmp( SID_OBJECT_ROTATE,
false );
459 OSL_ENSURE( pSdrView,
"EnterDrawTextMode without DrawView?" );
461 bool bReturn =
false;
469 pObj = pSdrView->
PickObj(aDocPos, pSdrView->
getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT);
473 ( dynamic_cast< const SdrTextObj *>( pObj ) !=
nullptr ||
474 ( dynamic_cast< const SwDrawVirtObj *>( pObj ) !=
nullptr &&
475 dynamic_cast< const SdrTextObj *>(&static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj() ) !=
nullptr ) ) &&
499 bool bIsNewObj,
bool bSetSelectionToStart)
503 std::unique_ptr<SdrOutliner> pOutliner = ::SdrMakeOutliner(OutlinerMode::TextObject, *pSdrView->
GetModel());
504 uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::
GetSpellChecker() );
508 pOutliner->SetSpeller(xSpell);
509 uno::Reference<linguistic2::XHyphenator> xHyphenator( ::
GetHyphenator() );
510 pOutliner->SetHyphenator( xHyphenator );
514 nCntrl |= EEControlBits::ALLOWBIGOBJS;
519 nCntrl |= EEControlBits::MARKFIELDS;
524 nCntrl |= EEControlBits::ONLINESPELLING;
528 pOutliner->SetControlWord(nCntrl);
530 pOutliner->SetDefaultLanguage(static_cast<const SvxLanguageItem&>(rItem).
GetLanguage());
533 pOutliner->SetVertical( SID_DRAW_TEXT_VERTICAL ==
m_nDrawSfxId ||
539 pOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
551 Point aNewTextEditOffset(0, 0);
553 if (
SwDrawVirtObj* pVirtObj = dynamic_cast<SwDrawVirtObj *>(pObj))
555 pToBeActivated = &
const_cast<SdrObject&
>(pVirtObj->GetReferencedObj());
556 aNewTextEditOffset = pVirtObj->GetOffset();
560 static_cast<SdrTextObj*
>(pToBeActivated)->SetTextEditOffset(aNewTextEditOffset);
562 bool bRet(pSdrView->
SdrBeginTextEdit( pToBeActivated, pPV, pWin,
true, pOutliner.
release(),
nullptr,
false,
false, false ));
580 if (bSetSelectionToStart)
603 OSL_ENSURE( pSdrView,
"IsTextTool without DrawView?" );
609 return nInvent == SdrInventor::Default;
657 for (
size_t i = 0;
i < nCount; ++
i)
664 if (!
HasOnlyObj(pSdrObj, SdrInventor::FmForm))
686 for (
size_t i = 0;
i < nCnt; ++
i)
702 if (rInfo.nCommand == SpellCallbackCommand::STARTSPELLDLG)
704 else if (rInfo.nCommand == SpellCallbackCommand::AUTOCORRECT_OPTIONS)
705 GetViewFrame()->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON );
727 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
void SetSdrObjectRef(SdrObject **, SdrModel *pModel)
size_t GetMarkCount() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
void ExecuteSpellPopup(const Point &rPosPixel, Link< SpellCallbackInfo &, void > const *pCallBack)
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
virtual const tools::Rectangle & GetSnapRect() const
void SetDrawFuncPtr(std::unique_ptr< SwDrawBase > pFuncPtr)
Used by the UI to modify the document model.
#define EE_PARA_NOT_FOUND
weld::Window * GetFrameWeld() const
ESelection aNewSelection(GetSelection())
SfxShell * GetShell(sal_uInt16 nIdx) const
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()
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
Point PixelToLogic(const Point &rDevicePt) 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
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
SdrPageView * GetSdrPageView() const
bool ExecDrwTextSpellPopup(const Point &rPt)
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
const SfxItemPool & GetItemPool() 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
bool IsWrongSpelledWordAtPos(const Point &rPosPixel, bool bMarkIfWrong=false)
Color GetShapeBackgrd() const
SwFEShell::GetShapeBackgrd.