20 #include <config_wasm_strip.h>
31 #include <osl/diagnose.h>
32 #include <com/sun/star/embed/EmbedMisc.hpp>
33 #include <com/sun/star/embed/XEmbeddedObject.hpp>
45 #include <viewimp.hxx>
56 #include <com/sun/star/embed/Aspects.hpp>
66 class SwSdrHdl :
public SdrHdl
69 SwSdrHdl(
const Point& rPnt,
bool bTopRight ) :
71 virtual bool IsFocusHdl()
const override;
76 bool SwSdrHdl::IsFocusHdl()
const
78 if( SdrHdlKind::Anchor == eKind || SdrHdlKind::Anchor_TR == eKind )
152 if(pSwVirtFlyDrawObj)
163 bool bSelected(
false);
165 for(
size_t a = 0; !bSelected &&
a < nMarkCount; ++
a)
179 aInnerBound.
grow(-1.0 * nTol);
221 OSL_FAIL(
"<SwDrawView::AddCustomHdl()> - missing frame format!" );
226 if (RndStdIds::FLY_AS_CHAR == rAnchor.
GetAnchorId())
235 if ( RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId() )
248 aPos = aAutoPos.
Pos();
253 std::unique_ptr<SdrHdl> hdl = std::make_unique<SwSdrHdl>( aPos, ( pAnch->
IsVertical() && !pAnch->
IsVertLR() ) ||
291 if ( nOrdNum < pTmpPage->GetObjCount() )
293 return pTmpPage->
GetObj( nOrdNum );
315 return pRet != pObj ? pRet :
nullptr;
329 OSL_ENSURE( pDrawPage,
330 "<SwDrawView::GetMaxChildOrdNum(..) - missing drawing page at parent object - crash!" );
338 if ( pObj == _pExclChildObj )
343 if ( pObj->
GetOrdNum() > nMaxChildOrdNum &&
351 return nMaxChildOrdNum;
356 const std::vector<SdrObject*>& _rMovedChildObjs )
const
359 std::vector<SwAnchoredObject*> aAnchoredObjs;
362 assert(pContact &&
"SwDrawView::MoveRepeatedObjs(..) - missing contact object -> crash.");
367 if ( aAnchoredObjs.size() <= 1 )
374 while ( !aAnchoredObjs.empty() )
377 if ( pAnchoredObj != &_rMovedAnchoredObj )
383 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
396 aAnchoredObjs.pop_back();
400 for (
SdrObject* pChildObj : _rMovedChildObjs )
404 assert(pContact &&
"SwDrawView::MoveRepeatedObjs(..) - missing contact object -> crash.");
408 const size_t nTmpNewPos = pChildObj->GetOrdNum();
409 while ( !aAnchoredObjs.empty() )
412 if ( pAnchoredObj->
GetDrawObj() != pChildObj )
418 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
431 aAnchoredObjs.pop_back();
457 const bool bMovedForward = nOldPos < nNewPos;
460 if ( pParentAnchoredObj )
464 const size_t nMaxChildOrdNumWithoutMoved =
466 if ( nNewPos > nMaxChildOrdNumWithoutMoved+1 )
470 nNewPos = nMaxChildOrdNumWithoutMoved+1;
476 if ( nNewPos < nParentOrdNum )
480 nNewPos = nParentOrdNum;
488 if ( ( bMovedForward && nNewPos < nObjCount - 1 ) ||
489 ( !bMovedForward && nNewPos > 0 ) )
492 pDrawPage->
GetObj( bMovedForward ? nNewPos - 1 : nNewPos + 1 );
495 size_t nTmpNewPos( nNewPos );
499 const sal_uInt32 nTmpMaxOrdNum =
501 if ( nTmpMaxOrdNum > nNewPos )
502 nTmpNewPos = nTmpMaxOrdNum;
507 const sal_uInt32 nTmpMinOrdNum =
509 if ( nTmpMinOrdNum < nNewPos )
510 nTmpNewPos = nTmpMinOrdNum;
512 if ( nTmpNewPos != nNewPos )
515 nNewPos = nTmpNewPos;
524 bMovedForward && nNewPos < nObjCount - 1 )
526 sal_uInt32 nMaxChildOrdNum =
528 if ( nNewPos < nMaxChildOrdNum )
533 if ( nTmpNewPos >= nObjCount )
538 pTmpObj = pDrawPage->
GetObj( nTmpNewPos );
542 nNewPos = nTmpNewPos;
548 if ( ( bMovedForward && nNewPos < nObjCount - 1 ) ||
549 ( !bMovedForward && nNewPos > 0 ) )
551 size_t nTmpNewPos( nNewPos );
553 pParentAnchoredObj ? &(pParentAnchoredObj->
GetFrameFormat()) :
nullptr;
562 const SwFlyFrame* pTmpParentObj = pTmpAnchorFrame
564 if ( pTmpParentObj &&
570 pTmpObj = pDrawPage->
GetObj( nTmpNewPos + 1 );
582 if ( nTmpNewPos != nNewPos )
585 nNewPos = nTmpNewPos;
591 std::vector< SdrObject* > aMovedChildObjs;
597 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
602 const sal_uInt32 nChildNewPos = bMovedForward ? nNewPos : nNewPos+1;
603 size_t i = bMovedForward ? nOldPos : nObjCount-1;
607 if ( pTmpObj == pObj )
615 const SwFlyFrame* pTmpParentObj = pTmpAnchorFrame
617 if ( pTmpParentObj &&
618 ( ( pTmpParentObj == pFlyFrame ) ||
619 ( pFlyFrame->IsUpperOf( *pTmpParentObj ) ) ) )
625 aMovedChildObjs.push_back( pTmpObj );
627 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
628 if (
auto pFlyDrawObj = dynamic_cast<SwVirtFlyDrawObj *>( pTmpObj ) )
630 const SwFlyFrame *pTmpFlyFrame = pFlyDrawObj->GetFlyFrame();
650 }
while ( ( bMovedForward && i < ( nObjCount - aMovedChildObjs.size() ) ) ||
651 ( !bMovedForward && i > ( nNewPos + aMovedChildObjs.size() ) ) );
653 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
674 if( ::
CalcClipRect( pObj, aRect, eMode == SdrDragMode::Move ) )
698 pAnch = pFlyDrawObj->GetFlyFrame()->GetAnchorFrame();
699 aMyRect = pFlyDrawObj->GetFlyFrame()->getFrameArea().SVRect();
717 const bool bTopRight = pAnch && ( ( pAnch->
IsVertical() &&
741 pAnch =
::FindAnchor( static_cast<const SwContentFrame*>(pAnch), aPt, bBodyOnly );
743 else if ( !pFlyDrawObj )
745 const SwRect aRect( aPt.getX(), aPt.getY(), 1, 1 );
748 if ( pContact->GetAnchorFrame( pObj ) &&
749 pContact->GetAnchorFrame( pObj )->IsPageFrame() )
750 pAnch = pContact->GetPageFrame();
752 pAnch = pContact->FindPage( aRect );
792 bool bColorWasSaved(
false);
797 bColorWasSaved =
true;
832 bool bProtect =
false;
833 bool bSzProtect =
false;
839 const SwFrame *pFrame =
nullptr;
840 if (
auto pVirtFlyDrawObj = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) )
842 const SwFlyFrame *pFly = pVirtFlyDrawObj->GetFlyFrame();
854 const uno::Reference < embed::XEmbeddedObject > xObj =
const_cast< SwOLEObj&
>(pOLENd->
GetOLEObj()).GetOleRef();
862 bSzProtect |= ( embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ) ) != 0;
895 OSL_FAIL(
"<SwDrawView::CheckPossibilities()> - missing frame format" );
923 std::vector<SdrObject*> aMarkedObjs;
927 aMarkedObjs.push_back( pMarkedObj );
933 while ( !aMarkedObjs.empty() )
935 SdrObject* pMarkObj = aMarkedObjs.back();
936 if (
auto pVirtObj = dynamic_cast<SwDrawVirtObj *>( pMarkObj ) )
938 SdrObject* pRefObj = &(pVirtObj->ReferencedObj());
941 _rMarkView.
MarkObj( pRefObj, pDrawPageView );
946 _rMarkView.
MarkObj( pMarkObj, pDrawPageView );
949 aMarkedObjs.pop_back();
975 std::vector<SwFrameFormat*> aTextBoxesToDelete;
984 for (
auto& rChildTextBox : pChildTextBoxes)
985 aTextBoxesToDelete.push_back(rChildTextBox);
989 aTextBoxesToDelete.push_back(pTextBox);
1000 for (
int i = aTextBoxesToDelete.size() - 1;
i >= 0; --
i)
1014 std::unique_ptr<SdrUndoManager> pUndoManager(
new SdrUndoManager);
1016 return pUndoManager;
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
bool IsAnLower(const SwFrame *) const
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
virtual void ModelHasChanged() override
void CheckCharRectAndTopOfLine(const bool _bCheckForParaPorInf)
check anchor character rectangle and top of line
void FrameNotify(SwViewShell *pVwSh, FlyMode eMode)
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Base class of the Writer layout elements.
const SwRect & GetLastCharRect() const
void SetHlplVisible(bool bOn=true)
virtual const SwFlyFrameFormat * GetFormat() const override
size_t GetMarkCount() const
void SetPos(const Point &rPnt)
static const SwFrame * lcl_FindAnchor(const SdrObject *pObj, bool bAll)
void SortMarkedObjects() const
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
const SwOLEObj & GetOLEObj() const
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
static sal_uInt32 GetMaxChildOrdNum(const SwFlyFrame &_rParentObj, const SdrObject *_pExclChildObj=nullptr)
determine maximal order number for a 'child' object of given 'parent' object
virtual void MakeVisible(const tools::Rectangle &, vcl::Window &rWin) override
void AddAccessibleFrame(const SwFrame *pFrame)
Add a frame in the accessible view.
virtual SdrObjList * getChildrenOfSdrObject() const
basegfx::B2DRange getInnerBound() const
void SetHitTolerancePixel(sal_uInt16 nVal)
void SetPrintPreview(bool bOn=true)
void EnableExtendedKeyInputDispatcher(bool bOn)
void AddAccessibleObj(const SdrObject *pObj)
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual bool IsFocusHdl() const
bool DeleteSelection(SwDrawView &)
SdrMark * GetMark(size_t nNum) const
void Pos(const Point &rNew)
static SfxObjectShell * Current()
IDocumentUndoRedo & GetIDocumentUndoRedo()
bool CalcClipRect(const SdrObject *pSdrObj, SwRect &rRect, bool bMove=true)
calculate rectangle in that the object can be moved or rather be resized
Of course Writer needs its own rectangles.
SfxViewShell * GetSfxViewShell() const
void EnableExtendedMouseEventDispatcher(bool bOn)
void SetFrameDragSingles(bool bOn=true)
EmbeddedObjectRef * pObject
The root element of a Writer document layout.
const SwViewShellImp & Imp() const
virtual SwFrameFormat & GetFrameFormat() override
virtual const tools::Rectangle & GetSnapRect() const
void SetBufferedOutputAllowed(bool bNew)
bool IsObjOrdNumsDirty() const
virtual SdrObject * GetMaxToTopObj(SdrObject *pObj) const override
Color const & GetBackgroundColor() const
bool IsPaintBuffer_Writer()
std::unique_ptr< SdrUndoManager > createLocalTextUndoManager() override
wrapper class for the positioning of Writer fly frames and drawing objects
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
virtual SdrObject * CheckSingleSdrObjectHit(const Point &rPnt, sal_uInt16 nTol, SdrObject *pObj, SdrPageView *pPV, SdrSearchOptions nOptions, const SdrLayerIDSet *pMVisLay) const override
SdrPage * getSdrPageFromSdrObject() const
void DisposeAccessibleObj(const SdrObject *pObj, bool bCanSkipInvisible)
void SetGlueVisible(bool bOn=true)
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
void SetBordVisible(bool bOn=true)
static SdrObject * impLocalHitCorrection(SdrObject *pRetval, const Point &rPnt, sal_uInt16 nTol, const SdrMarkList &rMrkList)
void SetPageVisible(bool bOn=true)
SwFlyFrame * FindFlyFrame()
static sal_uInt16 IsMath(const SvGlobalName &rName)
virtual SdrObject * CheckSingleSdrObjectHit(const Point &rPnt, sal_uInt16 nTol, SdrObject *pObj, SdrPageView *pPV, SdrSearchOptions nOptions, const SdrLayerIDSet *pMVisLay) const
bool IsFlyInContentFrame() const
sal_uInt32 GetOrdNumDirect() const
const SwViewShell * GetShell() const
Only for SwViewShell::Init()
void MakeVisible(const SwRect &)
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
SdrObject * GetMarkedSdrObj() const
void SetSwapAsynchron(bool bJa=true)
virtual SdrObject * GetMaxToBtmObj(SdrObject *pObj) const override
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
bool IsContentFrame() const
void SetBufferedOverlayAllowed(bool bNew)
const SdrObject * GetDrawObj() const
const SwSortedObjs * GetSortedObjs() const
virtual void DrawSelChanged()
SwPageFrame * FindPageFrame()
const SwFrame * Lower() const
bool m_bRotateFreeAllowed
const SdrMarkList & GetMarkedObjectList() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual const SwFlyFrame * DynCastFlyFrame() const
sal_uInt32 GetOrdNum() const
const OutlinerView * GetTextEditOutlinerView() const
virtual void ObjOrderChanged(SdrObject *pObj, size_t nOldPos, size_t nNewPos) override
bool IsOverlayBuffer_Writer()
bool TakeDragObjAnchorPos(Point &rPos, bool bTopRight) const
A page of the document layout.
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
virtual void CheckPossibilities() override
virtual bool IsAction() const override
size_t GetHdlCount() const
SdrHdl * GetHdl(size_t nNum) const
const SwContentNode * GetNode() const
SwFlyFrame * GetFlyFrame()
tools::Rectangle SVRect() const
static void ReplaceMarkedDrawVirtObjs(SdrMarkView &_rMarkView)
replace marked -objects by its reference object for delete marked objects.
general base class for all free-flowing frames
SwDrawView(SwViewShellImp &rI, FmFormModel &rFmFormModel, OutputDevice *pOutDev)
vcl::Window * GetWin() const
bool IsNoTextFrame() const
void SetBackgroundColor(const Color &rColor)
void MoveRepeatedObjs(const SwAnchoredObject &_rMovedAnchoredObj, const std::vector< SdrObject * > &_rMovedChildObjs) const
method to move 'repeated' objects of the given moved object to the according level ...
void SetGridVisible(bool bOn)
virtual void DeleteMarked()
bool IsRightToLeft() const
::sw::DocumentSettingManager & GetDocumentSettingManager()
SdrObject * getParentSdrObjectFromSdrObject() const
SdrPageView * GetSdrPageView() const
const SwContentFrame * FindAnchor(const SwFrame *pOldAnch, const Point &rNew, const bool bBody=false)
search an anchor for paragraph bound frames starting from pOldAnch
virtual void CheckPossibilities() override
sal_uInt16 GetMarkHdlSizePixel() const
static bool IsAntiAliasing()
virtual void AddCustomHdl() override
Gets called every time the handles need to be build.
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
virtual void MarkListHasChanged() override
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
const SwFrame * GetAnchorFrame() const
const SwFrame * CalcAnchor()
void EndAllAction(bool bVirDev=false)
Point GetFrameAnchorPos(bool bIgnoreFlysAnchoredAtThisFrame) const
returns the position for anchors based on frame direction
static std::vector< SwFrameFormat * > CollectTextBoxes(const SdrObject *pGroupObject, SwFrameFormat *pFormat)
Collect all textboxes of the group given by the pGroupObj Parameter.
void Height(tools::Long nNew)
SdrModel * GetModel() const
virtual bool TakeDragLimit(SdrDragMode eMode, tools::Rectangle &rRect) const override
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
virtual void DeleteMarked() override
SdrPageView * GetPageView()
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
bool IsObjMarked(SdrObject const *pObj) const
virtual void ModelHasChanged() override