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