xref: /trunk/main/sw/inc/fesh.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _FESH_HXX
24 #define _FESH_HXX
25 
26 #include <com/sun/star/text/RelOrientation.hpp>
27 #include <com/sun/star/embed/XClassifiedObject.hpp>
28 #include <com/sun/star/embed/XEmbeddedObject.hpp>
29 
30 #include <svx/svdobj.hxx>
31 #include "swdllapi.h"
32 #include <editsh.hxx>
33 #include <flyenum.hxx>
34 
35 // OD 25.06.2003 #108784#
36 #include <svx/svdtypes.hxx>
37 
38 #include <svtools/embedhlp.hxx>
39 
40 #ifndef INCLUDED_VECTOR
41 #include <vector>
42 #define INCLUDED_VECTOR
43 #endif
44 
45 
46 class SwFlyFrm;
47 class SwTabCols;
48 class SvxBrushItem;
49 class SvxFrameDirectionItem;
50 class SwTableAutoFmt;
51 class SwFrm;
52 class SwFmtFrmSize;
53 class SwFmtRowSplit;
54 class SvxBorderLine;
55 class SdrObject;
56 class Color;
57 class Outliner;
58 class SotDataObject;
59 class SwFrmFmt;
60 struct SwSortOptions;
61 class SdrMarkList;
62 
63 namespace svx
64 {
65     class ISdrObjectFilter;
66 }
67 
68 
69 // return values for GetFrmType() und GetSelFrmType().
70 //! values can be combined via logival or
71 #define FRMTYPE_NONE			(sal_uInt16)     0
72 #define FRMTYPE_PAGE			(sal_uInt16)     1
73 #define FRMTYPE_HEADER			(sal_uInt16)     2
74 #define FRMTYPE_FOOTER			(sal_uInt16)     4
75 #define FRMTYPE_BODY			(sal_uInt16)     8
76 #define FRMTYPE_COLUMN			(sal_uInt16)    16
77 #define FRMTYPE_TABLE			(sal_uInt16)    32
78 #define FRMTYPE_FLY_FREE		(sal_uInt16)    64
79 #define FRMTYPE_FLY_ATCNT		(sal_uInt16)   128
80 #define FRMTYPE_FLY_INCNT		(sal_uInt16)   256
81 #define FRMTYPE_FOOTNOTE		(sal_uInt16)   512
82 #define FRMTYPE_FTNPAGE			(sal_uInt16)  1024
83 #define FRMTYPE_FLY_ANY			(sal_uInt16)  2048
84 #define FRMTYPE_DRAWOBJ			(sal_uInt16)  4096
85 #define FRMTYPE_COLSECT			(sal_uInt16)  8192
86 #define FRMTYPE_COLSECTOUTTAB 	(sal_uInt16) 16384
87 
88 #define FRMTYPE_ANYCOLSECT ( FRMTYPE_COLSECT | FRMTYPE_COLSECTOUTTAB )
89 
90 //! values can be combined via logival or
91 #define GOTOOBJ_DRAW_CONTROL 	(sal_uInt16)  1
92 #define GOTOOBJ_DRAW_SIMPLE 	(sal_uInt16)  2
93 #define GOTOOBJ_DRAW_ANY 		(sal_uInt16)  3
94 #define GOTOOBJ_FLY_FRM 		(sal_uInt16)  4
95 #define GOTOOBJ_FLY_GRF 		(sal_uInt16)  8
96 #define GOTOOBJ_FLY_OLE 		(sal_uInt16) 16
97 #define GOTOOBJ_FLY_ANY 		(sal_uInt16) 28
98 #define GOTOOBJ_GOTO_ANY 		(sal_uInt16) 31
99 
100 //! values can be combined via logival or
101 #define FLYPROTECT_CONTENT		(sal_uInt16)  1		// kann verodert werden!
102 #define FLYPROTECT_SIZE			(sal_uInt16)  2
103 #define FLYPROTECT_POS			(sal_uInt16)  4
104 #define FLYPROTECT_PARENT 		(sal_uInt16)  8 	// nur Parents untersuchen
105 #define FLYPROTECT_FIXED		(sal_uInt16) 16		// nur nicht aufhebbarer Schutz
106 												// z.B. durch OLE-Server, gilt auch
107 												// fuer Dialog
108 
109 
110 enum ObjCntType		//Fuer das Ermitteln des Cntnts per Positon (D&D)
111 {
112 	OBJCNT_NONE,
113 	OBJCNT_FLY,
114 	OBJCNT_GRF,
115 	OBJCNT_OLE,
116 	OBJCNT_SIMPLE,
117 	OBJCNT_CONTROL,
118 	OBJCNT_URLBUTTON,
119 
120 	OBJCNT_GROUPOBJ,
121 	OBJCNT_DONTCARE		// nicht bestimmbar - unterschiedliche Objecte selektiert
122 };
123 
124 //fuer GetAnyCurRect
125 enum CurRectType
126 {
127 	RECT_PAGE,					//Rect der aktuellen Seite.
128 	RECT_PAGE_CALC,				//... Seite wird ggf. Formatiert
129 	RECT_PAGE_PRT,              //Rect der aktuellen PrtArea der Seite
130 	RECT_FRM,                   //Rect des aktuellen Rahmen
131 	RECT_FLY_EMBEDDED,          //Rect des aktuellen FlyFrm
132 	RECT_FLY_PRT_EMBEDDED,      //Rect der PrtArea des FlyFrm
133 	RECT_SECTION,				//Rect des aktuellen Bereichs
134 	RECT_OUTTABSECTION,			//Rect des aktuellen Bereichs,
135 								// aber ausserhalb der Tabelle
136 	RECT_SECTION_PRT,  			//Rect der aktuellen PrtArea des Bereichs
137 	RECT_OUTTABSECTION_PRT, 	//Rect der aktuellen PrtArea des Bereichs,
138 								// aber ausserhalb der Tabelle
139 	RECT_HEADERFOOTER,     		//Rect des aktuellen Headers/Footer
140     RECT_HEADERFOOTER_PRT,      //Rect der PrtArea des aktuellen Headers/Footers
141 
142     RECT_PAGES_AREA             //Rect covering the pages area
143 };
144 
145 struct SwGetCurColNumPara
146 {
147 	const SwFrmFmt* pFrmFmt;
148 	const SwRect* pPrtRect, *pFrmRect;
149 	SwGetCurColNumPara() : pFrmFmt( 0 ), pPrtRect( 0 ), pFrmRect( 0 ) {}
150 };
151 
152 #define SW_PASTESDR_INSERT		1
153 #define SW_PASTESDR_REPLACE		2
154 #define SW_PASTESDR_SETATTR		3
155 
156 #define SW_ADD_SELECT   1
157 #define SW_ENTER_GROUP  2
158 #define SW_LEAVE_FRAME  4
159 
160 #define SW_MOVE_UP      0
161 #define SW_MOVE_DOWN    1
162 #define SW_MOVE_LEFT    2
163 #define SW_MOVE_RIGHT   3
164 
165 #define SW_TABCOL_NONE          0
166 #define SW_TABCOL_HORI          1
167 #define SW_TABCOL_VERT          2
168 #define SW_TABROW_HORI          3
169 #define SW_TABROW_VERT          4
170 // --> FME 2004-07-30 #i32329# Enhanced table selection
171 #define SW_TABSEL_HORI          5
172 #define SW_TABSEL_HORI_RTL      6
173 #define SW_TABROWSEL_HORI       7
174 #define SW_TABROWSEL_HORI_RTL   8
175 #define SW_TABCOLSEL_HORI       9
176 #define SW_TABSEL_VERT          10
177 #define SW_TABROWSEL_VERT       11
178 #define SW_TABCOLSEL_VERT       12
179 // <--
180 
181 class SdrDropMarkerOverlay;
182 
183 class SW_DLLPUBLIC SwFEShell : public SwEditShell
184 {
185 	SdrDropMarkerOverlay *pChainFrom, *pChainTo;
186 	sal_Bool bCheckForOLEInCaption;
187 
188 	SW_DLLPRIVATE SwFlyFrm *FindFlyFrm() const;
189     SW_DLLPRIVATE SwFlyFrm *FindFlyFrm( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&  ) const;
190 
191 	//Actions fuer alle Shells beenden und ChangeLink rufen.
192 	SW_DLLPRIVATE void EndAllActionAndCall();
193 
194 	SW_DLLPRIVATE void ScrollTo( const Point &rPt );
195 
196     // OD 25.06.2003 #108784# - correct type of 1st parameter
197     SW_DLLPRIVATE void ChangeOpaque( SdrLayerID nLayerId );
198 
199     // Used for mouse operations on a table:
200     // Returns a cell frame that is 'close' to rPt.
201     SW_DLLPRIVATE const SwFrm *GetBox( const Point &rPt, bool* pbRow = 0, bool* pbCol = 0 ) const;
202 
203 	//0 == in keiner Spalte
204 	SW_DLLPRIVATE sal_uInt16 _GetCurColNum( const SwFrm *pFrm,
205 						  SwGetCurColNumPara* pPara ) const;
206 
207     SW_DLLPRIVATE void _GetTabCols( SwTabCols &rToFill, const SwFrm *pBox ) const;
208     SW_DLLPRIVATE void _GetTabRows( SwTabCols &rToFill, const SwFrm *pBox ) const;
209 
210 	SW_DLLPRIVATE sal_Bool ImpEndCreate();
211 
212 	SW_DLLPRIVATE ObjCntType GetObjCntType( const SdrObject& rObj ) const;
213 
214 	// Methoden fuers kopieren von DrawObjecten
215 	SW_DLLPRIVATE sal_Bool CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt,
216 								const Point& rInsPt, sal_Bool bIsMove,
217 								sal_Bool bSelectInsert );
218 
219     // get list of marked SdrObjects;
220     // helper method for GetSelFrmType, IsSelContainsControl
221     SW_DLLPRIVATE const SdrMarkList* _GetMarkList() const;
222 
223     SW_DLLPRIVATE sal_Bool CheckHeadline( bool bRepeat ) const;
224 
225     using SwEditShell::Copy;
226 
227 public:
228 
229     using SwEditShell::Insert;
230 
231 	TYPEINFO();
232     SwFEShell( SwDoc& rDoc, Window *pWin, const SwViewOption *pOpt = 0 );
233 	SwFEShell( SwEditShell& rShell, Window *pWin );
234 	virtual ~SwFEShell();
235 
236 	// Copy und Paste Methoden fuer das interne Clipboard
237 	sal_Bool Copy( SwDoc* pClpDoc, const String* pNewClpTxt = 0 );
238     sal_Bool Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames = sal_False);
239     //paste some pages into another doc - used in mailmerge
240     sal_Bool PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt16 nEndPage);
241 	// Copy-Methode fuer Drag&Drop
242 	sal_Bool Copy( SwFEShell*, const Point& rSttPt, const Point& rInsPt,
243 				sal_Bool bIsMove = sal_False, sal_Bool bSelectInsert = sal_True );
244 
245 	void SelectFlyFrm( SwFlyFrm& rFrm, sal_Bool bNew = sal_False );
246 
247 	// befindet sich der selektierte Rahmen innerhalb eines anderen?
248 	const SwFrmFmt* IsFlyInFly();
249 
250 //SS fuer DrawObjekte und Rahmen-----------------------------
251 
252 	//Wenn ein Objekt angegeben wurde, so wird genau diese Markiert (anstatt
253 	//ueber die Position zu suchen.
254     sal_Bool SelectObj( const Point& rSelPt, sal_uInt8 nFlag = 0, SdrObject *pObj = 0 );
255 	void DelSelectedObj();
256 
257 	//Selektion nach oben unten bewegen (Z-Order).
258 	//sal_True	== ganz nach oben/unten
259 	//sal_False == einen ueberholen
260 	void SelectionToTop   ( sal_Bool bTop = sal_True );
261 	void SelectionToBottom( sal_Bool bBottom = sal_True );
262 
263 	short GetLayerId() const;	//1 Heaven, 0 Hell, -1 Uneindeutig
264 	void  SelectionToHeaven();	//Ueber dem Dokument
265 	void  SelectionToHell();	//Unter dem Dokument
266 
267 	// folgende zwei Methoden returnen den enum SdrHdlKind, um sich ein
268 	// includen von SVDRAW.HXX zu ersparen als int deklariert.
269     bool IsObjSelectable( const Point& rPt );
270     int IsInsideSelectedObj( const Point& rPt );    //!! returns enum values
271 
272 	// #107513#
273 	// Test if there is a draw object at that position and if it should be selected.
274 	// The 'should' is aimed at Writer text fly frames which may be in front of
275 	// the draw object.
276 	sal_Bool ShouldObjectBeSelected(const Point& rPt);
277 
278     sal_Bool MoveAnchor( sal_uInt16 nDir );
279 
280     // Returns if Upper of frame at current position is section frame
281     // Currently only used by the rules. To be replaced by something more
282     // sophisticated one day.
283     bool IsDirectlyInSection() const;
284 
285 	//Returnwerte siehe oben FrmType.
286 	//pPt: Crsr bzw. DocPos; bStopAtFly: Bei Flys anhalten oder ueber den Anchor weitergehen
287 	// Obgleich (0,sal_True) eine Art Standard ist, sind die Parameter nicht defaultet, damit
288 	// bei jeder Benutzung insbesondere das bStopAtFly bewusst genutzt wird.
289 	sal_uInt16 GetFrmType( const Point *pPt, sal_Bool bStopAtFly ) const;
290 	sal_uInt16 GetSelFrmType() const;				//Selektion (Drawing)
291 
292     /** #108784# check whether selected frame contains a control;
293      * companion method to GetSelFrmType, used for preventing
294      * drag&drop of controls into header */
295     bool IsSelContainsControl() const;
296 
297 	ObjCntType GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const;
298 	ObjCntType GetObjCntTypeOfSelection( SdrObject** ppObj = 0 ) const;
299 
300 	//Zum Anpassen der PosAttr bei Ankerwechseln.
301 	SwRect  GetObjRect() const;
302 	//Zum Verschieben von Flys mit der Tastatur
303 	SwRect  GetFlyRect() const;
304     // OD 18.09.2003 #i17567#, #108749#, #110354# - adjustments to allow
305     //          negative vertical positions for fly frames anchored
306     //          to paragraph or to character.
307     // OD 02.10.2003 #i18732# - adjustments for new option 'FollowTextFlow'
308     // OD 12.11.2003 #i22341# - adjustments for new vertical alignment at top of line
309     void CalcBoundRect( SwRect& _orRect,
310                         const RndStdIds _nAnchorId,
311                         const sal_Int16 _eHoriRelOrient = com::sun::star::text::RelOrientation::FRAME,
312                         const sal_Int16 _eVertRelOrient = com::sun::star::text::RelOrientation::FRAME,
313                         const SwPosition* _pToCharCntntPos = NULL,
314                         const bool _bFollowTextFlow = false,
315                         bool _bMirror = false,
316                         Point* _opRef = NULL,
317                         Size* _opPercent = NULL ) const;
318 
319 	// Groesse von Drawobjekten setzen
320 	void SetObjRect( const SwRect& rRect );
321 
322 	long BeginDrag( const Point *pPt, sal_Bool bProp );
323 	long Drag	  ( const Point *pPt, sal_Bool bProp );
324 	long EndDrag  ( const Point *pPt, sal_Bool bProp );
325 	void BreakDrag();
326 
327 	//Methoden fuer die Statuszeile.
328 	Point GetAnchorObjDiff() const;	//Abstand zum Anker
329 	Point GetObjAbsPos()	 const; //Absolute Position
330 	Size  GetObjSize()	     const;	//Groesse, ggf. die umschliessende
331 
332 	//SS fuer die BriefUmschlaege: hole alle Seitengebundenen Objekte
333 	//und setze diese auf eine neue Seite.
334 	void GetPageObjs( SvPtrarr& rFillArr );
335 	void SetPageObjsNewPage( SvPtrarr& rFillArr, int nOffset = 1 );
336 
337 	// zeige die aktuelle Selektion an ( ggfs. den Rahmen/DrawObject)
338 	virtual void MakeSelVisible();
339 
340 	// returne das FrmFmt von dem evt. unter dem Point stehenden Object.
341 	// Das Object wird nicht selektiert!
342 	const SwFrmFmt* GetFmtFromObj( const Point& rPt, SwRect** pRectToFill = 0 ) const;
343 	// returns a format too, if the point is over the text of any fly
344 	const SwFrmFmt* GetFmtFromAnyObj( const Point& rPt ) const;
345 
346 	//Welcher Schutz ist am selektierten Objekt gesetzt?
347     //!! returns several flags in sal_uInt8
348 	sal_uInt8 IsSelObjProtected( sal_uInt16 /*FLYPROTECT_...*/ eType ) const;
349 
350 	//Liefert neben der Grafik in rName bei gelinkten Grafiken den Namen mit
351 	//Pfad und sonst den Grafiknamen. rbLink ist TRU bei gelinkten Grafiken.
352 	const Graphic *GetGrfAtPos( const Point &rDocPos,
353 								String &rName, sal_Bool &rbLink ) const;
354 
355     // --> OD 2009-07-13 #i73249#
356     const String GetObjTitle() const;
357     void SetObjTitle( const String& rTitle );
358     const String GetObjDescription() const;
359     void SetObjDescription( const String& rDescription );
360     // <--
361 
362 //SS fuer Rahmen --------------------------------------------
363 
364 	sal_Bool IsFrmSelected() const;
365 	sal_Bool GetFlyFrmAttr( SfxItemSet &rSet ) const;
366 	sal_Bool SetFlyFrmAttr( SfxItemSet &rSet );
367 	sal_Bool ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet = 0 );
368 	const SwFrmFmt *NewFlyFrm( const SfxItemSet &rSet, sal_Bool bAnchValid = sal_False,
369 						 SwFrmFmt *pParent = 0 );
370 	void SetFlyPos( const Point &rAbsPos);
371 	Point FindAnchorPos( const Point &rAbsPos, sal_Bool bMoveIt = sal_False );
372     // determines whether a frame or its environment is vertically formatted and right-to-left
373     // --> OD 2009-08-31 #mongolianlayout#
374     // also determines, if frame or its environmane is in mongolianlayout (vertical left-to-right)
375     // - add output parameter <bVertL2R>
376     sal_Bool IsFrmVertical(const sal_Bool bEnvironment, sal_Bool& bRightToLeft, sal_Bool& bVertL2R) const;
377 
378 	SwFrmFmt* GetCurFrmFmt() const;	//Wenn Rahmen, dann Rahmenvorlage, sonst 0
379 	void SetFrmFmt( SwFrmFmt *pFmt, sal_Bool bKeepOrient = sal_False, Point* pDocPos = 0 );	//Wenn Rahmen, dann Rahmenvorlage setzen
380 	const SwFlyFrm *GetCurrFlyFrm() const { return FindFlyFrm(); }
381 
382 	// finde/loeschen den Fly, in dem der Cursor steht
383 	SwFrmFmt* WizzardGetFly();
384 
385 	//Selebstaendiges selektieren von Flys
386     sal_Bool GotoNextFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY )
387                                 { return GotoObj( sal_True, eType ); }
388     sal_Bool GotoPrevFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY)
389                                 { return GotoObj( sal_False, eType); }
390 
391 	//iterieren ueber Flys - fuer Basic-Collections
392 	sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL ) const;
393 	const SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL) const;
394 
395 	//Wenn ein fly selectiert ist, zieht er den Crsr in den ersten CntntFrm
396 	const SwFrmFmt* SelFlyGrabCrsr();
397 
398 	//Get FlyFrameFormat; fuer UI Macro Anbindung an Flys
399 	const SwFrmFmt* GetFlyFrmFmt() const;
400 	      SwFrmFmt* GetFlyFrmFmt();
401 
402 	//OLE, Server fordert neue Groesse an, die gewuenschten Werte werden
403 	//als Rahmenattribute eingestellt. Wenn die Werte nicht erlaubt sind,
404 	//so wird von der Formatierung geclippt und eine Scalierung eingestellt.
405 	//siehe CalcAndSetScale().
406 	// The return value is the applied size.
407     Size RequestObjectResize( const SwRect &rRect, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
408 
409     //The layout has been changed, so the active object has to be moved after that
410     virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
411 
412 	//Der Client fuer das OleObject muss bezueglich der Scalierung auf dem
413 	//neuesten Stand gehalten werden. Impl in der WrtShell.
414 	//Wird ein Pointer auf eine Size uebergeben, so ist diese die aktuelle
415 	//Core-Groesse des Objectes. Anderfalls wird die Groesse per GetCurFlyRect()
416 	//besorgt.
417     virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
418 								  const SwRect *pFlyPrtRect = 0,
419                                   const SwRect *pFlyFrmRect = 0,
420                                   const bool bNoTxtFrmPrtAreaChanged = false ) = 0;
421 
422 	//Objekte mit ActivateWhenVisible werden beim Paint Connected.
423 	//gerufen von notxtfrm::Paint, impl in wrtsh
424     virtual void ConnectObj( svt::EmbeddedObjectRef&,
425                              const SwRect &rPrt,
426 							 const SwRect &rFrm ) = 0;
427 
428 	//Sichbaren Bereich auf das Object setzen, wenn es noch nicht sichtbar ist.
429     void MakeObjVisible( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
430 
431 	// check resize of OLE-Object
432 	sal_Bool IsCheckForOLEInCaption() const 		{ return bCheckForOLEInCaption; }
433 	void SetCheckForOLEInCaption( sal_Bool bFlag )	{ bCheckForOLEInCaption = bFlag; }
434 
435 	// setze am selektierten FlyFrame einen Namen
436 	void SetFlyName( const String& rName );
437 	const String& GetFlyName() const;
438 
439     // get reference to OLE object (if there is one) for selected FlyFrame
440     const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef() const;
441 
442 	// erezeuge eindeutige Namen fuer Rahmen
443 	String GetUniqueGrfName() const;
444 	String GetUniqueOLEName() const;
445 	String GetUniqueFrameName() const;
446 
447 	// springe zum benannten Rahmen (Grafik/OLE)
448 	sal_Bool GotoFly( const String& rName, FlyCntType eType = FLYCNTTYPE_ALL,
449 					sal_Bool bSelFrame = sal_True );
450 	// steht an der Position eine Grafik mit einer URL ?
451 	const SwFrmFmt* IsURLGrfAtPos( const Point& rPt, String* pURL = 0,
452 									String *pTargetFrameName = 0,
453 									String *pURLDescription = 0 ) const;
454 
455 	//Fuer das Chain wird immer der durch das Format spezifizierte Fly
456 	//mit dem durch den Point getroffenen verbunden.
457 	//In rRect wird das Rect des Flys geliefert (fuer Highlight desselben)
458 	int Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const;
459 	int Chain( SwFrmFmt &rSource, const Point &rPt );
460     int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
461     void Unchain( SwFrmFmt &rFmt );
462 	void HideChainMarker();
463 	void SetChainMarker();
464 
465 	Size GetGraphicDefaultSize() const;
466 
467 //SS fuer DrawObjekte ---------------------
468 
469 	//Temporaer um Bug zu umgehen.
470 	void CheckUnboundObjects();
471 
472 	//Achtung: Uneindeutikeiten bei Mehrfachselektionen.
473 	sal_Bool GetObjAttr( SfxItemSet &rSet ) const;
474 	sal_Bool SetObjAttr( const SfxItemSet &rSet );
475 
476     const SdrObject* GetBestObject( sal_Bool bNext, sal_uInt16 eType = GOTOOBJ_DRAW_ANY, sal_Bool bFlat = sal_True, const ::svx::ISdrObjectFilter* pFilter = NULL );
477     sal_Bool GotoObj( sal_Bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_DRAW_ANY);
478 
479 	//Setzen vom DragMode (z.B. Rotate), tut nix bei Rahmenselektion.
480 	void SetDragMode( sal_uInt16 eSdrDragMode );
481 
482 	sal_uInt16 IsObjSelected() const;	//Liefert gleich die Anzahl der Objekte,
483 									//zaehlt aber nicht die Objekte in Gruppen.
484 	sal_Bool IsObjSelected( const SdrObject& rObj ) const;
485 
486 	void EndTextEdit();				//Loescht ggf. das Objekt.
487 
488 	//Ankertyp des selektierten Objektes, -1 bei Uneindeutigkeit oder
489     //Rahmenselektion; FLY_AT_PAGE bzw. FLY_AT_PARA aus frmatr.hxx sonst.
490 	short GetAnchorId() const;
491 
492 	//Erzeugen von DrawObjekten, beim Begin wird der Objekttyp mitgegeben.
493 	//Beim End kann ein Cmd mitgegeben werden, hier ist ggf.
494 	//SDRCREATE_RESTRAINTEND fuer Ende oder SDRCREATE_NEXTPOINT fuer ein
495 	//Polygon relevant. Nach dem RESTRAINTEND ist das Objekt erzeugt und
496 	//selektiert.
497 	//Mit BreakCreate wird der Vorgang abgebrochen, dann ist kein Objekt
498 	//mehr selektiert.
499     sal_Bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Point &rPos );
500 	sal_Bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, sal_uInt32 eObjInventor, const Point &);
501 	void MoveCreate ( const Point &rPos );
502 	sal_Bool EndCreate	( sal_uInt16 eSdrCreateCmd );
503 	void BreakCreate();
504 	sal_Bool IsDrawCreate() const;
505     void CreateDefaultShape( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Rectangle& rRect, sal_uInt16 nSlotId);
506 
507 	// Funktionen f�r Rubberbox, um Draw-Objekte zu selektieren
508 	sal_Bool BeginMark( const Point &rPos );
509 	void MoveMark ( const Point &rPos );
510 	sal_Bool EndMark  ();
511 	void BreakMark();
512 
513 	//Gruppe erzeugen, aufloesen, nix bei Rahmenselektion.
514 	sal_Bool IsGroupSelected();		//Kann auch eine Mischselektion sein!
515 	void GroupSelection();		//Hinterher ist die Gruppe selektiert.
516 	void UnGroupSelection();	//Die Einzelobjekte sind Selektiert
517 								//Es koennen noch immer Gruppen dabei sein.
518 
519     // OD 27.06.2003 #108784# - change return type.
520     bool IsGroupAllowed() const;
521 
522 	void MirrorSelection( sal_Bool bHorizontal );	//Bei sal_False Vertikal
523 
524 	//frmatr.hxx. Hier kein enum wg. Abhaengigkeiten
525 	//Der sal_Bool ist nur fuer internen Gebrauch! Anker wird nur - anhand der
526 	//aktuellen Dokumentposition - neu gesetzt aber nicht umgesetzt.
527 	void ChgAnchor( int eAnchorId, sal_Bool bSameOnly = sal_False,
528 								   sal_Bool bPosCorr = sal_True );
529 
530     sal_Bool SetDrawingAttr( SfxItemSet &rSet );
531 
532     // hole die selectierten DrawObj als Grafik (MetaFile/Bitmap)
533 	// Return-Wert besagt ob konvertiert wurde!!
534 	sal_Bool GetDrawObjGraphic( sal_uLong nFmt, Graphic& rGrf ) const;
535 
536 	void Paste( SvStream& rStm, sal_uInt16 nAction, const Point* pPt = 0 );
537 	sal_Bool Paste( const Graphic &rGrf );
538 	sal_Bool Paste( SotDataObject& rObj, const Point& rPt );
539 
540 	sal_Bool IsAlignPossible() const;
541 	void SetCalcFieldValueHdl(Outliner* pOutliner);
542 
543 	void Insert(const String& rGrfName,
544 				const String& rFltName,
545 				const Graphic* pGraphic = 0,
546 				const SfxItemSet* pFlyAttrSet = 0,
547 				const SfxItemSet* pGrfAttrSet = 0,
548 				SwFrmFmt* = 0 );
549 
550     // Insertion of a drawing object which have to be already inserted in the DrawModel
551     void InsertDrawObj( SdrObject& rDrawObj,
552                         const Point& rInsertPosition );
553 
554 	sal_Bool ReplaceSdrObj( const String& rGrfName, const String& rFltName,
555 						const Graphic* pGrf = 0 );
556 
557 	// --> #i972#
558     // for starmath formulas anchored 'as char' it alignes it baseline to baseline
559     // changing the previous vertical orientation
560     void AlignFormulaToBaseline( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly = 0 );
561 
562     // aligns all formulas with anchor 'as char' to baseline
563     void AlignAllFormulasToBaseline();
564     // <--
565 
566 //------------------------------------------
567 
568 	//Auskunft ueber naechstliegenden Inhalt zum uebergebenen Point
569 	Point GetCntntPos( const Point& rPoint, sal_Bool bNext ) const;
570 
571     //convert document position into position relative to the current page
572     Point GetRelativePagePosition(const Point& rDocPos);
573 
574     //Layout-Selektion Hiden/Zeigen und aufruf an die CrsrSh weiterreichen.
575 	void ShLooseFcs();
576 	void ShGetFcs( sal_Bool bUpdate = sal_True );
577 
578 	//PageDescriptor-Schnittstelle
579 	void   ChgCurPageDesc( const SwPageDesc& );
580 	sal_uInt16 GetCurPageDesc( const sal_Bool bCalcFrm = sal_True ) const;
581     sal_uInt16 GetMousePageDesc( const Point &rPt ) const;
582     sal_uInt16 GetPageDescCnt() const;
583 	SwPageDesc* FindPageDescByName( const String& rName,
584 									sal_Bool bGetFromPool = sal_False,
585 									sal_uInt16* pPos = 0 );
586 
587 	const SwPageDesc& GetPageDesc( sal_uInt16 i ) const;
588 	void  ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
589 	// if inside all selection only one PageDesc, return this.
590 	// Otherwise return 0 pointer
591 	const SwPageDesc* GetSelectedPageDescs() const;
592 
593 	const SwRect& GetAnyCurRect( CurRectType eType,
594 								 const Point* pPt = 0,
595                                  const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& =
596                                  ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >() ) const;
597 
598 	//Seitennummer der Seite in der der Point liegt, 0 wenn keine
599 	//getroffen ist.
600 	sal_uInt16 GetPageNumber( const Point &rPoint ) const;
601 	sal_Bool GetPageNumber( long nYPos, sal_Bool bAtCrsrPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, String &rDisplay ) const;
602 
603     SwFlyFrmFmt* InsertObject( const svt::EmbeddedObjectRef&,
604 				const SfxItemSet* pFlyAttrSet = 0,
605 				const SfxItemSet* pGrfAttrSet = 0,
606 				SwFrmFmt* = 0 );
607 	sal_Bool 	FinishOLEObj();								// Server wird beendet
608 
609 	//Attribute der Tabelle besorgen/setzen.
610 	void GetTblAttr( SfxItemSet & ) const;
611 	void SetTblAttr( const SfxItemSet & );
612 
613 	//Tabelle vollstaendig selektiert?
614 	sal_Bool HasWholeTabSelection() const;
615 	//Ist der Inhalt einer Tabellenzelle oder mindestens eine Tabellenzelle
616 	//vollstaendig selektiert ist
617 	sal_Bool HasBoxSelection() const;
618 
619 	sal_Bool InsertRow( sal_uInt16 nCnt, sal_Bool bBehind );
620 	sal_Bool InsertCol( sal_uInt16 nCnt, sal_Bool bBehind );  // 0 == am Ende
621 	sal_Bool DeleteCol();
622 	sal_Bool DeleteRow();
623 
624 	sal_Bool DeleteTblSel();		//Aktuelle Selektion, ggf. die ganze Tabelle.
625 
626 	sal_uInt16 MergeTab();			//Merged selektierte Tabellenteile zusammen
627 								//Fehler ueber enum zurueck
628     // Zelle Vertikal oder Horizontal splitten.
629     sal_Bool SplitTab( sal_Bool nVert = sal_True, sal_uInt16 nCnt = 1, sal_Bool bSameHeight = sal_False );
630 	sal_Bool Sort(const SwSortOptions&);	//Sortieren.
631 
632 	void SetRowHeight( const SwFmtFrmSize &rSz );
633 	//Der Pointer muss vom Aufrufer zerstoert werden wenn != 0
634 	void GetRowHeight( SwFmtFrmSize *&rpSz ) const;
635 
636     void SetRowSplit( const SwFmtRowSplit &rSz );
637     void GetRowSplit( SwFmtRowSplit *&rpSz ) const;
638 
639 	void   SetBoxAlign( sal_uInt16 nOrient );
640 	sal_uInt16 GetBoxAlign() const;			//USHRT_MAX fuer uneindeutig!
641 
642 	//Ausgleichen der Zeilenhoehen. Mit bTstOnly festellen ob mehr als eine
643 	//Zeile markiert ist.
644 	sal_Bool BalanceRowHeight( sal_Bool bTstOnly );
645 
646 	void SetTabBorders( const SfxItemSet& rSet );
647 	void GetTabBorders( 	  SfxItemSet& rSet) const;
648 	void SetTabLineStyle(const Color* pColor, sal_Bool bSetLine = sal_False, const SvxBorderLine* pBorderLine = NULL);
649 
650 	void SetTabBackground( const SvxBrushItem &rNew );
651 	void GetTabBackground( SvxBrushItem &rToFill ) const;
652 
653 	void SetBoxBackground( const SvxBrushItem &rNew );
654 	sal_Bool GetBoxBackground( SvxBrushItem &rToFill ) const; //sal_False uneindeutig
655 
656     void SetBoxDirection( const SvxFrameDirectionItem& rNew );
657     sal_Bool GetBoxDirection( SvxFrameDirectionItem& rToFill ) const; //sal_False uneindeutig
658 
659     void SetRowBackground( const SvxBrushItem &rNew );
660 	sal_Bool GetRowBackground( SvxBrushItem &rToFill ) const; //sal_False uneindeutig
661 
662     sal_uInt8 WhichMouseTabCol( const Point &rPt ) const;
663     void GetTabCols( SwTabCols &rToFill ) const; //Spalten- und Randinfo.
664     void SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly = sal_True );
665     void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const;
666 	void SetMouseTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
667                           const Point &rPt );
668 
669     // --> FME 2004-07-30 #i20126# Enhanced table selection
670     // pEnd will be used during MouseMove
671     bool SelTblRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
672     // <--
673 
674     // #i24134# adjustment of table rows via Ruler
675     void GetTabRows( SwTabCols &rToFill ) const;
676     void SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly );
677     void GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const;
678     void SetMouseTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const Point &rPt );
679 
680     void ProtectCells();    //Falls eine Tabselektion besteht, wird sie ver-
681 							// nichtet, wenn der Cursor nicht in Readonly darf
682 	void UnProtectCells();	// auf die Tabellenselektin
683 	void UnProtectTbls();	//bei allen Tabellen in der Selektion den Schutz aufheben
684 	sal_Bool HasTblAnyProtection( const String* pTblName = 0,
685 								sal_Bool* pFullTblProtection = 0 );
686 	sal_Bool CanUnProtectCells() const;
687 
688     sal_uInt16 GetRowsToRepeat() const;
689     void SetRowsToRepeat( sal_uInt16 nNumOfRows );
690     sal_uInt16 GetVirtPageNum( const sal_Bool bCalcFrm = sal_True );
691     //returns the number of table rows currently selected
692     //if the selection start at the top of the table
693     sal_uInt16    GetRowSelectionFromTop() const;
694 
695     sal_Bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
696     sal_Bool IsInHeadline() const { return CheckHeadline( false ); }
697 
698 	//Stellt die Breiten der Zellen so ein, dass der Inhalt moeglichst
699 	//nicht umgebrochen werden muss.
700 	//bBalance sorgt fuer einen Ausgleich der markierten Spalten.
701 	void AdjustCellWidth( sal_Bool bBalance = sal_False );
702 	//Nicht erlaubt, wenn nur  leere Zellen selektiert sind.
703 	sal_Bool IsAdjustCellWidthAllowed( sal_Bool bBalance = sal_False ) const;
704 
705 	//Ausgleich der Zellenbreiten, mit bTstOnly feststellen, ob mehr als
706 	//eine Zelle markiert ist.
707 	sal_Bool BalanceCellWidth( sal_Bool bTstOnly );
708 
709 		// AutoFormat fuer die Tabelle/TabellenSelection
710 	sal_Bool SetTableAutoFmt( const SwTableAutoFmt& rNew );
711 		// Erfrage wie attributiert ist
712 	sal_Bool GetTableAutoFmt( SwTableAutoFmt& rGet );
713 		// aender eine  Zellenbreite/-Hoehe/Spaltenbreite/Zeilenhoehe
714 	sal_Bool SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff = 283 );
715 		// Autosumme
716 	sal_Bool GetAutoSum( String& rFml ) const;
717 
718 	//Phy:	Tatsaechliche Seitenanzahl.
719 	//Virt: Vom User evtl. gesetzten Offset mit einbeziehen.
720 	sal_uInt16	GetPhyPageNum();
721 
722 	// Setzt an der aktuellen Postion einen neuen Page Offset
723 	void SetNewPageOffset( sal_uInt16 nOffset );
724 	void SetPageOffset( sal_uInt16 nOffset );	//Aendert den letzten Page Offset
725 	sal_uInt16 GetPageOffset() const;			//Liefert den letzten Page Offset
726 
727 	//SS fuer Beschriftungen
728     void InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
729                       const String& rNumberSeparator,
730 					  const sal_Bool bBefore, const sal_uInt16 nId,
731                       const String& rCharacterStyle,
732                       const sal_Bool bCpyBrd = sal_True );
733 
734 	//Das Lineal will auch noch etwas von uns wissen.
735 	sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = 0 ) const;	//0 == in keiner Spalte
736 	sal_uInt16 GetCurMouseColNum( const Point &rPt,
737 							SwGetCurColNumPara* pPara = 0 ) const;
738 	sal_uInt16 GetCurTabColNum() const;		//0 == in keiner Tabelle
739 	sal_uInt16 GetCurMouseTabColNum( const Point &rPt ) const;
740 	sal_uInt16 GetCurOutColNum( SwGetCurColNumPara* pPara = 0 ) const;	// aktuelle aeussere Spalte
741 
742     sal_Bool IsTableRightToLeft() const;
743     sal_Bool IsMouseTableRightToLeft( const Point &rPt ) const;
744     sal_Bool IsTableVertical() const;
745 
746     sal_Bool IsLastCellInRow() const;
747     // Die Breite des aktuellen Bereichs fuer Spaltendialog
748 	long GetSectionWidth( SwFmt& rFmt ) const;
749 
750     void GetConnectableFrmFmts
751     (SwFrmFmt & rFmt, const String & rReference, sal_Bool bSuccessors,
752      ::std::vector< String > & aPrevPageVec,
753      ::std::vector< String > & aThisPageVec,
754      ::std::vector< String > & aNextPageVec,
755      ::std::vector< String > & aRestVec);
756 
757     /** SwFEShell::GetShapeBackgrd
758 
759         OD 02.09.2002 for #102450#:
760         method determines background color of the page the selected drawing
761         object is on and returns this color.
762         If no color is found, because no drawing object is selected or ...,
763         color COL_BLACK (default color on constructing object of class Color)
764         is returned.
765 
766         @author OD
767 
768         @returns an object of class Color
769     */
770     const Color GetShapeBackgrd() const;
771 
772     /** Is default horizontal text direction for selected drawing object right-to-left
773 
774         OD 09.12.2002 #103045#
775         Because drawing objects only painted for each page only, the default
776         horizontal text direction of a drawing object is given by the corresponding
777         page property.
778 
779         @author OD
780 
781         @returns boolean, indicating, if the horizontal text direction of the
782         page, the selected drawing object is on, is right-to-left.
783     */
784     bool IsShapeDefaultHoriTextDirR2L() const;
785 
786     void ParkCursorInTab();
787 
788     // -> #i23726#
789     SwTxtNode * GetNumRuleNodeAtPos(const Point &rPot);
790     sal_Bool IsNumLabel( const Point &rPt, int nMaxOffset = -1 );
791     // <- #i23726#
792     // --> OD 2005-02-21 #i42921#
793     bool IsVerticalModeAtNdAndPos( const SwTxtNode& _rTxtNode,
794                                    const Point& _rDocPos ) const;
795     // <--
796 
797 };
798 
799 #endif
800