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