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>
24 #include <svx/svdobj.hxx>
27 #include "flyenum.hxx"
29 #include <svx/svdtypes.hxx>
30 #include <sot/formats.hxx>
31 #include <rtl/ustring.hxx>
32 #include <o3tl/typed_flags_set.hxx>
33 #include <comphelper/interfacecontainer2.hxx>
38 namespace editeng
{ class SvxBorderLine
; }
43 class SvxFrameDirectionItem
;
44 class SwTableAutoFormat
;
46 class SwFormatFrameSize
;
47 class SwFormatRowSplit
;
56 class ISdrObjectFilter
;
58 namespace com
{ namespace sun
{ namespace star
{ namespace embed
{ class XEmbeddedObject
; } } } }
60 // return values for GetFrameType() and GetSelFrameType().
61 //! values can be combined via logical or
62 enum class FrameTypeFlags
{
82 template<> struct typed_flags
<FrameTypeFlags
> : is_typed_flags
<FrameTypeFlags
, 0x7fff> {};
85 //! values can be combined via logical or
86 enum class GotoObjFlags
91 DrawAny
= DrawControl
| DrawSimple
,
95 FlyAny
= FlyOLE
| FlyGrf
| FlyFrame
,
96 Any
= FlyAny
| DrawAny
,
100 template<> struct typed_flags
<GotoObjFlags
> : is_typed_flags
<GotoObjFlags
, 31> {};
103 //! values can be combined via logical or
104 enum class FlyProtectFlags
110 Parent
= 8, ///< Check only parents.
111 Fixed
= 16, /**< Only protection that cannot be withdrawn
112 e.g. by OLE-server; also relevant for dialog. */
116 template<> struct typed_flags
<FlyProtectFlags
> : is_typed_flags
<FlyProtectFlags
, 31> {};
119 // For figuring out contents by position (D&D)
131 OBJCNT_DONTCARE
///< Not determinable - different objects are selected.
135 enum class CurRectType
137 Page
, ///< Rect of current page.
138 PageCalc
, ///< ... page will be formatted if required.
139 PagePrt
, ///< Rect of current PrtArea of page.
140 Frame
, ///< Rect of current frame.
141 FlyEmbedded
, ///< Rect of current FlyFrame.
142 FlyEmbeddedPrt
, ///< Rect of PrtArea of FlyFrame
143 Section
, ///< Rect of current section.
144 SectionOutsideTable
, ///< Rect of current section but outside of table.
145 SectionPrt
, ///< Rect of current PrtArea of section.
146 HeaderFooter
, ///< Rect of current header/footer
147 PagesArea
///< Rect covering the pages area
150 struct SwGetCurColNumPara
152 const SwFrameFormat
* pFrameFormat
;
153 const SwRect
* pPrtRect
;
154 SwGetCurColNumPara() : pFrameFormat( nullptr ), pPrtRect( nullptr ) {}
157 enum class SwPasteSdr
165 #define SW_ADD_SELECT 1
166 #define SW_ENTER_GROUP 2
167 #define SW_LEAVE_FRAME 4
168 /// Allow SwFEShell::SelectObj() to select the TextBox of a shape.
169 #define SW_ALLOW_TEXTBOX 8
179 // return values for WhichMouseTabCol
197 class SdrDropMarkerOverlay
;
200 class SW_DLLPUBLIC SwFEShell
: public SwEditShell
203 mutable std::unique_ptr
<SwColCache
> m_pColumnCache
;
204 mutable std::unique_ptr
<SwColCache
> m_pRowCache
;
205 std::unique_ptr
<SdrDropMarkerOverlay
> m_pChainTo
;
206 std::unique_ptr
<SdrDropMarkerOverlay
> m_pChainFrom
;
207 bool m_bCheckForOLEInCaption
;
208 comphelper::OInterfaceContainerHelper2 m_aPasteListeners
;
210 SAL_DLLPRIVATE SwFlyFrame
*FindFlyFrame( const css::uno::Reference
< css::embed::XEmbeddedObject
>& ) const;
212 /// Terminate actions for all shells and call ChangeLink.
213 SAL_DLLPRIVATE
void EndAllActionAndCall();
215 SAL_DLLPRIVATE
void ScrollTo( const Point
&rPt
);
217 SAL_DLLPRIVATE
void ChangeOpaque( SdrLayerID nLayerId
);
219 /** Used for mouse operations on a table:
220 @return a cell frame that is 'close' to rPt. */
221 SAL_DLLPRIVATE
const SwFrame
*GetBox( const Point
&rPt
, bool* pbRow
= nullptr, bool* pbCol
= nullptr ) const;
223 // 0 == not in any column.
224 SAL_DLLPRIVATE
static sal_uInt16
GetCurColNum_( const SwFrame
*pFrame
,
225 SwGetCurColNumPara
* pPara
);
227 SAL_DLLPRIVATE
void GetTabCols_(SwTabCols
&rToFill
, const SwFrame
*pBox
) const;
228 SAL_DLLPRIVATE
void GetTabRows_(SwTabCols
&rToFill
, const SwFrame
*pBox
) const;
230 SAL_DLLPRIVATE
bool ImpEndCreate();
232 /// Methods for copying of draw objects.
233 SAL_DLLPRIVATE
bool CopyDrawSel( SwFEShell
* pDestShell
, const Point
& rSttPt
,
234 const Point
& rInsPt
, bool bIsMove
,
235 bool bSelectInsert
);
237 /// Get list of marked SdrObjects;
238 /// helper method for GetSelFrameType, IsSelContainsControl.
239 SAL_DLLPRIVATE
const SdrMarkList
* GetMarkList_() const;
241 SAL_DLLPRIVATE
bool CheckHeadline( bool bRepeat
) const;
243 using SwEditShell::Copy
;
247 using SwEditShell::Insert
;
249 SwFEShell( SwDoc
& rDoc
, vcl::Window
*pWin
, const SwViewOption
*pOpt
);
250 SwFEShell( SwEditShell
& rShell
, vcl::Window
*pWin
);
251 virtual ~SwFEShell() override
;
253 /// Copy and Paste methods for internal clipboard.
254 void Copy( SwDoc
* pClpDoc
, const OUString
* pNewClpText
= nullptr );
255 bool Paste( SwDoc
* pClpDoc
, bool bNestedTable
= false );
257 /// Paste some pages into another doc - used in mailmerge.
258 void PastePages( SwFEShell
& rToFill
, sal_uInt16 nStartPage
, sal_uInt16 nEndPage
);
260 /// Copy-Method for Drag&Drop
261 bool Copy( SwFEShell
*, const Point
& rSttPt
, const Point
& rInsPt
,
262 bool bIsMove
= false, bool bSelectInsert
= true );
264 void SelectFlyFrame( SwFlyFrame
& rFrame
);
266 /// Is selected frame within another frame?
267 const SwFrameFormat
* IsFlyInFly();
269 /** If an object has been given, exactly this object is selected
270 (instead of searching over position). */
271 bool SelectObj( const Point
& rSelPt
, sal_uInt8 nFlag
= 0, SdrObject
*pObj
= nullptr );
272 void DelSelectedObj();
274 /** Move selection upwards or downwards (Z-Order).
275 TRUE = to top or bottom.
276 FALSE = run past one other. */
277 void SelectionToTop ( bool bTop
= true );
278 void SelectionToBottom( bool bBottom
= true );
280 SdrLayerID
GetLayerId() const; ///< 1 Heaven, 0 Hell, SDRLAYER_NOTFOUND Ambiguous.
281 void SelectionToHeaven(); ///< Above document.
282 void SelectionToHell(); ///< Below document.
284 /** The following two methods return enum SdrHdlKind.
285 Declared as int in order to spare including SVDRAW.HXX. */
286 bool IsObjSelectable( const Point
& rPt
);
287 /// Same as IsObjSelectable(), but return the object as well.
288 SdrObject
* GetObjAt(const Point
& rPt
);
289 bool IsInsideSelectedObj( const Point
& rPt
); ///< returns enum values
290 /** Test if there is a draw object at that position and if it should be selected.
291 The 'should' is aimed at Writer text fly frames which may be in front of
293 bool ShouldObjectBeSelected(const Point
& rPt
);
295 bool MoveAnchor( SwMove nDir
);
297 /** @return if Upper of frame at current position is section frame
298 Currently only used by the rules. To be replaced by something more
299 sophisticated one day. */
300 bool IsDirectlyInSection() const;
302 /** For return values see above FrameType.
303 pPt: Cursr or DocPos respectively; bStopAtFly: Stop at flys or continue over anchor.
304 Although (0,TRUE) is kind of a standard, the parameters are not defaulted here
305 in order to force more conscious use especially of bStopAtFly. */
306 FrameTypeFlags
GetFrameType( const Point
*pPt
, bool bStopAtFly
) const;
307 FrameTypeFlags
GetSelFrameType() const; //Selection (Drawing)
309 /** check whether selected frame contains a control;
310 * companion method to GetSelFrameType, used for preventing
311 * drag&drop of controls into header */
312 bool IsSelContainsControl() const;
314 static ObjCntType
GetObjCntType( const SdrObject
& rObj
);
315 ObjCntType
GetObjCntType( const Point
&rPt
, SdrObject
*&rpObj
) const;
316 ObjCntType
GetObjCntTypeOfSelection() const;
318 /// For adjustment of PosAttr when anchor changes.
319 SwRect
GetObjRect() const;
321 /// For moving flys with keyboard.
322 SwRect
GetFlyRect() const;
323 /** i#17567 - adjustments to allow negative vertical positions for fly frames anchored
324 to paragraph or to character.
325 i#18732 - adjustments for new option 'FollowTextFlow'
326 i#22341 - adjustments for new vertical alignment at top of line */
327 void CalcBoundRect( SwRect
& _orRect
,
328 const RndStdIds _nAnchorId
,
329 const sal_Int16 _eHoriRelOrient
= css::text::RelOrientation::FRAME
,
330 const sal_Int16 _eVertRelOrient
= css::text::RelOrientation::FRAME
,
331 const SwPosition
* _pToCharContentPos
= nullptr,
332 const bool _bFollowTextFlow
= false,
333 bool _bMirror
= false,
334 Point
* _opRef
= nullptr,
335 Size
* _opPercent
= nullptr,
336 const SwFormatFrameSize
* pFormatFrameSize
= nullptr ) const;
338 /// Set size of draw objects.
339 void SetObjRect( const SwRect
& rRect
);
341 void BeginDrag( const Point
*pPt
, bool bProp
);
342 void Drag ( const Point
*pPt
, bool bProp
);
346 /// Methods for status line.
347 Point
GetAnchorObjDiff() const;
348 Point
GetObjAbsPos() const;
349 Size
GetObjSize() const;
351 /// SS for envelopes: get all page-bound objects and set them to new page.
352 void GetPageObjs( std::vector
<SwFrameFormat
*>& rFillArr
);
353 void SetPageObjsNewPage( std::vector
<SwFrameFormat
*>& rFillArr
);
355 /// Show current selection (frame / draw object as required).
356 virtual void MakeSelVisible() override
;
358 /** @return FrameFormat of object that may be under Point.
359 Object does not become selected! */
360 const SwFrameFormat
* GetFormatFromObj( const Point
& rPt
, SwRect
** pRectToFill
= nullptr ) const;
362 /// @return a format too, if the point is over the text of any fly.
363 const SwFrameFormat
* GetFormatFromAnyObj( const Point
& rPt
) const;
365 /** Which Protection is set at selected object? */
366 FlyProtectFlags
IsSelObjProtected( FlyProtectFlags eType
) const;
368 /** Deliver graphic in rName besides graphic name. If graphic is
369 linked give name with path. rbLink is TRUE if graphic is linked. */
370 const Graphic
*GetGrfAtPos( const Point
&rDocPos
,
371 OUString
&rName
, bool &rbLink
) const;
373 OUString
GetObjTitle() const;
374 void SetObjTitle( const OUString
& rTitle
);
375 OUString
GetObjDescription() const;
376 void SetObjDescription( const OUString
& rDescription
);
378 bool IsFrameSelected() const;
379 bool GetFlyFrameAttr( SfxItemSet
&rSet
) const;
380 bool SetFlyFrameAttr( SfxItemSet
&rSet
);
381 static SfxItemSet
makeItemSetFromFormatAnchor(SfxItemPool
& rPool
, const SwFormatAnchor
&rAnchor
);
382 void ResetFlyFrameAttr( const SfxItemSet
* pSet
);
383 const SwFrameFormat
*NewFlyFrame( const SfxItemSet
&rSet
, bool bAnchValid
= false,
384 SwFrameFormat
*pParent
= nullptr );
385 void SetFlyPos( const Point
&rAbsPos
);
386 Point
FindAnchorPos( const Point
&rAbsPos
, bool bMoveIt
= false );
388 /** Determines whether a frame or its environment is vertically formatted and right-to-left.
389 also determines, if frame or its environment is in Mongolian layout (vertical left-to-right)
390 - add output parameter <bVertL2R> */
391 bool IsFrameVertical(const bool bEnvironment
, bool& bRightToLeft
, bool& bVertL2R
) const;
393 SwFrameFormat
* GetSelectedFrameFormat() const; ///< If frame then frame style, else 0.
394 void SetFrameFormat( SwFrameFormat
*pFormat
, bool bKeepOrient
= false, Point
const * pDocPos
= nullptr ); ///< If frame then set frame style.
397 SwFlyFrame
* GetSelectedFlyFrame() const;
399 // Get current fly in which the cursor is positioned
400 SwFlyFrame
* GetCurrFlyFrame(const bool bCalcFrame
= true) const;
402 // Get selected fly, but if none Get current fly in which the cursor is positioned
403 SwFlyFrame
* GetSelectedOrCurrFlyFrame() const;
405 /// Find/delete fly containing the cursor.
406 SwFrameFormat
* WizardGetFly();
408 /// Independent selecting of flys.
409 bool GotoNextFly( GotoObjFlags eType
= GotoObjFlags::FlyAny
)
410 { return GotoObj( true, eType
); }
411 bool GotoPrevFly( GotoObjFlags eType
= GotoObjFlags::FlyAny
)
412 { return GotoObj( false, eType
); }
414 /// Iterate over flys - for Basic-collections.
415 size_t GetFlyCount( FlyCntType eType
, bool bIgnoreTextBoxes
= false ) const;
416 const SwFrameFormat
* GetFlyNum(size_t nIdx
, FlyCntType eType
, bool bIgnoreTextBoxes
= false) const;
418 std::vector
<SwFrameFormat
const*> GetFlyFrameFormats(
419 FlyCntType eType
, bool bIgnoreTextBoxes
);
421 /// If a fly is selected, it draws cursor into the first ContentFrame.
422 const SwFrameFormat
* SelFlyGrabCursor();
424 /// Get FlyFrameFormat; for UI macro linkage at Flys
425 const SwFrameFormat
* GetFlyFrameFormat() const;
426 SwFrameFormat
* GetFlyFrameFormat();
428 /** OLE. Server requires new size. Desired values are adjusted as frame attributes.
429 If the values are not allowed, the formatting clips and determines scaling.
430 See CalcAndSetScale().
431 The @return value is the applied size. */
432 Size
RequestObjectResize( const SwRect
&rRect
, const css::uno::Reference
< css::embed::XEmbeddedObject
>& );
434 /// The layout has been changed, so the active object has to be moved after that
435 virtual void MoveObjectIfActive( svt::EmbeddedObjectRef
& xObj
, const Point
& rOffset
);
437 /** Client for OleObject has to be up-to-date regarding scaling.
438 Implemented in WrtShell.
439 If a pointer is passed on a size, this is the object's current core-size.
440 Else the size is provided via GetCurFlyRect(). */
441 virtual void CalcAndSetScale( svt::EmbeddedObjectRef
& xObj
,
442 const SwRect
*pFlyPrtRect
= nullptr,
443 const SwRect
*pFlyFrameRect
= nullptr,
444 const bool bNoTextFramePrtAreaChanged
= false ) = 0;
446 /** Connect objects with ActivateWhenVisible at Paint.
447 Called by notxtfrm::Paint, implemented in wrtsh. */
448 virtual void ConnectObj( svt::EmbeddedObjectRef
&,
450 const SwRect
&rFrame
) = 0;
452 /// Check resize of OLE-Object.
453 bool IsCheckForOLEInCaption() const { return m_bCheckForOLEInCaption
; }
454 void SetCheckForOLEInCaption( bool bFlag
) { m_bCheckForOLEInCaption
= bFlag
; }
456 /// Set name at selected FlyFrame.
457 void SetFlyName( const OUString
& rName
);
458 OUString
GetFlyName() const;
460 /// get reference to OLE object (if there is one) for selected FlyFrame
461 css::uno::Reference
< css::embed::XEmbeddedObject
> GetOleRef() const;
463 /// Created unique name for frame.
464 OUString
GetUniqueGrfName() const;
465 OUString
GetUniqueOLEName() const;
466 OUString
GetUniqueFrameName() const;
467 OUString
GetUniqueShapeName() const;
469 /// Jump to named Fly (graphic/OLE).
470 bool GotoFly( const OUString
& rName
, FlyCntType eType
,
473 /// Position is a graphic with URL?
474 const SwFrameFormat
* IsURLGrfAtPos( const Point
& rPt
, OUString
* pURL
= nullptr,
475 OUString
*pTargetFrameName
= nullptr,
476 OUString
*pURLDescription
= nullptr ) const;
478 /** For Chain always connect Fly specified by format with that hit by point.
479 rRect contains rect of Fly (for its highlight). */
480 SwChainRet
Chainable( SwRect
&rRect
, const SwFrameFormat
&rSource
, const Point
&rPt
) const;
481 SwChainRet
Chain( SwFrameFormat
&rSource
, const Point
&rPt
);
482 void Chain( SwFrameFormat
&rSource
, const SwFrameFormat
&rDest
);
483 void Unchain( SwFrameFormat
&rFormat
);
484 void HideChainMarker();
485 void SetChainMarker();
487 Size
GetGraphicDefaultSize() const;
489 /// Temporary work around for bug.
490 void CheckUnboundObjects();
492 /// Attention: Ambiguities if multiple selections.
493 bool GetObjAttr( SfxItemSet
&rSet
) const;
494 void SetObjAttr( const SfxItemSet
&rSet
);
496 const SdrObject
* GetBestObject( bool bNext
, GotoObjFlags eType
, bool bFlat
= true, const svx::ISdrObjectFilter
* pFilter
= nullptr );
497 bool GotoObj( bool bNext
, GotoObjFlags eType
= GotoObjFlags::DrawAny
);
499 /// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
500 void SetDragMode( SdrDragMode eSdrDragMode
);
502 // Get the current drag mode
503 SdrDragMode
GetDragMode() const;
505 // Start cropping the selected image
506 void StartCropImage();
508 // RotGrfFlyFrame: check if RotationMode is possible
509 bool IsRotationOfSwGrfNodePossible() const;
511 size_t IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups.
512 bool IsObjSelected( const SdrObject
& rObj
) const;
513 bool IsObjSameLevelWithMarked(const SdrObject
* pObj
) const;
514 const SdrMarkList
* GetMarkList() const{ return GetMarkList_(); };
516 void EndTextEdit(); ///< Deletes object if required.
518 /** Anchor type of selected object, RndStdIds::UNKNOWN if ambiguous or in case of frame selection.
519 Else RndStdIds::FLY_AT_PAGE or RndStdIds::FLY_AT_PARA. */
520 RndStdIds
GetAnchorId() const;
522 /** Process of creating draw objects. At the beginning object type is passed.
523 At the end a Cmd can be passed. Here, SDRCREATE_RESTRAINTEND for end
524 or SdrCreateCmd::NextPoint for a polygon may be relevant.
525 After RESTRAINTEND the object is created and selected.
526 BreakCreate interrupts the process. In this case no object is selected. */
527 bool BeginCreate( sal_uInt16
/*SdrObjKind ?*/ eSdrObjectKind
, const Point
&rPos
);
528 bool BeginCreate( sal_uInt16
/*SdrObjKind ?*/ eSdrObjectKind
, SdrInventor eObjInventor
, const Point
&);
529 void MoveCreate ( const Point
&rPos
);
530 bool EndCreate ( SdrCreateCmd eSdrCreateCmd
);
532 bool IsDrawCreate() const;
533 void CreateDefaultShape( sal_uInt16
/*SdrObjKind ?*/ eSdrObjectKind
, const tools::Rectangle
& rRect
, sal_uInt16 nSlotId
);
535 /// Functions for Rubberbox, ti select Draw-Objects
536 bool BeginMark( const Point
&rPos
);
537 void MoveMark ( const Point
&rPos
);
540 /// Create and destroy group, don't when frame is selected.
541 bool IsGroupSelected(); ///< Can be a mixed selection!
542 void GroupSelection(); ///< Afterwards the group is selected.
543 void UnGroupSelection(); /**< The individual objects are selected, but
544 it is possible that there are groups included. */
546 bool IsGroupAllowed() const;
547 bool IsUnGroupAllowed() const;
549 void MirrorSelection( bool bHorizontal
); ///< Vertical if FALSE.
551 /** frmatr.hxx. Here no enum because of dependencies.
552 bool value only for internal use! Anchor is newly set according
553 to current document position. Anchor is not re-set. */
554 void ChgAnchor( RndStdIds eAnchorId
, bool bSameOnly
= false,
555 bool bPosCorr
= true );
557 bool SetDrawingAttr( SfxItemSet
&rSet
);
559 /** Get selected DrawObj as graphics (MetaFile/Bitmap).
560 Return value indicates if it was converted. */
561 bool GetDrawObjGraphic( SotClipboardFormatId nFormat
, Graphic
& rGrf
) const;
563 void Paste( SvStream
& rStm
, SwPasteSdr nAction
, const Point
* pPt
);
564 bool Paste( const Graphic
&rGrf
, const OUString
& rURL
);
566 comphelper::OInterfaceContainerHelper2
& GetPasteListeners();
568 bool IsAlignPossible() const;
569 void SetCalcFieldValueHdl(Outliner
* pOutliner
);
571 void Insert(const OUString
& rGrfName
,
572 const OUString
& rFltName
,
573 const Graphic
* pGraphic
,
574 const SfxItemSet
* pFlyAttrSet
);
576 /// Insertion of a drawing object which have to be already inserted in the DrawModel.
577 void InsertDrawObj( SdrObject
& rDrawObj
,
578 const Point
& rInsertPosition
);
580 void ReplaceSdrObj( const OUString
& rGrfName
, const Graphic
* pGrf
);
583 /** for starmath formulas anchored 'as char' it aligns it baseline to baseline
584 changing the previous vertical orientation */
585 void AlignFormulaToBaseline( const css::uno::Reference
< css::embed::XEmbeddedObject
>& xObj
);
587 /// aligns all formulas with anchor 'as char' to baseline
588 void AlignAllFormulasToBaseline();
590 /// Provide information about content situated closes to given Point.
591 Point
GetContentPos( const Point
& rPoint
, bool bNext
) const;
593 /// Convert document position into position relative to the current page.
594 Point
GetRelativePagePosition(const Point
& rDocPos
);
596 /// Hide or show layout-selection and pass call to CursorSh.
597 void ShellLoseFocus();
598 void ShellGetFocus();
600 /// PageDescriptor-interface
601 void ChgCurPageDesc( const SwPageDesc
& );
602 size_t GetCurPageDesc( const bool bCalcFrame
= true ) const;
603 size_t GetMousePageDesc( const Point
&rPt
) const;
604 size_t GetPageDescCnt() const;
605 SwPageDesc
* FindPageDescByName( const OUString
& rName
,
606 bool bGetFromPool
= false,
607 size_t* pPos
= nullptr );
609 const SwPageDesc
& GetPageDesc( size_t i
) const;
610 void ChgPageDesc( size_t i
, const SwPageDesc
& );
611 /** if inside all selection only one PageDesc, @return this.
612 Otherwise @return 0 pointer */
613 const SwPageDesc
* GetSelectedPageDescs() const;
615 const SwRect
& GetAnyCurRect( CurRectType eType
,
616 const Point
* pPt
= nullptr,
617 const css::uno::Reference
< css::embed::XEmbeddedObject
>& =
618 css::uno::Reference
< css::embed::XEmbeddedObject
>() ) const;
620 /// Page number of the page containing Point, O if no page.
621 sal_uInt16
GetPageNumber( const Point
&rPoint
) const;
622 bool GetPageNumber( long nYPos
, bool bAtCursorPos
, sal_uInt16
& rPhyNum
, sal_uInt16
& rVirtNum
, OUString
&rDisplay
) const;
624 SwFlyFrameFormat
* InsertObject( const svt::EmbeddedObjectRef
&,
625 SfxItemSet
* pFlyAttrSet
);
626 bool FinishOLEObj(); ///< Shutdown server.
628 void GetTableAttr( SfxItemSet
& ) const;
629 void SetTableAttr( const SfxItemSet
& );
631 bool HasWholeTabSelection() const;
633 /// Is content of a table cell or at least a table cell completely selected?
634 bool HasBoxSelection() const;
636 void InsertRow( sal_uInt16 nCnt
, bool bBehind
);
637 void InsertCol( sal_uInt16 nCnt
, bool bBehind
); // 0 == at the end.
640 bool DeleteRow(bool bCompleteTable
= false);
642 /// insert table rows or columns instead of overwriting the existing table cells
643 SwTable::SearchType m_eTableInsertMode
;
644 SwTable::SearchType
GetTableInsertMode() const { return m_eTableInsertMode
; }
645 void SetTableInsertMode( SwTable::SearchType eFlag
) { m_eTableInsertMode
= eFlag
; }
646 /// table copied to the clipboard by the last private copy
648 bool GetTableCopied() { return bTableCopied
; }
649 void SetTableCopied( bool bCopied
) { bTableCopied
= bCopied
; }
651 bool DeleteTableSel(); ///< Current selection, may be whole table.
653 TableMergeErr
MergeTab(); /**< Merge selected parts of table */
655 /// Split cell vertically or horizontally.
656 void SplitTab( bool bVert
, sal_uInt16 nCnt
, bool bSameHeight
);
657 bool Sort(const SwSortOptions
&); // sorting
659 void SetRowHeight( const SwFormatFrameSize
&rSz
);
661 /// Pointer must be destroyed by caller != 0.
662 std::unique_ptr
<SwFormatFrameSize
> GetRowHeight() const;
664 void SetRowSplit( const SwFormatRowSplit
&rSz
);
665 std::unique_ptr
<SwFormatRowSplit
> GetRowSplit() const;
667 void SetBoxAlign( sal_uInt16 nOrient
);
668 sal_uInt16
GetBoxAlign() const; ///< USHRT_MAX if ambiguous.
670 bool BalanceRowHeight( bool bTstOnly
, const bool bOptimize
= false );
672 void SetTabBorders( const SfxItemSet
& rSet
);
673 void GetTabBorders( SfxItemSet
& rSet
) const;
674 void SetTabLineStyle(const Color
* pColor
, bool bSetLine
= false, const editeng::SvxBorderLine
* pBorderLine
= nullptr);
676 void SetTabBackground( const SvxBrushItem
&rNew
);
677 void GetTabBackground( std::shared_ptr
<SvxBrushItem
>& rToFill
) const;
679 void SetBoxBackground( const SvxBrushItem
&rNew
);
680 bool GetBoxBackground( std::shared_ptr
<SvxBrushItem
>& rToFill
) const; ///< FALSE ambiguous.
682 void SetBoxDirection( const SvxFrameDirectionItem
& rNew
);
683 bool GetBoxDirection( std::shared_ptr
<SvxFrameDirectionItem
>& rToFill
) const; ///< FALSE ambiguous.
685 void SetRowBackground( const SvxBrushItem
&rNew
);
686 bool GetRowBackground( std::shared_ptr
<SvxBrushItem
>& rToFill
) const; ///< FALSE ambiguous.
688 SwTab
WhichMouseTabCol( const Point
&rPt
) const;
689 void GetTabCols( SwTabCols
&rToFill
) const; ///< Info about columns and margins.
690 void SetTabCols( const SwTabCols
&rNew
, bool bCurRowOnly
);
691 void GetMouseTabCols( SwTabCols
&rToFill
, const Point
&rPt
) const;
692 void SetMouseTabCols( const SwTabCols
&rNew
, bool bCurRowOnly
,
695 /// pEnd will be used during MouseMove
696 bool SelTableRowCol( const Point
& rPt
, const Point
* pEnd
, bool bRowDrag
);
698 void GetTabRows( SwTabCols
&rToFill
) const;
699 void SetTabRows( const SwTabCols
&rNew
, bool bCurColOnly
);
700 void GetMouseTabRows( SwTabCols
&rToFill
, const Point
&rPt
) const;
701 void SetMouseTabRows( const SwTabCols
&rNew
, bool bCurColOnly
, const Point
&rPt
);
703 void ProtectCells(); /**< If a table selection exists it is destroyed in case
704 cursor is not allowed in readonly. */
705 void UnProtectCells(); ///< Refers to table selection.
706 void UnProtectTables(); ///< Unprotect all tables in selection.
707 bool HasTableAnyProtection( const OUString
* pTableName
,
708 bool* pFullTableProtection
);
709 bool CanUnProtectCells() const;
711 sal_uInt16
GetRowsToRepeat() const;
712 void SetRowsToRepeat( sal_uInt16 nNumOfRows
);
713 sal_uInt16
GetVirtPageNum() const;
715 /** @return the number of table rows currently selected
716 if the selection start at the top of the table. */
717 sal_uInt16
GetRowSelectionFromTop() const;
719 bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
720 bool IsInHeadline() const { return CheckHeadline( false ); }
722 void AdjustCellWidth( const bool bBalance
, const bool bNoShrink
);
724 /// Not allowed if only empty cells are selected.
725 bool IsAdjustCellWidthAllowed( bool bBalance
= false ) const;
727 /// Set table style of the current table.
728 bool SetTableStyle(const OUString
& rStyleName
);
729 bool SetTableStyle(const SwTableAutoFormat
& rNew
);
731 /// Update the direct formatting according to the current table style.
732 /// @param pTableNode Table node to update. When nullptr, current cursor position is used.
733 /// @param bResetDirect Reset direct formatting that might be applied to the cells.
734 /// @param pStyleName new style to apply
735 bool UpdateTableStyleFormatting(SwTableNode
*pTableNode
= nullptr, bool bResetDirect
= false, OUString
const* pStyleName
= nullptr);
737 bool GetTableAutoFormat( SwTableAutoFormat
& rGet
);
739 void SetColRowWidthHeight( TableChgWidthHeightType eType
, sal_uInt16 nDiff
);
741 void GetAutoSum( OUString
& rFormula
) const;
743 /** Phy: real page count.
744 Virt: consider offset that may have been set by user. */
745 sal_uInt16
GetPhyPageNum() const;
747 void SetNewPageOffset( sal_uInt16 nOffset
);
748 void SetPageOffset( sal_uInt16 nOffset
); ///< Changes last page offset.
749 sal_uInt16
GetPageOffset() const; ///< @return last page offset.
751 void InsertLabel( const SwLabelType eType
, const OUString
&rText
, const OUString
& rSeparator
,
752 const OUString
& rNumberSeparator
,
753 const bool bBefore
, const sal_uInt16 nId
,
754 const OUString
& rCharacterStyle
,
755 const bool bCpyBrd
);
757 /// The ruler needs some information too.
758 sal_uInt16
GetCurColNum( SwGetCurColNumPara
* pPara
= nullptr ) const; //0 == not in any column.
759 sal_uInt16
GetCurMouseColNum( const Point
&rPt
) const;
760 size_t GetCurTabColNum() const; //0 == not in any table.
761 size_t GetCurMouseTabColNum( const Point
&rPt
) const;
762 sal_uInt16
GetCurOutColNum() const; ///< Current outer column.
764 bool IsColRightToLeft() const;
765 bool IsTableRightToLeft() const;
766 bool IsMouseTableRightToLeft( const Point
&rPt
) const;
767 bool IsTableVertical() const;
769 bool IsLastCellInRow() const;
771 /// Width of current range for column-dialog.
772 long GetSectionWidth( SwFormat
const & rFormat
) const;
774 void GetConnectableFrameFormats
775 (SwFrameFormat
& rFormat
, const OUString
& rReference
, bool bSuccessors
,
776 std::vector
< OUString
> & aPrevPageVec
,
777 std::vector
< OUString
> & aThisPageVec
,
778 std::vector
< OUString
> & aNextPageVec
,
779 std::vector
< OUString
> & aRestVec
);
781 /** SwFEShell::GetShapeBackgrd
783 method determines background color of the page the selected drawing
784 object is on and returns this color.
785 If no color is found, because no drawing object is selected or ...,
786 color COL_BLACK (default color on constructing object of class Color)
789 @returns an object of class Color
791 Color
GetShapeBackgrd() const;
793 /** Is default horizontal text direction for selected drawing object right-to-left
795 Because drawing objects only painted for each page only, the default
796 horizontal text direction of a drawing object is given by the corresponding
799 @returns boolean, indicating, if the horizontal text direction of the
800 page, the selected drawing object is on, is right-to-left.
802 bool IsShapeDefaultHoriTextDirR2L() const;
804 void ParkCursorInTab();
806 SwTextNode
* GetNumRuleNodeAtPos(const Point
&rPot
);
807 bool IsNumLabel( const Point
&rPt
, int nMaxOffset
= -1 );
809 static bool IsVerticalModeAtNdAndPos( const SwTextNode
& _rTextNode
,
810 const Point
& _rDocPos
);
812 void ToggleHeaderFooterEdit( );
813 static void SetLineEnds(SfxItemSet
& rAttr
, SdrObject
const & rObj
, sal_uInt16 nSlotId
);
815 SAL_DLLPRIVATE
void ClearColumnRowCache(SwTabFrame
const*);
818 void ClearFEShellTabCols(SwDoc
& rDoc
, SwTabFrame
const*const pFrame
);
822 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */