21 #include <editeng/editeng.hxx>
31 #include <viewimp.hxx>
33 #include <docfunc.hxx>
40 #include <drawdoc.hxx>
68 OSL_ENSURE( pContact,
"<lcl_AdjustPositioningAttr(..)> - missing contact object." );
75 OSL_ENSURE( !pAnchorFrame ||
77 !
static_cast<const SwTextFrame*
>(pAnchorFrame)->IsFollow(),
78 "<lcl_AdjustPositioningAttr(..)> - anchor frame is a follow." );
98 switch ( rDirItem.GetValue() )
100 case SvxFrameDirection::Vertical_LR_TB:
105 OSL_FAIL(
"<lcl_AdjustPositioningAttr(..)> - vertical from left-to-right not supported." );
108 case SvxFrameDirection::Vertical_RL_TB:
115 case SvxFrameDirection::Horizontal_RL_TB:
122 case SvxFrameDirection::Horizontal_LR_TB:
129 case SvxFrameDirection::Environment:
130 SAL_WARN(
"sw.core",
"lcl_AdjustPositioningAttr(..) SvxFrameDirection::Environment not supported");
143 nHoriRelPos = aObjRect.
Left() - aAnchorPos.getX();
144 nVertRelPos = aObjRect.
Top() - aAnchorPos.getY();
147 nHoriRelPos = aObjRect.
Top() - aAnchorPos.getY();
148 nVertRelPos = aAnchorPos.getX() - aObjRect.
Right();
153 nHoriRelPos = aAnchorPos.getX() - aObjRect.
Right();
154 nVertRelPos = aObjRect.
Top() - aAnchorPos.getY();
158 nHoriRelPos = aObjRect.
Left() - aAnchorPos.getX();
159 nVertRelPos = aObjRect.
Top() - aAnchorPos.getY();
172 if (
auto pAnchoredDrawObj = dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) )
176 ->SetLastObjRect( aObjRect.
SVRect() );
199 std::unique_ptr<SwUndoDrawGroup> pUndo;
204 bool bGroupMembersNotPositioned(
false );
217 #if OSL_DEBUG_LEVEL > 0
220 OSL_ENSURE( bGroupMembersNotPositioned == pAnchoredDrawObj->
NotYetPositioned(),
221 "<SwDoc::GroupSelection(..)> - group members have different positioning status!" );
230 pUndo->AddObj(
i, pFormat, pObj );
239 pObj->
NbcMove(
Size( aAnchorPos.getX(), aAnchorPos.getY() ) );
247 text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
250 OSL_ENSURE( rMrkList.
GetMarkCount() == 1,
"GroupMarked more or none groups." );
260 if ( !bGroupMembersNotPositioned )
268 pUndo->SetGroupFormat( pFormat );
280 OSL_ENSURE( rMrkList.
GetMarkCount() == 1,
"GroupMarked more or none groups." );
299 std::unique_ptr<std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >[]> pFormatsAndObjs;
303 pFormatsAndObjs.reset(
new std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >[nMarkCount] );
307 for (
size_t i = 0;
i < nMarkCount; ++
i )
310 if (
auto pObjGroup = dynamic_cast<SdrObjGroup*>(pObj) )
323 for (
size_t i2 = 0; i2 < pLst->GetObjCount(); ++i2 )
331 text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
332 pFormatsAndObjs[
i].emplace_back( pFormat, pSubObj );
335 pUndo->
AddObj( static_cast<sal_uInt16>(i2), pFormat );
344 for (
size_t i = 0;
i < nMarkCount; ++
i )
353 while ( !pFormatsAndObjs[
i].empty() )
356 SdrObject* pObj( pFormatsAndObjs[
i].back().second );
357 pFormatsAndObjs[
i].pop_back();
374 bool bCallBase =
false;
379 bool bDelMarked =
true;
384 if(
auto pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>( pObj) )
398 if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) ==
nullptr )
417 std::unique_ptr<SwUndoDrawDelete> pUndo;
434 if ( dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr )
436 OSL_FAIL(
"<SwDrawVirtObj> is still marked for delete. application will crash!" );
443 pUndo->AddObj( pFormat, rMark );
465 : m_pFormat(pFrameFormat)
467 , m_nOrdNum(nArrOrdNum)
488 if (
auto pDateField = dynamic_cast<const SvxDateField*>( pField))
491 pInfo->SetRepresentation(
492 pDateField->GetFormatted(
495 else if (
auto pURLField = dynamic_cast<const SvxURLField*>( pField))
498 switch ( pURLField->GetFormat() )
500 case SvxURLFormat::AppDefault:
501 case SvxURLFormat::Repr:
502 pInfo->SetRepresentation(pURLField->GetRepresentation());
505 case SvxURLFormat::Url:
506 pInfo->SetRepresentation(pURLField->GetURL());
510 sal_uInt16 nChrFormat;
512 if (IsVisitedURL(pURLField->GetURL()))
517 SwFormat *pFormat = getIDocumentStylePoolAccess().GetCharFormatFromPool(nChrFormat);
523 pInfo->SetTextColor(aColor);
525 else if (dynamic_cast<const SdrMeasureField*>( pField))
528 pInfo->SetFieldColor(std::optional<Color>());
530 else if (
auto pTimeField = dynamic_cast<const SvxExtTimeField*>( pField) )
533 pInfo->SetRepresentation(
538 OSL_FAIL(
"unknown field command");
539 pInfo->SetRepresentation( OUString(
'?' ) );
548 bool bExistsDrawObjs(
false );
559 if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
562 bExistsDrawObjs =
true;
568 return bExistsDrawObjs;
573 bool bAllDrawObjsOnPage(
true );
584 if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
596 if ( !pAnchoredDrawObj )
598 OSL_FAIL(
"<docfunc::AllDrawObjsOnPage() - missing anchored draw object" );
599 bAllDrawObjsOnPage =
false;
608 bAllDrawObjsOnPage =
false;
613 bAllDrawObjsOnPage =
false;
622 bAllDrawObjsOnPage =
false;
629 return bAllDrawObjsOnPage;
#define LINK(Instance, Class, Member)
bool ExistsDrawObjs(SwDoc &p_rDoc)
method to check, if given Writer document contains at least one drawing object
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
static void lcl_AdjustPositioningAttr(SwDrawFrameFormat *_pFrameFormat, const SdrObject &_rSdrObj)
local method to determine positioning and alignment attributes for a drawing object, which is newly connected to the layout.
void Right(const tools::Long nRight)
size_t GetMarkCount() const
class for the positioning of drawing objects
OUString GetUniqueDrawObjectName() const
const SwFrameFormat * m_pFormat
ZSortFly(const SwFrameFormat *pFrameFormat, const SwFormatAnchor *pFlyAnchor, sal_uInt32 nArrOrdNum)
void SetName(const OUString &rStr, const bool bSetChanged=true)
void Left(const tools::Long nLeft)
virtual void SetModified()=0
Must be called manually at changes of format.
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
void AddFormatAndObj(SwDrawFrameFormat *pDrawFrameFormat, SdrObject *pDrawObject)
void SetCalcFieldValueHdl(Outliner *pOutliner)
In the Outliner, set a link to the method for field display in edit objects.
bool DeleteSelection(SwDrawView &)
SdrMark * GetMark(size_t nNum) const
IDocumentUndoRedo & GetIDocumentUndoRedo()
Of course Writer needs its own rectangles.
SwDrawFrameFormat * MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
const SwViewShellImp & Imp() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
virtual const tools::Rectangle & GetSnapRect() const
wrapper class for the positioning of Writer fly frames and drawing objects
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual bool DoesUndo() const =0
Is Undo enabled?
SwAttrPool * GetPool() const
SwDrawContact * GroupSelection(SdrView &)
SdrObject * GetMarkedSdrObj() const
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual void ClearRedo()=0
Delete all Redo actions.
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
const SdrMarkList & GetMarkedObjectList() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void SetCalcFieldValueHdl(const Link< EditFieldInfo *, void > &rLink)
bool IsOutsidePage() const
void UnGroupSelection(SdrView &)
IDocumentState const & getIDocumentState() const
void SetUserCall(SdrObjUserCall *pUser)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
OUString GetUniqueShapeName() const
const SwFrameFormat * GetDfltFrameFormat() const
virtual const tools::Rectangle & GetLastBoundRect() const
bool AllDrawObjsOnPage(SwDoc &p_rDoc)
method to check, if given Writer document contains only drawing objects, which are completely on its ...
tools::Rectangle SVRect() const
static void ReplaceMarkedDrawVirtObjs(SdrMarkView &_rMarkView)
replace marked -objects by its reference object for delete marked objects.
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *)
#define SAL_WARN_IF(condition, area, stream)
virtual void NbcMove(const Size &rSiz)
bool NotYetPositioned() const
bool IsRightToLeft() const
void Top(const tools::Long nTop)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
const Point & GetAnchorPos() const
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
SdrObject * getParentSdrObjectFromSdrObject() const
virtual void CallSwClientNotify(const SfxHint &rHint) const override
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTBLUE
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
#define SAL_WARN(area, stream)
virtual void NbcSetAnchorPos(const Point &rPnt)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
const SwFrame * GetAnchorFrame() const
constexpr OUStringLiteral first
Point GetFrameAnchorPos(bool bIgnoreFlysAnchoredAtThisFrame) const
returns the position for anchors based on frame direction
SdrObjUserCall * GetUserCall() const
IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo *, pInfo, void)
Recognise fields/URLs in the Outliner and set how they are displayed.
const Color & GetValue() const
SdrPageView * GetPageView()
const SvxFieldData * GetField() const