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>
56#include <com/sun/star/embed/Aspects.hpp>
66class SwSdrHdl :
public SdrHdl
69 SwSdrHdl(
const Point& rPnt,
bool bTopRight ) :
76bool 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!" );
333 for (
size_t i = nObjCount-1;
i > _rParentObj.
GetDrawObj()->GetOrdNum() ; --
i )
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
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
698 pAnch = pFlyDrawObj->GetFlyFrame()->GetAnchorFrame();
699 aMyRect = pFlyDrawObj->GetFlyFrame()->getFrameArea().SVRect();
717 const bool bTopRight = pAnch && ( ( pAnch->
IsVertical() &&
743 else if ( !pFlyDrawObj )
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;
981 if (
pObject->getChildrenOfSdrObject())
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;
@ MATH_BASELINE_ALIGNMENT
virtual void CheckPossibilities() override
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
void SetBackgroundColor(const Color &rColor)
Color const & GetBackgroundColor() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
virtual bool IsAction() const override
bool TakeDragObjAnchorPos(Point &rPos, bool bTopRight) const
bool m_bRotateFreeAllowed
size_t GetHdlCount() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
SdrHdl * GetHdl(size_t nNum) const
void SetPos(const Point &rPnt)
virtual bool IsFocusHdl() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
void SetFrameDragSingles(bool bOn=true)
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
void SortMarkedObjects() const
virtual SdrObject * CheckSingleSdrObjectHit(const Point &rPnt, sal_uInt16 nTol, SdrObject *pObj, SdrPageView *pPV, SdrSearchOptions nOptions, const SdrLayerIDSet *pMVisLay) const
sal_uInt16 GetMarkHdlSizePixel() const
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const OutlinerView * GetTextEditOutlinerView() const
virtual void ModelHasChanged() override
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
bool IsObjOrdNumsDirty() const
sal_uInt32 GetOrdNumDirect() const
sal_uInt32 GetOrdNum() const
virtual const tools::Rectangle & GetSnapRect() const
SdrPage * getSdrPageFromSdrObject() const
SdrObject * getParentSdrObjectFromSdrObject() const
void SetPageVisible(bool bOn=true)
void SetHlplVisible(bool bOn=true)
void SetBufferedOverlayAllowed(bool bNew)
void SetHitTolerancePixel(sal_uInt16 nVal)
void SetBordVisible(bool bOn=true)
void SetSwapAsynchron(bool bJa=true)
void SetPrintPreview(bool bOn=true)
void SetGlueVisible(bool bOn=true)
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
void SetBufferedOutputAllowed(bool bNew)
void SetGridVisible(bool bOn)
void EnableExtendedMouseEventDispatcher(bool bOn)
virtual void DeleteMarked()
void EnableExtendedKeyInputDispatcher(bool bOn)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
static sal_uInt16 IsMath(const SvGlobalName &rName)
wrapper class for the positioning of Writer fly frames and drawing objects
const SwFrame * GetAnchorFrame() const
void CheckCharRectAndTopOfLine(const bool _bCheckForParaPorInf)
check anchor character rectangle and top of line
const SwRect & GetLastCharRect() const
virtual const SwFlyFrame * DynCastFlyFrame() const
const SdrObject * GetDrawObj() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
bool DeleteSelection(SwDrawView &)
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
::sw::DocumentSettingManager & GetDocumentSettingManager()
virtual SdrObject * GetMaxToBtmObj(SdrObject *pObj) const override
const SwViewShellImp & Imp() const
virtual void MarkListHasChanged() override
virtual void CheckPossibilities() override
static void ReplaceMarkedDrawVirtObjs(SdrMarkView &_rMarkView)
replace marked <SwDrawVirtObj>-objects by its reference object for delete marked objects.
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
std::unique_ptr< SdrUndoManager > createLocalTextUndoManager() override
virtual void ObjOrderChanged(SdrObject *pObj, size_t nOldPos, size_t nNewPos) override
SwDrawView(SwViewShellImp &rI, FmFormModel &rFmFormModel, OutputDevice *pOutDev)
static bool IsAntiAliasing()
virtual void DeleteMarked() override
const SwFrame * CalcAnchor()
virtual SdrObject * GetMaxToTopObj(SdrObject *pObj) const override
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
virtual SdrObject * CheckSingleSdrObjectHit(const Point &rPnt, sal_uInt16 nTol, SdrObject *pObj, SdrPageView *pPV, SdrSearchOptions nOptions, const SdrLayerIDSet *pMVisLay) const override
virtual void MakeVisible(const tools::Rectangle &, vcl::Window &rWin) override
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 AddCustomHdl() override
Gets called every time the handles need to be build.
virtual bool TakeDragLimit(SdrDragMode eMode, tools::Rectangle &rRect) const override
virtual void ModelHasChanged() override
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object.
general base class for all free-flowing frames
const SwVirtFlyDrawObj * GetVirtDrawObj() const
virtual const SwFlyFrameFormat * GetFormat() const override
virtual SwFrameFormat & GetFrameFormat() override
bool IsFlyInContentFrame() const
Base class of the Writer layout elements.
SwFlyFrame * FindFlyFrame()
Point GetFrameAnchorPos(bool bIgnoreFlysAnchoredAtThisFrame) const
returns the position for anchors based on frame direction
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
bool IsRightToLeft() const
bool IsNoTextFrame() const
bool IsContentFrame() const
SwPageFrame * FindPageFrame()
bool IsAnLower(const SwFrame *) const
const SwFrame * Lower() const
const SwContentNode * GetNode() const
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
const SwOLEObj & GetOLEObj() const
A page of the document layout.
const SwSortedObjs * GetSortedObjs() const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Pos(const Point &rNew)
tools::Rectangle SVRect() const
The root element of a Writer document layout.
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
static std::vector< SwFrameFormat * > CollectTextBoxes(const SdrObject *pGroupObject, SwFrameFormat *pFormat)
Collect all textboxes of the group given by the pGroupObj Parameter.
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
void AddAccessibleObj(const SdrObject *pObj)
void AddAccessibleFrame(const SwFrame *pFrame)
Add a frame in the accessible view.
void DisposeAccessibleObj(const SdrObject *pObj, bool bCanSkipInvisible)
SdrPageView * GetPageView()
const SwViewShell * GetShell() const
Only for SwViewShell::Init()
virtual void DrawSelChanged()
vcl::Window * GetWin() const
SfxViewShell * GetSfxViewShell() const
void MakeVisible(const SwRect &)
SwFlyFrame * GetFlyFrame()
basegfx::B2DRange getInnerBound() const
bool isInside(const Tuple2D< TYPE > &rTuple) const
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
static SdrObject * impLocalHitCorrection(SdrObject *pRetval, const Point &rPnt, sal_uInt16 nTol, const SdrMarkList &rMrkList)
static const SwFrame * lcl_FindAnchor(const SdrObject *pObj, bool bAll)
void FrameNotify(SwViewShell *pVwSh, FlyMode eMode)
EmbeddedObjectRef * pObject
bool CalcClipRect(const SdrObject *pSdrObj, SwRect &rRect, bool bMove=true)
calculate rectangle in that the object can be moved or rather be resized
const SwContentFrame * FindAnchor(const SwFrame *pOldAnch, const Point &rNew, const bool bBody=false)
search an anchor for paragraph bound frames starting from pOldAnch
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
bool IsPaintBuffer_Writer()
bool IsOverlayBuffer_Writer()