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