1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_FESH_HXX
20 #define INCLUDED_SW_INC_FESH_HXX
22 #include <com/sun/star/text/RelOrientation.hpp>
23 #include <com/sun/star/text/XPasteListener.hpp>
25 #include <svx/svdobj.hxx>
28 #include "flyenum.hxx"
30 #include <svx/svdtypes.hxx>
31 #include <sot/formats.hxx>
32 #include <rtl/ustring.hxx>
33 #include <o3tl/typed_flags_set.hxx>
34 #include <comphelper/interfacecontainer3.hxx>
39 namespace editeng
{ class SvxBorderLine
; }
44 class SvxFrameDirectionItem
;
45 class SwTableAutoFormat
;
47 class SwFormatFrameSize
;
48 class SwFormatRowSplit
;
57 class ISdrObjectFilter
;
59 namespace com::sun::star::embed
{ class XEmbeddedObject
; }
61 // return values for GetFrameType() and GetSelFrameType().
62 //! values can be combined via logical or
63 enum class FrameTypeFlags
{
83 template<> struct typed_flags
<FrameTypeFlags
> : is_typed_flags
<FrameTypeFlags
, 0x7fff> {};
86 //! values can be combined via logical or
87 enum class GotoObjFlags
92 DrawAny
= DrawControl
| DrawSimple
,
96 FlyAny
= FlyOLE
| FlyGrf
| FlyFrame
,
97 Any
= FlyAny
| DrawAny
,
101 template<> struct typed_flags
<GotoObjFlags
> : is_typed_flags
<GotoObjFlags
, 31> {};
104 //! values can be combined via logical or
105 enum class FlyProtectFlags
111 Parent
= 8, ///< Check only parents.
112 Fixed
= 16, /**< Only protection that cannot be withdrawn
113 e.g. by OLE-server; also relevant for dialog. */
117 template<> struct typed_flags
<FlyProtectFlags
> : is_typed_flags
<FlyProtectFlags
, 31> {};
120 // For figuring out contents by position (D&D)
132 OBJCNT_DONTCARE
///< Not determinable - different objects are selected.
136 enum class CurRectType
138 Page
, ///< Rect of current page.
139 PageCalc
, ///< ... page will be formatted if required.
140 PagePrt
, ///< Rect of current PrtArea of page.
141 Frame
, ///< Rect of current frame.
142 FlyEmbedded
, ///< Rect of current FlyFrame.
143 FlyEmbeddedPrt
, ///< Rect of PrtArea of FlyFrame
144 Section
, ///< Rect of current section.
145 SectionOutsideTable
, ///< Rect of current section but outside of table.
146 SectionPrt
, ///< Rect of current PrtArea of section.
147 HeaderFooter
, ///< Rect of current header/footer
148 PagesArea
///< Rect covering the pages area
151 struct SwGetCurColNumPara
153 const SwFrameFormat
* pFrameFormat
;
154 const SwRect
* pPrtRect
;
155 SwGetCurColNumPara() : pFrameFormat( nullptr ), pPrtRect( nullptr ) {}
158 enum class SwPasteSdr
166 #define SW_ADD_SELECT 1
167 #define SW_ENTER_GROUP 2
168 #define SW_LEAVE_FRAME 4
169 /// Allow SwFEShell::SelectObj() to select the TextBox of a shape.
170 #define SW_ALLOW_TEXTBOX 8
180 // return values for WhichMouseTabCol
198 class SdrDropMarkerOverlay
;
201 class SW_DLLPUBLIC SwFEShell
: public SwEditShell
204 mutable std::unique_ptr
<SwColCache
> m_pColumnCache
;
205 mutable std::unique_ptr
<SwColCache
> m_pRowCache
;
206 std::unique_ptr
<SdrDropMarkerOverlay
> m_pChainTo
;
207 std::unique_ptr
<SdrDropMarkerOverlay
> m_pChainFrom
;
208 bool m_bCheckForOLEInCaption
;
209 comphelper::OInterfaceContainerHelper3
<css::text::XPasteListener
> m_aPasteListeners
;
210 /// insert table rows or columns instead of overwriting the existing table cells
211 SwTable::SearchType m_eTableInsertMode
;
212 /// table copied to the clipboard by the last private copy
215 SAL_DLLPRIVATE SwFlyFrame
*FindFlyFrame( const css::uno::Reference
< css::embed::XEmbeddedObject
>& ) const;
217 /// Terminate actions for all shells and call ChangeLink.
218 SAL_DLLPRIVATE
void EndAllActionAndCall();
220 SAL_DLLPRIVATE
void ScrollTo( const Point
&rPt
);
222 SAL_DLLPRIVATE
void ChangeOpaque( SdrLayerID nLayerId
);
224 /** Used for mouse operations on a table:
225 @return a cell frame that is 'close' to rPt. */
226 SAL_DLLPRIVATE
const SwFrame
*GetBox( const Point
&rPt
, bool* pbRow
= nullptr, bool* pbCol
= nullptr ) const;
228 // 0 == not in any column.
229 SAL_DLLPRIVATE
static sal_uInt16
GetCurColNum_( const SwFrame
*pFrame
,
230 SwGetCurColNumPara
* pPara
);
232 SAL_DLLPRIVATE
void GetTabCols_(SwTabCols
&rToFill
, const SwFrame
*pBox
) const;
233 SAL_DLLPRIVATE
void GetTabRows_(SwTabCols
&rToFill
, const SwFrame
*pBox
) const;
235 SAL_DLLPRIVATE
bool ImpEndCreate();
237 /// Methods for copying of draw objects.
238 SAL_DLLPRIVATE
bool CopyDrawSel( SwFEShell
& rDestShell
, const Point
& rSttPt
,
239 const Point
& rInsPt
, bool bIsMove
,
240 bool bSelectInsert
);
242 /// Get list of marked SdrObjects;
243 /// helper method for GetSelFrameType, IsSelContainsControl.
244 SAL_DLLPRIVATE
const SdrMarkList
* GetMarkList_() const;
246 SAL_DLLPRIVATE
bool CheckHeadline( bool bRepeat
) const;
248 using SwEditShell::Copy
;
252 using SwEditShell::Insert
;
254 SwFEShell( SwDoc
& rDoc
, vcl::Window
*pWin
, const SwViewOption
*pOpt
);
255 SwFEShell( SwEditShell
& rShell
, vcl::Window
*pWin
);
256 virtual ~SwFEShell() override
;
258 /// Copy and Paste methods for internal clipboard.
259 void Copy( SwDoc
& rClpDoc
, const OUString
* pNewClpText
= nullptr );
260 bool Paste( SwDoc
& rClpDoc
, bool bNestedTable
= false );
262 /// Paste some pages into another doc - used in mailmerge.
263 void PastePages( SwFEShell
& rToFill
, sal_uInt16 nStartPage
, sal_uInt16 nEndPage
);
265 /// Copy-Method for Drag&Drop
266 bool Copy( SwFEShell
&, const Point
& rSttPt
, const Point
& rInsPt
,
267 bool bIsMove
= false, bool bSelectInsert
= true );
269 void SelectFlyFrame( SwFlyFrame
& rFrame
);
271 /// Is selected frame within another frame?
272 const SwFrameFormat
* IsFlyInFly();
274 /** If an object has been given, exactly this object is selected
275 (instead of searching over position). */
276 bool SelectObj( const Point
& rSelPt
, sal_uInt8 nFlag
= 0, SdrObject
*pObj
= nullptr );
277 void DelSelectedObj();
279 /** Move selection upwards or downwards (Z-Order).
280 TRUE = to top or bottom.
281 FALSE = run past one other. */
282 void SelectionToTop ( bool bTop
= true );
283 void SelectionToBottom( bool bBottom
= true );
285 SdrLayerID
GetLayerId() const; ///< 1 Heaven, 0 Hell, SDRLAYER_NOTFOUND Ambiguous.
286 void SelectionToHeaven(); ///< Above document.
287 void SelectionToHell(); ///< Below document.
289 /** The following two methods return enum SdrHdlKind.
290 Declared as int in order to spare including SVDRAW.HXX. */
291 bool IsObjSelectable( const Point
& rPt
);
292 /// Same as IsObjSelectable(), but return the object as well.
293 SdrObject
* GetObjAt(const Point
& rPt
);
294 bool IsInsideSelectedObj( const Point
& rPt
); ///< returns enum values
295 /** Test if there is a draw object at that position and if it should be selected.
296 The 'should' is aimed at Writer text fly frames which may be in front of
298 bool ShouldObjectBeSelected(const Point
& rPt
);
300 bool MoveAnchor( SwMove nDir
);
302 /** @return if Upper of frame at current position is section frame
303 Currently only used by the rules. To be replaced by something more
304 sophisticated one day. */
305 bool IsDirectlyInSection() const;
307 /** For return values see above FrameType.
308 pPt: Cursr or DocPos respectively; bStopAtFly: Stop at flys or continue over anchor.
309 Although (0,TRUE) is kind of a standard, the parameters are not defaulted here
310 in order to force more conscious use especially of bStopAtFly. */
311 FrameTypeFlags
GetFrameType( const Point
*pPt
, bool bStopAtFly
) const;
312 FrameTypeFlags
GetSelFrameType() const; //Selection (Drawing)
314 /** check whether selected frame contains a control;
315 * companion method to GetSelFrameType, used for preventing
316 * drag&drop of controls into header */
317 bool IsSelContainsControl() const;
319 static ObjCntType
GetObjCntType( const SdrObject
& rObj
);
320 ObjCntType
GetObjCntType( const Point
&rPt
, SdrObject
*&rpObj
) const;
321 ObjCntType
GetObjCntTypeOfSelection() const;
323 /// For adjustment of PosAttr when anchor changes.
324 SwRect
GetObjRect() const;
326 /// For moving flys with keyboard.
327 SwRect
GetFlyRect() const;
328 /** i#17567 - adjustments to allow negative vertical positions for fly frames anchored
329 to paragraph or to character.
330 i#18732 - adjustments for new option 'FollowTextFlow'
331 i#22341 - adjustments for new vertical alignment at top of line */
332 void CalcBoundRect( SwRect
& _orRect
,
333 const RndStdIds _nAnchorId
,
334 const sal_Int16 _eHoriRelOrient
= css::text::RelOrientation::FRAME
,
335 const sal_Int16 _eVertRelOrient
= css::text::RelOrientation::FRAME
,
336 const SwFormatAnchor
* _pToCharContentPos
= nullptr,
337 const bool _bFollowTextFlow
= false,
338 bool _bMirror
= false,
339 Point
* _opRef
= nullptr,
340 Size
* _opPercent
= nullptr,
341 const SwFormatFrameSize
* pFormatFrameSize
= nullptr ) const;
343 /// Set size of draw objects.
344 void SetObjRect( const SwRect
& rRect
);
346 void BeginDrag( const Point
*pPt
, bool bProp
);
347 void Drag ( const Point
*pPt
, bool bProp
);
351 /// Methods for status line.
352 Point
GetAnchorObjDiff() const;
353 Point
GetObjAbsPos() const;
354 Size
GetObjSize() const;
356 /// SS for envelopes: get all page-bound objects and set them to new page.
357 void GetPageObjs( std::vector
<SwFrameFormat
*>& rFillArr
);
358 void SetPageObjsNewPage( std::vector
<SwFrameFormat
*>& rFillArr
);
360 /// Show current selection (frame / draw object as required).
361 virtual void MakeSelVisible() override
;
363 /** @return FrameFormat of object that may be under Point.
364 Object does not become selected! */
365 const SwFrameFormat
* GetFormatFromObj( const Point
& rPt
, SwRect
** pRectToFill
= nullptr ) const;
367 /// @return a format too, if the point is over the text of any fly.
368 const SwFrameFormat
* GetFormatFromAnyObj( const Point
& rPt
) const;
370 /** Which Protection is set at selected object? */
371 FlyProtectFlags
IsSelObjProtected( FlyProtectFlags eType
) const;
373 /** Deliver graphic in rName besides graphic name. If graphic is
374 linked give name with path. rbLink is TRUE if graphic is linked. */
375 const Graphic
*GetGrfAtPos( const Point
&rDocPos
,
376 OUString
&rName
, bool &rbLink
) const;
378 OUString
GetObjTitle() const;
379 void SetObjTitle( const OUString
& rTitle
);
380 OUString
GetObjDescription() const;
381 void SetObjDescription( const OUString
& rDescription
);
382 bool IsObjDecorative() const;
383 void SetObjDecorative(bool isDecorative
);
385 bool IsFrameSelected() const;
386 bool GetFlyFrameAttr( SfxItemSet
&rSet
) const;
387 bool SetFlyFrameAttr( SfxItemSet
&rSet
);
388 static SfxItemSetFixed
<RES_VERT_ORIENT
, RES_ANCHOR
> makeItemSetFromFormatAnchor(SfxItemPool
& rPool
, const SwFormatAnchor
&rAnchor
);
389 void ResetFlyFrameAttr( const SfxItemSet
* pSet
);
390 const SwFrameFormat
*NewFlyFrame( const SfxItemSet
&rSet
, bool bAnchValid
= false,
391 SwFrameFormat
*pParent
= nullptr );
392 void SetFlyPos( const Point
&rAbsPos
);
393 Point
FindAnchorPos( const Point
&rAbsPos
, bool bMoveIt
= false );
395 /** Determines whether a frame or its environment is vertically formatted and right-to-left.
396 also determines, if frame or its environment is in Mongolian layout (vertical left-to-right)
397 - add output parameter <bVertL2R> */
398 bool IsFrameVertical(const bool bEnvironment
, bool& bRightToLeft
, bool& bVertL2R
) const;
400 SwFrameFormat
* GetSelectedFrameFormat() const; ///< If frame then frame style, else 0.
401 void SetFrameFormat( SwFrameFormat
*pFormat
, bool bKeepOrient
= false, Point
const * pDocPos
= nullptr ); ///< If frame then set frame style.
404 SwFlyFrame
* GetSelectedFlyFrame() const;
406 // Get current fly in which the cursor is positioned
407 SwFlyFrame
* GetCurrFlyFrame(const bool bCalcFrame
= true) const;
409 // Get selected fly, but if none Get current fly in which the cursor is positioned
410 SwFlyFrame
* GetSelectedOrCurrFlyFrame() const;
412 /// Find/delete fly containing the cursor.
413 SwFrameFormat
* WizardGetFly();
415 /// Independent selecting of flys.
416 bool GotoNextFly( GotoObjFlags eType
= GotoObjFlags::FlyAny
)
417 { return GotoObj( true, eType
); }
418 bool GotoPrevFly( GotoObjFlags eType
= GotoObjFlags::FlyAny
)
419 { return GotoObj( false, eType
); }
421 /// Iterate over flys - for Basic-collections.
422 size_t GetFlyCount( FlyCntType eType
, bool bIgnoreTextBoxes
= false ) const;
423 const SwFrameFormat
* GetFlyNum(size_t nIdx
, FlyCntType eType
, bool bIgnoreTextBoxes
= false) const;
425 std::vector
<SwFrameFormat
const*> GetFlyFrameFormats(
426 FlyCntType eType
, bool bIgnoreTextBoxes
);
428 /// If a fly is selected, it draws cursor into the first ContentFrame.
429 const SwFrameFormat
* SelFlyGrabCursor();
431 /// Get FlyFrameFormat; for UI macro linkage at Flys
432 const SwFrameFormat
* GetFlyFrameFormat() const;
433 SwFrameFormat
* GetFlyFrameFormat();
435 /** OLE. Server requires new size. Desired values are adjusted as frame attributes.
436 If the values are not allowed, the formatting clips and determines scaling.
437 See CalcAndSetScale().
438 The @return value is the applied size. */
439 Size
RequestObjectResize( const SwRect
&rRect
, const css::uno::Reference
< css::embed::XEmbeddedObject
>& );
441 /// The layout has been changed, so the active object has to be moved after that
442 virtual void MoveObjectIfActive( svt::EmbeddedObjectRef
& xObj
, const Point
& rOffset
);
444 /** Client for OleObject has to be up-to-date regarding scaling.
445 Implemented in WrtShell.
446 If a pointer is passed on a size, this is the object's current core-size.
447 Else the size is provided via GetCurFlyRect(). */
448 virtual void CalcAndSetScale( svt::EmbeddedObjectRef
& xObj
,
449 const SwRect
*pFlyPrtRect
= nullptr,
450 const SwRect
*pFlyFrameRect
= nullptr,
451 const bool bNoTextFramePrtAreaChanged
= false ) = 0;
453 /** Connect objects with ActivateWhenVisible at Paint.
454 Called by notxtfrm::Paint, implemented in wrtsh. */
455 virtual void ConnectObj( svt::EmbeddedObjectRef
&,
457 const SwRect
&rFrame
) = 0;
459 /// Check resize of OLE-Object.
460 bool IsCheckForOLEInCaption() const { return m_bCheckForOLEInCaption
; }
461 void SetCheckForOLEInCaption( bool bFlag
) { m_bCheckForOLEInCaption
= bFlag
; }
463 /// Set name at selected FlyFrame.
464 void SetFlyName( const OUString
& rName
);
465 OUString
GetFlyName() const;
467 /// get reference to OLE object (if there is one) for selected FlyFrame
468 css::uno::Reference
< css::embed::XEmbeddedObject
> GetOleRef() const;
470 /// Created unique name for frame.
471 OUString
GetUniqueGrfName() const;
472 OUString
GetUniqueOLEName() const;
473 OUString
GetUniqueFrameName() const;
475 /// Jump to named Fly (graphic/OLE).
476 bool GotoFly( const OUString
& rName
, FlyCntType eType
,
479 /// Position is a graphic with URL?
480 const SwFrameFormat
* IsURLGrfAtPos( const Point
& rPt
, OUString
* pURL
= nullptr,
481 OUString
*pTargetFrameName
= nullptr,
482 OUString
*pURLDescription
= nullptr ) const;
484 /** For Chain always connect Fly specified by format with that hit by point.
485 rRect contains rect of Fly (for its highlight). */
486 SwChainRet
Chainable( SwRect
&rRect
, const SwFrameFormat
&rSource
, const Point
&rPt
) const;
487 SwChainRet
Chain( SwFrameFormat
&rSource
, const Point
&rPt
);
488 void Chain( SwFrameFormat
&rSource
, const SwFrameFormat
&rDest
);
489 void Unchain( SwFrameFormat
&rFormat
);
490 void HideChainMarker();
491 void SetChainMarker();
493 Size
GetGraphicDefaultSize() const;
495 /// Temporary work around for bug.
496 void CheckUnboundObjects();
498 /// Attention: Ambiguities if multiple selections.
499 bool GetObjAttr( SfxItemSet
&rSet
) const;
500 void SetObjAttr( const SfxItemSet
&rSet
);
502 const SdrObject
* GetBestObject(bool bNext
, GotoObjFlags eType
, bool bFlat
= true,
503 const svx::ISdrObjectFilter
* pFilter
= nullptr,
504 bool* pbWrapped
= nullptr);
505 bool GotoObj( bool bNext
, GotoObjFlags eType
= GotoObjFlags::DrawAny
);
507 /// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
508 void SetDragMode( SdrDragMode eSdrDragMode
);
510 // Get the current drag mode
511 SdrDragMode
GetDragMode() const;
513 // Start cropping the selected image
514 void StartCropImage();
516 // RotGrfFlyFrame: check if RotationMode is possible
517 bool IsRotationOfSwGrfNodePossible() const;
519 size_t IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups.
520 bool IsObjSelected( const SdrObject
& rObj
) const;
521 bool IsObjSameLevelWithMarked(const SdrObject
* pObj
) const;
522 const SdrMarkList
* GetMarkList() const{ return GetMarkList_(); };
524 void EndTextEdit(); ///< Deletes object if required.
526 /** Anchor type of selected object, RndStdIds::UNKNOWN if ambiguous or in case of frame selection.
527 Else RndStdIds::FLY_AT_PAGE or RndStdIds::FLY_AT_PARA. */
528 RndStdIds
GetAnchorId() const;
530 /** Process of creating draw objects. At the beginning object type is passed.
531 At the end a Cmd can be passed. Here, SDRCREATE_RESTRAINTEND for end
532 or SdrCreateCmd::NextPoint for a polygon may be relevant.
533 After RESTRAINTEND the object is created and selected.
534 BreakCreate interrupts the process. In this case no object is selected. */
535 bool BeginCreate( SdrObjKind eSdrObjectKind
, const Point
&rPos
);
536 bool BeginCreate( SdrObjKind eSdrObjectKind
, SdrInventor eObjInventor
, const Point
&);
537 void MoveCreate ( const Point
&rPos
);
538 bool EndCreate ( SdrCreateCmd eSdrCreateCmd
);
540 bool IsDrawCreate() const;
541 void CreateDefaultShape(SdrObjKind eSdrObjectKind
, const tools::Rectangle
& rRect
, sal_uInt16 nSlotId
);
543 /// Functions for Rubberbox, it selects Draw-Objects
544 bool BeginMark( const Point
&rPos
);
545 void MoveMark ( const Point
&rPos
);
548 /// Create and destroy group, don't when frame is selected.
549 bool IsGroupSelected(bool bAllowDiagams
); ///< Can be a mixed selection!
550 void GroupSelection(); ///< Afterwards the group is selected.
551 void UnGroupSelection(); /**< The individual objects are selected, but
552 it is possible that there are groups included. */
554 bool IsGroupAllowed() const;
555 bool IsUnGroupAllowed() const;
557 void MirrorSelection( bool bHorizontal
); ///< Vertical if FALSE.
559 /** frmatr.hxx. Here no enum because of dependencies.
560 bool value only for internal use! Anchor is newly set according
561 to current document position. Anchor is not re-set. */
562 void ChgAnchor( RndStdIds eAnchorId
, bool bSameOnly
= false,
563 bool bPosCorr
= true );
565 bool SetDrawingAttr( SfxItemSet
&rSet
);
567 /** Get selected DrawObj as graphics (MetaFile/Bitmap).
568 Return value indicates if it was converted. */
569 bool GetDrawObjGraphic( SotClipboardFormatId nFormat
, Graphic
& rGrf
) const;
571 void Paste( SvStream
& rStm
, SwPasteSdr nAction
, const Point
* pPt
);
572 bool Paste( const Graphic
&rGrf
, const OUString
& rURL
);
574 comphelper::OInterfaceContainerHelper3
<css::text::XPasteListener
>& GetPasteListeners();
576 bool IsAlignPossible() const;
577 void SetCalcFieldValueHdl(Outliner
* pOutliner
);
579 void Insert(const OUString
& rGrfName
,
580 const OUString
& rFltName
,
581 const Graphic
* pGraphic
,
582 const SfxItemSet
* pFlyAttrSet
);
584 /// Insertion of a drawing object which have to be already inserted in the DrawModel.
585 void InsertDrawObj( SdrObject
& rDrawObj
,
586 const Point
& rInsertPosition
);
588 void ReplaceSdrObj( const OUString
& rGrfName
, const Graphic
* pGrf
);
591 /** for starmath formulas anchored 'as char' it aligns it baseline to baseline
592 changing the previous vertical orientation */
593 void AlignFormulaToBaseline( const css::uno::Reference
< css::embed::XEmbeddedObject
>& xObj
);
595 /// aligns all formulas with anchor 'as char' to baseline
596 void AlignAllFormulasToBaseline();
598 /// Provide information about content situated closes to given Point.
599 Point
GetContentPos( const Point
& rPoint
, bool bNext
) const;
601 /// Convert document position into position relative to the current page.
602 Point
GetRelativePagePosition(const Point
& rDocPos
);
604 /// Hide or show layout-selection and pass call to CursorSh.
605 void ShellLoseFocus();
606 void ShellGetFocus();
608 /// PageDescriptor-interface
609 void ChgCurPageDesc( const SwPageDesc
& );
610 size_t GetCurPageDesc( const bool bCalcFrame
= true ) const;
611 size_t GetMousePageDesc( const Point
&rPt
) const;
612 size_t GetPageDescCnt() const;
613 SwPageDesc
* FindPageDescByName( const OUString
& rName
,
614 bool bGetFromPool
= false,
615 size_t* pPos
= nullptr );
617 const SwPageDesc
& GetPageDesc( size_t i
) const;
618 void ChgPageDesc( size_t i
, const SwPageDesc
& );
619 /** if inside all selection only one PageDesc, @return this.
620 Otherwise @return 0 pointer */
621 const SwPageDesc
* GetSelectedPageDescs() const;
623 const SwRect
& GetAnyCurRect( CurRectType eType
,
624 const Point
* pPt
= nullptr,
625 const css::uno::Reference
< css::embed::XEmbeddedObject
>& =
626 css::uno::Reference
< css::embed::XEmbeddedObject
>() ) const;
628 /// Page number of the page containing Point, O if no page.
629 sal_uInt16
GetPageNumber( const Point
&rPoint
) const;
630 bool GetPageNumber( tools::Long nYPos
, bool bAtCursorPos
, sal_uInt16
& rPhyNum
, sal_uInt16
& rVirtNum
, OUString
&rDisplay
) const;
632 SwFlyFrameFormat
* InsertObject( const svt::EmbeddedObjectRef
&,
633 SfxItemSet
* pFlyAttrSet
);
634 bool FinishOLEObj(); ///< Shutdown server.
636 void GetTableAttr( SfxItemSet
& ) const;
637 void SetTableAttr( const SfxItemSet
& );
639 bool HasWholeTabSelection() const;
641 /// Is content of a table cell or at least a table cell completely selected?
642 bool HasBoxSelection() const;
644 void InsertRow( sal_uInt16 nCnt
, bool bBehind
);
645 void InsertCol( sal_uInt16 nCnt
, bool bBehind
); // 0 == at the end.
648 bool DeleteRow(bool bCompleteTable
= false);
650 SwTable::SearchType
GetTableInsertMode() const { return m_eTableInsertMode
; }
651 void SetTableInsertMode( SwTable::SearchType eFlag
) { m_eTableInsertMode
= eFlag
; }
653 bool GetTableCopied() const { return m_bTableCopied
; }
654 void SetTableCopied( bool bCopied
) { m_bTableCopied
= bCopied
; }
656 bool DeleteTableSel(); ///< Current selection, may be whole table.
658 TableMergeErr
MergeTab(); /**< Merge selected parts of table */
660 /// Split cell vertically or horizontally.
661 void SplitTab( bool bVert
, sal_uInt16 nCnt
, bool bSameHeight
);
662 bool Sort(const SwSortOptions
&); // sorting
664 void SetRowHeight( const SwFormatFrameSize
&rSz
);
666 /// Pointer must be destroyed by caller != 0.
667 std::unique_ptr
<SwFormatFrameSize
> GetRowHeight() const;
669 void SetRowSplit( const SwFormatRowSplit
&rSz
);
670 std::unique_ptr
<SwFormatRowSplit
> GetRowSplit() const;
672 void SetBoxAlign( sal_uInt16 nOrient
);
673 sal_uInt16
GetBoxAlign() const; ///< USHRT_MAX if ambiguous.
675 bool BalanceRowHeight( bool bTstOnly
, const bool bOptimize
= false );
677 void SetTabBorders( const SfxItemSet
& rSet
);
678 void GetTabBorders( SfxItemSet
& rSet
) const;
679 void SetTabLineStyle(const Color
* pColor
, bool bSetLine
= false, const editeng::SvxBorderLine
* pBorderLine
= nullptr);
681 void SetTabBackground( const SvxBrushItem
&rNew
);
682 void GetTabBackground( std::unique_ptr
<SvxBrushItem
>& rToFill
) const;
684 void SetBoxBackground( const SvxBrushItem
&rNew
);
685 bool GetBoxBackground( std::unique_ptr
<SvxBrushItem
>& rToFill
) const; ///< FALSE ambiguous.
687 void SetBoxDirection( const SvxFrameDirectionItem
& rNew
);
688 bool GetBoxDirection( std::unique_ptr
<SvxFrameDirectionItem
>& rToFill
) const; ///< FALSE ambiguous.
690 void SetRowBackground( const SvxBrushItem
&rNew
);
691 bool GetRowBackground( std::unique_ptr
<SvxBrushItem
>& rToFill
) const; ///< FALSE ambiguous.
693 SwTab
WhichMouseTabCol( const Point
&rPt
) const;
694 void GetTabCols( SwTabCols
&rToFill
) const; ///< Info about columns and margins.
695 void SetTabCols( const SwTabCols
&rNew
, bool bCurRowOnly
);
696 void GetMouseTabCols( SwTabCols
&rToFill
, const Point
&rPt
) const;
697 void SetMouseTabCols( const SwTabCols
&rNew
, bool bCurRowOnly
,
700 /// pEnd will be used during MouseMove
701 bool SelTableRowCol( const Point
& rPt
, const Point
* pEnd
, bool bRowDrag
);
703 void GetTabRows( SwTabCols
&rToFill
) const;
704 void SetTabRows( const SwTabCols
&rNew
, bool bCurColOnly
);
705 void GetMouseTabRows( SwTabCols
&rToFill
, const Point
&rPt
) const;
706 void SetMouseTabRows( const SwTabCols
&rNew
, bool bCurColOnly
, const Point
&rPt
);
708 void ProtectCells(); /**< If a table selection exists it is destroyed in case
709 cursor is not allowed in readonly. */
710 void UnProtectCells(); ///< Refers to table selection.
711 void UnProtectTables(); ///< Unprotect all tables in selection.
712 bool HasTableAnyProtection( const OUString
* pTableName
,
713 bool* pFullTableProtection
);
714 bool CanUnProtectCells() const;
716 sal_uInt16
GetRowsToRepeat() const;
717 void SetRowsToRepeat( sal_uInt16 nNumOfRows
);
718 sal_uInt16
GetVirtPageNum() const;
720 /** @return the number of table rows currently selected
721 if the selection start at the top of the table. */
722 sal_uInt16
GetRowSelectionFromTop() const;
724 bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
725 bool IsInHeadline() const { return CheckHeadline( false ); }
727 void AdjustCellWidth( const bool bBalance
, const bool bNoShrink
);
729 /// Not allowed if only empty cells are selected.
730 bool IsAdjustCellWidthAllowed( bool bBalance
= false ) const;
732 /// Set table style of the current table.
733 void SetTableStyle(const OUString
& rStyleName
);
734 bool SetTableStyle(const SwTableAutoFormat
& rNew
);
736 /// Update the direct formatting according to the current table style.
737 /// @param pTableNode Table node to update. When nullptr, current cursor position is used.
738 /// @param bResetDirect Reset direct formatting that might be applied to the cells.
739 /// @param pStyleName new style to apply
740 bool UpdateTableStyleFormatting(SwTableNode
*pTableNode
= nullptr, bool bResetDirect
= false, OUString
const* pStyleName
= nullptr);
742 bool GetTableAutoFormat( SwTableAutoFormat
& rGet
);
744 void SetColRowWidthHeight( TableChgWidthHeightType eType
, sal_uInt16 nDiff
);
746 void GetAutoSum( OUString
& rFormula
) const;
748 /** Phy: real page count.
749 Virt: consider offset that may have been set by user. */
750 sal_uInt16
GetPhyPageNum() const;
752 void SetNewPageOffset( sal_uInt16 nOffset
);
753 void SetPageOffset( sal_uInt16 nOffset
); ///< Changes last page offset.
754 sal_uInt16
GetPageOffset() const; ///< @return last page offset.
756 void InsertLabel( const SwLabelType eType
, const OUString
&rText
, const OUString
& rSeparator
,
757 const OUString
& rNumberSeparator
,
758 const bool bBefore
, const sal_uInt16 nId
,
759 const OUString
& rCharacterStyle
,
760 const bool bCpyBrd
);
762 /// The ruler needs some information too.
763 sal_uInt16
GetCurColNum( SwGetCurColNumPara
* pPara
= nullptr ) const; //0 == not in any column.
764 sal_uInt16
GetCurMouseColNum( const Point
&rPt
) const;
765 size_t GetCurTabColNum() const; //0 == not in any table.
766 size_t GetCurMouseTabColNum( const Point
&rPt
) const;
767 sal_uInt16
GetCurOutColNum() const; ///< Current outer column.
769 bool IsColRightToLeft() const;
770 bool IsTableRightToLeft() const;
771 bool IsMouseTableRightToLeft( const Point
&rPt
) const;
772 bool IsTableVertical() const;
774 bool IsLastCellInRow() const;
776 /// Width of current range for column-dialog.
777 tools::Long
GetSectionWidth( SwFormat
const & rFormat
) const;
779 void GetConnectableFrameFormats
780 (SwFrameFormat
& rFormat
, const OUString
& rReference
, bool bSuccessors
,
781 std::vector
< OUString
> & aPrevPageVec
,
782 std::vector
< OUString
> & aThisPageVec
,
783 std::vector
< OUString
> & aNextPageVec
,
784 std::vector
< OUString
> & aRestVec
);
786 /** SwFEShell::GetShapeBackground
788 method determines background color of the page the selected drawing
789 object is on and returns this color.
790 If no color is found, because no drawing object is selected or ...,
791 color COL_BLACK (default color on constructing object of class Color)
794 @returns an object of class Color
796 Color
GetShapeBackground() const;
798 /** Is default horizontal text direction for selected drawing object right-to-left
800 Because drawing objects only painted for each page only, the default
801 horizontal text direction of a drawing object is given by the corresponding
804 @returns boolean, indicating, if the horizontal text direction of the
805 page, the selected drawing object is on, is right-to-left.
807 bool IsShapeDefaultHoriTextDirR2L() const;
809 void ParkCursorInTab();
811 SwTextNode
* GetNumRuleNodeAtPos(const Point
&rPot
);
812 bool IsNumLabel( const Point
&rPt
, int nMaxOffset
= -1 );
814 static bool IsVerticalModeAtNdAndPos( const SwTextNode
& _rTextNode
,
815 const Point
& _rDocPos
);
817 void ToggleHeaderFooterEdit( );
818 static void SetLineEnds(SfxItemSet
& rAttr
, SdrObject
const & rObj
, sal_uInt16 nSlotId
);
820 SAL_DLLPRIVATE
void ClearColumnRowCache(SwTabFrame
const*);
823 void ClearFEShellTabCols(SwDoc
& rDoc
, SwTabFrame
const*const pFrame
);
827 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */