Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / fesh.hxx
blobb3bbfcda8aa9aa96ba17011eb915122961b8afc3
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>
23 #include <com/sun/star/embed/XClassifiedObject.hpp>
24 #include <com/sun/star/embed/XEmbeddedObject.hpp>
26 #include <svx/svdobj.hxx>
27 #include "swdllapi.h"
28 #include <editsh.hxx>
29 #include <flyenum.hxx>
31 #include <svx/svdtypes.hxx>
32 #include <sot/formats.hxx>
33 #include <rtl/ustring.hxx>
34 #include <svtools/embedhlp.hxx>
35 #include <o3tl/typed_flags_set.hxx>
37 #include <vector>
38 #include <memory>
40 namespace editeng { class SvxBorderLine; }
42 class SwFlyFrm;
43 class SwTabCols;
44 class SvxBrushItem;
45 class SvxFrameDirectionItem;
46 class SwTableAutoFormat;
47 class SwFrm;
48 class SwFormatFrmSize;
49 class SwFormatRowSplit;
50 class SdrObject;
51 class Color;
52 class Outliner;
53 class SotDataObject;
54 class SwFrameFormat;
55 struct SwSortOptions;
56 class SdrMarkList;
58 namespace svx
60 class ISdrObjectFilter;
63 // return values for GetFrmType() und GetSelFrmType().
64 //! values can be combined via logical or
65 enum class FrmTypeFlags {
66 NONE = 0,
67 PAGE = 1,
68 HEADER = 2,
69 FOOTER = 4,
70 BODY = 8,
71 COLUMN = 16,
72 TABLE = 32,
73 FLY_FREE = 64,
74 FLY_ATCNT = 128,
75 FLY_INCNT = 256,
76 FOOTNOTE = 512,
77 FTNPAGE = 1024,
78 FLY_ANY = 2048,
79 DRAWOBJ = 4096,
80 COLSECT = 8192,
81 COLSECTOUTTAB = 16384
83 namespace o3tl
85 template<> struct typed_flags<FrmTypeFlags> : is_typed_flags<FrmTypeFlags, 0x4fff> {};
88 //! values can be combined via logical or
89 #define GOTOOBJ_DRAW_CONTROL (sal_uInt16) 1
90 #define GOTOOBJ_DRAW_SIMPLE (sal_uInt16) 2
91 #define GOTOOBJ_DRAW_ANY (sal_uInt16) 3
92 #define GOTOOBJ_FLY_FRM (sal_uInt16) 4
93 #define GOTOOBJ_FLY_GRF (sal_uInt16) 8
94 #define GOTOOBJ_FLY_OLE (sal_uInt16) 16
95 #define GOTOOBJ_FLY_ANY (sal_uInt16) 28
96 #define GOTOOBJ_GOTO_ANY (sal_uInt16) 31
98 //! values can be combined via logical or
99 #define FLYPROTECT_CONTENT (sal_uInt16) 1
100 #define FLYPROTECT_SIZE (sal_uInt16) 2
101 #define FLYPROTECT_POS (sal_uInt16) 4
102 #define FLYPROTECT_PARENT (sal_uInt16) 8 ///< Check only parents.
103 #define FLYPROTECT_FIXED (sal_uInt16) 16 /**< Only protection that cannot be withdrawn
104 e.g. by OLE-server; also relevant for dialog. */
106 // For figuring out contents by position (D&D)
107 enum ObjCntType
109 OBJCNT_NONE,
110 OBJCNT_FLY,
111 OBJCNT_GRF,
112 OBJCNT_OLE,
113 OBJCNT_SIMPLE,
114 OBJCNT_CONTROL,
115 OBJCNT_URLBUTTON,
117 OBJCNT_GROUPOBJ,
118 OBJCNT_DONTCARE ///< Not determinable - different objects are selected.
121 //For GetAnyCurRect
122 enum CurRectType
124 RECT_PAGE, ///< Rect of current page.
125 RECT_PAGE_CALC, ///< ... page will be formatted if required.
126 RECT_PAGE_PRT, ///< Rect of current PrtArea of page.
127 RECT_FRM, ///< Rect of current frame.
128 RECT_FLY_EMBEDDED, ///< Rect of current FlyFrm.
129 RECT_FLY_PRT_EMBEDDED, ///< Rect of PrtArea of FlyFrm
130 RECT_SECTION, ///< Rect of current section.
131 RECT_OUTTABSECTION, ///< Rect of current section but outside of table.
132 RECT_SECTION_PRT, ///< Rect of current PrtArea of section.
133 RECT_OUTTABSECTION_PRT, ///< Rect of current PrtArea of section but outside table.
134 RECT_HEADERFOOTER, ///< Rect of current header/footer
135 RECT_HEADERFOOTER_PRT, ///< Rect of PrtArea of current headers/footers
137 RECT_PAGES_AREA ///< Rect covering the pages area
140 struct SwGetCurColNumPara
142 const SwFrameFormat* pFrameFormat;
143 const SwRect* pPrtRect, *pFrmRect;
144 SwGetCurColNumPara() : pFrameFormat( 0 ), pPrtRect( 0 ), pFrmRect( 0 ) {}
147 #define SW_PASTESDR_INSERT 1
148 #define SW_PASTESDR_REPLACE 2
149 #define SW_PASTESDR_SETATTR 3
151 #define SW_ADD_SELECT 1
152 #define SW_ENTER_GROUP 2
153 #define SW_LEAVE_FRAME 4
155 enum class SwMove
157 UP = 0,
158 DOWN = 1,
159 LEFT = 2,
160 RIGHT = 3
163 // return values for WhichMouseTabCol
164 enum class SwTab
166 COL_NONE = 0,
167 COL_HORI = 1,
168 COL_VERT = 2,
169 ROW_HORI = 3,
170 ROW_VERT = 4,
171 SEL_HORI = 5,
172 SEL_HORI_RTL = 6,
173 ROWSEL_HORI = 7,
174 ROWSEL_HORI_RTL = 8,
175 COLSEL_HORI = 9,
176 SEL_VERT = 10,
177 ROWSEL_VERT = 11,
178 COLSEL_VERT = 12
181 class SdrDropMarkerOverlay;
183 class SW_DLLPUBLIC SwFEShell : public SwEditShell
185 private:
186 std::unique_ptr<SdrDropMarkerOverlay> m_pChainTo;
187 std::unique_ptr<SdrDropMarkerOverlay> m_pChainFrom;
188 bool m_bCheckForOLEInCaption;
190 SAL_DLLPRIVATE SwFlyFrm *FindFlyFrm() const;
191 SAL_DLLPRIVATE SwFlyFrm *FindFlyFrm( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
193 /// Terminate actions for all shells and call ChangeLink.
194 SAL_DLLPRIVATE void EndAllActionAndCall();
196 SAL_DLLPRIVATE void ScrollTo( const Point &rPt );
198 SAL_DLLPRIVATE void ChangeOpaque( SdrLayerID nLayerId );
200 /** Used for mouse operations on a table:
201 @return a cell frame that is 'close' to rPt. */
202 SAL_DLLPRIVATE const SwFrm *GetBox( const Point &rPt, bool* pbRow = 0, bool* pbCol = 0 ) const;
204 // 0 == not in any column.
205 SAL_DLLPRIVATE sal_uInt16 _GetCurColNum( const SwFrm *pFrm,
206 SwGetCurColNumPara* pPara ) const;
208 SAL_DLLPRIVATE void _GetTabCols( SwTabCols &rToFill, const SwFrm *pBox ) const;
209 SAL_DLLPRIVATE void _GetTabRows( SwTabCols &rToFill, const SwFrm *pBox ) const;
211 SAL_DLLPRIVATE bool ImpEndCreate();
213 SAL_DLLPRIVATE ObjCntType GetObjCntType( const SdrObject& rObj ) const;
215 /// Methods for copying of draw objects.
216 SAL_DLLPRIVATE bool CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt,
217 const Point& rInsPt, bool bIsMove,
218 bool bSelectInsert );
220 /// Get list of marked SdrObjects;
221 /// helper method for GetSelFrmType, IsSelContainsControl.
222 SAL_DLLPRIVATE const SdrMarkList* _GetMarkList() const;
224 SAL_DLLPRIVATE bool CheckHeadline( bool bRepeat ) const;
226 using SwEditShell::Copy;
228 public:
230 using SwEditShell::Insert;
232 TYPEINFO_OVERRIDE();
233 SwFEShell( SwDoc& rDoc, vcl::Window *pWin, const SwViewOption *pOpt = 0 );
234 SwFEShell( SwEditShell& rShell, vcl::Window *pWin );
235 virtual ~SwFEShell();
237 /// Copy and Paste methods for internal clipboard.
238 bool Copy( SwDoc* pClpDoc, const OUString* pNewClpText = 0 );
239 bool Paste( SwDoc* pClpDoc, bool bIncludingPageFrames = false);
241 /// Paste some pages into another doc - used in mailmerge.
242 bool PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt16 nEndPage);
244 /// Copy-Method for Drag&Drop
245 bool Copy( SwFEShell*, const Point& rSttPt, const Point& rInsPt,
246 bool bIsMove = false, bool bSelectInsert = true );
248 void SelectFlyFrm( SwFlyFrm& rFrm, bool bNew = false );
250 /// Is selected frame within another frame?
251 const SwFrameFormat* IsFlyInFly();
253 /** If an object as been given, exactly this object is selected
254 (instead of searching over position). */
255 bool SelectObj( const Point& rSelPt, sal_uInt8 nFlag = 0, SdrObject *pObj = 0 );
256 void DelSelectedObj();
258 /** Move selection upwards or downwards (Z-Order).
259 TRUE = to top or bottom.
260 FALSE = run past one other. */
261 void SelectionToTop ( bool bTop = true );
262 void SelectionToBottom( bool bBottom = true );
264 short GetLayerId() const; ///< 1 Heaven, 0 Hell, -1 Ambiguous.
265 void SelectionToHeaven(); ///< Above document.
266 void SelectionToHell(); ///< Below document.
268 /** The following two methods return enum SdrHdlKind.
269 Declared as int in order to spare including SVDRAW.HXX. */
270 bool IsObjSelectable( const Point& rPt );
271 /// Same as IsObjSelectable(), but return the object as well.
272 SdrObject* GetObjAt(const Point& rPt);
273 int IsInsideSelectedObj( const Point& rPt ); ///< returns enum values
274 /** Test if there is a draw object at that position and if it should be selected.
275 The 'should' is aimed at Writer text fly frames which may be in front of
276 the draw object. */
277 bool ShouldObjectBeSelected(const Point& rPt);
279 bool MoveAnchor( SwMove nDir );
281 /** @return if Upper of frame at current position is section frame
282 Currently only used by the rules. To be replaced by something more
283 sophisticated one day. */
284 bool IsDirectlyInSection() const;
286 /** For return valies see above FrmType.
287 pPt: Cursr or DocPos respectively; bStopAtFly: Stop at flys or continue over anchor.
288 Although (0,TRUE) is kind of a standard, the parameters are not defaulted here
289 in order to force more conscious use especially of bStopAtFly. */
290 FrmTypeFlags GetFrmType( const Point *pPt, bool bStopAtFly ) const;
291 FrmTypeFlags GetSelFrmType() const; //Selektion (Drawing)
293 /** check whether selected frame contains a control;
294 * companion method to GetSelFrmType, used for preventing
295 * drag&drop of controls into header */
296 bool IsSelContainsControl() const;
298 ObjCntType GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const;
299 ObjCntType GetObjCntTypeOfSelection( SdrObject** ppObj = 0 ) const;
301 /// For adjustment of PosAttr when anchor changes.
302 SwRect GetObjRect() const;
304 /// For moving flys with keyboard.
305 SwRect GetFlyRect() const;
306 /** i#17567 - adjustments to allow negative vertical positions for fly frames anchored
307 to paragraph or to character.
308 i#18732 - adjustments for new option 'FollowTextFlow'
309 i#22341 - adjustments for new vertical alignment at top of line */
310 void CalcBoundRect( SwRect& _orRect,
311 const RndStdIds _nAnchorId,
312 const sal_Int16 _eHoriRelOrient = com::sun::star::text::RelOrientation::FRAME,
313 const sal_Int16 _eVertRelOrient = com::sun::star::text::RelOrientation::FRAME,
314 const SwPosition* _pToCharContentPos = NULL,
315 const bool _bFollowTextFlow = false,
316 bool _bMirror = false,
317 Point* _opRef = NULL,
318 Size* _opPercent = NULL,
319 const SwFormatFrmSize* pFormatFrmSize = 0 ) const;
321 /// Set size of draw objects.
322 void SetObjRect( const SwRect& rRect );
324 long BeginDrag( const Point *pPt, bool bProp );
325 long Drag ( const Point *pPt, bool bProp );
326 long EndDrag ( const Point *pPt, bool bProp );
327 void BreakDrag();
329 /// Methods for status line.
330 Point GetAnchorObjDiff() const;
331 Point GetObjAbsPos() const;
332 Size GetObjSize() const;
334 /// SS for envelopes: get all page-bound objects and set them to new page.
335 void GetPageObjs( std::vector<SwFrameFormat*>& rFillArr );
336 void SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr, int nOffset = 1 );
338 /// Show current selection (frame / draw object as required).
339 virtual void MakeSelVisible() SAL_OVERRIDE;
341 /** @return FrameFormat of object that may be under Point.
342 Object does not become selected! */
343 const SwFrameFormat* GetFormatFromObj( const Point& rPt, SwRect** pRectToFill = 0 ) const;
345 /// @return a format too, if the point is over the text of any fly.
346 const SwFrameFormat* GetFormatFromAnyObj( const Point& rPt ) const;
348 /** Which Protection is set at selected object?
349 returns several flags in sal_uInt8 */
350 sal_uInt8 IsSelObjProtected( sal_uInt16 /*FLYPROTECT_...*/ eType ) const;
352 /** Deliver graphic in rName besides graphic name. If graphic is
353 linked give name with path. rbLink is TRUE if graphic is linked. */
354 const Graphic *GetGrfAtPos( const Point &rDocPos,
355 OUString &rName, bool &rbLink ) const;
357 OUString GetObjTitle() const;
358 void SetObjTitle( const OUString& rTitle );
359 OUString GetObjDescription() const;
360 void SetObjDescription( const OUString& rDescription );
362 bool IsFrmSelected() const;
363 bool GetFlyFrmAttr( SfxItemSet &rSet ) const;
364 bool SetFlyFrmAttr( SfxItemSet &rSet );
365 bool ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet = 0 );
366 const SwFrameFormat *NewFlyFrm( const SfxItemSet &rSet, bool bAnchValid = false,
367 SwFrameFormat *pParent = 0 );
368 void SetFlyPos( const Point &rAbsPos);
369 Point FindAnchorPos( const Point &rAbsPos, bool bMoveIt = false );
371 /** Determines whether a frame or its environment is vertically formatted and right-to-left.
372 also determines, if frame or its environmane is in mongolianlayout (vertical left-to-right)
373 - add output parameter <bVertL2R> */
374 bool IsFrmVertical(const bool bEnvironment, bool& bRightToLeft, bool& bVertL2R) const;
376 SwFrameFormat* GetCurFrameFormat() const; ///< If frame then frame style, else 0.
377 void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point* pDocPos = 0 ); ///< If frame then set frame style.
378 const SwFlyFrm *GetCurrFlyFrm() const { return FindFlyFrm(); }
380 /// Find/delete fly containing the cursor.
381 SwFrameFormat* WizzardGetFly();
383 /// Independent selecting of flys.
384 bool GotoNextFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY )
385 { return GotoObj( true, eType ); }
386 bool GotoPrevFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY)
387 { return GotoObj( false, eType); }
389 /// Iterate over flys - for Basic-collections.
390 size_t GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
391 const SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false) const;
393 /// If a fly is selected, it draws cursor into the first ContentFrm.
394 const SwFrameFormat* SelFlyGrabCrsr();
396 /// Get FlyFrameFormat; fuer UI Macro Anbindung an Flys
397 const SwFrameFormat* GetFlyFrameFormat() const;
398 SwFrameFormat* GetFlyFrameFormat();
400 /** OLE. Server requires new size. Desired values are adjusted as frame attributes.
401 If the values are not allowed, the formatting clips and determines scaling.
402 See CalcAndSetScale().
403 The @return value is the applied size. */
404 Size RequestObjectResize( const SwRect &rRect, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
406 /// The layout has been changed, so the active object has to be moved after that
407 virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
409 /** Client for OleObject has to be up-to-date regarding scaling.
410 Implemented in WrtShell.
411 If a pointer is passed on a size, this is the object's current core-size.
412 Else the size is provided via GetCurFlyRect(). */
413 virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
414 const SwRect *pFlyPrtRect = 0,
415 const SwRect *pFlyFrmRect = 0,
416 const bool bNoTextFrmPrtAreaChanged = false ) = 0;
418 /** Connect objects with ActivateWhenVisible at Paint.
419 Called by notxtfrm::Paint, implemented in wrtsh. */
420 virtual void ConnectObj( svt::EmbeddedObjectRef&,
421 const SwRect &rPrt,
422 const SwRect &rFrm ) = 0;
424 /// Set visible range on object, if it is not yet visible.
425 void MakeObjVisible( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
427 /// Check resize of OLE-Object.
428 bool IsCheckForOLEInCaption() const { return m_bCheckForOLEInCaption; }
429 void SetCheckForOLEInCaption( bool bFlag ) { m_bCheckForOLEInCaption = bFlag; }
431 /// Set name at selected FlyFrame.
432 void SetFlyName( const OUString& rName );
433 OUString GetFlyName() const;
435 /// get reference to OLE object (if there is one) for selected FlyFrame
436 const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef() const;
438 /// Created unique name for frame.
439 OUString GetUniqueGrfName() const;
440 OUString GetUniqueOLEName() const;
441 OUString GetUniqueFrameName() const;
443 /// Jump to named Fly (graphic/OLE).
444 bool GotoFly( const OUString& rName, FlyCntType eType = FLYCNTTYPE_ALL,
445 bool bSelFrame = true );
447 /// Position is a graphic with URL?
448 const SwFrameFormat* IsURLGrfAtPos( const Point& rPt, OUString* pURL = 0,
449 OUString *pTargetFrameName = 0,
450 OUString *pURLDescription = 0 ) const;
452 /** For Chain always connect Fly specified by format with that hit by point.
453 rRect contains rect of Fly (for its highlight). */
454 SwChainRet Chainable( SwRect &rRect, const SwFrameFormat &rSource, const Point &rPt ) const;
455 SwChainRet Chain( SwFrameFormat &rSource, const Point &rPt );
456 SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
457 void Unchain( SwFrameFormat &rFormat );
458 void HideChainMarker();
459 void SetChainMarker();
461 Size GetGraphicDefaultSize() const;
463 /// Temporary work around for bug.
464 void CheckUnboundObjects();
466 /// Attention: Ambiguities if multiple selections.
467 bool GetObjAttr( SfxItemSet &rSet ) const;
468 bool SetObjAttr( const SfxItemSet &rSet );
470 const SdrObject* GetBestObject( bool bNext, sal_uInt16 eType = GOTOOBJ_DRAW_ANY, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = NULL );
471 bool GotoObj( bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_DRAW_ANY);
473 /// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
474 void SetDragMode( sal_uInt16 eSdrDragMode );
476 // Get the current drag mode
477 SdrDragMode GetDragMode() const;
479 // Start cropping the selected image
480 void StartCropImage();
482 size_t IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups.
483 bool IsObjSelected( const SdrObject& rObj ) const;
484 bool IsObjSameLevelWithMarked(const SdrObject* pObj) const;
485 const SdrMarkList* GetMarkList() const{ return _GetMarkList(); };
487 void EndTextEdit(); ///< Deletes object if required.
489 /** Anchor type of selected object, -1 if ambiguous or in case of frame selection.
490 Else FLY_AT_PAGE or FLY_AT_PARA resp. from frmatr.hxx. */
491 short GetAnchorId() const;
493 /** Process of creating draw objects. At the beginning object type is passed.
494 At the end a Cmd can be passed. Here, SDRCREATE_RESTRAINTEND for end
495 or SDRCREATE_NEXTPOINT for a polygon may be relevant.
496 After RESTRAINTEND the object is created and selected.
497 BreakCreate interrupts the process. In this case no object is selected. */
498 bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Point &rPos );
499 bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, sal_uInt32 eObjInventor, const Point &);
500 void MoveCreate ( const Point &rPos );
501 bool EndCreate ( sal_uInt16 eSdrCreateCmd );
502 void BreakCreate();
503 bool IsDrawCreate() const;
504 void CreateDefaultShape( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Rectangle& rRect, sal_uInt16 nSlotId);
506 /// Functions for Rubberbox, ti select Draw-Objects
507 bool BeginMark( const Point &rPos );
508 void MoveMark ( const Point &rPos );
509 bool EndMark ();
510 void BreakMark();
512 /// Create and destroy group, don't when frame is selected.
513 bool IsGroupSelected(); ///< Can be a mixed selection!
514 void GroupSelection(); ///< Afterwards the group is selected.
515 void UnGroupSelection(); /**< The individual objects are selected, but
516 it is possible that there are groups included. */
518 bool IsGroupAllowed() const;
519 bool IsUnGroupAllowed() const;
521 void MirrorSelection( bool bHorizontal ); ///< Vertical if FALSE.
523 /** frmatr.hxx. Here no enum because of dependencies.
524 bool value only for internal use! Anchor is newly set according
525 to current document position. Anchor is not re-set. */
526 void ChgAnchor( int eAnchorId, bool bSameOnly = false,
527 bool bPosCorr = true );
529 bool SetDrawingAttr( SfxItemSet &rSet );
531 /** Get selected DrawObj as graphics (MetaFile/Bitmap).
532 Return value indicates if it was converted. */
533 bool GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf ) const;
535 void Paste( SvStream& rStm, sal_uInt16 nAction, const Point* pPt = 0 );
536 bool Paste( const Graphic &rGrf, const OUString& rURL );
537 bool Paste( SotDataObject& rObj, const Point& rPt );
539 bool IsAlignPossible() const;
540 void SetCalcFieldValueHdl(Outliner* pOutliner);
542 void Insert(const OUString& rGrfName,
543 const OUString& rFltName,
544 const Graphic* pGraphic = 0,
545 const SfxItemSet* pFlyAttrSet = 0,
546 const SfxItemSet* pGrfAttrSet = 0,
547 SwFrameFormat* = 0 );
549 /// Insertion of a drawing object which have to be already inserted in the DrawModel.
550 void InsertDrawObj( SdrObject& rDrawObj,
551 const Point& rInsertPosition );
553 bool ReplaceSdrObj( const OUString& rGrfName, const OUString& rFltName,
554 const Graphic* pGrf = 0 );
556 // --> #i972#
557 /** for starmath formulas anchored 'as char' it alignes it baseline to baseline
558 changing the previous vertical orientation */
559 void AlignFormulaToBaseline( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly = 0 );
561 /// aligns all formulas with anchor 'as char' to baseline
562 void AlignAllFormulasToBaseline();
564 /// Provide information about content situated closes to given Point.
565 Point GetContentPos( const Point& rPoint, bool bNext ) const;
567 /// Convert document position into position relative to the current page.
568 Point GetRelativePagePosition(const Point& rDocPos);
570 /// Hide or show layout-selection and pass call to CrsrSh.
571 void ShLooseFcs();
572 void ShGetFcs( bool bUpdate = true );
574 /// PageDescriptor-interface
575 void ChgCurPageDesc( const SwPageDesc& );
576 size_t GetCurPageDesc( const bool bCalcFrm = true ) const;
577 size_t GetMousePageDesc( const Point &rPt ) const;
578 size_t GetPageDescCnt() const;
579 SwPageDesc* FindPageDescByName( const OUString& rName,
580 bool bGetFromPool = false,
581 size_t* pPos = 0 );
583 const SwPageDesc& GetPageDesc( size_t i ) const;
584 void ChgPageDesc( size_t i, const SwPageDesc& );
585 /** if inside all selection only one PageDesc, @return this.
586 Otherwise @return 0 pointer */
587 const SwPageDesc* GetSelectedPageDescs() const;
589 const SwRect& GetAnyCurRect( CurRectType eType,
590 const Point* pPt = 0,
591 const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& =
592 ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >() ) const;
594 /// Page number of the page containing Point, O if no page.
595 sal_uInt16 GetPageNumber( const Point &rPoint ) const;
596 bool GetPageNumber( long nYPos, bool bAtCrsrPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, OUString &rDisplay ) const;
598 SwFlyFrameFormat* InsertObject( const svt::EmbeddedObjectRef&,
599 const SfxItemSet* pFlyAttrSet = 0,
600 const SfxItemSet* pGrfAttrSet = 0,
601 SwFrameFormat* = 0 );
602 bool FinishOLEObj(); ///< Shutdown server.
604 void GetTableAttr( SfxItemSet & ) const;
605 void SetTableAttr( const SfxItemSet & );
607 bool HasWholeTabSelection() const;
609 /// Is content of a table cell or at least a table cell completely selected?
610 bool HasBoxSelection() const;
612 bool InsertRow( sal_uInt16 nCnt, bool bBehind );
613 bool InsertCol( sal_uInt16 nCnt, bool bBehind ); // 0 == at the end.
614 bool DeleteCol();
615 bool DeleteTable();
616 bool DeleteRow(bool bCompleteTable = false);
618 bool DeleteTableSel(); ///< Current selection, may be whole table.
620 sal_uInt16 MergeTab(); /**< Merge selected parts of table.
621 @return error via enum. */
623 /// Split cell vertically or horizontally.
624 bool SplitTab( bool nVert = true, sal_uInt16 nCnt = 1, bool bSameHeight = false );
625 bool Sort(const SwSortOptions&); //Sortieren.
627 void SetRowHeight( const SwFormatFrmSize &rSz );
629 /// Pointer must be detroyed by caller != 0.
630 void GetRowHeight( SwFormatFrmSize *&rpSz ) const;
632 void SetRowSplit( const SwFormatRowSplit &rSz );
633 void GetRowSplit( SwFormatRowSplit *&rpSz ) const;
635 void SetBoxAlign( sal_uInt16 nOrient );
636 sal_uInt16 GetBoxAlign() const; ///< USHRT_MAX if ambiguous.
638 /// Adjustment of Rowheights. Determine via bTstOnly if more than one row is selected.
639 bool BalanceRowHeight( bool bTstOnly );
641 void SetTabBorders( const SfxItemSet& rSet );
642 void GetTabBorders( SfxItemSet& rSet) const;
643 void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = NULL);
645 void SetTabBackground( const SvxBrushItem &rNew );
646 void GetTabBackground( SvxBrushItem &rToFill ) const;
648 void SetBoxBackground( const SvxBrushItem &rNew );
649 bool GetBoxBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous.
651 void SetBoxDirection( const SvxFrameDirectionItem& rNew );
652 bool GetBoxDirection( SvxFrameDirectionItem& rToFill ) const; ///< FALSE ambiguous.
654 void SetRowBackground( const SvxBrushItem &rNew );
655 bool GetRowBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous.
657 SwTab WhichMouseTabCol( const Point &rPt ) const;
658 void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins.
659 void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly = true );
660 void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const;
661 void SetMouseTabCols( const SwTabCols &rNew, bool bCurRowOnly,
662 const Point &rPt );
664 /// pEnd will be used during MouseMove
665 bool SelTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
667 void GetTabRows( SwTabCols &rToFill ) const;
668 void SetTabRows( const SwTabCols &rNew, bool bCurColOnly );
669 void GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const;
670 void SetMouseTabRows( const SwTabCols &rNew, bool bCurColOnly, const Point &rPt );
672 void ProtectCells(); /**< If a table selection exists it is destroyed in case
673 cursor is not allowed in readonly. */
674 void UnProtectCells(); ///< Refers to table selection.
675 void UnProtectTables(); ///< Unprotect all tables in selection.
676 bool HasTableAnyProtection( const OUString* pTableName = 0,
677 bool* pFullTableProtection = 0 );
678 bool CanUnProtectCells() const;
680 sal_uInt16 GetRowsToRepeat() const;
681 void SetRowsToRepeat( sal_uInt16 nNumOfRows );
682 sal_uInt16 GetVirtPageNum( const bool bCalcFrm = true );
684 /** @return the number of table rows currently selected
685 if the selection start at the top of the table. */
686 sal_uInt16 GetRowSelectionFromTop() const;
688 bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
689 bool IsInHeadline() const { return CheckHeadline( false ); }
691 /** Adjusts cell widths in such a way, that their content
692 does not need to be wrapped (if possible).
693 bBalance provides for adjustment of selected columns. */
694 void AdjustCellWidth( bool bBalance = false );
696 /// Not allowed if only empty cells are selected.
697 bool IsAdjustCellWidthAllowed( bool bBalance = false ) const;
699 /// Adjustment of cell-widths; determine via bTstOnly if more than one cell is selected.
700 bool BalanceCellWidth( bool bTstOnly );
702 /// AutoFormat for table/ table selection.
703 bool SetTableAutoFormat( const SwTableAutoFormat& rNew );
705 bool GetTableAutoFormat( SwTableAutoFormat& rGet );
707 bool SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff = 283 );
709 bool GetAutoSum( OUString& rFormula ) const;
711 /** Phy: real page count.
712 Virt: consider offset that may have been set by user. */
713 sal_uInt16 GetPhyPageNum();
715 void SetNewPageOffset( sal_uInt16 nOffset );
716 void SetPageOffset( sal_uInt16 nOffset ); ///< Changes last page offset.
717 sal_uInt16 GetPageOffset() const; ///< @return last page offset.
719 void InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
720 const OUString& rNumberSeparator,
721 const bool bBefore, const sal_uInt16 nId,
722 const OUString& rCharacterStyle,
723 const bool bCpyBrd = true );
725 /// The ruler needs some information too.
726 sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = 0 ) const; //0 == not in any column.
727 sal_uInt16 GetCurMouseColNum( const Point &rPt,
728 SwGetCurColNumPara* pPara = 0 ) const;
729 size_t GetCurTabColNum() const; //0 == not in any table.
730 size_t GetCurMouseTabColNum( const Point &rPt ) const;
731 sal_uInt16 GetCurOutColNum( SwGetCurColNumPara* pPara = 0 ) const; ///< Current outer column.
733 bool IsTableRightToLeft() const;
734 bool IsMouseTableRightToLeft( const Point &rPt ) const;
735 bool IsTableVertical() const;
737 bool IsLastCellInRow() const;
739 /// Width of current range for column-dialog.
740 long GetSectionWidth( SwFormat const & rFormat ) const;
742 void GetConnectableFrameFormats
743 (SwFrameFormat & rFormat, const OUString & rReference, bool bSuccessors,
744 ::std::vector< OUString > & aPrevPageVec,
745 ::std::vector< OUString > & aThisPageVec,
746 ::std::vector< OUString > & aNextPageVec,
747 ::std::vector< OUString > & aRestVec);
749 /** SwFEShell::GetShapeBackgrd
751 method determines background color of the page the selected drawing
752 object is on and returns this color.
753 If no color is found, because no drawing object is selected or ...,
754 color COL_BLACK (default color on constructing object of class Color)
755 is returned.
757 @author OD
759 @returns an object of class Color
761 const Color GetShapeBackgrd() const;
763 /** Is default horizontal text direction for selected drawing object right-to-left
765 Because drawing objects only painted for each page only, the default
766 horizontal text direction of a drawing object is given by the corresponding
767 page property.
769 @author OD
771 @returns boolean, indicating, if the horizontal text direction of the
772 page, the selected drawing object is on, is right-to-left.
774 bool IsShapeDefaultHoriTextDirR2L() const;
776 void ParkCursorInTab();
778 SwTextNode * GetNumRuleNodeAtPos(const Point &rPot);
779 bool IsNumLabel( const Point &rPt, int nMaxOffset = -1 );
781 static bool IsVerticalModeAtNdAndPos( const SwTextNode& _rTextNode,
782 const Point& _rDocPos );
784 void ToggleHeaderFooterEdit( );
787 void ClearFEShellTabCols();
789 #endif
791 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */