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