xref: /trunk/main/sw/inc/fesh.hxx (revision 351838c4d8726bbb9f5f13e599b27a7f22b4a9bd)
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 #ifndef _FESH_HXX
23 #define _FESH_HXX
24 
25 #include <com/sun/star/text/RelOrientation.hpp>
26 #include <com/sun/star/embed/XClassifiedObject.hpp>
27 #include <com/sun/star/embed/XEmbeddedObject.hpp>
28 
29 #include <svx/svdobj.hxx>
30 #include "swdllapi.h"
31 #include <editsh.hxx>
32 #include <flyenum.hxx>
33 
34 // OD 25.06.2003 #108784#
35 #include <svx/svdtypes.hxx>
36 
37 #include <svtools/embedhlp.hxx>
38 
39 #ifndef INCLUDED_VECTOR
40 #include <vector>
41 #define INCLUDED_VECTOR
42 #endif
43 
44 class SwFlyFrm;
45 class SwTabCols;
46 class SvxBrushItem;
47 class SvxFrameDirectionItem;
48 class SwTableAutoFmt;
49 class SwFrm;
50 class SwFmtFrmSize;
51 class SwFmtRowSplit;
52 class SvxBorderLine;
53 class SdrObject;
54 class Color;
55 class Outliner;
56 class SotDataObject;
57 class SwFrmFmt;
58 struct SwSortOptions;
59 class SdrMarkList;
60 
61 namespace svx
62 {
63     class ISdrObjectFilter;
64 }
65 
66 
67 // return values for GetFrmType() und GetSelFrmType().
68 //! values can be combined via logival or
69 #define FRMTYPE_NONE            (sal_uInt16)     0
70 #define FRMTYPE_PAGE            (sal_uInt16)     1
71 #define FRMTYPE_HEADER          (sal_uInt16)     2
72 #define FRMTYPE_FOOTER          (sal_uInt16)     4
73 #define FRMTYPE_BODY            (sal_uInt16)     8
74 #define FRMTYPE_COLUMN          (sal_uInt16)    16
75 #define FRMTYPE_TABLE           (sal_uInt16)    32
76 #define FRMTYPE_FLY_FREE        (sal_uInt16)    64
77 #define FRMTYPE_FLY_ATCNT       (sal_uInt16)   128
78 #define FRMTYPE_FLY_INCNT       (sal_uInt16)   256
79 #define FRMTYPE_FOOTNOTE        (sal_uInt16)   512
80 #define FRMTYPE_FTNPAGE         (sal_uInt16)  1024
81 #define FRMTYPE_FLY_ANY         (sal_uInt16)  2048
82 #define FRMTYPE_DRAWOBJ         (sal_uInt16)  4096
83 #define FRMTYPE_COLSECT         (sal_uInt16)  8192
84 #define FRMTYPE_COLSECTOUTTAB   (sal_uInt16) 16384
85 
86 #define FRMTYPE_ANYCOLSECT ( FRMTYPE_COLSECT | FRMTYPE_COLSECTOUTTAB )
87 
88 //! values can be combined via logival or
89 #define GOTOOBJ_DRAW_CONTROL    (sal_uInt16)  1
90 #define GOTOOBJ_DRAW_SIMPLE     (sal_uInt16)  2
91 #define GOTOOBJ_DRAW_ANY        (sal_uInt16)  3
92 #define GOTOOBJ_FLY_FRM         (sal_uInt16)  4
93 #define GOTOOBJ_FLY_GRF         (sal_uInt16)  8
94 #define GOTOOBJ_FLY_OLE         (sal_uInt16) 16
95 #define GOTOOBJ_FLY_ANY         (sal_uInt16) 28
96 #define GOTOOBJ_GOTO_ANY        (sal_uInt16) 31
97 
98 //! values can be combined via logival or
99 #define FLYPROTECT_CONTENT      (sal_uInt16)  1     // kann verodert werden!
100 #define FLYPROTECT_SIZE         (sal_uInt16)  2
101 #define FLYPROTECT_POS          (sal_uInt16)  4
102 #define FLYPROTECT_PARENT       (sal_uInt16)  8     // nur Parents untersuchen
103 #define FLYPROTECT_FIXED        (sal_uInt16) 16     // nur nicht aufhebbarer Schutz
104                                                 // z.B. durch OLE-Server, gilt auch
105                                                 // fuer Dialog
106 
107 
108 enum ObjCntType     //Fuer das Ermitteln des Cntnts per Positon (D&D)
109 {
110     OBJCNT_NONE,
111     OBJCNT_FLY,
112     OBJCNT_GRF,
113     OBJCNT_OLE,
114     OBJCNT_SIMPLE,
115     OBJCNT_CONTROL,
116     OBJCNT_URLBUTTON,
117 
118     OBJCNT_GROUPOBJ,
119     OBJCNT_DONTCARE     // nicht bestimmbar - unterschiedliche Objecte selektiert
120 };
121 
122 //fuer GetAnyCurRect
123 enum CurRectType
124 {
125     RECT_PAGE,                  //Rect der aktuellen Seite.
126     RECT_PAGE_CALC,             //... Seite wird ggf. Formatiert
127     RECT_PAGE_PRT,              //Rect der aktuellen PrtArea der Seite
128     RECT_FRM,                   //Rect des aktuellen Rahmen
129     RECT_FLY_EMBEDDED,          //Rect des aktuellen FlyFrm
130     RECT_FLY_PRT_EMBEDDED,      //Rect der PrtArea des FlyFrm
131     RECT_SECTION,               //Rect des aktuellen Bereichs
132     RECT_OUTTABSECTION,         //Rect des aktuellen Bereichs,
133                                 // aber ausserhalb der Tabelle
134     RECT_SECTION_PRT,           //Rect der aktuellen PrtArea des Bereichs
135     RECT_OUTTABSECTION_PRT,     //Rect der aktuellen PrtArea des Bereichs,
136                                 // aber ausserhalb der Tabelle
137     RECT_HEADERFOOTER,          //Rect des aktuellen Headers/Footer
138     RECT_HEADERFOOTER_PRT,      //Rect der PrtArea des aktuellen Headers/Footers
139 
140     RECT_PAGES_AREA             //Rect covering the pages area
141 };
142 
143 struct SwGetCurColNumPara
144 {
145     const SwFrmFmt* pFrmFmt;
146     const SwRect* pPrtRect, *pFrmRect;
147     SwGetCurColNumPara() : pFrmFmt( 0 ), pPrtRect( 0 ), pFrmRect( 0 ) {}
148 };
149 
150 #define SW_PASTESDR_INSERT      1
151 #define SW_PASTESDR_REPLACE     2
152 #define SW_PASTESDR_SETATTR     3
153 
154 #define SW_ADD_SELECT   1
155 #define SW_ENTER_GROUP  2
156 #define SW_LEAVE_FRAME  4
157 
158 #define SW_MOVE_UP      0
159 #define SW_MOVE_DOWN    1
160 #define SW_MOVE_LEFT    2
161 #define SW_MOVE_RIGHT   3
162 
163 #define SW_TABCOL_NONE          0
164 #define SW_TABCOL_HORI          1
165 #define SW_TABCOL_VERT          2
166 #define SW_TABROW_HORI          3
167 #define SW_TABROW_VERT          4
168 // --> FME 2004-07-30 #i32329# Enhanced table selection
169 #define SW_TABSEL_HORI          5
170 #define SW_TABSEL_HORI_RTL      6
171 #define SW_TABROWSEL_HORI       7
172 #define SW_TABROWSEL_HORI_RTL   8
173 #define SW_TABCOLSEL_HORI       9
174 #define SW_TABSEL_VERT          10
175 #define SW_TABROWSEL_VERT       11
176 #define SW_TABCOLSEL_VERT       12
177 // <--
178 
179 class SdrDropMarkerOverlay;
180 
181 class SW_DLLPUBLIC SwFEShell : public SwEditShell
182 {
183     SdrDropMarkerOverlay *pChainFrom, *pChainTo;
184     sal_Bool bCheckForOLEInCaption;
185 
186     SW_DLLPRIVATE SwFlyFrm *FindFlyFrm() const;
187     SW_DLLPRIVATE SwFlyFrm *FindFlyFrm( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&  ) const;
188 
189     //Actions fuer alle Shells beenden und ChangeLink rufen.
190     SW_DLLPRIVATE void EndAllActionAndCall();
191 
192     SW_DLLPRIVATE void ScrollTo( const Point &rPt );
193 
194     // OD 25.06.2003 #108784# - correct type of 1st parameter
195     SW_DLLPRIVATE void ChangeOpaque( SdrLayerID nLayerId );
196 
197     // Used for mouse operations on a table:
198     // Returns a cell frame that is 'close' to rPt.
199     SW_DLLPRIVATE const SwFrm *GetBox( const Point &rPt, bool* pbRow = 0, bool* pbCol = 0 ) const;
200 
201     //0 == in keiner Spalte
202     SW_DLLPRIVATE sal_uInt16 _GetCurColNum( const SwFrm *pFrm,
203                           SwGetCurColNumPara* pPara ) const;
204 
205     SW_DLLPRIVATE void _GetTabCols( SwTabCols &rToFill, const SwFrm *pBox ) const;
206     SW_DLLPRIVATE void _GetTabRows( SwTabCols &rToFill, const SwFrm *pBox ) const;
207 
208     SW_DLLPRIVATE sal_Bool ImpEndCreate();
209 
210     SW_DLLPRIVATE ObjCntType GetObjCntType( const SdrObject& rObj ) const;
211 
212     // Methoden fuers kopieren von DrawObjecten
213     SW_DLLPRIVATE sal_Bool CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt,
214                                 const Point& rInsPt, sal_Bool bIsMove,
215                                 sal_Bool bSelectInsert );
216 
217     // get list of marked SdrObjects;
218     // helper method for GetSelFrmType, IsSelContainsControl
219     SW_DLLPRIVATE const SdrMarkList* _GetMarkList() const;
220 
221     SW_DLLPRIVATE sal_Bool CheckHeadline( bool bRepeat ) const;
222 
223     using SwEditShell::Copy;
224 
225 public:
226 
227     using SwEditShell::Insert;
228 
229     TYPEINFO();
230     SwFEShell( SwDoc& rDoc, Window *pWin, const SwViewOption *pOpt = 0 );
231     SwFEShell( SwEditShell& rShell, Window *pWin );
232     virtual ~SwFEShell();
233 
234     // Copy und Paste Methoden fuer das interne Clipboard
235     sal_Bool Copy( SwDoc* pClpDoc, const String* pNewClpTxt = 0 );
236     sal_Bool Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames = sal_False);
237     //paste some pages into another doc - used in mailmerge
238     sal_Bool PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt16 nEndPage);
239     // Copy-Methode fuer Drag&Drop
240     sal_Bool Copy( SwFEShell*, const Point& rSttPt, const Point& rInsPt,
241                 sal_Bool bIsMove = sal_False, sal_Bool bSelectInsert = sal_True );
242 
243     void SelectFlyFrm( SwFlyFrm& rFrm, sal_Bool bNew = sal_False );
244 
245     // befindet sich der selektierte Rahmen innerhalb eines anderen?
246     const SwFrmFmt* IsFlyInFly();
247 
248 //SS fuer DrawObjekte und Rahmen-----------------------------
249 
250     //Wenn ein Objekt angegeben wurde, so wird genau diese Markiert (anstatt
251     //ueber die Position zu suchen.
252     sal_Bool SelectObj( const Point& rSelPt, sal_uInt8 nFlag = 0, SdrObject *pObj = 0 );
253     void DelSelectedObj();
254 
255     //Selektion nach oben unten bewegen (Z-Order).
256     //sal_True  == ganz nach oben/unten
257     //sal_False == einen ueberholen
258     void SelectionToTop   ( sal_Bool bTop = sal_True );
259     void SelectionToBottom( sal_Bool bBottom = sal_True );
260 
261     short GetLayerId() const;   //1 Heaven, 0 Hell, -1 Uneindeutig
262     void  SelectionToHeaven();  //Ueber dem Dokument
263     void  SelectionToHell();    //Unter dem Dokument
264 
265     // folgende zwei Methoden returnen den enum SdrHdlKind, um sich ein
266     // includen von SVDRAW.HXX zu ersparen als int deklariert.
267     bool IsObjSelectable( const Point& rPt );
268     int IsInsideSelectedObj( const Point& rPt );    //!! returns enum values
269 
270     // #107513#
271     // Test if there is a draw object at that position and if it should be selected.
272     // The 'should' is aimed at Writer text fly frames which may be in front of
273     // the draw object.
274     sal_Bool ShouldObjectBeSelected(const Point& rPt);
275 
276     sal_Bool MoveAnchor( sal_uInt16 nDir );
277 
278     // Returns if Upper of frame at current position is section frame
279     // Currently only used by the rules. To be replaced by something more
280     // sophisticated one day.
281     bool IsDirectlyInSection() const;
282 
283     //Returnwerte siehe oben FrmType.
284     //pPt: Crsr bzw. DocPos; bStopAtFly: Bei Flys anhalten oder ueber den Anchor weitergehen
285     // Obgleich (0,sal_True) eine Art Standard ist, sind die Parameter nicht defaultet, damit
286     // bei jeder Benutzung insbesondere das bStopAtFly bewusst genutzt wird.
287     sal_uInt16 GetFrmType( const Point *pPt, sal_Bool bStopAtFly ) const;
288     sal_uInt16 GetSelFrmType() const;               //Selektion (Drawing)
289 
290     /** #108784# check whether selected frame contains a control;
291      * companion method to GetSelFrmType, used for preventing
292      * drag&drop of controls into header */
293     bool IsSelContainsControl() const;
294 
295     ObjCntType GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const;
296     ObjCntType GetObjCntTypeOfSelection( SdrObject** ppObj = 0 ) const;
297 
298     //Zum Anpassen der PosAttr bei Ankerwechseln.
299     SwRect  GetObjRect() const;
300     //Zum Verschieben von Flys mit der Tastatur
301     SwRect  GetFlyRect() const;
302     // OD 18.09.2003 #i17567#, #108749#, #110354# - adjustments to allow
303     //          negative vertical positions for fly frames anchored
304     //          to paragraph or to character.
305     // OD 02.10.2003 #i18732# - adjustments for new option 'FollowTextFlow'
306     // OD 12.11.2003 #i22341# - adjustments for new vertical alignment at top of line
307     void CalcBoundRect( SwRect& _orRect,
308                         const RndStdIds _nAnchorId,
309                         const sal_Int16 _eHoriRelOrient = com::sun::star::text::RelOrientation::FRAME,
310                         const sal_Int16 _eVertRelOrient = com::sun::star::text::RelOrientation::FRAME,
311                         const SwPosition* _pToCharCntntPos = NULL,
312                         const bool _bFollowTextFlow = false,
313                         bool _bMirror = false,
314                         Point* _opRef = NULL,
315                         Size* _opPercent = NULL ) const;
316 
317     // Groesse von Drawobjekten setzen
318     void SetObjRect( const SwRect& rRect );
319 
320     long BeginDrag( const Point *pPt, sal_Bool bProp );
321     long Drag     ( const Point *pPt, sal_Bool bProp );
322     long EndDrag  ( const Point *pPt, sal_Bool bProp );
323     void BreakDrag();
324 
325     //Methoden fuer die Statuszeile.
326     Point GetAnchorObjDiff() const; //Abstand zum Anker
327     Point GetObjAbsPos()     const; //Absolute Position
328     Size  GetObjSize()       const; //Groesse, ggf. die umschliessende
329 
330     //SS fuer die BriefUmschlaege: hole alle Seitengebundenen Objekte
331     //und setze diese auf eine neue Seite.
332     void GetPageObjs( SvPtrarr& rFillArr );
333     void SetPageObjsNewPage( SvPtrarr& rFillArr, int nOffset = 1 );
334 
335     // zeige die aktuelle Selektion an ( ggfs. den Rahmen/DrawObject)
336     virtual void MakeSelVisible();
337 
338     // returne das FrmFmt von dem evt. unter dem Point stehenden Object.
339     // Das Object wird nicht selektiert!
340     const SwFrmFmt* GetFmtFromObj( const Point& rPt, SwRect** pRectToFill = 0 ) const;
341     // returns a format too, if the point is over the text of any fly
342     const SwFrmFmt* GetFmtFromAnyObj( const Point& rPt ) const;
343 
344     //Welcher Schutz ist am selektierten Objekt gesetzt?
345     //!! returns several flags in sal_uInt8
346     sal_uInt8 IsSelObjProtected( sal_uInt16 /*FLYPROTECT_...*/ eType ) const;
347 
348     //Liefert neben der Grafik in rName bei gelinkten Grafiken den Namen mit
349     //Pfad und sonst den Grafiknamen. rbLink ist TRU bei gelinkten Grafiken.
350     const Graphic *GetGrfAtPos( const Point &rDocPos,
351                                 String &rName, sal_Bool &rbLink ) const;
352 
353     // --> OD 2009-07-13 #i73249#
354     const String GetObjTitle() const;
355     void SetObjTitle( const String& rTitle );
356     const String GetObjDescription() const;
357     void SetObjDescription( const String& rDescription );
358     // <--
359 
360 //SS fuer Rahmen --------------------------------------------
361 
362     sal_Bool IsFrmSelected() const;
363     sal_Bool GetFlyFrmAttr( SfxItemSet &rSet ) const;
364     sal_Bool SetFlyFrmAttr( SfxItemSet &rSet );
365     sal_Bool ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet = 0 );
366     const SwFrmFmt *NewFlyFrm( const SfxItemSet &rSet, sal_Bool bAnchValid = sal_False,
367                          SwFrmFmt *pParent = 0 );
368     void SetFlyPos( const Point &rAbsPos);
369     Point FindAnchorPos( const Point &rAbsPos, sal_Bool bMoveIt = sal_False );
370     // determines whether a frame or its environment is vertically formatted and right-to-left
371     // --> OD 2009-08-31 #mongolianlayout#
372     // also determines, if frame or its environmane is in mongolianlayout (vertical left-to-right)
373     // - add output parameter <bVertL2R>
374     sal_Bool IsFrmVertical(const sal_Bool bEnvironment, sal_Bool& bRightToLeft, sal_Bool& bVertL2R) const;
375 
376     SwFrmFmt* GetCurFrmFmt() const; //Wenn Rahmen, dann Rahmenvorlage, sonst 0
377     void SetFrmFmt( SwFrmFmt *pFmt, sal_Bool bKeepOrient = sal_False, Point* pDocPos = 0 ); //Wenn Rahmen, dann Rahmenvorlage setzen
378     const SwFlyFrm *GetCurrFlyFrm() const { return FindFlyFrm(); }
379 
380     // finde/loeschen den Fly, in dem der Cursor steht
381     SwFrmFmt* WizzardGetFly();
382 
383     //Selebstaendiges selektieren von Flys
384     sal_Bool GotoNextFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY )
385                                 { return GotoObj( sal_True, eType ); }
386     sal_Bool GotoPrevFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY)
387                                 { return GotoObj( sal_False, eType); }
388 
389     //iterieren ueber Flys - fuer Basic-Collections
390     sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL ) const;
391     const SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL) const;
392 
393     //Wenn ein fly selectiert ist, zieht er den Crsr in den ersten CntntFrm
394     const SwFrmFmt* SelFlyGrabCrsr();
395 
396     //Get FlyFrameFormat; fuer UI Macro Anbindung an Flys
397     const SwFrmFmt* GetFlyFrmFmt() const;
398           SwFrmFmt* GetFlyFrmFmt();
399 
400     //OLE, Server fordert neue Groesse an, die gewuenschten Werte werden
401     //als Rahmenattribute eingestellt. Wenn die Werte nicht erlaubt sind,
402     //so wird von der Formatierung geclippt und eine Scalierung eingestellt.
403     //siehe CalcAndSetScale().
404     // The return value is the applied size.
405     Size RequestObjectResize( const SwRect &rRect, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
406 
407     //The layout has been changed, so the active object has to be moved after that
408     virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
409 
410     //Der Client fuer das OleObject muss bezueglich der Scalierung auf dem
411     //neuesten Stand gehalten werden. Impl in der WrtShell.
412     //Wird ein Pointer auf eine Size uebergeben, so ist diese die aktuelle
413     //Core-Groesse des Objectes. Anderfalls wird die Groesse per GetCurFlyRect()
414     //besorgt.
415     virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
416                                   const SwRect *pFlyPrtRect = 0,
417                                   const SwRect *pFlyFrmRect = 0,
418                                   const bool bNoTxtFrmPrtAreaChanged = false ) = 0;
419 
420     //Objekte mit ActivateWhenVisible werden beim Paint Connected.
421     //gerufen von notxtfrm::Paint, impl in wrtsh
422     virtual void ConnectObj( svt::EmbeddedObjectRef&,
423                              const SwRect &rPrt,
424                              const SwRect &rFrm ) = 0;
425 
426     //Sichbaren Bereich auf das Object setzen, wenn es noch nicht sichtbar ist.
427     void MakeObjVisible( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& ) const;
428 
429     // check resize of OLE-Object
430     sal_Bool IsCheckForOLEInCaption() const         { return bCheckForOLEInCaption; }
431     void SetCheckForOLEInCaption( sal_Bool bFlag )  { bCheckForOLEInCaption = bFlag; }
432 
433     // setze am selektierten FlyFrame einen Namen
434     void SetFlyName( const String& rName );
435     const String& GetFlyName() const;
436 
437     // get reference to OLE object (if there is one) for selected FlyFrame
438     const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef() const;
439 
440     // erezeuge eindeutige Namen fuer Rahmen
441     String GetUniqueGrfName() const;
442     String GetUniqueOLEName() const;
443     String GetUniqueFrameName() const;
444 
445     // springe zum benannten Rahmen (Grafik/OLE)
446     sal_Bool GotoFly( const String& rName, FlyCntType eType = FLYCNTTYPE_ALL,
447                     sal_Bool bSelFrame = sal_True );
448     // steht an der Position eine Grafik mit einer URL ?
449     const SwFrmFmt* IsURLGrfAtPos( const Point& rPt, String* pURL = 0,
450                                     String *pTargetFrameName = 0,
451                                     String *pURLDescription = 0 ) const;
452 
453     //Fuer das Chain wird immer der durch das Format spezifizierte Fly
454     //mit dem durch den Point getroffenen verbunden.
455     //In rRect wird das Rect des Flys geliefert (fuer Highlight desselben)
456     int Chainable( SwRect &rRect, const SwFrmFmt &rSource, const Point &rPt ) const;
457     int Chain( SwFrmFmt &rSource, const Point &rPt );
458     int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
459     void Unchain( SwFrmFmt &rFmt );
460     void HideChainMarker();
461     void SetChainMarker();
462 
463     Size GetGraphicDefaultSize() const;
464 
465 //SS fuer DrawObjekte ---------------------
466 
467     //Temporaer um Bug zu umgehen.
468     void CheckUnboundObjects();
469 
470     //Achtung: Uneindeutikeiten bei Mehrfachselektionen.
471     sal_Bool GetObjAttr( SfxItemSet &rSet ) const;
472     sal_Bool SetObjAttr( const SfxItemSet &rSet );
473 
474     const SdrObject* GetBestObject( sal_Bool bNext, sal_uInt16 eType = GOTOOBJ_DRAW_ANY, sal_Bool bFlat = sal_True, const ::svx::ISdrObjectFilter* pFilter = NULL );
475     sal_Bool GotoObj( sal_Bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_DRAW_ANY);
476 
477     //Setzen vom DragMode (z.B. Rotate), tut nix bei Rahmenselektion.
478     void SetDragMode( sal_uInt16 eSdrDragMode );
479 
480     sal_uInt16 IsObjSelected() const;   //Liefert gleich die Anzahl der Objekte,
481                                     //zaehlt aber nicht die Objekte in Gruppen.
482     sal_Bool IsObjSelected( const SdrObject& rObj ) const;
483     sal_Bool IsObjSameLevelWithMarked(const SdrObject* pObj) const;
484     const SdrMarkList* GetMarkList() const{ return _GetMarkList(); };
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     bool Paste( const Graphic &rGrf, const String& rURL );
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     // Der Ruler 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 
801 /* vim: set noet sw=4 ts=4: */
802