Bump version to 21.06.18.1
[LibreOffice.git] / sw / inc / fesh.hxx
blob95eb809aebfaae14e13d18681fb4d4b84445977e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
25 #include "swdllapi.h"
26 #include "editsh.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>
35 #include <vector>
36 #include <memory>
38 namespace editeng { class SvxBorderLine; }
40 class SwFlyFrame;
41 class SwTabCols;
42 class SvxBrushItem;
43 class SvxFrameDirectionItem;
44 class SwTableAutoFormat;
45 class SwFrame;
46 class SwFormatFrameSize;
47 class SwFormatRowSplit;
48 class Outliner;
49 class SwFrameFormat;
50 struct SwSortOptions;
51 class SdrMarkList;
52 enum class RndStdIds;
54 namespace svx
56 class ISdrObjectFilter;
58 namespace com::sun::star::embed { class XEmbeddedObject; }
60 // return values for GetFrameType() and GetSelFrameType().
61 //! values can be combined via logical or
62 enum class FrameTypeFlags {
63 NONE = 0,
64 PAGE = 1,
65 HEADER = 2,
66 FOOTER = 4,
67 BODY = 8,
68 COLUMN = 16,
69 TABLE = 32,
70 FLY_FREE = 64,
71 FLY_ATCNT = 128,
72 FLY_INCNT = 256,
73 FOOTNOTE = 512,
74 FTNPAGE = 1024,
75 FLY_ANY = 2048,
76 DRAWOBJ = 4096,
77 COLSECT = 8192,
78 COLSECTOUTTAB = 16384
80 namespace o3tl
82 template<> struct typed_flags<FrameTypeFlags> : is_typed_flags<FrameTypeFlags, 0x7fff> {};
85 //! values can be combined via logical or
86 enum class GotoObjFlags
88 NONE = 0,
89 DrawControl = 1,
90 DrawSimple = 2,
91 DrawAny = DrawControl | DrawSimple,
92 FlyFrame = 4,
93 FlyGrf = 8,
94 FlyOLE = 16,
95 FlyAny = FlyOLE | FlyGrf | FlyFrame,
96 Any = FlyAny | DrawAny,
98 namespace o3tl
100 template<> struct typed_flags<GotoObjFlags> : is_typed_flags<GotoObjFlags, 31> {};
103 //! values can be combined via logical or
104 enum class FlyProtectFlags
106 NONE = 0,
107 Content = 1,
108 Size = 2,
109 Pos = 4,
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. */
114 namespace o3tl
116 template<> struct typed_flags<FlyProtectFlags> : is_typed_flags<FlyProtectFlags, 31> {};
119 // For figuring out contents by position (D&D)
120 enum ObjCntType
122 OBJCNT_NONE,
123 OBJCNT_FLY,
124 OBJCNT_GRF,
125 OBJCNT_OLE,
126 OBJCNT_SIMPLE,
127 OBJCNT_CONTROL,
128 OBJCNT_URLBUTTON,
130 OBJCNT_GROUPOBJ,
131 OBJCNT_DONTCARE ///< Not determinable - different objects are selected.
134 //For GetAnyCurRect
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
159 NONE = 0,
160 Insert = 1,
161 Replace = 2,
162 SetAttr = 3
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
171 enum class SwMove
173 UP = 0,
174 DOWN = 1,
175 LEFT = 2,
176 RIGHT = 3
179 // return values for WhichMouseTabCol
180 enum class SwTab
182 COL_NONE = 0,
183 COL_HORI = 1,
184 COL_VERT = 2,
185 ROW_HORI = 3,
186 ROW_VERT = 4,
187 SEL_HORI = 5,
188 SEL_HORI_RTL = 6,
189 ROWSEL_HORI = 7,
190 ROWSEL_HORI_RTL = 8,
191 COLSEL_HORI = 9,
192 SEL_VERT = 10,
193 ROWSEL_VERT = 11,
194 COLSEL_VERT = 12
197 class SdrDropMarkerOverlay;
198 struct SwColCache;
200 class SW_DLLPUBLIC SwFEShell : public SwEditShell
202 private:
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;
209 /// insert table rows or columns instead of overwriting the existing table cells
210 SwTable::SearchType m_eTableInsertMode;
211 /// table copied to the clipboard by the last private copy
212 bool m_bTableCopied;
214 SAL_DLLPRIVATE SwFlyFrame *FindFlyFrame( const css::uno::Reference < css::embed::XEmbeddedObject >& ) const;
216 /// Terminate actions for all shells and call ChangeLink.
217 SAL_DLLPRIVATE void EndAllActionAndCall();
219 SAL_DLLPRIVATE void ScrollTo( const Point &rPt );
221 SAL_DLLPRIVATE void ChangeOpaque( SdrLayerID nLayerId );
223 /** Used for mouse operations on a table:
224 @return a cell frame that is 'close' to rPt. */
225 SAL_DLLPRIVATE const SwFrame *GetBox( const Point &rPt, bool* pbRow = nullptr, bool* pbCol = nullptr ) const;
227 // 0 == not in any column.
228 SAL_DLLPRIVATE static sal_uInt16 GetCurColNum_( const SwFrame *pFrame,
229 SwGetCurColNumPara* pPara );
231 SAL_DLLPRIVATE void GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const;
232 SAL_DLLPRIVATE void GetTabRows_(SwTabCols &rToFill, const SwFrame *pBox) const;
234 SAL_DLLPRIVATE bool ImpEndCreate();
236 /// Methods for copying of draw objects.
237 SAL_DLLPRIVATE bool CopyDrawSel( SwFEShell& rDestShell, const Point& rSttPt,
238 const Point& rInsPt, bool bIsMove,
239 bool bSelectInsert );
241 /// Get list of marked SdrObjects;
242 /// helper method for GetSelFrameType, IsSelContainsControl.
243 SAL_DLLPRIVATE const SdrMarkList* GetMarkList_() const;
245 SAL_DLLPRIVATE bool CheckHeadline( bool bRepeat ) const;
247 using SwEditShell::Copy;
249 public:
251 using SwEditShell::Insert;
253 SwFEShell( SwDoc& rDoc, vcl::Window *pWin, const SwViewOption *pOpt );
254 SwFEShell( SwEditShell& rShell, vcl::Window *pWin );
255 virtual ~SwFEShell() override;
257 /// Copy and Paste methods for internal clipboard.
258 void Copy( SwDoc& rClpDoc, const OUString* pNewClpText = nullptr );
259 bool Paste( SwDoc& rClpDoc, bool bNestedTable = false );
261 /// Paste some pages into another doc - used in mailmerge.
262 void PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt16 nEndPage);
264 /// Copy-Method for Drag&Drop
265 bool Copy( SwFEShell&, const Point& rSttPt, const Point& rInsPt,
266 bool bIsMove = false, bool bSelectInsert = true );
268 void SelectFlyFrame( SwFlyFrame& rFrame );
270 /// Is selected frame within another frame?
271 const SwFrameFormat* IsFlyInFly();
273 /** If an object has been given, exactly this object is selected
274 (instead of searching over position). */
275 bool SelectObj( const Point& rSelPt, sal_uInt8 nFlag = 0, SdrObject *pObj = nullptr );
276 void DelSelectedObj();
278 /** Move selection upwards or downwards (Z-Order).
279 TRUE = to top or bottom.
280 FALSE = run past one other. */
281 void SelectionToTop ( bool bTop = true );
282 void SelectionToBottom( bool bBottom = true );
284 SdrLayerID GetLayerId() const; ///< 1 Heaven, 0 Hell, SDRLAYER_NOTFOUND Ambiguous.
285 void SelectionToHeaven(); ///< Above document.
286 void SelectionToHell(); ///< Below document.
288 /** The following two methods return enum SdrHdlKind.
289 Declared as int in order to spare including SVDRAW.HXX. */
290 bool IsObjSelectable( const Point& rPt );
291 /// Same as IsObjSelectable(), but return the object as well.
292 SdrObject* GetObjAt(const Point& rPt);
293 bool IsInsideSelectedObj( const Point& rPt ); ///< returns enum values
294 /** Test if there is a draw object at that position and if it should be selected.
295 The 'should' is aimed at Writer text fly frames which may be in front of
296 the draw object. */
297 bool ShouldObjectBeSelected(const Point& rPt);
299 bool MoveAnchor( SwMove nDir );
301 /** @return if Upper of frame at current position is section frame
302 Currently only used by the rules. To be replaced by something more
303 sophisticated one day. */
304 bool IsDirectlyInSection() const;
306 /** For return values see above FrameType.
307 pPt: Cursr or DocPos respectively; bStopAtFly: Stop at flys or continue over anchor.
308 Although (0,TRUE) is kind of a standard, the parameters are not defaulted here
309 in order to force more conscious use especially of bStopAtFly. */
310 FrameTypeFlags GetFrameType( const Point *pPt, bool bStopAtFly ) const;
311 FrameTypeFlags GetSelFrameType() const; //Selection (Drawing)
313 /** check whether selected frame contains a control;
314 * companion method to GetSelFrameType, used for preventing
315 * drag&drop of controls into header */
316 bool IsSelContainsControl() const;
318 static ObjCntType GetObjCntType( const SdrObject& rObj );
319 ObjCntType GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const;
320 ObjCntType GetObjCntTypeOfSelection() const;
322 /// For adjustment of PosAttr when anchor changes.
323 SwRect GetObjRect() const;
325 /// For moving flys with keyboard.
326 SwRect GetFlyRect() const;
327 /** i#17567 - adjustments to allow negative vertical positions for fly frames anchored
328 to paragraph or to character.
329 i#18732 - adjustments for new option 'FollowTextFlow'
330 i#22341 - adjustments for new vertical alignment at top of line */
331 void CalcBoundRect( SwRect& _orRect,
332 const RndStdIds _nAnchorId,
333 const sal_Int16 _eHoriRelOrient = css::text::RelOrientation::FRAME,
334 const sal_Int16 _eVertRelOrient = css::text::RelOrientation::FRAME,
335 const SwPosition* _pToCharContentPos = nullptr,
336 const bool _bFollowTextFlow = false,
337 bool _bMirror = false,
338 Point* _opRef = nullptr,
339 Size* _opPercent = nullptr,
340 const SwFormatFrameSize* pFormatFrameSize = nullptr ) const;
342 /// Set size of draw objects.
343 void SetObjRect( const SwRect& rRect );
345 void BeginDrag( const Point *pPt, bool bProp );
346 void Drag ( const Point *pPt, bool bProp );
347 void EndDrag ();
348 void BreakDrag();
350 /// Methods for status line.
351 Point GetAnchorObjDiff() const;
352 Point GetObjAbsPos() const;
353 Size GetObjSize() const;
355 /// SS for envelopes: get all page-bound objects and set them to new page.
356 void GetPageObjs( std::vector<SwFrameFormat*>& rFillArr );
357 void SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr );
359 /// Show current selection (frame / draw object as required).
360 virtual void MakeSelVisible() override;
362 /** @return FrameFormat of object that may be under Point.
363 Object does not become selected! */
364 const SwFrameFormat* GetFormatFromObj( const Point& rPt, SwRect** pRectToFill = nullptr ) const;
366 /// @return a format too, if the point is over the text of any fly.
367 const SwFrameFormat* GetFormatFromAnyObj( const Point& rPt ) const;
369 /** Which Protection is set at selected object? */
370 FlyProtectFlags IsSelObjProtected( FlyProtectFlags eType ) const;
372 /** Deliver graphic in rName besides graphic name. If graphic is
373 linked give name with path. rbLink is TRUE if graphic is linked. */
374 const Graphic *GetGrfAtPos( const Point &rDocPos,
375 OUString &rName, bool &rbLink ) const;
377 OUString GetObjTitle() const;
378 void SetObjTitle( const OUString& rTitle );
379 OUString GetObjDescription() const;
380 void SetObjDescription( const OUString& rDescription );
382 bool IsFrameSelected() const;
383 bool GetFlyFrameAttr( SfxItemSet &rSet ) const;
384 bool SetFlyFrameAttr( SfxItemSet &rSet );
385 static SfxItemSet makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor);
386 void ResetFlyFrameAttr( const SfxItemSet* pSet );
387 const SwFrameFormat *NewFlyFrame( const SfxItemSet &rSet, bool bAnchValid = false,
388 SwFrameFormat *pParent = nullptr );
389 void SetFlyPos( const Point &rAbsPos);
390 Point FindAnchorPos( const Point &rAbsPos, bool bMoveIt = false );
392 /** Determines whether a frame or its environment is vertically formatted and right-to-left.
393 also determines, if frame or its environment is in Mongolian layout (vertical left-to-right)
394 - add output parameter <bVertL2R> */
395 bool IsFrameVertical(const bool bEnvironment, bool& bRightToLeft, bool& bVertL2R) const;
397 SwFrameFormat* GetSelectedFrameFormat() const; ///< If frame then frame style, else 0.
398 void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point const * pDocPos = nullptr ); ///< If frame then set frame style.
400 // Get selected fly
401 SwFlyFrame* GetSelectedFlyFrame() const;
403 // Get current fly in which the cursor is positioned
404 SwFlyFrame* GetCurrFlyFrame(const bool bCalcFrame = true) const;
406 // Get selected fly, but if none Get current fly in which the cursor is positioned
407 SwFlyFrame* GetSelectedOrCurrFlyFrame() const;
409 /// Find/delete fly containing the cursor.
410 SwFrameFormat* WizardGetFly();
412 /// Independent selecting of flys.
413 bool GotoNextFly( GotoObjFlags eType = GotoObjFlags::FlyAny )
414 { return GotoObj( true, eType ); }
415 bool GotoPrevFly( GotoObjFlags eType = GotoObjFlags::FlyAny)
416 { return GotoObj( false, eType); }
418 /// Iterate over flys - for Basic-collections.
419 size_t GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes = false ) const;
420 const SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes = false) const;
422 std::vector<SwFrameFormat const*> GetFlyFrameFormats(
423 FlyCntType eType, bool bIgnoreTextBoxes);
425 /// If a fly is selected, it draws cursor into the first ContentFrame.
426 const SwFrameFormat* SelFlyGrabCursor();
428 /// Get FlyFrameFormat; for UI macro linkage at Flys
429 const SwFrameFormat* GetFlyFrameFormat() const;
430 SwFrameFormat* GetFlyFrameFormat();
432 /** OLE. Server requires new size. Desired values are adjusted as frame attributes.
433 If the values are not allowed, the formatting clips and determines scaling.
434 See CalcAndSetScale().
435 The @return value is the applied size. */
436 Size RequestObjectResize( const SwRect &rRect, const css::uno::Reference < css::embed::XEmbeddedObject >& );
438 /// The layout has been changed, so the active object has to be moved after that
439 virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
441 /** Client for OleObject has to be up-to-date regarding scaling.
442 Implemented in WrtShell.
443 If a pointer is passed on a size, this is the object's current core-size.
444 Else the size is provided via GetCurFlyRect(). */
445 virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
446 const SwRect *pFlyPrtRect = nullptr,
447 const SwRect *pFlyFrameRect = nullptr,
448 const bool bNoTextFramePrtAreaChanged = false ) = 0;
450 /** Connect objects with ActivateWhenVisible at Paint.
451 Called by notxtfrm::Paint, implemented in wrtsh. */
452 virtual void ConnectObj( svt::EmbeddedObjectRef&,
453 const SwRect &rPrt,
454 const SwRect &rFrame ) = 0;
456 /// Check resize of OLE-Object.
457 bool IsCheckForOLEInCaption() const { return m_bCheckForOLEInCaption; }
458 void SetCheckForOLEInCaption( bool bFlag ) { m_bCheckForOLEInCaption = bFlag; }
460 /// Set name at selected FlyFrame.
461 void SetFlyName( const OUString& rName );
462 OUString GetFlyName() const;
464 /// get reference to OLE object (if there is one) for selected FlyFrame
465 css::uno::Reference < css::embed::XEmbeddedObject > GetOleRef() const;
467 /// Created unique name for frame.
468 OUString GetUniqueGrfName() const;
469 OUString GetUniqueOLEName() const;
470 OUString GetUniqueFrameName() const;
471 OUString GetUniqueShapeName() const;
473 /// Jump to named Fly (graphic/OLE).
474 bool GotoFly( const OUString& rName, FlyCntType eType,
475 bool bSelFrame );
477 /// Position is a graphic with URL?
478 const SwFrameFormat* IsURLGrfAtPos( const Point& rPt, OUString* pURL = nullptr,
479 OUString *pTargetFrameName = nullptr,
480 OUString *pURLDescription = nullptr ) const;
482 /** For Chain always connect Fly specified by format with that hit by point.
483 rRect contains rect of Fly (for its highlight). */
484 SwChainRet Chainable( SwRect &rRect, const SwFrameFormat &rSource, const Point &rPt ) const;
485 SwChainRet Chain( SwFrameFormat &rSource, const Point &rPt );
486 void Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
487 void Unchain( SwFrameFormat &rFormat );
488 void HideChainMarker();
489 void SetChainMarker();
491 Size GetGraphicDefaultSize() const;
493 /// Temporary work around for bug.
494 void CheckUnboundObjects();
496 /// Attention: Ambiguities if multiple selections.
497 bool GetObjAttr( SfxItemSet &rSet ) const;
498 void SetObjAttr( const SfxItemSet &rSet );
500 const SdrObject* GetBestObject( bool bNext, GotoObjFlags eType, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = nullptr );
501 bool GotoObj( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny);
503 /// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
504 void SetDragMode( SdrDragMode eSdrDragMode );
506 // Get the current drag mode
507 SdrDragMode GetDragMode() const;
509 // Start cropping the selected image
510 void StartCropImage();
512 // RotGrfFlyFrame: check if RotationMode is possible
513 bool IsRotationOfSwGrfNodePossible() const;
515 size_t IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups.
516 bool IsObjSelected( const SdrObject& rObj ) const;
517 bool IsObjSameLevelWithMarked(const SdrObject* pObj) const;
518 const SdrMarkList* GetMarkList() const{ return GetMarkList_(); };
520 void EndTextEdit(); ///< Deletes object if required.
522 /** Anchor type of selected object, RndStdIds::UNKNOWN if ambiguous or in case of frame selection.
523 Else RndStdIds::FLY_AT_PAGE or RndStdIds::FLY_AT_PARA. */
524 RndStdIds GetAnchorId() const;
526 /** Process of creating draw objects. At the beginning object type is passed.
527 At the end a Cmd can be passed. Here, SDRCREATE_RESTRAINTEND for end
528 or SdrCreateCmd::NextPoint for a polygon may be relevant.
529 After RESTRAINTEND the object is created and selected.
530 BreakCreate interrupts the process. In this case no object is selected. */
531 bool BeginCreate( SdrObjKind eSdrObjectKind, const Point &rPos );
532 bool BeginCreate( SdrObjKind eSdrObjectKind, SdrInventor eObjInventor, const Point &);
533 void MoveCreate ( const Point &rPos );
534 bool EndCreate ( SdrCreateCmd eSdrCreateCmd );
535 void BreakCreate();
536 bool IsDrawCreate() const;
537 void CreateDefaultShape(SdrObjKind eSdrObjectKind, const tools::Rectangle& rRect, sal_uInt16 nSlotId);
539 /// Functions for Rubberbox, ti select Draw-Objects
540 bool BeginMark( const Point &rPos );
541 void MoveMark ( const Point &rPos );
542 bool EndMark ();
544 /// Create and destroy group, don't when frame is selected.
545 bool IsGroupSelected(); ///< Can be a mixed selection!
546 void GroupSelection(); ///< Afterwards the group is selected.
547 void UnGroupSelection(); /**< The individual objects are selected, but
548 it is possible that there are groups included. */
550 bool IsGroupAllowed() const;
551 bool IsUnGroupAllowed() const;
553 void MirrorSelection( bool bHorizontal ); ///< Vertical if FALSE.
555 /** frmatr.hxx. Here no enum because of dependencies.
556 bool value only for internal use! Anchor is newly set according
557 to current document position. Anchor is not re-set. */
558 void ChgAnchor( RndStdIds eAnchorId, bool bSameOnly = false,
559 bool bPosCorr = true );
561 bool SetDrawingAttr( SfxItemSet &rSet );
563 /** Get selected DrawObj as graphics (MetaFile/Bitmap).
564 Return value indicates if it was converted. */
565 bool GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf ) const;
567 void Paste( SvStream& rStm, SwPasteSdr nAction, const Point* pPt );
568 bool Paste( const Graphic &rGrf, const OUString& rURL );
570 comphelper::OInterfaceContainerHelper2& GetPasteListeners();
572 bool IsAlignPossible() const;
573 void SetCalcFieldValueHdl(Outliner* pOutliner);
575 void Insert(const OUString& rGrfName,
576 const OUString& rFltName,
577 const Graphic* pGraphic,
578 const SfxItemSet* pFlyAttrSet );
580 /// Insertion of a drawing object which have to be already inserted in the DrawModel.
581 void InsertDrawObj( SdrObject& rDrawObj,
582 const Point& rInsertPosition );
584 void ReplaceSdrObj( const OUString& rGrfName, const Graphic* pGrf );
586 // --> #i972#
587 /** for starmath formulas anchored 'as char' it aligns it baseline to baseline
588 changing the previous vertical orientation */
589 void AlignFormulaToBaseline( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj );
591 /// aligns all formulas with anchor 'as char' to baseline
592 void AlignAllFormulasToBaseline();
594 /// Provide information about content situated closes to given Point.
595 Point GetContentPos( const Point& rPoint, bool bNext ) const;
597 /// Convert document position into position relative to the current page.
598 Point GetRelativePagePosition(const Point& rDocPos);
600 /// Hide or show layout-selection and pass call to CursorSh.
601 void ShellLoseFocus();
602 void ShellGetFocus();
604 /// PageDescriptor-interface
605 void ChgCurPageDesc( const SwPageDesc& );
606 size_t GetCurPageDesc( const bool bCalcFrame = true ) const;
607 size_t GetMousePageDesc( const Point &rPt ) const;
608 size_t GetPageDescCnt() const;
609 SwPageDesc* FindPageDescByName( const OUString& rName,
610 bool bGetFromPool = false,
611 size_t* pPos = nullptr );
613 const SwPageDesc& GetPageDesc( size_t i ) const;
614 void ChgPageDesc( size_t i, const SwPageDesc& );
615 /** if inside all selection only one PageDesc, @return this.
616 Otherwise @return 0 pointer */
617 const SwPageDesc* GetSelectedPageDescs() const;
619 const SwRect& GetAnyCurRect( CurRectType eType,
620 const Point* pPt = nullptr,
621 const css::uno::Reference < css::embed::XEmbeddedObject >& =
622 css::uno::Reference < css::embed::XEmbeddedObject >() ) const;
624 /// Page number of the page containing Point, O if no page.
625 sal_uInt16 GetPageNumber( const Point &rPoint ) const;
626 bool GetPageNumber( tools::Long nYPos, bool bAtCursorPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, OUString &rDisplay ) const;
628 SwFlyFrameFormat* InsertObject( const svt::EmbeddedObjectRef&,
629 SfxItemSet* pFlyAttrSet );
630 bool FinishOLEObj(); ///< Shutdown server.
632 void GetTableAttr( SfxItemSet & ) const;
633 void SetTableAttr( const SfxItemSet & );
635 bool HasWholeTabSelection() const;
637 /// Is content of a table cell or at least a table cell completely selected?
638 bool HasBoxSelection() const;
640 void InsertRow( sal_uInt16 nCnt, bool bBehind );
641 void InsertCol( sal_uInt16 nCnt, bool bBehind ); // 0 == at the end.
642 bool DeleteCol();
643 void DeleteTable();
644 bool DeleteRow(bool bCompleteTable = false);
646 SwTable::SearchType GetTableInsertMode() const { return m_eTableInsertMode; }
647 void SetTableInsertMode( SwTable::SearchType eFlag ) { m_eTableInsertMode = eFlag; }
649 bool GetTableCopied() const { return m_bTableCopied; }
650 void SetTableCopied( bool bCopied ) { m_bTableCopied = bCopied; }
652 bool DeleteTableSel(); ///< Current selection, may be whole table.
654 TableMergeErr MergeTab(); /**< Merge selected parts of table */
656 /// Split cell vertically or horizontally.
657 void SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight );
658 bool Sort(const SwSortOptions&); // sorting
660 void SetRowHeight( const SwFormatFrameSize &rSz );
662 /// Pointer must be destroyed by caller != 0.
663 std::unique_ptr<SwFormatFrameSize> GetRowHeight() const;
665 void SetRowSplit( const SwFormatRowSplit &rSz );
666 std::unique_ptr<SwFormatRowSplit> GetRowSplit() const;
668 void SetBoxAlign( sal_uInt16 nOrient );
669 sal_uInt16 GetBoxAlign() const; ///< USHRT_MAX if ambiguous.
671 bool BalanceRowHeight( bool bTstOnly, const bool bOptimize = false );
673 void SetTabBorders( const SfxItemSet& rSet );
674 void GetTabBorders( SfxItemSet& rSet) const;
675 void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = nullptr);
677 void SetTabBackground( const SvxBrushItem &rNew );
678 void GetTabBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const;
680 void SetBoxBackground( const SvxBrushItem &rNew );
681 bool GetBoxBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
683 void SetBoxDirection( const SvxFrameDirectionItem& rNew );
684 bool GetBoxDirection( std::unique_ptr<SvxFrameDirectionItem>& rToFill ) const; ///< FALSE ambiguous.
686 void SetRowBackground( const SvxBrushItem &rNew );
687 bool GetRowBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
689 SwTab WhichMouseTabCol( const Point &rPt ) const;
690 void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins.
691 void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly );
692 void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const;
693 void SetMouseTabCols( const SwTabCols &rNew, bool bCurRowOnly,
694 const Point &rPt );
696 /// pEnd will be used during MouseMove
697 bool SelTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag );
699 void GetTabRows( SwTabCols &rToFill ) const;
700 void SetTabRows( const SwTabCols &rNew, bool bCurColOnly );
701 void GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const;
702 void SetMouseTabRows( const SwTabCols &rNew, bool bCurColOnly, const Point &rPt );
704 void ProtectCells(); /**< If a table selection exists it is destroyed in case
705 cursor is not allowed in readonly. */
706 void UnProtectCells(); ///< Refers to table selection.
707 void UnProtectTables(); ///< Unprotect all tables in selection.
708 bool HasTableAnyProtection( const OUString* pTableName,
709 bool* pFullTableProtection );
710 bool CanUnProtectCells() const;
712 sal_uInt16 GetRowsToRepeat() const;
713 void SetRowsToRepeat( sal_uInt16 nNumOfRows );
714 sal_uInt16 GetVirtPageNum() const;
716 /** @return the number of table rows currently selected
717 if the selection start at the top of the table. */
718 sal_uInt16 GetRowSelectionFromTop() const;
720 bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
721 bool IsInHeadline() const { return CheckHeadline( false ); }
723 void AdjustCellWidth( const bool bBalance, const bool bNoShrink );
725 /// Not allowed if only empty cells are selected.
726 bool IsAdjustCellWidthAllowed( bool bBalance = false ) const;
728 /// Set table style of the current table.
729 bool SetTableStyle(const OUString& rStyleName);
730 bool SetTableStyle(const SwTableAutoFormat& rNew);
732 /// Update the direct formatting according to the current table style.
733 /// @param pTableNode Table node to update. When nullptr, current cursor position is used.
734 /// @param bResetDirect Reset direct formatting that might be applied to the cells.
735 /// @param pStyleName new style to apply
736 bool UpdateTableStyleFormatting(SwTableNode *pTableNode = nullptr, bool bResetDirect = false, OUString const* pStyleName = nullptr);
738 bool GetTableAutoFormat( SwTableAutoFormat& rGet );
740 void SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16 nDiff );
742 void GetAutoSum( OUString& rFormula ) const;
744 /** Phy: real page count.
745 Virt: consider offset that may have been set by user. */
746 sal_uInt16 GetPhyPageNum() const;
748 void SetNewPageOffset( sal_uInt16 nOffset );
749 void SetPageOffset( sal_uInt16 nOffset ); ///< Changes last page offset.
750 sal_uInt16 GetPageOffset() const; ///< @return last page offset.
752 void InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
753 const OUString& rNumberSeparator,
754 const bool bBefore, const sal_uInt16 nId,
755 const OUString& rCharacterStyle,
756 const bool bCpyBrd );
758 /// The ruler needs some information too.
759 sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = nullptr ) const; //0 == not in any column.
760 sal_uInt16 GetCurMouseColNum( const Point &rPt ) const;
761 size_t GetCurTabColNum() const; //0 == not in any table.
762 size_t GetCurMouseTabColNum( const Point &rPt ) const;
763 sal_uInt16 GetCurOutColNum() const; ///< Current outer column.
765 bool IsColRightToLeft() const;
766 bool IsTableRightToLeft() const;
767 bool IsMouseTableRightToLeft( const Point &rPt ) const;
768 bool IsTableVertical() const;
770 bool IsLastCellInRow() const;
772 /// Width of current range for column-dialog.
773 tools::Long GetSectionWidth( SwFormat const & rFormat ) const;
775 void GetConnectableFrameFormats
776 (SwFrameFormat & rFormat, const OUString & rReference, bool bSuccessors,
777 std::vector< OUString > & aPrevPageVec,
778 std::vector< OUString > & aThisPageVec,
779 std::vector< OUString > & aNextPageVec,
780 std::vector< OUString > & aRestVec);
782 /** SwFEShell::GetShapeBackgrd
784 method determines background color of the page the selected drawing
785 object is on and returns this color.
786 If no color is found, because no drawing object is selected or ...,
787 color COL_BLACK (default color on constructing object of class Color)
788 is returned.
790 @returns an object of class Color
792 Color GetShapeBackgrd() const;
794 /** Is default horizontal text direction for selected drawing object right-to-left
796 Because drawing objects only painted for each page only, the default
797 horizontal text direction of a drawing object is given by the corresponding
798 page property.
800 @returns boolean, indicating, if the horizontal text direction of the
801 page, the selected drawing object is on, is right-to-left.
803 bool IsShapeDefaultHoriTextDirR2L() const;
805 void ParkCursorInTab();
807 SwTextNode * GetNumRuleNodeAtPos(const Point &rPot);
808 bool IsNumLabel( const Point &rPt, int nMaxOffset = -1 );
810 static bool IsVerticalModeAtNdAndPos( const SwTextNode& _rTextNode,
811 const Point& _rDocPos );
813 void ToggleHeaderFooterEdit( );
814 static void SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj, sal_uInt16 nSlotId);
816 SAL_DLLPRIVATE void ClearColumnRowCache(SwTabFrame const*);
819 void ClearFEShellTabCols(SwDoc & rDoc, SwTabFrame const*const pFrame);
821 #endif
823 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */