Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SW_INC_FESH_HXX
20 : #define INCLUDED_SW_INC_FESH_HXX
21 :
22 : #include <com/sun/star/text/RelOrientation.hpp>
23 : #include <com/sun/star/embed/XClassifiedObject.hpp>
24 : #include <com/sun/star/embed/XEmbeddedObject.hpp>
25 :
26 : #include <svx/svdobj.hxx>
27 : #include "swdllapi.h"
28 : #include <editsh.hxx>
29 : #include <flyenum.hxx>
30 :
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>
36 :
37 : #include <vector>
38 : #include <memory>
39 :
40 : namespace editeng { class SvxBorderLine; }
41 :
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;
57 :
58 : namespace svx
59 : {
60 : class ISdrObjectFilter;
61 : }
62 :
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
82 : };
83 : namespace o3tl
84 : {
85 : template<> struct typed_flags<FrmTypeFlags> : is_typed_flags<FrmTypeFlags, 0x4fff> {};
86 : }
87 :
88 : //! values can be combined via logical or
89 : enum class GotoObjFlags
90 : {
91 : NONE = 0,
92 : DrawControl = 1,
93 : DrawSimple = 2,
94 : DrawAny = DrawControl | DrawSimple,
95 : FlyFrm = 4,
96 : FlyGrf = 8,
97 : FlyOLE = 16,
98 : FlyAny = FlyOLE | FlyGrf | FlyFrm,
99 : Any = FlyAny | DrawAny,
100 : };
101 : namespace o3tl
102 : {
103 : template<> struct typed_flags<GotoObjFlags> : is_typed_flags<GotoObjFlags, 31> {};
104 : }
105 :
106 : //! values can be combined via logical or
107 : enum class FlyProtectFlags
108 : {
109 : NONE = 0,
110 : Content = 1,
111 : Size = 2,
112 : Pos = 4,
113 : Parent = 8, ///< Check only parents.
114 : Fixed = 16, /**< Only protection that cannot be withdrawn
115 : e.g. by OLE-server; also relevant for dialog. */
116 : };
117 : namespace o3tl
118 : {
119 : template<> struct typed_flags<FlyProtectFlags> : is_typed_flags<FlyProtectFlags, 31> {};
120 : }
121 :
122 : // For figuring out contents by position (D&D)
123 : enum ObjCntType
124 : {
125 : OBJCNT_NONE,
126 : OBJCNT_FLY,
127 : OBJCNT_GRF,
128 : OBJCNT_OLE,
129 : OBJCNT_SIMPLE,
130 : OBJCNT_CONTROL,
131 : OBJCNT_URLBUTTON,
132 :
133 : OBJCNT_GROUPOBJ,
134 : OBJCNT_DONTCARE ///< Not determinable - different objects are selected.
135 : };
136 :
137 : //For GetAnyCurRect
138 : enum CurRectType
139 : {
140 : RECT_PAGE, ///< Rect of current page.
141 : RECT_PAGE_CALC, ///< ... page will be formatted if required.
142 : RECT_PAGE_PRT, ///< Rect of current PrtArea of page.
143 : RECT_FRM, ///< Rect of current frame.
144 : RECT_FLY_EMBEDDED, ///< Rect of current FlyFrm.
145 : RECT_FLY_PRT_EMBEDDED, ///< Rect of PrtArea of FlyFrm
146 : RECT_SECTION, ///< Rect of current section.
147 : RECT_OUTTABSECTION, ///< Rect of current section but outside of table.
148 : RECT_SECTION_PRT, ///< Rect of current PrtArea of section.
149 : RECT_OUTTABSECTION_PRT, ///< Rect of current PrtArea of section but outside table.
150 : RECT_HEADERFOOTER, ///< Rect of current header/footer
151 : RECT_HEADERFOOTER_PRT, ///< Rect of PrtArea of current headers/footers
152 :
153 : RECT_PAGES_AREA ///< Rect covering the pages area
154 : };
155 :
156 : struct SwGetCurColNumPara
157 : {
158 : const SwFrameFormat* pFrameFormat;
159 : const SwRect* pPrtRect, *pFrmRect;
160 0 : SwGetCurColNumPara() : pFrameFormat( 0 ), pPrtRect( 0 ), pFrmRect( 0 ) {}
161 : };
162 :
163 : #define SW_PASTESDR_INSERT 1
164 : #define SW_PASTESDR_REPLACE 2
165 : #define SW_PASTESDR_SETATTR 3
166 :
167 : #define SW_ADD_SELECT 1
168 : #define SW_ENTER_GROUP 2
169 : #define SW_LEAVE_FRAME 4
170 :
171 : enum class SwMove
172 : {
173 : UP = 0,
174 : DOWN = 1,
175 : LEFT = 2,
176 : RIGHT = 3
177 : };
178 :
179 : // return values for WhichMouseTabCol
180 : enum class SwTab
181 : {
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
195 : };
196 :
197 : class SdrDropMarkerOverlay;
198 :
199 : class SW_DLLPUBLIC SwFEShell : public SwEditShell
200 : {
201 : private:
202 : std::unique_ptr<SdrDropMarkerOverlay> m_pChainTo;
203 : std::unique_ptr<SdrDropMarkerOverlay> m_pChainFrom;
204 : bool m_bCheckForOLEInCaption;
205 :
206 : SAL_DLLPRIVATE SwFlyFrm *FindFlyFrm() const;
207 : SAL_DLLPRIVATE SwFlyFrm *FindFlyFrm( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
208 :
209 : /// Terminate actions for all shells and call ChangeLink.
210 : SAL_DLLPRIVATE void EndAllActionAndCall();
211 :
212 : SAL_DLLPRIVATE void ScrollTo( const Point &rPt );
213 :
214 : SAL_DLLPRIVATE void ChangeOpaque( SdrLayerID nLayerId );
215 :
216 : /** Used for mouse operations on a table:
217 : @return a cell frame that is 'close' to rPt. */
218 : SAL_DLLPRIVATE const SwFrm *GetBox( const Point &rPt, bool* pbRow = 0, bool* pbCol = 0 ) const;
219 :
220 : // 0 == not in any column.
221 : SAL_DLLPRIVATE sal_uInt16 _GetCurColNum( const SwFrm *pFrm,
222 : SwGetCurColNumPara* pPara ) const;
223 :
224 : SAL_DLLPRIVATE void _GetTabCols( SwTabCols &rToFill, const SwFrm *pBox ) const;
225 : SAL_DLLPRIVATE void _GetTabRows( SwTabCols &rToFill, const SwFrm *pBox ) const;
226 :
227 : SAL_DLLPRIVATE bool ImpEndCreate();
228 :
229 : SAL_DLLPRIVATE ObjCntType GetObjCntType( const SdrObject& rObj ) const;
230 :
231 : /// Methods for copying of draw objects.
232 : SAL_DLLPRIVATE bool CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt,
233 : const Point& rInsPt, bool bIsMove,
234 : bool bSelectInsert );
235 :
236 : /// Get list of marked SdrObjects;
237 : /// helper method for GetSelFrmType, IsSelContainsControl.
238 : SAL_DLLPRIVATE const SdrMarkList* _GetMarkList() const;
239 :
240 : SAL_DLLPRIVATE bool CheckHeadline( bool bRepeat ) const;
241 :
242 : using SwEditShell::Copy;
243 :
244 : public:
245 :
246 : using SwEditShell::Insert;
247 :
248 : TYPEINFO_OVERRIDE();
249 : SwFEShell( SwDoc& rDoc, vcl::Window *pWin, const SwViewOption *pOpt = 0 );
250 : SwFEShell( SwEditShell& rShell, vcl::Window *pWin );
251 : virtual ~SwFEShell();
252 :
253 : /// Copy and Paste methods for internal clipboard.
254 : bool Copy( SwDoc* pClpDoc, const OUString* pNewClpText = 0 );
255 : bool Paste( SwDoc* pClpDoc, bool bIncludingPageFrames = false);
256 :
257 : /// Paste some pages into another doc - used in mailmerge.
258 : bool PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt16 nEndPage);
259 :
260 : /// Copy-Method for Drag&Drop
261 : bool Copy( SwFEShell*, const Point& rSttPt, const Point& rInsPt,
262 : bool bIsMove = false, bool bSelectInsert = true );
263 :
264 : void SelectFlyFrm( SwFlyFrm& rFrm, bool bNew = false );
265 :
266 : /// Is selected frame within another frame?
267 : const SwFrameFormat* IsFlyInFly();
268 :
269 : /** If an object as 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 = 0 );
272 : void DelSelectedObj();
273 :
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 );
279 :
280 : short GetLayerId() const; ///< 1 Heaven, 0 Hell, -1 Ambiguous.
281 : void SelectionToHeaven(); ///< Above document.
282 : void SelectionToHell(); ///< Below document.
283 :
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 : int 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
292 : the draw object. */
293 : bool ShouldObjectBeSelected(const Point& rPt);
294 :
295 : bool MoveAnchor( SwMove nDir );
296 :
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;
301 :
302 : /** For return valies see above FrmType.
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 : FrmTypeFlags GetFrmType( const Point *pPt, bool bStopAtFly ) const;
307 : FrmTypeFlags GetSelFrmType() const; //Selektion (Drawing)
308 :
309 : /** check whether selected frame contains a control;
310 : * companion method to GetSelFrmType, used for preventing
311 : * drag&drop of controls into header */
312 : bool IsSelContainsControl() const;
313 :
314 : ObjCntType GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const;
315 : ObjCntType GetObjCntTypeOfSelection( SdrObject** ppObj = 0 ) const;
316 :
317 : /// For adjustment of PosAttr when anchor changes.
318 : SwRect GetObjRect() const;
319 :
320 : /// For moving flys with keyboard.
321 : SwRect GetFlyRect() const;
322 : /** i#17567 - adjustments to allow negative vertical positions for fly frames anchored
323 : to paragraph or to character.
324 : i#18732 - adjustments for new option 'FollowTextFlow'
325 : i#22341 - adjustments for new vertical alignment at top of line */
326 : void CalcBoundRect( SwRect& _orRect,
327 : const RndStdIds _nAnchorId,
328 : const sal_Int16 _eHoriRelOrient = com::sun::star::text::RelOrientation::FRAME,
329 : const sal_Int16 _eVertRelOrient = com::sun::star::text::RelOrientation::FRAME,
330 : const SwPosition* _pToCharContentPos = NULL,
331 : const bool _bFollowTextFlow = false,
332 : bool _bMirror = false,
333 : Point* _opRef = NULL,
334 : Size* _opPercent = NULL,
335 : const SwFormatFrmSize* pFormatFrmSize = 0 ) const;
336 :
337 : /// Set size of draw objects.
338 : void SetObjRect( const SwRect& rRect );
339 :
340 : long BeginDrag( const Point *pPt, bool bProp );
341 : long Drag ( const Point *pPt, bool bProp );
342 : long EndDrag ( const Point *pPt, bool bProp );
343 : void BreakDrag();
344 :
345 : /// Methods for status line.
346 : Point GetAnchorObjDiff() const;
347 : Point GetObjAbsPos() const;
348 : Size GetObjSize() const;
349 :
350 : /// SS for envelopes: get all page-bound objects and set them to new page.
351 : void GetPageObjs( std::vector<SwFrameFormat*>& rFillArr );
352 : void SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr, int nOffset = 1 );
353 :
354 : /// Show current selection (frame / draw object as required).
355 : virtual void MakeSelVisible() SAL_OVERRIDE;
356 :
357 : /** @return FrameFormat of object that may be under Point.
358 : Object does not become selected! */
359 : const SwFrameFormat* GetFormatFromObj( const Point& rPt, SwRect** pRectToFill = 0 ) const;
360 :
361 : /// @return a format too, if the point is over the text of any fly.
362 : const SwFrameFormat* GetFormatFromAnyObj( const Point& rPt ) const;
363 :
364 : /** Which Protection is set at selected object? */
365 : FlyProtectFlags IsSelObjProtected( FlyProtectFlags eType ) const;
366 :
367 : /** Deliver graphic in rName besides graphic name. If graphic is
368 : linked give name with path. rbLink is TRUE if graphic is linked. */
369 : const Graphic *GetGrfAtPos( const Point &rDocPos,
370 : OUString &rName, bool &rbLink ) const;
371 :
372 : OUString GetObjTitle() const;
373 : void SetObjTitle( const OUString& rTitle );
374 : OUString GetObjDescription() const;
375 : void SetObjDescription( const OUString& rDescription );
376 :
377 : bool IsFrmSelected() const;
378 : bool GetFlyFrmAttr( SfxItemSet &rSet ) const;
379 : bool SetFlyFrmAttr( SfxItemSet &rSet );
380 : bool ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet = 0 );
381 : const SwFrameFormat *NewFlyFrm( const SfxItemSet &rSet, bool bAnchValid = false,
382 : SwFrameFormat *pParent = 0 );
383 : void SetFlyPos( const Point &rAbsPos);
384 : Point FindAnchorPos( const Point &rAbsPos, bool bMoveIt = false );
385 :
386 : /** Determines whether a frame or its environment is vertically formatted and right-to-left.
387 : also determines, if frame or its environmane is in mongolianlayout (vertical left-to-right)
388 : - add output parameter <bVertL2R> */
389 : bool IsFrmVertical(const bool bEnvironment, bool& bRightToLeft, bool& bVertL2R) const;
390 :
391 : SwFrameFormat* GetCurFrameFormat() const; ///< If frame then frame style, else 0.
392 : void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point* pDocPos = 0 ); ///< If frame then set frame style.
393 116 : const SwFlyFrm *GetCurrFlyFrm() const { return FindFlyFrm(); }
394 :
395 : /// Find/delete fly containing the cursor.
396 : SwFrameFormat* WizzardGetFly();
397 :
398 : /// Independent selecting of flys.
399 0 : bool GotoNextFly( GotoObjFlags eType = GotoObjFlags::FlyAny )
400 0 : { return GotoObj( true, eType ); }
401 0 : bool GotoPrevFly( GotoObjFlags eType = GotoObjFlags::FlyAny)
402 0 : { return GotoObj( false, eType); }
403 :
404 : /// Iterate over flys - for Basic-collections.
405 : size_t GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
406 : const SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false) const;
407 :
408 : /// If a fly is selected, it draws cursor into the first ContentFrm.
409 : const SwFrameFormat* SelFlyGrabCrsr();
410 :
411 : /// Get FlyFrameFormat; fuer UI Macro Anbindung an Flys
412 : const SwFrameFormat* GetFlyFrameFormat() const;
413 : SwFrameFormat* GetFlyFrameFormat();
414 :
415 : /** OLE. Server requires new size. Desired values are adjusted as frame attributes.
416 : If the values are not allowed, the formatting clips and determines scaling.
417 : See CalcAndSetScale().
418 : The @return value is the applied size. */
419 : Size RequestObjectResize( const SwRect &rRect, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
420 :
421 : /// The layout has been changed, so the active object has to be moved after that
422 : virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
423 :
424 : /** Client for OleObject has to be up-to-date regarding scaling.
425 : Implemented in WrtShell.
426 : If a pointer is passed on a size, this is the object's current core-size.
427 : Else the size is provided via GetCurFlyRect(). */
428 : virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
429 : const SwRect *pFlyPrtRect = 0,
430 : const SwRect *pFlyFrmRect = 0,
431 : const bool bNoTextFrmPrtAreaChanged = false ) = 0;
432 :
433 : /** Connect objects with ActivateWhenVisible at Paint.
434 : Called by notxtfrm::Paint, implemented in wrtsh. */
435 : virtual void ConnectObj( svt::EmbeddedObjectRef&,
436 : const SwRect &rPrt,
437 : const SwRect &rFrm ) = 0;
438 :
439 : /// Set visible range on object, if it is not yet visible.
440 : void MakeObjVisible( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
441 :
442 : /// Check resize of OLE-Object.
443 8 : bool IsCheckForOLEInCaption() const { return m_bCheckForOLEInCaption; }
444 0 : void SetCheckForOLEInCaption( bool bFlag ) { m_bCheckForOLEInCaption = bFlag; }
445 :
446 : /// Set name at selected FlyFrame.
447 : void SetFlyName( const OUString& rName );
448 : OUString GetFlyName() const;
449 :
450 : /// get reference to OLE object (if there is one) for selected FlyFrame
451 : const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef() const;
452 :
453 : /// Created unique name for frame.
454 : OUString GetUniqueGrfName() const;
455 : OUString GetUniqueOLEName() const;
456 : OUString GetUniqueFrameName() const;
457 :
458 : /// Jump to named Fly (graphic/OLE).
459 : bool GotoFly( const OUString& rName, FlyCntType eType = FLYCNTTYPE_ALL,
460 : bool bSelFrame = true );
461 :
462 : /// Position is a graphic with URL?
463 : const SwFrameFormat* IsURLGrfAtPos( const Point& rPt, OUString* pURL = 0,
464 : OUString *pTargetFrameName = 0,
465 : OUString *pURLDescription = 0 ) const;
466 :
467 : /** For Chain always connect Fly specified by format with that hit by point.
468 : rRect contains rect of Fly (for its highlight). */
469 : SwChainRet Chainable( SwRect &rRect, const SwFrameFormat &rSource, const Point &rPt ) const;
470 : SwChainRet Chain( SwFrameFormat &rSource, const Point &rPt );
471 : SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
472 : void Unchain( SwFrameFormat &rFormat );
473 : void HideChainMarker();
474 : void SetChainMarker();
475 :
476 : Size GetGraphicDefaultSize() const;
477 :
478 : /// Temporary work around for bug.
479 : void CheckUnboundObjects();
480 :
481 : /// Attention: Ambiguities if multiple selections.
482 : bool GetObjAttr( SfxItemSet &rSet ) const;
483 : bool SetObjAttr( const SfxItemSet &rSet );
484 :
485 : const SdrObject* GetBestObject( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = NULL );
486 : bool GotoObj( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny);
487 :
488 : /// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
489 : void SetDragMode( sal_uInt16 eSdrDragMode );
490 :
491 : // Get the current drag mode
492 : SdrDragMode GetDragMode() const;
493 :
494 : // Start cropping the selected image
495 : void StartCropImage();
496 :
497 : size_t IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups.
498 : bool IsObjSelected( const SdrObject& rObj ) const;
499 : bool IsObjSameLevelWithMarked(const SdrObject* pObj) const;
500 0 : const SdrMarkList* GetMarkList() const{ return _GetMarkList(); };
501 :
502 : void EndTextEdit(); ///< Deletes object if required.
503 :
504 : /** Anchor type of selected object, -1 if ambiguous or in case of frame selection.
505 : Else FLY_AT_PAGE or FLY_AT_PARA resp. from frmatr.hxx. */
506 : short GetAnchorId() const;
507 :
508 : /** Process of creating draw objects. At the beginning object type is passed.
509 : At the end a Cmd can be passed. Here, SDRCREATE_RESTRAINTEND for end
510 : or SDRCREATE_NEXTPOINT for a polygon may be relevant.
511 : After RESTRAINTEND the object is created and selected.
512 : BreakCreate interrupts the process. In this case no object is selected. */
513 : bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Point &rPos );
514 : bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, sal_uInt32 eObjInventor, const Point &);
515 : void MoveCreate ( const Point &rPos );
516 : bool EndCreate ( sal_uInt16 eSdrCreateCmd );
517 : void BreakCreate();
518 : bool IsDrawCreate() const;
519 : void CreateDefaultShape( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Rectangle& rRect, sal_uInt16 nSlotId);
520 :
521 : /// Functions for Rubberbox, ti select Draw-Objects
522 : bool BeginMark( const Point &rPos );
523 : void MoveMark ( const Point &rPos );
524 : bool EndMark ();
525 : void BreakMark();
526 :
527 : /// Create and destroy group, don't when frame is selected.
528 : bool IsGroupSelected(); ///< Can be a mixed selection!
529 : void GroupSelection(); ///< Afterwards the group is selected.
530 : void UnGroupSelection(); /**< The individual objects are selected, but
531 : it is possible that there are groups included. */
532 :
533 : bool IsGroupAllowed() const;
534 : bool IsUnGroupAllowed() const;
535 :
536 : void MirrorSelection( bool bHorizontal ); ///< Vertical if FALSE.
537 :
538 : /** frmatr.hxx. Here no enum because of dependencies.
539 : bool value only for internal use! Anchor is newly set according
540 : to current document position. Anchor is not re-set. */
541 : void ChgAnchor( int eAnchorId, bool bSameOnly = false,
542 : bool bPosCorr = true );
543 :
544 : bool SetDrawingAttr( SfxItemSet &rSet );
545 :
546 : /** Get selected DrawObj as graphics (MetaFile/Bitmap).
547 : Return value indicates if it was converted. */
548 : bool GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf ) const;
549 :
550 : void Paste( SvStream& rStm, sal_uInt16 nAction, const Point* pPt = 0 );
551 : bool Paste( const Graphic &rGrf, const OUString& rURL );
552 : bool Paste( SotDataObject& rObj, const Point& rPt );
553 :
554 : bool IsAlignPossible() const;
555 : void SetCalcFieldValueHdl(Outliner* pOutliner);
556 :
557 : void Insert(const OUString& rGrfName,
558 : const OUString& rFltName,
559 : const Graphic* pGraphic = 0,
560 : const SfxItemSet* pFlyAttrSet = 0,
561 : const SfxItemSet* pGrfAttrSet = 0,
562 : SwFrameFormat* = 0 );
563 :
564 : /// Insertion of a drawing object which have to be already inserted in the DrawModel.
565 : void InsertDrawObj( SdrObject& rDrawObj,
566 : const Point& rInsertPosition );
567 :
568 : bool ReplaceSdrObj( const OUString& rGrfName, const OUString& rFltName,
569 : const Graphic* pGrf = 0 );
570 :
571 : // --> #i972#
572 : /** for starmath formulas anchored 'as char' it alignes it baseline to baseline
573 : changing the previous vertical orientation */
574 : void AlignFormulaToBaseline( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly = 0 );
575 :
576 : /// aligns all formulas with anchor 'as char' to baseline
577 : void AlignAllFormulasToBaseline();
578 :
579 : /// Provide information about content situated closes to given Point.
580 : Point GetContentPos( const Point& rPoint, bool bNext ) const;
581 :
582 : /// Convert document position into position relative to the current page.
583 : Point GetRelativePagePosition(const Point& rDocPos);
584 :
585 : /// Hide or show layout-selection and pass call to CrsrSh.
586 : void ShLooseFcs();
587 : void ShGetFcs( bool bUpdate = true );
588 :
589 : /// PageDescriptor-interface
590 : void ChgCurPageDesc( const SwPageDesc& );
591 : size_t GetCurPageDesc( const bool bCalcFrm = true ) const;
592 : size_t GetMousePageDesc( const Point &rPt ) const;
593 : size_t GetPageDescCnt() const;
594 : SwPageDesc* FindPageDescByName( const OUString& rName,
595 : bool bGetFromPool = false,
596 : size_t* pPos = 0 );
597 :
598 : const SwPageDesc& GetPageDesc( size_t i ) const;
599 : void ChgPageDesc( size_t i, const SwPageDesc& );
600 : /** if inside all selection only one PageDesc, @return this.
601 : Otherwise @return 0 pointer */
602 : const SwPageDesc* GetSelectedPageDescs() const;
603 :
604 : const SwRect& GetAnyCurRect( CurRectType eType,
605 : const Point* pPt = 0,
606 : const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& =
607 : ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >() ) const;
608 :
609 : /// Page number of the page containing Point, O if no page.
610 : sal_uInt16 GetPageNumber( const Point &rPoint ) const;
611 : bool GetPageNumber( long nYPos, bool bAtCrsrPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, OUString &rDisplay ) const;
612 :
613 : SwFlyFrameFormat* InsertObject( const svt::EmbeddedObjectRef&,
614 : const SfxItemSet* pFlyAttrSet = 0,
615 : const SfxItemSet* pGrfAttrSet = 0,
616 : SwFrameFormat* = 0 );
617 : bool FinishOLEObj(); ///< Shutdown server.
618 :
619 : void GetTableAttr( SfxItemSet & ) const;
620 : void SetTableAttr( const SfxItemSet & );
621 :
622 : bool HasWholeTabSelection() const;
623 :
624 : /// Is content of a table cell or at least a table cell completely selected?
625 : bool HasBoxSelection() const;
626 :
627 : bool InsertRow( sal_uInt16 nCnt, bool bBehind );
628 : bool InsertCol( sal_uInt16 nCnt, bool bBehind ); // 0 == at the end.
629 : bool DeleteCol();
630 : bool DeleteTable();
631 : bool DeleteRow(bool bCompleteTable = false);
632 :
633 : bool DeleteTableSel(); ///< Current selection, may be whole table.
634 :
635 : sal_uInt16 MergeTab(); /**< Merge selected parts of table.
636 : @return error via enum. */
637 :
638 : /// Split cell vertically or horizontally.
639 : bool SplitTab( bool nVert = true, sal_uInt16 nCnt = 1, bool bSameHeight = false );
640 : bool Sort(const SwSortOptions&); //Sortieren.
641 :
642 : void SetRowHeight( const SwFormatFrmSize &rSz );
643 :
644 : /// Pointer must be detroyed by caller != 0.
645 : void GetRowHeight( SwFormatFrmSize *&rpSz ) const;
646 :
647 : void SetRowSplit( const SwFormatRowSplit &rSz );
648 : void GetRowSplit( SwFormatRowSplit *&rpSz ) const;
649 :
650 : void SetBoxAlign( sal_uInt16 nOrient );
651 : sal_uInt16 GetBoxAlign() const; ///< USHRT_MAX if ambiguous.
652 :
653 : /// Adjustment of Rowheights. Determine via bTstOnly if more than one row is selected.
654 : bool BalanceRowHeight( bool bTstOnly );
655 :
656 : void SetTabBorders( const SfxItemSet& rSet );
657 : void GetTabBorders( SfxItemSet& rSet) const;
658 : void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = NULL);
659 :
660 : void SetTabBackground( const SvxBrushItem &rNew );
661 : void GetTabBackground( SvxBrushItem &rToFill ) const;
662 :
663 : void SetBoxBackground( const SvxBrushItem &rNew );
664 : bool GetBoxBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous.
665 :
666 : void SetBoxDirection( const SvxFrameDirectionItem& rNew );
667 : bool GetBoxDirection( SvxFrameDirectionItem& rToFill ) const; ///< FALSE ambiguous.
668 :
669 : void SetRowBackground( const SvxBrushItem &rNew );
670 : bool GetRowBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous.
671 :
672 : SwTab WhichMouseTabCol( const Point &rPt ) const;
673 : void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins.
674 : void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly = true );
675 : void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const;
676 : void SetMouseTabCols( const SwTabCols &rNew, bool bCurRowOnly,
677 : const Point &rPt );
678 :
679 : /// pEnd will be used during MouseMove
680 : bool SelTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
681 :
682 : void GetTabRows( SwTabCols &rToFill ) const;
683 : void SetTabRows( const SwTabCols &rNew, bool bCurColOnly );
684 : void GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const;
685 : void SetMouseTabRows( const SwTabCols &rNew, bool bCurColOnly, const Point &rPt );
686 :
687 : void ProtectCells(); /**< If a table selection exists it is destroyed in case
688 : cursor is not allowed in readonly. */
689 : void UnProtectCells(); ///< Refers to table selection.
690 : void UnProtectTables(); ///< Unprotect all tables in selection.
691 : bool HasTableAnyProtection( const OUString* pTableName = 0,
692 : bool* pFullTableProtection = 0 );
693 : bool CanUnProtectCells() const;
694 :
695 : sal_uInt16 GetRowsToRepeat() const;
696 : void SetRowsToRepeat( sal_uInt16 nNumOfRows );
697 : sal_uInt16 GetVirtPageNum( const bool bCalcFrm = true );
698 :
699 : /** @return the number of table rows currently selected
700 : if the selection start at the top of the table. */
701 : sal_uInt16 GetRowSelectionFromTop() const;
702 :
703 4 : bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
704 0 : bool IsInHeadline() const { return CheckHeadline( false ); }
705 :
706 : /** Adjusts cell widths in such a way, that their content
707 : does not need to be wrapped (if possible).
708 : bBalance provides for adjustment of selected columns. */
709 : void AdjustCellWidth( bool bBalance = false );
710 :
711 : /// Not allowed if only empty cells are selected.
712 : bool IsAdjustCellWidthAllowed( bool bBalance = false ) const;
713 :
714 : /// Adjustment of cell-widths; determine via bTstOnly if more than one cell is selected.
715 : bool BalanceCellWidth( bool bTstOnly );
716 :
717 : /// AutoFormat for table/ table selection.
718 : bool SetTableAutoFormat( const SwTableAutoFormat& rNew );
719 :
720 : bool GetTableAutoFormat( SwTableAutoFormat& rGet );
721 :
722 : bool SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff = 283 );
723 :
724 : bool GetAutoSum( OUString& rFormula ) const;
725 :
726 : /** Phy: real page count.
727 : Virt: consider offset that may have been set by user. */
728 : sal_uInt16 GetPhyPageNum();
729 :
730 : void SetNewPageOffset( sal_uInt16 nOffset );
731 : void SetPageOffset( sal_uInt16 nOffset ); ///< Changes last page offset.
732 : sal_uInt16 GetPageOffset() const; ///< @return last page offset.
733 :
734 : void InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
735 : const OUString& rNumberSeparator,
736 : const bool bBefore, const sal_uInt16 nId,
737 : const OUString& rCharacterStyle,
738 : const bool bCpyBrd = true );
739 :
740 : /// The ruler needs some information too.
741 : sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = 0 ) const; //0 == not in any column.
742 : sal_uInt16 GetCurMouseColNum( const Point &rPt,
743 : SwGetCurColNumPara* pPara = 0 ) const;
744 : size_t GetCurTabColNum() const; //0 == not in any table.
745 : size_t GetCurMouseTabColNum( const Point &rPt ) const;
746 : sal_uInt16 GetCurOutColNum( SwGetCurColNumPara* pPara = 0 ) const; ///< Current outer column.
747 :
748 : bool IsTableRightToLeft() const;
749 : bool IsMouseTableRightToLeft( const Point &rPt ) const;
750 : bool IsTableVertical() const;
751 :
752 : bool IsLastCellInRow() const;
753 :
754 : /// Width of current range for column-dialog.
755 : long GetSectionWidth( SwFormat const & rFormat ) const;
756 :
757 : void GetConnectableFrameFormats
758 : (SwFrameFormat & rFormat, const OUString & rReference, bool bSuccessors,
759 : ::std::vector< OUString > & aPrevPageVec,
760 : ::std::vector< OUString > & aThisPageVec,
761 : ::std::vector< OUString > & aNextPageVec,
762 : ::std::vector< OUString > & aRestVec);
763 :
764 : /** SwFEShell::GetShapeBackgrd
765 :
766 : method determines background color of the page the selected drawing
767 : object is on and returns this color.
768 : If no color is found, because no drawing object is selected or ...,
769 : color COL_BLACK (default color on constructing object of class Color)
770 : is returned.
771 :
772 : @author OD
773 :
774 : @returns an object of class Color
775 : */
776 : const Color GetShapeBackgrd() const;
777 :
778 : /** Is default horizontal text direction for selected drawing object right-to-left
779 :
780 : Because drawing objects only painted for each page only, the default
781 : horizontal text direction of a drawing object is given by the corresponding
782 : page property.
783 :
784 : @author OD
785 :
786 : @returns boolean, indicating, if the horizontal text direction of the
787 : page, the selected drawing object is on, is right-to-left.
788 : */
789 : bool IsShapeDefaultHoriTextDirR2L() const;
790 :
791 : void ParkCursorInTab();
792 :
793 : SwTextNode * GetNumRuleNodeAtPos(const Point &rPot);
794 : bool IsNumLabel( const Point &rPt, int nMaxOffset = -1 );
795 :
796 : static bool IsVerticalModeAtNdAndPos( const SwTextNode& _rTextNode,
797 : const Point& _rDocPos );
798 :
799 : void ToggleHeaderFooterEdit( );
800 : };
801 :
802 : void ClearFEShellTabCols();
803 :
804 : #endif
805 :
806 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|