LibreOffice Module sw (master) 1
fews.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <svx/svdobj.hxx>
21#include <osl/diagnose.h>
22#include <comphelper/lok.hxx>
23#include <init.hxx>
24#include <fesh.hxx>
25#include <tabcol.hxx>
26#include <pagefrm.hxx>
27#include <rootfrm.hxx>
28#include <cntfrm.hxx>
29#include <doc.hxx>
30#include <frmtool.hxx>
31#include <swtable.hxx>
32#include <viewimp.hxx>
33#include <dview.hxx>
34#include <flyfrm.hxx>
35#include <node.hxx>
36#include <pam.hxx>
37#include <sectfrm.hxx>
38#include <fmtpdsc.hxx>
39#include <fmtsrnd.hxx>
40#include <fmtcntnt.hxx>
41#include <fmtfsize.hxx>
42#include <tabfrm.hxx>
43#include <flyfrms.hxx>
44#include <txtfrm.hxx>
45#include <mdiexp.hxx>
46#include <pagedesc.hxx>
47#include <fmtanchr.hxx>
49#include <ndtxt.hxx>
50#include <dflyobj.hxx>
51#include <dcontact.hxx>
52#include <UndoInsert.hxx>
53
54using namespace com::sun::star;
55
56namespace
57{
62osl::Mutex& GetPasteMutex()
63{
64 static osl::Mutex aMutex;
65 return aMutex;
66}
67}
68
70{
71 for(SwViewShell& rCurrentShell : GetRingContainer())
72 {
73 if( dynamic_cast<const SwCursorShell*>( &rCurrentShell) != nullptr )
74 {
75 static_cast<SwFEShell*>(&rCurrentShell)->EndAction();
76 static_cast<SwFEShell*>(&rCurrentShell)->CallChgLnk();
77 }
78 else
79 rCurrentShell.EndAction();
80 }
81}
82
83// Determine the Content's nearest to the point
84Point SwFEShell::GetContentPos( const Point& rPoint, bool bNext ) const
85{
86 CurrShell aCurr( const_cast<SwFEShell*>(this) );
87 return GetLayout()->GetNextPrevContentPos( rPoint, bNext );
88}
89
91 const uno::Reference < embed::XEmbeddedObject >& xObj ) const
92{
93 const SwFrame *pFrame = Imp()->HasDrawView()
94 ? ::GetFlyFromMarked( &Imp()->GetDrawView()->GetMarkedObjectList(),
95 const_cast<SwFEShell*>(this))
96 : nullptr;
97
98 if( !pFrame )
99 {
100 if( pPt )
101 {
102 SwPosition aPos( *GetCursor()->GetPoint() );
103 Point aPt( *pPt );
105 SwContentNode *pNd = aPos.GetNode().GetContentNode();
106 std::pair<Point, bool> const tmp(*pPt, true);
107 pFrame = pNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
108 }
109 else
110 {
111 const bool bOldCallbackActionEnabled = GetLayout()->IsCallbackActionEnabled();
112 if( bOldCallbackActionEnabled )
114 pFrame = GetCurrFrame();
115 if( bOldCallbackActionEnabled )
117 }
118 }
119
120 if( !pFrame )
121 return GetLayout()->getFrameArea();
122
123 bool bFrame = true;
124 switch ( eType )
125 {
126 case CurRectType::PagePrt: bFrame = false;
127 [[fallthrough]];
128 case CurRectType::Page : pFrame = pFrame->FindPageFrame();
129 break;
130
132 {
133 DisableCallbackAction a(const_cast<SwRootFrame&>(*pFrame->getRootFrame()));
134 pFrame->Calc(Imp()->GetShell()->GetOut());
135 pFrame = pFrame->FindPageFrame();
136 pFrame->Calc(Imp()->GetShell()->GetOut());
137 }
138 break;
139
141 bFrame = false;
142 [[fallthrough]];
144 {
145 const SwFrame *pFlyFrame = xObj.is() ? FindFlyFrame(xObj) : nullptr;
146 pFrame = pFlyFrame ? pFlyFrame
147 : pFrame->IsFlyFrame()
148 ? pFrame
149 : pFrame->FindFlyFrame();
150 break;
151 }
153 if( pFrame->IsInTab() )
154 pFrame = pFrame->FindTabFrame();
155 else {
156 OSL_FAIL( "Missing Table" );
157 }
158 [[fallthrough]];
161 if( pFrame->IsInSct() )
162 pFrame = pFrame->FindSctFrame();
163 else {
164 OSL_FAIL( "Missing section" );
165 }
166
168 bFrame = false;
169 break;
170
172 pFrame = pFrame->FindFooterOrHeader();
173 if( nullptr == pFrame )
174 return GetLayout()->getFrameArea();
175 break;
176
178 return GetLayout()->GetPagesArea();
179
180 default: break;
181 }
182 return bFrame ? pFrame->getFrameArea() : pFrame->getFramePrintArea();
183}
184
185sal_uInt16 SwFEShell::GetPageNumber( const Point &rPoint ) const
186{
187 const SwFrame *pPage = GetLayout()->Lower();
188 while ( pPage && !pPage->getFrameArea().Contains( rPoint ) )
189 pPage = pPage->GetNext();
190 if ( pPage )
191 return static_cast<const SwPageFrame*>(pPage)->GetPhyPageNum();
192 else
193 return 0;
194}
195
196bool SwFEShell::GetPageNumber( tools::Long nYPos, bool bAtCursorPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, OUString &rDisplay) const
197{
198 const SwFrame *pPage;
199
200 if ( bAtCursorPos ) // get page of Cursor
201 {
202 pPage = GetCurrFrame( false );
203 if ( pPage )
204 pPage = pPage->FindPageFrame();
205 }
206 else if ( nYPos > -1 ) // determine page via the position
207 {
208 pPage = GetLayout()->Lower();
209 while( pPage && (pPage->getFrameArea().Bottom() < nYPos ||
210 nYPos < pPage->getFrameArea().Top() ) )
211 pPage = pPage->GetNext();
212 }
213 else // first visible page
214 {
215 pPage = Imp()->GetFirstVisPage(GetOut());
216 if ( pPage && static_cast<const SwPageFrame*>(pPage)->IsEmptyPage() )
217 pPage = pPage->GetNext();
218 }
219
220 if( pPage )
221 {
222 rPhyNum = static_cast<const SwPageFrame*>(pPage)->GetPhyPageNum();
223 rVirtNum = static_cast<const SwPageFrame*>(pPage)->GetVirtPageNum();
224 const SvxNumberType& rNum = static_cast<const SwPageFrame*>(pPage)->GetPageDesc()->GetNumType();
225 rDisplay = rNum.GetNumStr( rVirtNum );
226 }
227
228 return nullptr != pPage;
229}
230
232{
233 SwFrame* pFrame = GetCurrFrame( false );
234 return pFrame && pFrame->GetUpper() && pFrame->GetUpper()->IsSctFrame();
235}
236
237FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) const
238{
240 const SwFrame *pFrame;
241 if ( pPt )
242 {
243 SwPosition aPos( *GetCursor()->GetPoint() );
244 Point aPt( *pPt );
246 SwContentNode *pNd = aPos.GetNode().GetContentNode();
247 std::pair<Point, bool> const tmp(*pPt, true);
248 pFrame = pNd->getLayoutFrame(GetLayout(), nullptr, &tmp);
249 }
250 else
251 pFrame = GetCurrFrame( false );
252 while ( pFrame )
253 {
254 switch ( pFrame->GetType() )
255 {
257 if( pFrame->GetUpper()->IsSctFrame() )
258 {
259 // Check, if isn't not only a single column
260 // from a section with footnotes at the end.
261 if( pFrame->GetNext() || pFrame->GetPrev() )
262 // Sectioncolumns
263 nReturn |= ( nReturn & FrameTypeFlags::TABLE ) ?
265 }
266 else // only pages and frame columns
267 nReturn |= FrameTypeFlags::COLUMN;
268 break;
270 nReturn |= FrameTypeFlags::PAGE;
271 if( static_cast<const SwPageFrame*>(pFrame)->IsFootnotePage() )
272 nReturn |= FrameTypeFlags::FTNPAGE;
273 break;
274 case SwFrameType::Header: nReturn |= FrameTypeFlags::HEADER; break;
275 case SwFrameType::Footer: nReturn |= FrameTypeFlags::FOOTER; break;
277 if( pFrame->GetUpper()->IsPageFrame() ) // not for ColumnFrames
278 nReturn |= FrameTypeFlags::BODY;
279 break;
280 case SwFrameType::Ftn: nReturn |= FrameTypeFlags::FOOTNOTE; break;
281 case SwFrameType::Fly:
282 if( static_cast<const SwFlyFrame*>(pFrame)->IsFlyLayFrame() )
283 nReturn |= FrameTypeFlags::FLY_FREE;
284 else if ( static_cast<const SwFlyFrame*>(pFrame)->IsFlyAtContentFrame() )
285 nReturn |= FrameTypeFlags::FLY_ATCNT;
286 else
287 {
288 OSL_ENSURE( static_cast<const SwFlyFrame*>(pFrame)->IsFlyInContentFrame(),
289 "New frametype?" );
290 nReturn |= FrameTypeFlags::FLY_INCNT;
291 }
292 nReturn |= FrameTypeFlags::FLY_ANY;
293 if( bStopAtFly )
294 return nReturn;
295 break;
296 case SwFrameType::Tab:
297 case SwFrameType::Row:
298 case SwFrameType::Cell: nReturn |= FrameTypeFlags::TABLE; break;
299 default: /* do nothing */ break;
300 }
301 if ( pFrame->IsFlyFrame() )
302 pFrame = static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame();
303 else
304 pFrame = pFrame->GetUpper();
305 }
306 return nReturn;
307}
308
310{
311 ::SetShell( this );
313
314 if ( HasDrawView() )
315 {
318 if ( Imp()->GetDrawView()->AreObjectsMarked() )
320 }
321}
322
324{
326
327 if ( HasDrawView() && Imp()->GetDrawView()->AreObjectsMarked() )
328 {
331 FrameNotify( this, FLY_DRAG_END );
332 }
333}
334
335sal_uInt16 SwFEShell::GetPhyPageNum() const
336{
337 SwFrame *pFrame = GetCurrFrame();
338 if ( pFrame )
339 return pFrame->GetPhyPageNum();
340 return 0;
341}
342
344{
345 SwFrame *pFrame = GetCurrFrame();
346 if ( pFrame )
347 return pFrame->GetVirtPageNum();
348 return 0;
349}
350
351static void lcl_SetAPageOffset( sal_uInt16 nOffset, SwPageFrame* pPage, SwFEShell* pThis )
352{
353 pThis->StartAllAction();
354 OSL_ENSURE( pPage->FindFirstBodyContent(),
355 "SwFEShell _SetAPageOffset() without ContentFrame" );
356
357 SwFormatPageDesc aDesc( pPage->GetPageDesc() );
358 aDesc.SetNumOffset( nOffset );
359
360 SwFrame *pFrame = pThis->GetCurrFrame( false );
361 if ( pFrame->IsInTab() )
362 pThis->GetDoc()->SetAttr( aDesc, *pFrame->FindTabFrame()->GetFormat() );
363 else
364 {
366 *pThis->GetCursor(), aDesc, SetAttrMode::DEFAULT, pThis->GetLayout());
367 }
368
369 pThis->EndAllAction();
370}
371
372void SwFEShell::SetNewPageOffset( sal_uInt16 nOffset )
373{
374 GetLayout()->SetVirtPageNum( true );
375 const SwPageFrame *pPage = GetCurrFrame( false )->FindPageFrame();
376 lcl_SetAPageOffset( nOffset, const_cast<SwPageFrame*>(pPage), this );
377}
378
379void SwFEShell::SetPageOffset( sal_uInt16 nOffset )
380{
381 const SwPageFrame *pPage = GetCurrFrame( false )->FindPageFrame();
382 const SwRootFrame* pDocLayout = GetLayout();
383 while ( pPage )
384 {
385 const SwFrame *pFlow = pPage->FindFirstBodyContent();
386 if ( pFlow )
387 {
388 if ( pFlow->IsInTab() )
389 pFlow = pFlow->FindTabFrame();
390 const SwFormatPageDesc& rPgDesc = pFlow->GetPageDescItem();
391 if ( rPgDesc.GetNumOffset() )
392 {
393 pDocLayout->SetVirtPageNum( true );
394 lcl_SetAPageOffset( nOffset, const_cast<SwPageFrame*>(pPage), this );
395 break;
396 }
397 }
398 pPage = static_cast<const SwPageFrame*>(pPage->GetPrev());
399 }
400}
401
402sal_uInt16 SwFEShell::GetPageOffset() const
403{
404 const SwPageFrame *pPage = GetCurrFrame()->FindPageFrame();
405 while ( pPage )
406 {
407 const SwFrame *pFlow = pPage->FindFirstBodyContent();
408 if ( pFlow )
409 {
410 if ( pFlow->IsInTab() )
411 pFlow = pFlow->FindTabFrame();
412 ::std::optional<sal_uInt16> oNumOffset = pFlow->GetPageDescItem().GetNumOffset();
413 if ( oNumOffset )
414 return *oNumOffset;
415 }
416 pPage = static_cast<const SwPageFrame*>(pPage->GetPrev());
417 }
418 return 0;
419}
420
421void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
422 const OUString& rNumberSeparator,
423 const bool bBefore, const sal_uInt16 nId,
424 const OUString& rCharacterStyle,
425 const bool bCpyBrd )
426{
427 // get node index of cursor position, SwDoc can do everything else itself
428 SwContentFrame *pCnt = SwLabelType::Draw==eType ? nullptr : GetCurrFrame( false );
429 if( SwLabelType::Draw!=eType && !pCnt )
430 return;
431
434 StartUndo(SwUndoId::INSERTLABEL, &aRewriter);
435
436 SwNodeOffset nIdx(0);
437 bool bInnerCntIsFly = false;
438 SwFlyFrameFormat* pFlyFormat = nullptr;
439 switch( eType )
440 {
442 case SwLabelType::Fly:
443 bInnerCntIsFly = pCnt->IsInFly();
444 if (bInnerCntIsFly)
445 {
446 // pass down index to the startnode for flys
447 nIdx = pCnt->FindFlyFrame()->
448 GetFormat()->GetContent().GetContentIdx()->GetIndex();
449 }
450 break;
452 if( pCnt->IsInTab() )
453 {
454 // pass down index to the TableNode for tables
455 const SwTable& rTable = *pCnt->FindTabFrame()->GetTable();
456 nIdx = rTable.GetTabSortBoxes()[ 0 ]
457 ->GetSttNd()->FindTableNode()->GetIndex();
458 }
459 break;
461 if( Imp()->GetDrawView() )
462 {
463 SwDrawView *pDView = Imp()->GetDrawView();
464 const SdrMarkList& rMrkList = pDView->GetMarkedObjectList();
465
466 // copy marked drawing objects to
467 // local list to perform the corresponding action for each object
468 std::vector<SdrObject*> aDrawObjs;
469 {
470 for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
471 {
472 SdrObject* pDrawObj = rMrkList.GetMark(i)->GetMarkedSdrObj();
473 if( pDrawObj )
474 aDrawObjs.push_back( pDrawObj );
475 }
476 }
477 // loop on marked drawing objects
478 while ( !aDrawObjs.empty() )
479 {
480 SdrObject* pDrawObj = aDrawObjs.back();
481 if ( dynamic_cast<const SwVirtFlyDrawObj*>( pDrawObj) == nullptr &&
482 dynamic_cast<const SwFlyDrawObj*>( pDrawObj) == nullptr )
483 {
484 SwFlyFrameFormat *pFormat =
485 GetDoc()->InsertDrawLabel( rText, rSeparator, rNumberSeparator, nId, rCharacterStyle, *pDrawObj );
486 if( !pFlyFormat )
487 pFlyFormat = pFormat;
488 }
489
490 aDrawObjs.pop_back();
491 }
492
493 }
494 break;
495 default:
496 OSL_ENSURE( false, "Cursor neither in table nor in fly." );
497 }
498
499 if( nIdx )
500 {
501 pFlyFormat = GetDoc()->InsertLabel(eType, rText, rSeparator,
502 rNumberSeparator, bBefore, nId,
503 nIdx, rCharacterStyle, bCpyBrd);
504 }
505
506 if (pFlyFormat)
507 {
508 const Point aPt(GetCursorDocPos());
509 if (SwFlyFrame* pFrame = pFlyFormat->GetFrame(&aPt))
510 SelectFlyFrame(*pFrame);
511 }
512 EndUndo();
514
515}
516
518{
519 if( !HasSelection() )
520 return false;
521
522 CurrShell aCurr( this );
523 bool bRet = false;
525 if(IsTableMode())
526 {
527 // Sort table
528 // check if Point/Mark of current Cursor are in one table
529 SwFrame *pFrame = GetCurrFrame( false );
530 OSL_ENSURE( pFrame->FindTabFrame(), "Cursor not in table." );
531
532 // search boxes via the layout
533 SwSelBoxes aBoxes;
534 GetTableSel(*this, aBoxes);
535
536 // The Cursor should be removed from the deletion area.
537 // Always put them behind/on the table; via the
538 // document position they will always be set to the old position
539 while( !pFrame->IsCellFrame() )
540 pFrame = pFrame->GetUpper();
541 {
542 /* ParkCursor->ParkCursorTab */
544 }
545
546 // call sorting on document
547 bRet = mxDoc->SortTable(aBoxes, rOpt);
548 }
549 else
550 {
551 // Sort text nothing else
552 for(SwPaM& rPaM : GetCursor()->GetRingContainer())
553 {
554 SwPaM* pPam = &rPaM;
555
556 auto [pStart, pEnd] = pPam->StartEnd(); // SwPosition*
557
558 SwNodeIndex aPrevIdx( pStart->GetNode(), -1 );
559 SwNodeOffset nOffset = pEnd->GetNodeIndex() - pStart->GetNodeIndex();
560 const sal_Int32 nCntStt = pStart->GetContentIndex();
561
562 // Sorting
563 bRet = mxDoc->SortText(*pPam, rOpt);
564
565 // put selection again
566 pPam->DeleteMark();
567 pPam->GetPoint()->Assign( aPrevIdx.GetNode(), SwNodeOffset(+1) );
568 SwContentNode* pCNd = pPam->GetPointContentNode();
569 sal_Int32 nLen = pCNd->Len();
570 if( nLen > nCntStt )
571 nLen = nCntStt;
572 pPam->GetPoint()->SetContent(nLen );
573 pPam->SetMark();
574
575 pPam->GetPoint()->Adjust(nOffset);
576 pCNd = pPam->GetPointContentNode();
577 pPam->GetPoint()->SetContent( pCNd->Len() );
578 }
579 }
580
581 EndAllAction();
582 return bRet;
583}
584
586{
587 SwFrame* pFrame = GetCurrFrame();
588 while (pFrame)
589 {
590 pFrame = pFrame->GetUpper();
591 if (pFrame && pFrame->IsColumnFrame())
592 {
593 return pFrame->IsRightToLeft();
594 }
595 }
596 return false;
597}
598
599sal_uInt16 SwFEShell::GetCurColNum_( const SwFrame *pFrame,
600 SwGetCurColNumPara* pPara )
601{
602 sal_uInt16 nRet = 0;
603 while ( pFrame )
604 {
605 pFrame = pFrame->GetUpper();
606 if( pFrame && pFrame->IsColumnFrame() )
607 {
608 const SwFrame *pCurFrame = pFrame;
609 do {
610 ++nRet;
611 pFrame = pFrame->GetPrev();
612 } while ( pFrame );
613
614 if( pPara )
615 {
616 // now search the format, determining the columness
617 pFrame = pCurFrame->GetUpper();
618 while( pFrame )
619 {
621 {
622 pPara->pFrameFormat = static_cast<const SwLayoutFrame*>(pFrame)->GetFormat();
623 pPara->pPrtRect = &pFrame->getFramePrintArea();
624 break;
625 }
626 pFrame = pFrame->GetUpper();
627 }
628 if( !pFrame )
629 {
630 pPara->pFrameFormat = nullptr;
631 pPara->pPrtRect = nullptr;
632 }
633 }
634 break;
635 }
636 }
637 return nRet;
638}
639
641{
642 OSL_ENSURE( GetCurrFrame(), "Cursor parked?" );
643 return GetCurColNum_( GetCurrFrame(), pPara );
644}
645
647{
648 sal_uInt16 nRet = 0;
649 SwFrame* pFrame = GetCurrFrame();
650 OSL_ENSURE( pFrame, "Cursor parked?" );
651 if( pFrame )
652 {
653 pFrame = pFrame->IsInTab() ? static_cast<SwFrame*>(pFrame->FindTabFrame())
654 : static_cast<SwFrame*>(pFrame->FindSctFrame());
655 OSL_ENSURE( pFrame, "No Tab, no Sect" );
656 if( pFrame )
657 nRet = GetCurColNum_( pFrame, nullptr );
658 }
659 return nRet;
660}
661
662SwFEShell::SwFEShell( SwDoc& rDoc, vcl::Window *pWindow, const SwViewOption *pOptions )
663 : SwEditShell( rDoc, pWindow, pOptions )
664 , m_bCheckForOLEInCaption(false)
665 , m_aPasteListeners(GetPasteMutex())
666 , m_eTableInsertMode(SwTable::SEARCH_NONE)
667 , m_bTableCopied(false)
668{
669}
670
672 : SwEditShell( rShell, pWindow )
673 , m_bCheckForOLEInCaption(false)
674 , m_aPasteListeners(GetPasteMutex())
675 , m_eTableInsertMode(SwTable::SEARCH_NONE)
676 , m_bTableCopied(false)
677{
678}
679
681{
682}
683
684// #i17567# - adjustments for allowing
685// negative vertical positions for fly frames anchored to paragraph/to character.
686// #i22305# - adjustments for option 'Follow text flow'
687// for to frame anchored objects.
688// #i22341# - adjustments for vertical alignment at top of line
689// for to character anchored objects.
691 const RndStdIds _nAnchorId,
692 const sal_Int16 _eHoriRelOrient,
693 const sal_Int16 _eVertRelOrient,
694 const SwFormatAnchor* _pToCharContentPos,
695 const bool _bFollowTextFlow,
696 bool _bMirror,
697 Point* _opRef,
698 Size* _opPercent,
699 const SwFormatFrameSize* pFormatFrameSize) const
700{
701 const SwFrame* pFrame;
702 const SwFlyFrame* pFly;
703 if( _opRef )
704 {
705 pFrame = GetCurrFrame();
706 pFly = pFrame->FindFlyFrame();
707 if( nullptr != pFly )
708 pFrame = pFly->GetAnchorFrame();
709 }
710 else
711 {
712 pFly = GetSelectedFlyFrame();
713 pFrame = pFly ? pFly->GetAnchorFrame() : GetCurrFrame();
714 }
715
716 bool bWrapThrough = false;
717 if ( pFly )
718 {
719 SwFlyFrameFormat* pFormat = const_cast<SwFlyFrameFormat*>(pFly->GetFormat());
720 const SwFormatSurround& rSurround = pFormat->GetSurround();
721 bWrapThrough = rSurround.GetSurround() == css::text::WrapTextMode_THROUGH;
722 }
723
724 const SwPageFrame* pPage = pFrame->FindPageFrame();
725 _bMirror = _bMirror && !pPage->OnRightPage();
726
727 Point aPos;
728 bool bVertic = false;
729 bool bRTL = false;
730 bool bVerticalL2R = false;
731
732 if ((RndStdIds::FLY_AT_PAGE == _nAnchorId) || (RndStdIds::FLY_AT_FLY == _nAnchorId)) // LAYER_IMPL
733 {
734 const SwFrame* pTmp = pFrame;
735 // #i22305#
736 if ((RndStdIds::FLY_AT_PAGE == _nAnchorId) ||
737 ((RndStdIds::FLY_AT_FLY == _nAnchorId) && !_bFollowTextFlow))
738 {
739 pFrame = pPage;
740 }
741 else
742 {
743 pFrame = pFrame->FindFlyFrame();
744 }
745 if ( !pFrame )
746 pFrame = pTmp;
747 _orRect = pFrame->getFrameArea();
748 SwRectFnSet aRectFnSet(pFrame);
749 bRTL = pFrame->IsRightToLeft();
750 if ( bRTL )
751 aPos = pFrame->getFrameArea().TopRight();
752 else
753 aPos = aRectFnSet.GetPos(pFrame->getFrameArea());
754
755 if( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() )
756 {
757 bVertic = aRectFnSet.IsVert();
758 bVerticalL2R = aRectFnSet.IsVertL2R();
759 _bMirror = false; // no mirroring in vertical environment
760 switch ( _eHoriRelOrient )
761 {
762 case text::RelOrientation::PAGE_RIGHT:
763 case text::RelOrientation::FRAME_RIGHT: aPos.AdjustY(pFrame->getFramePrintArea().Height() );
764 [[fallthrough]];
765 case text::RelOrientation::PRINT_AREA:
766 case text::RelOrientation::PAGE_PRINT_AREA: aPos.AdjustY(pFrame->getFramePrintArea().Top() ); break;
767 default: break;
768 }
769 }
770 else if ( _bMirror )
771 {
772 switch ( _eHoriRelOrient )
773 {
774 case text::RelOrientation::PRINT_AREA:
775 case text::RelOrientation::PAGE_PRINT_AREA: aPos.AdjustX(pFrame->getFramePrintArea().Width() );
776 [[fallthrough]];
777 case text::RelOrientation::PAGE_RIGHT:
778 case text::RelOrientation::FRAME_RIGHT: aPos.AdjustX(pFrame->getFramePrintArea().Left() ); break;
779 default: aPos.AdjustX(pFrame->getFrameArea().Width() );
780 }
781 }
782 else if ( bRTL )
783 {
784 switch ( _eHoriRelOrient )
785 {
786 case text::RelOrientation::PRINT_AREA:
787 case text::RelOrientation::PAGE_PRINT_AREA: aPos.AdjustX(pFrame->getFramePrintArea().Width() );
788 [[fallthrough]];
789 case text::RelOrientation::PAGE_LEFT:
790 case text::RelOrientation::FRAME_LEFT: aPos.AdjustX(pFrame->getFramePrintArea().Left() -
791 pFrame->getFrameArea().Width() ); break;
792 default: break;
793 }
794 }
795 else
796 {
797 switch ( _eHoriRelOrient )
798 {
799 case text::RelOrientation::PAGE_RIGHT:
800 case text::RelOrientation::FRAME_RIGHT: aPos.AdjustX(pFrame->getFramePrintArea().Width() );
801 [[fallthrough]];
802 case text::RelOrientation::PRINT_AREA:
803 case text::RelOrientation::PAGE_PRINT_AREA: aPos.AdjustX(pFrame->getFramePrintArea().Left() ); break;
804 default:break;
805 }
806 }
807
808 if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() )
809 {
810 switch ( _eVertRelOrient )
811 {
812 case text::RelOrientation::PRINT_AREA:
813 case text::RelOrientation::PAGE_PRINT_AREA:
814 {
815 aPos.AdjustX( -(pFrame->GetRightMargin()) );
816 }
817 break;
818 }
819 }
820 else if ( aRectFnSet.IsVertL2R() )
821 {
822 switch ( _eVertRelOrient )
823 {
824 case text::RelOrientation::PRINT_AREA:
825 case text::RelOrientation::PAGE_PRINT_AREA:
826 {
827 aPos.AdjustX(pFrame->GetLeftMargin() );
828 }
829 break;
830 }
831 }
832 else
833 {
834 switch ( _eVertRelOrient )
835 {
836 case text::RelOrientation::PRINT_AREA:
837 case text::RelOrientation::PAGE_PRINT_AREA:
838 {
839 if ( pFrame->IsPageFrame() )
840 {
841 aPos.setY(
842 static_cast<const SwPageFrame*>(pFrame)->PrtWithoutHeaderAndFooter().Top() );
843 }
844 else
845 {
846 aPos.AdjustY(pFrame->getFramePrintArea().Top() );
847 }
848 }
849 break;
850 }
851 }
852 if ( _opPercent )
853 *_opPercent = pFrame->getFramePrintArea().SSize();
854 }
855 else
856 {
857 const SwFrame* pUpper = ( pFrame->IsPageFrame() || pFrame->IsFlyFrame() ) ?
858 pFrame : pFrame->GetUpper();
859 SwRectFnSet aRectFnSet(pUpper);
860 if ( _opPercent )
861 {
862 // If the size is relative from page, then full size should be counted from the page frame.
863 if (pFormatFrameSize && pFormatFrameSize->GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME)
864 _opPercent->setWidth(pPage->getFrameArea().Width());
865 else
866 _opPercent->setWidth(pUpper->getFramePrintArea().Width());
867
868 if (pFormatFrameSize && pFormatFrameSize->GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME)
869 // If the size is relative from page, then full size should be counted from the page frame.
870 _opPercent->setHeight(pPage->getFrameArea().Height());
871 else
872 _opPercent->setHeight(pUpper->getFramePrintArea().Height());
873 }
874
875 bRTL = pFrame->IsRightToLeft();
876 if ( bRTL )
877 aPos = pFrame->getFrameArea().TopRight();
878 else
879 aPos = aRectFnSet.GetPos(pFrame->getFrameArea());
880 // #i17567# - allow negative positions
881 // for fly frames anchor to paragraph/to character.
882 if ((_nAnchorId == RndStdIds::FLY_AT_PARA) || (_nAnchorId == RndStdIds::FLY_AT_CHAR))
883 {
884 // The rectangle, the fly frame can be positioned in, is determined
885 // horizontally by the frame area of the horizontal environment
886 // and vertically by the printing area of the vertical environment,
887 // if the object follows the text flow, or by the frame area of the
888 // vertical environment, if the object doesn't follow the text flow.
889 // new class <SwEnvironmentOfAnchoredObject>
891 _bFollowTextFlow );
892 const SwLayoutFrame& rHoriEnvironLayFrame =
893 aEnvOfObj.GetHoriEnvironmentLayoutFrame( *pFrame );
894 const SwLayoutFrame& rVertEnvironLayFrame =
895 aEnvOfObj.GetVertEnvironmentLayoutFrame( *pFrame );
896 const SwRect& aHoriEnvironRect( rHoriEnvironLayFrame.getFrameArea() );
897 SwRect aVertEnvironRect;
898 if ( _bFollowTextFlow )
899 {
900 aVertEnvironRect = rVertEnvironLayFrame.getFramePrintArea();
901 aVertEnvironRect.Pos() += rVertEnvironLayFrame.getFrameArea().Pos();
902 // #i18732# - adjust vertical 'virtual' anchor position
903 // (<aPos.Y()> respectively <aPos.X()>), if object is vertical aligned
904 // to page areas.
905 if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
906 {
907 if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() )
908 {
909 aPos.setX( aVertEnvironRect.Right() );
910 }
911 else if ( aRectFnSet.IsVertL2R() )
912 {
913 aPos.setX( aVertEnvironRect.Left() );
914 }
915 else
916 {
917 aPos.setY( aVertEnvironRect.Top() );
918 }
919 }
920 }
921 else
922 {
923 OSL_ENSURE( rVertEnvironLayFrame.IsPageFrame(),
924 "<SwFEShell::CalcBoundRect(..)> - not following text flow, but vertical environment *not* page!" );
925 aVertEnvironRect = rVertEnvironLayFrame.getFrameArea();
926 // #i18732# - adjustment vertical 'virtual' anchor position
927 // (<aPos.Y()> respectively <aPos.X()>), if object is vertical aligned
928 // to page areas.
929 if (_eVertRelOrient == text::RelOrientation::PAGE_FRAME
930 || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA
931 || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
932 {
933 if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() )
934 {
935 aPos.setX( aVertEnvironRect.Right() );
936 if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
937 {
938 aPos.setX(aPos.getX() - rVertEnvironLayFrame.GetRightMargin());
939 }
940 }
941 else if ( aRectFnSet.IsVertL2R() )
942 {
943 aPos.setX( aVertEnvironRect.Left() );
944 if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
945 {
946 aPos.setX(aPos.getX() + rVertEnvironLayFrame.GetLeftMargin());
947 }
948 }
949 else
950 {
951 aPos.setY( aVertEnvironRect.Top() );
952 if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
953 {
954 aPos.setY(aPos.getY() + rVertEnvironLayFrame.GetTopMargin());
955 // add height of page header
956 const SwFrame* pTmpFrame = rVertEnvironLayFrame.Lower();
957 if ( pTmpFrame->IsHeaderFrame() )
958 {
959 aPos.setY(aPos.getY() + pTmpFrame->getFrameArea().Height());
960 }
961 }
962 else if (_eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)
963 {
964 if (rVertEnvironLayFrame.IsPageFrame())
965 {
966 auto& rPageFrame = static_cast<const SwPageFrame&>(rVertEnvironLayFrame);
967 aPos.setY(rPageFrame.PrtWithoutHeaderAndFooter().Bottom());
968 }
969 else
970 {
971 aPos.AdjustY(rVertEnvironLayFrame.getFramePrintArea().Bottom());
972 }
973 }
974 }
975 }
976 }
977
978 // #i22341# - adjust vertical 'virtual' anchor position
979 // (<aPos.Y()> respectively <aPos.X()>), if object is anchored to
980 // character and vertical aligned at character or top of line
981 // <pFrame>, which is the anchor frame or the proposed anchor frame,
982 // doesn't have to be a text frame (e.g. edit a to-page anchored
983 // fly frame). Thus, assure this.
984 const SwTextFrame* pTextFrame = pFrame->DynCastTextFrame();
985 if ( pTextFrame &&
986 (_nAnchorId == RndStdIds::FLY_AT_CHAR) &&
987 ( _eVertRelOrient == text::RelOrientation::CHAR ||
988 _eVertRelOrient == text::RelOrientation::TEXT_LINE ) )
989 {
990 SwTwips nTop = 0;
991 if ( _eVertRelOrient == text::RelOrientation::CHAR )
992 {
993 SwRect aChRect;
994 if ( _pToCharContentPos )
995 {
996 pTextFrame->GetAutoPos( aChRect, *_pToCharContentPos->GetContentAnchor() );
997 }
998 else
999 {
1000 // No content position provided. Thus, use a default one.
1001 SwPosition aDefaultContentPos(*(pTextFrame->GetTextNodeFirst()));
1002 pTextFrame->GetAutoPos( aChRect, aDefaultContentPos );
1003 }
1004 nTop = aRectFnSet.GetBottom(aChRect);
1005 }
1006 else
1007 {
1008 if ( _pToCharContentPos )
1009 {
1010 pTextFrame->GetTopOfLine( nTop, *_pToCharContentPos->GetContentAnchor() );
1011 }
1012 else
1013 {
1014 // No content position provided. Thus, use a default one.
1015 SwPosition aDefaultContentPos(*(pTextFrame->GetTextNodeFirst()));
1016 pTextFrame->GetTopOfLine( nTop, aDefaultContentPos );
1017 }
1018 }
1019 if ( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() )
1020 {
1021 aPos.setX(nTop);
1022 }
1023 else
1024 {
1025 aPos.setY(nTop);
1026 }
1027 }
1028
1029 // #i26945# - adjust horizontal 'virtual' anchor
1030 // position (<aPos.X()> respectively <aPos.Y()>), if object is
1031 // anchored to character and horizontal aligned at character.
1032 if ( pTextFrame &&
1033 (_nAnchorId == RndStdIds::FLY_AT_CHAR) &&
1034 _eHoriRelOrient == text::RelOrientation::CHAR )
1035 {
1036 SwTwips nLeft = 0;
1037 SwRect aChRect;
1038 if ( _pToCharContentPos )
1039 {
1040 pTextFrame->GetAutoPos( aChRect, *_pToCharContentPos->GetContentAnchor() );
1041 }
1042 else
1043 {
1044 // No content position provided. Thus, use a default one.
1045 SwPosition aDefaultContentPos(*(pTextFrame->GetTextNodeFirst()));
1046 pTextFrame->GetAutoPos( aChRect, aDefaultContentPos );
1047 }
1048 nLeft = aRectFnSet.GetLeft(aChRect);
1049 if ( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() )
1050 {
1051 aPos.setY(nLeft);
1052 }
1053 else
1054 {
1055 aPos.setX(nLeft);
1056 }
1057 }
1058 if ( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() )
1059 {
1060 _orRect = SwRect( aVertEnvironRect.Left(),
1061 aHoriEnvironRect.Top(),
1062 aVertEnvironRect.Width(),
1063 aHoriEnvironRect.Height() );
1064 }
1065 else
1066 {
1067 _orRect = SwRect( aHoriEnvironRect.Left(),
1068 aVertEnvironRect.Top(),
1069 aHoriEnvironRect.Width(),
1070 aVertEnvironRect.Height() );
1071 }
1072 }
1073 else
1074 {
1075 if( _opRef && pFly && pFly->IsFlyInContentFrame() )
1076 *_opRef = static_cast<const SwFlyInContentFrame*>( pFly )->GetRefPoint();
1077
1078 _orRect = pUpper->getFrameArea();
1079 if( !pUpper->IsBodyFrame() )
1080 {
1081 _orRect += pUpper->getFramePrintArea().Pos();
1082 _orRect.SSize( pUpper->getFramePrintArea().SSize() );
1083 if ( pUpper->IsCellFrame() )//MA_FLY_HEIGHT
1084 {
1085 const SwFrame* pTab = pUpper->FindTabFrame();
1086 tools::Long nBottom = aRectFnSet.GetPrtBottom(*pTab->GetUpper());
1087 aRectFnSet.SetBottom( _orRect, nBottom );
1088 }
1089 }
1090 // only use 90% of height for character bound
1091 {
1092 if( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() )
1093 _orRect.Width( (_orRect.Width()*9)/10 );
1094 else
1095 _orRect.Height( (_orRect.Height()*9)/10 );
1096 }
1097 }
1098
1099 const SwTwips nBaseOfstForFly = ( pFrame->IsTextFrame() && pFly ) ?
1100 static_cast<const SwTextFrame*>(pFrame)->GetBaseOffsetForFly( !bWrapThrough ) :
1101 0;
1102 if( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() )
1103 {
1104 bVertic = aRectFnSet.IsVert();
1105 bVerticalL2R = aRectFnSet.IsVertL2R();
1106 _bMirror = false;
1107
1108 switch ( _eHoriRelOrient )
1109 {
1110 case text::RelOrientation::FRAME_RIGHT:
1111 {
1112 aPos.setY(aPos.getY() + pFrame->getFramePrintArea().Height());
1113 aPos += aRectFnSet.GetPos(pFrame->getFramePrintArea());
1114 break;
1115 }
1116 case text::RelOrientation::PRINT_AREA:
1117 {
1118 aPos += aRectFnSet.GetPos(pFrame->getFramePrintArea());
1119 aPos.setY(aPos.getY() + nBaseOfstForFly);
1120 break;
1121 }
1122 case text::RelOrientation::PAGE_RIGHT:
1123 {
1124 aPos.setY(pPage->getFrameArea().Top() + pPage->getFramePrintArea().Bottom());
1125 break;
1126 }
1127 case text::RelOrientation::PAGE_PRINT_AREA:
1128 {
1129 aPos.setY(pPage->getFrameArea().Top() + pPage->getFramePrintArea().Top());
1130 break;
1131 }
1132 case text::RelOrientation::PAGE_LEFT:
1133 case text::RelOrientation::PAGE_FRAME:
1134 {
1135 aPos.setY(pPage->getFrameArea().Top());
1136 break;
1137 }
1138 case text::RelOrientation::FRAME:
1139 {
1140 aPos.setY(aPos.getY() + nBaseOfstForFly);
1141 break;
1142 }
1143 default: break;
1144 }
1145 }
1146 else if( _bMirror )
1147 {
1148 switch ( _eHoriRelOrient )
1149 {
1150 case text::RelOrientation::FRAME_RIGHT: aPos.setX(aPos.getX() + pFrame->getFramePrintArea().Left()); break;
1151 case text::RelOrientation::FRAME:
1152 case text::RelOrientation::FRAME_LEFT: aPos.setX(aPos.getX() + pFrame->getFrameArea().Width()); break;
1153 case text::RelOrientation::PRINT_AREA: aPos.setX(aPos.getX() + pFrame->getFramePrintArea().Right()); break;
1154 case text::RelOrientation::PAGE_LEFT:
1155 case text::RelOrientation::PAGE_FRAME: aPos.setX(pPage->getFrameArea().Right()); break;
1156 case text::RelOrientation::PAGE_PRINT_AREA: aPos.setX(pPage->getFrameArea().Left()
1157 + pPage->getFramePrintArea().Left()); break;
1158 default: break;
1159 }
1160 }
1161 else if ( bRTL )
1162 {
1163 switch ( _eHoriRelOrient )
1164 {
1165 case text::RelOrientation::FRAME_LEFT:
1166 aPos.setX(pFrame->getFrameArea().Left() +
1167 pFrame->getFramePrintArea().Left());
1168 break;
1169
1170 case text::RelOrientation::PRINT_AREA:
1171 aPos.setX(pFrame->getFrameArea().Left() + pFrame->getFramePrintArea().Left() +
1172 pFrame->getFramePrintArea().Width());
1173 aPos.setX(aPos.getX() + nBaseOfstForFly);
1174 break;
1175
1176 case text::RelOrientation::PAGE_LEFT:
1177 aPos.setX(pPage->getFrameArea().Left() + pPage->getFramePrintArea().Left());
1178 break;
1179
1180 case text::RelOrientation::PAGE_PRINT_AREA:
1181 aPos.setX(pPage->getFrameArea().Left() + pPage->getFramePrintArea().Left() +
1182 pPage->getFramePrintArea().Width());
1183 break;
1184
1185 case text::RelOrientation::PAGE_RIGHT:
1186 case text::RelOrientation::PAGE_FRAME:
1187 aPos.setX(pPage->getFrameArea().Right());
1188 break;
1189
1190 case text::RelOrientation::FRAME:
1191 aPos.setX(aPos.getX() + nBaseOfstForFly);
1192 break;
1193 default: break;
1194 }
1195 }
1196 else
1197 {
1198 switch ( _eHoriRelOrient )
1199 {
1200 case text::RelOrientation::FRAME_RIGHT:
1201 aPos.AdjustX(pFrame->getFramePrintArea().Width() );
1202 aPos += pFrame->getFramePrintArea().Pos();
1203 break;
1204 case text::RelOrientation::PRINT_AREA:
1205 aPos += pFrame->getFramePrintArea().Pos();
1206 aPos.setX(aPos.getX() + nBaseOfstForFly);
1207 break;
1208 case text::RelOrientation::PAGE_RIGHT:
1209 aPos.setX(pPage->getFrameArea().Left() + pPage->getFramePrintArea().Right());
1210 break;
1211 case text::RelOrientation::PAGE_PRINT_AREA:
1212 aPos.setX(pPage->getFrameArea().Left() + pPage->getFramePrintArea().Left());
1213 break;
1214 case text::RelOrientation::PAGE_LEFT:
1215 case text::RelOrientation::PAGE_FRAME:
1216 aPos.setX(pPage->getFrameArea().Left());
1217 break;
1218 case text::RelOrientation::FRAME:
1219 aPos.setX(aPos.getX() + nBaseOfstForFly);
1220 break;
1221 default: break;
1222 }
1223 }
1224
1225 }
1226 if( _opRef )
1227 return;
1228
1229 if( bVertic && !bVerticalL2R )
1230 _orRect.Pos( aPos.getX() - _orRect.Width() - _orRect.Left(), _orRect.Top() - aPos.getY() );
1231 else if( bVerticalL2R )
1232 _orRect.Pos( _orRect.Left() - aPos.getX(), _orRect.Top() - aPos.getY() );
1233 else if ( bRTL )
1234 _orRect.Pos( - ( _orRect.Right() - aPos.getX() ), _orRect.Top() - aPos.getY() );
1235 else
1236 _orRect.Pos( _orRect.Left() - aPos.getX(), _orRect.Top() - aPos.getY() );
1237 if( _bMirror )
1238 _orRect.Pos( -_orRect.Right(), _orRect.Top() );
1239}
1240
1242{
1243 Size aRet;
1245 if ( pFly )
1246 {
1247 // #i32951# - due to issue #i28701# no format of a
1248 // newly inserted Writer fly frame or its anchor frame is performed
1249 // any more. Thus, it could be possible (e.g. on insert of a horizontal
1250 // line) that the anchor frame isn't formatted and its printing area
1251 // size is (0,0). If this is the case the printing area of the upper
1252 // of the anchor frame is taken.
1253 const SwFrame* pAnchorFrame = pFly->GetAnchorFrame();
1254 aRet = pAnchorFrame->getFramePrintArea().SSize();
1255 if ( aRet.IsEmpty() && pAnchorFrame->GetUpper() )
1256 {
1257 aRet = pAnchorFrame->GetUpper()->getFramePrintArea().SSize();
1258 }
1259
1260 SwRect aBound;
1261 CalcBoundRect( aBound, pFly->GetFormat()->GetAnchor().GetAnchorId());
1262 if ( pFly->GetAnchorFrame()->IsVertical() )
1263 aRet.setWidth( aBound.Width() );
1264 else
1265 aRet.setHeight( aBound.Height() );
1266 }
1267 return aRet;
1268}
1269
1270bool SwFEShell::IsFrameVertical(const bool bEnvironment, bool& bRTL, bool& bVertL2R) const
1271{
1272 bool bVert = false;
1273 bRTL = false;
1274 bVertL2R = false;
1275
1276 if ( Imp()->HasDrawView() )
1277 {
1278 const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
1279 if( rMrkList.GetMarkCount() != 1 )
1280 return bVert;
1281
1282 SdrObject* pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
1283 if ( !pObj )
1284 {
1285 OSL_FAIL( "<SwFEShell::IsFrameVertical(..)> - missing SdrObject instance in marked object list -> This is a serious situation" );
1286 return bVert;
1287 }
1288 // #i26791#
1289 SwContact* pContact = GetUserCall( pObj );
1290 if ( !pContact )
1291 {
1292 OSL_FAIL( "<SwFEShell::IsFrameVertical(..)> - missing SwContact instance at marked object -> This is a serious situation" );
1293 return bVert;
1294 }
1295 const SwFrame* pRef = pContact->GetAnchoredObj( pObj )->GetAnchorFrame();
1296 if ( !pRef )
1297 {
1298 OSL_FAIL( "<SwFEShell::IsFrameVertical(..)> - missing anchor frame at marked object -> This is a serious situation" );
1299 return bVert;
1300 }
1301
1302 if ( !bEnvironment )
1303 if ( auto pVirtFly = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) )
1304 pRef = pVirtFly->GetFlyFrame();
1305
1306 bVert = pRef->IsVertical();
1307 bRTL = pRef->IsRightToLeft();
1308 bVertL2R = pRef->IsVertLR();
1309 }
1310
1311 return bVert;
1312}
1313
1315{
1316 // does not do anything, only avoids crash if the method is used for wrong shell
1317}
1318
1320{
1321 // Clear objects selection
1322 if ( Imp()->GetDrawView()->AreObjectsMarked() )
1323 {
1324 Imp()->GetDrawView()->UnmarkAll();
1325 ClearMark();
1326 }
1327
1329}
1330
1331/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
helper class to disable creation of an action by a callback event in particular, change event from a ...
Definition: rootfrm.hxx:465
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long getX() const
constexpr tools::Long getY() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
void showMarkHandles()
void hideMarkHandles()
SdrObject * GetMarkedSdrObj() const
void UnmarkAll()
bool IsEmpty() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
OUString GetNumStr(sal_Int32 nNo) const
const SwFrame * GetAnchorFrame() const
Base class for the following contact objects (frame + draw objects).
Definition: dcontact.hxx:67
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const =0
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
virtual sal_Int32 Len() const
Definition: node.cxx:1256
void ShellGetFocus()
Definition: crsrsh.cxx:2758
Point & GetCursorDocPos() const
Definition: crsrsh.hxx:925
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2838
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
void ShellLoseFocus()
Definition: crsrsh.cxx:2751
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
Definition: crsrsh.cxx:2771
void ClearMark()
Definition: crsrsh.cxx:1225
void CallChgLnk()
Definition: crsrsh.cxx:2847
bool IsTableMode() const
Definition: crsrsh.hxx:668
Definition: doc.hxx:197
SwFlyFrameFormat * InsertDrawLabel(const OUString &rText, const OUString &rSeparator, const OUString &rNumberSeparator, const sal_uInt16 nId, const OUString &rCharacterStyle, SdrObject &rObj)
Definition: doclay.cxx:1244
SwFlyFrameFormat * InsertLabel(const SwLabelType eType, const OUString &rText, const OUString &rSeparator, const OUString &rNumberingSeparator, const bool bBefore, const sal_uInt16 nId, const SwNodeOffset nIdx, const OUString &rCharacterStyle, const bool bCpyBrd)
Definition: doclay.cxx:972
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
Definition: docfmt.cxx:458
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
void EndAllAction()
Definition: edws.cxx:97
void SetNewPageOffset(sal_uInt16 nOffset)
Definition: fews.cxx:372
SwFlyFrame * GetSelectedFlyFrame() const
Definition: fefly1.cxx:277
sal_uInt16 GetCurColNum(SwGetCurColNumPara *pPara=nullptr) const
The ruler needs some information too.
Definition: fews.cxx:640
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void ShellGetFocus()
Definition: fews.cxx:309
bool IsColRightToLeft() const
Definition: fews.cxx:585
virtual void MoveObjectIfActive(svt::EmbeddedObjectRef &xObj, const Point &rOffset)
The layout has been changed, so the active object has to be moved after that.
Definition: fews.cxx:1314
virtual ~SwFEShell() override
Definition: fews.cxx:680
SwFEShell(SwDoc &rDoc, vcl::Window *pWin, const SwViewOption *pOpt)
Definition: fews.cxx:662
bool IsFrameVertical(const bool bEnvironment, bool &bRightToLeft, bool &bVertL2R) const
Determines whether a frame or its environment is vertically formatted and right-to-left.
Definition: fews.cxx:1270
SAL_DLLPRIVATE void EndAllActionAndCall()
Terminate actions for all shells and call ChangeLink.
Definition: fews.cxx:69
void ToggleHeaderFooterEdit()
Definition: fews.cxx:1319
static SAL_DLLPRIVATE sal_uInt16 GetCurColNum_(const SwFrame *pFrame, SwGetCurColNumPara *pPara)
Definition: fews.cxx:599
void ShellLoseFocus()
Hide or show layout-selection and pass call to CursorSh.
Definition: fews.cxx:323
void InsertLabel(const SwLabelType eType, const OUString &rText, const OUString &rSeparator, const OUString &rNumberSeparator, const bool bBefore, const sal_uInt16 nId, const OUString &rCharacterStyle, const bool bCpyBrd)
Definition: fews.cxx:421
void SetPageOffset(sal_uInt16 nOffset)
Changes last page offset.
Definition: fews.cxx:379
sal_uInt16 GetPhyPageNum() const
Phy: real page count.
Definition: fews.cxx:335
sal_uInt16 GetVirtPageNum() const
Definition: fews.cxx:343
Size GetGraphicDefaultSize() const
Definition: fews.cxx:1241
sal_uInt16 GetCurOutColNum() const
Current outer column.
Definition: fews.cxx:646
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:90
void ParkCursorInTab()
Definition: fetab.cxx:93
SAL_DLLPRIVATE SwFlyFrame * FindFlyFrame(const css::uno::Reference< css::embed::XEmbeddedObject > &) const
Definition: feflyole.cxx:38
void CalcBoundRect(SwRect &_orRect, const RndStdIds _nAnchorId, const sal_Int16 _eHoriRelOrient=css::text::RelOrientation::FRAME, const sal_Int16 _eVertRelOrient=css::text::RelOrientation::FRAME, const SwFormatAnchor *_pToCharContentPos=nullptr, const bool _bFollowTextFlow=false, bool _bMirror=false, Point *_opRef=nullptr, Size *_opPercent=nullptr, const SwFormatFrameSize *pFormatFrameSize=nullptr) const
i#17567 - adjustments to allow negative vertical positions for fly frames anchored to paragraph or to...
Definition: fews.cxx:690
Point GetContentPos(const Point &rPoint, bool bNext) const
Provide information about content situated closes to given Point.
Definition: fews.cxx:84
sal_uInt16 GetPageOffset() const
Definition: fews.cxx:402
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
sal_uInt16 GetPageNumber(const Point &rPoint) const
Page number of the page containing Point, O if no page.
Definition: fews.cxx:185
bool IsDirectlyInSection() const
Definition: fews.cxx:231
bool Sort(const SwSortOptions &)
Definition: fews.cxx:517
void SelectFlyFrame(SwFlyFrame &rFrame)
Definition: fefly1.cxx:238
SwFlyFrame * GetFrame(const Point *pDocPos=nullptr) const
Definition: atrfrm.cxx:3140
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:3119
bool IsFlyAtContentFrame() const
Definition: flyfrm.hxx:220
bool IsFlyInContentFrame() const
Definition: flyfrm.hxx:217
bool IsFlyLayFrame() const
Definition: flyfrm.hxx:219
Flys that are anchored as a character in the content.
Definition: flyfrms.hxx:210
FlyAnchors.
Definition: fmtanchr.hxx:37
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
sal_Int16 GetWidthPercentRelation() const
Definition: fmtfsize.hxx:92
sal_Int16 GetHeightPercentRelation() const
Definition: fmtfsize.hxx:89
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:65
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Definition: fmtpdsc.hxx:64
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
const SwRect & getFrameArea() const
Definition: frame.hxx:179
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool OnRightPage() const
Definition: frame.hxx:739
bool IsCellFrame() const
Definition: frame.hxx:1232
bool IsTextFrame() const
Definition: frame.hxx:1240
tools::Long GetLeftMargin() const
Definition: ssfrm.cxx:48
SwTextFrame * DynCastTextFrame()
Definition: findfrm.cxx:1927
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1817
tools::Long GetRightMargin() const
Definition: ssfrm.cxx:50
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1117
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1121
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1105
SwFrame * GetNext()
Definition: frame.hxx:682
bool IsPageFrame() const
Definition: frame.hxx:1184
bool IsColumnFrame() const
Definition: frame.hxx:1188
SwFrameType GetType() const
Definition: frame.hxx:521
bool IsHeaderFrame() const
Definition: frame.hxx:1196
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1799
bool IsInTab() const
Definition: frame.hxx:961
bool IsRightToLeft() const
Definition: frame.hxx:993
bool IsInFly() const
Definition: frame.hxx:967
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
bool IsVertical() const
Definition: frame.hxx:979
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
bool IsFlyFrame() const
Definition: frame.hxx:1216
SwFrame * GetPrev()
Definition: frame.hxx:683
bool IsSctFrame() const
Definition: frame.hxx:1220
bool IsVertLR() const
Definition: frame.hxx:985
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:633
virtual const SwFormatPageDesc & GetPageDescItem() const
Definition: findfrm.cxx:747
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1706
tools::Long GetTopMargin() const
Definition: ssfrm.cxx:44
bool IsBodyFrame() const
Definition: frame.hxx:1212
bool IsInSct() const
Definition: frame.hxx:973
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:401
const SwFrame * Lower() const
Definition: layfrm.hxx:101
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwContentNode * GetContentNode()
Definition: node.hxx:666
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:269
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:279
void DeleteMark()
Definition: pam.hxx:232
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:202
A page of the document layout.
Definition: pagefrm.hxx:60
SwContentFrame * FindFirstBodyContent()
Definition: pagefrm.hxx:359
bool IsFootnotePage() const
Foot note interface.
Definition: pagefrm.hxx:204
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:147
bool IsVert() const
Definition: frame.hxx:1372
void SetBottom(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1392
bool IsVertL2R() const
Definition: frame.hxx:1373
Point GetPos(const SwRect &rRect) const
Definition: frame.hxx:1388
tools::Long GetLeft(const SwRect &rRect) const
Definition: frame.hxx:1384
tools::Long GetBottom(const SwRect &rRect) const
Definition: frame.hxx:1383
tools::Long GetPrtBottom(const SwFrame &rFrame) const
Definition: frame.hxx:1415
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void SSize(const Size &rNew)
Definition: swrect.hxx:180
bool Contains(const Point &rPOINT) const
Definition: swrect.hxx:356
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
Point TopRight() const
Definition: swrect.hxx:258
void Width(tools::Long nNew)
Definition: swrect.hxx:189
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
void SetVirtPageNum(const bool bOf) const
Definition: rootfrm.hxx:457
Point GetNextPrevContentPos(const Point &rPoint, bool bNext) const
Search the nearest Content to the passed point.
Definition: trvlfrm.cxx:1486
const SwRect & GetPagesArea() const
Definition: rootfrm.hxx:422
bool IsCallbackActionEnabled() const
Definition: rootfrm.hxx:400
void SetCallbackActionEnabled(bool b)
Definition: rootfrm.hxx:399
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
Definition: trvlfrm.cxx:425
const SwTable * GetTable() const
Definition: tabfrm.hxx:162
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:267
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
SwTwips GetBaseOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
Definition: txtfrm.hxx:776
bool GetAutoPos(SwRect &, const SwPosition &) const
A slimmer version of GetCharRect for autopositioning Frames.
Definition: frmcrsr.cxx:366
bool GetTopOfLine(SwTwips &_onTopOfLine, const SwPosition &_rPos) const
Determine top of line for given position in the text frame.
Definition: frmcrsr.cxx:453
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:472
static SwRewriter CreateRewriter(const OUString &rStr)
Definition: unins.cxx:993
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
Definition: viewimp.cxx:315
bool HasDrawView() const
New Interface for StarView Drawing.
Definition: viewimp.hxx:163
SwDrawView * GetDrawView()
Definition: viewimp.hxx:164
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:365
bool HasDrawView() const
Definition: vnew.cxx:371
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:199
SwViewShellImp * Imp()
Definition: viewsh.hxx:211
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
void ToggleHeaderFooterEdit()
Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags.
Definition: viewsh.cxx:112
SdrView * GetDrawView()
Definition: vnew.cxx:386
const SwLayoutFrame & GetHoriEnvironmentLayoutFrame(const SwFrame &_rHoriOrientFrame) const
determine environment layout frame for possible horizontal object positions respectively for alignmen...
const SwLayoutFrame & GetVertEnvironmentLayoutFrame(const SwFrame &_rVertOrientFrame) const
determine environment layout frame for possible vertical object positions respectively for alignments...
ring_container GetRingContainer()
Definition: ring.hxx:240
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:172
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
void FrameNotify(SwViewShell *pVwSh, FlyMode eMode)
Definition: edtwin3.cxx:78
CurRectType
Definition: fesh.hxx:137
@ FlyEmbeddedPrt
Rect of PrtArea of FlyFrame.
@ Page
Rect of current page.
@ SectionPrt
Rect of current PrtArea of section.
@ PageCalc
... page will be formatted if required.
@ FlyEmbedded
Rect of current FlyFrame.
@ HeaderFooter
Rect of current header/footer.
@ PagesArea
Rect covering the pages area.
@ PagePrt
Rect of current PrtArea of page.
@ Section
Rect of current section.
@ SectionOutsideTable
Rect of current section but outside of table.
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
SwFlyFrame * GetFlyFromMarked(const SdrMarkList *pLst, SwViewShell *pSh)
Definition: feshview.cxx:109
static void lcl_SetAPageOffset(sal_uInt16 nOffset, SwPageFrame *pPage, SwFEShell *pThis)
Definition: fews.cxx:351
DocumentType eType
uno_Any a
@ FLY_DRAG_START
Definition: mdiexp.hxx:40
@ FLY_DRAG_END
Definition: mdiexp.hxx:40
Shell * GetShell()
int i
long Long
std::mutex aMutex
void SetShell(SwViewShell *pSh)
Definition: newfrm.cxx:353
sal_Int16 nId
const SwRect * pPrtRect
Definition: fesh.hxx:154
const SwFrameFormat * pFrameFormat
Definition: fesh.hxx:153
Marks a position in the document model.
Definition: pam.hxx:38
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
Definition: pam.cxx:257
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:267
RndStdIds
tools::Long SwTwips
Definition: swtypes.hxx:51
SwLabelType
Definition: swtypes.hxx:85
void GetTableSel(const SwCursorShell &rShell, SwSelBoxes &rBoxes, const SwTableSearchType eSearchType)
Definition: tblsel.cxx:149