21#include <editeng/editeng.hxx>
27#include <osl/diagnose.h>
69 OSL_ENSURE( pContact,
"<lcl_AdjustPositioningAttr(..)> - missing contact object." );
76 OSL_ENSURE( !pAnchorFrame ||
78 !
static_cast<const SwTextFrame*
>(pAnchorFrame)->IsFollow(),
79 "<lcl_AdjustPositioningAttr(..)> - anchor frame is a follow." );
99 switch ( rDirItem.GetValue() )
101 case SvxFrameDirection::Vertical_LR_TB:
106 OSL_FAIL(
"<lcl_AdjustPositioningAttr(..)> - vertical from left-to-right not supported." );
109 case SvxFrameDirection::Vertical_RL_TB:
116 case SvxFrameDirection::Horizontal_RL_TB:
123 case SvxFrameDirection::Horizontal_LR_TB:
130 case SvxFrameDirection::Environment:
131 SAL_WARN(
"sw.core",
"lcl_AdjustPositioningAttr(..) SvxFrameDirection::Environment not supported");
144 nHoriRelPos = aObjRect.
Left() - aAnchorPos.
getX();
145 nVertRelPos = aObjRect.
Top() - aAnchorPos.
getY();
148 nHoriRelPos = aObjRect.
Top() - aAnchorPos.
getY();
149 nVertRelPos = aAnchorPos.
getX() - aObjRect.
Right();
154 nHoriRelPos = aAnchorPos.
getX() - aObjRect.
Right();
155 nVertRelPos = aObjRect.
Top() - aAnchorPos.
getY();
159 nHoriRelPos = aObjRect.
Left() - aAnchorPos.
getX();
160 nVertRelPos = aObjRect.
Top() - aAnchorPos.
getY();
177 ->SetLastObjRect( aObjRect );
200 std::unique_ptr<SwUndoDrawGroup> pUndo;
205 bool bGroupMembersNotPositioned(
false );
212 std::map<const SdrObject*, SwFrameFormat*> vSavedTextBoxes;
220#if OSL_DEBUG_LEVEL > 0
223 OSL_ENSURE( bGroupMembersNotPositioned == pAnchoredDrawObj->
NotYetPositioned(),
224 "<SwDoc::GroupSelection(..)> - group members have different positioning status!" );
227 if (
auto pShapeFormat = pContact->
GetFormat())
228 if (
auto pTextBoxNode = pShapeFormat->GetOtherTextBoxFormats())
229 for (
const auto& rTextBoxElement : pTextBoxNode->GetAllTextBoxes())
230 vSavedTextBoxes.emplace(rTextBoxElement);
238 pUndo->AddObj(
i, pFormat, pObj );
255 text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
258 auto pTextBoxNode = std::make_shared<SwTextBoxNode>(
260 for (
const auto& pTextBoxEntry : vSavedTextBoxes)
262 pTextBoxNode->AddTextBox(
const_cast<SdrObject*
>(pTextBoxEntry.first),
263 pTextBoxEntry.second);
264 pTextBoxEntry.second->SetOtherTextBoxFormats(pTextBoxNode);
267 vSavedTextBoxes.clear();
270 OSL_ENSURE( rMrkList.
GetMarkCount() == 1,
"GroupMarked more or none groups." );
280 if ( !bGroupMembersNotPositioned )
288 pUndo->SetGroupFormat( pFormat );
300 OSL_ENSURE( rMrkList.
GetMarkCount() == 1,
"GroupMarked more or none groups." );
310 for (
size_t i = 0;
i < pChildrenObjs->GetObjCount(); ++
i)
314 if (
auto pTextBox = pTextBoxNode->GetTextBox(pSourceObjs))
340 std::unique_ptr<std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >[]> pFormatsAndObjs;
344 pFormatsAndObjs.reset(
new std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >[nMarkCount] );
348 for (
size_t i = 0;
i < nMarkCount; ++
i )
351 if (
auto pObjGroup =
dynamic_cast<SdrObjGroup*
>(pObj) )
355 std::shared_ptr<SwTextBoxNode> pTextBoxNode;
356 if (
auto pGroupFormat = pContact->
GetFormat())
357 pTextBoxNode = pGroupFormat->GetOtherTextBoxFormats();
369 for (
size_t i2 = 0; i2 < pLst->
GetObjCount(); ++i2 )
380 if (
auto pTextBoxFormat = pTextBoxNode->GetTextBox(pSubObj))
382 auto pNewTextBoxNode =std::make_shared<SwTextBoxNode>(
SwTextBoxNode(pFormat));
383 pNewTextBoxNode->AddTextBox(pSubObj, pTextBoxFormat);
385 pTextBoxFormat->SetOtherTextBoxFormats(pNewTextBoxNode);
395 text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
396 if (pSubObj->
GetName().isEmpty())
398 pFormatsAndObjs[
i].emplace_back( pFormat, pSubObj );
401 pUndo->
AddObj( o3tl::narrowing<sal_uInt16>(i2), pFormat );
410 for (
size_t i = 0;
i < nMarkCount; ++
i )
419 while ( !pFormatsAndObjs[
i].empty() )
422 SdrObject* pObj( pFormatsAndObjs[
i].back().second );
423 pFormatsAndObjs[
i].pop_back();
440 bool bCallBase =
false;
445 bool bDelMarked =
true;
483 std::unique_ptr<SwUndoDrawDelete> pUndo;
502 OSL_FAIL(
"<SwDrawVirtObj> is still marked for delete. application will crash!" );
509 pUndo->AddObj( pFormat, rMark );
531 : m_pFormat(pFrameFormat)
533 , m_nOrdNum(nArrOrdNum)
554 if (
auto pDateField =
dynamic_cast<const SvxDateField*
>( pField))
557 pInfo->SetRepresentation(
558 pDateField->GetFormatted(
561 else if (
auto pURLField =
dynamic_cast<const SvxURLField*
>( pField))
564 switch ( pURLField->GetFormat() )
566 case SvxURLFormat::AppDefault:
567 case SvxURLFormat::Repr:
568 pInfo->SetRepresentation(pURLField->GetRepresentation());
571 case SvxURLFormat::Url:
572 pInfo->SetRepresentation(pURLField->GetURL());
576 sal_uInt16 nChrFormat;
578 if (IsVisitedURL(pURLField->GetURL()))
583 SwFormat *pFormat = getIDocumentStylePoolAccess().GetCharFormatFromPool(nChrFormat);
589 pInfo->SetTextColor(aColor);
594 pInfo->SetFieldColor(std::optional<Color>());
596 else if (
auto pTimeField =
dynamic_cast<const SvxExtTimeField*
>( pField) )
599 pInfo->SetRepresentation(
604 OSL_FAIL(
"unknown field command");
605 pInfo->SetRepresentation( OUString(
'?' ) );
614 bool bExistsDrawObjs(
false );
628 bExistsDrawObjs =
true;
634 return bExistsDrawObjs;
639 bool bAllDrawObjsOnPage(
true );
662 if ( !pAnchoredDrawObj )
664 OSL_FAIL(
"<docfunc::AllDrawObjsOnPage() - missing anchored draw object" );
665 bAllDrawObjsOnPage =
false;
674 bAllDrawObjsOnPage =
false;
679 bAllDrawObjsOnPage =
false;
688 bAllDrawObjsOnPage =
false;
695 return bAllDrawObjsOnPage;
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual void SetModified()=0
Must be called manually at changes of format.
void SetCalcFieldValueHdl(const Link< EditFieldInfo *, void > &rLink)
constexpr tools::Long getX() const
constexpr tools::Long getY() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual void NbcSetAnchorPos(const Point &rPnt)
SdrObjUserCall * GetUserCall() const
const Point & GetAnchorPos() const
void SetUserCall(SdrObjUserCall *pUser)
virtual const tools::Rectangle & GetSnapRect() const
virtual const OUString & GetName() const
virtual SdrObjList * getChildrenOfSdrObject() const
virtual const tools::Rectangle & GetLastBoundRect() const
SdrObject * getParentSdrObjectFromSdrObject() const
virtual void SetName(const OUString &rStr, const bool bSetChanged=true)
virtual void NbcMove(const Size &rSiz)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const Color & GetValue() const
const SvxFieldData * GetField() const
class for the positioning of drawing objects
bool NotYetPositioned() const
bool IsOutsidePage() const
wrapper class for the positioning of Writer fly frames and drawing objects
const SwFrame * GetAnchorFrame() const
SwAttrPool * GetPool() const
IDocumentState const & getIDocumentState() const
bool DeleteSelection(SwDrawView &)
IDocumentUndoRedo & GetIDocumentUndoRedo()
OUString GetUniqueShapeName() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
OUString GetUniqueDrawObjectName() const
SwDrawContact * GroupSelection(SdrView &)
void UnGroupSelection(SdrView &)
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
const SwFrameFormat * GetDfltFrameFormat() const
SwDrawFrameFormat * MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
void SetCalcFieldValueHdl(Outliner *pOutliner)
In the Outliner, set a link to the method for field display in edit objects.
const SwViewShellImp & Imp() const
static void ReplaceMarkedDrawVirtObjs(SdrMarkView &_rMarkView)
replace marked <SwDrawVirtObj>-objects by its reference object for delete marked objects.
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object.
Base class of the Writer layout elements.
Point GetFrameAnchorPos(bool bIgnoreFlysAnchoredAtThisFrame) const
returns the position for anchors based on frame direction
bool IsRightToLeft() const
Textboxes are basically textframe + shape pairs.
Represents the visualization of a paragraph.
void AddFormatAndObj(SwDrawFrameFormat *pDrawFrameFormat, SdrObject *pDrawObject)
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *)
SdrPageView * GetPageView()
ZSortFly(const SwFrameFormat *pFrameFormat, const SwFormatAnchor *pFlyAnchor, sal_uInt32 nArrOrdNum)
const SwFrameFormat * m_pFormat
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo *, pInfo, void)
Recognise fields/URLs in the Outliner and set how they are displayed.
static void lcl_CollectTextBoxesForSubGroupObj(SwFrameFormat *pTargetFormat, std::shared_ptr< SwTextBoxNode > pTextBoxNode, SdrObject *pSourceObjs)
static void lcl_AdjustPositioningAttr(SwDrawFrameFormat *_pFrameFormat, const SdrObject &_rSdrObj)
local method to determine positioning and alignment attributes for a drawing object,...
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
bool ExistsDrawObjs(SwDoc &p_rDoc)
method to check, if given Writer document contains at least one drawing object
bool AllDrawObjsOnPage(SwDoc &p_rDoc)
method to check, if given Writer document contains only drawing objects, which are completely on its ...
constexpr OUStringLiteral first
@ RES_POOLCHR_INET_VISIT
Internet visited.
@ RES_POOLCHR_INET_NORMAL
Internet normal.