xref: /trunk/main/sw/inc/fesh.hxx (revision b597708ba18998e5b62934c916addb8de3415a8a)
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     //IAccessibility2 Implementation 2009-----
486     sal_Bool IsObjSameLevelWithMarked(const SdrObject* pObj) const;
487     const SdrMarkList* GetMarkList() const{ return _GetMarkList(); };
488     //-----IAccessibility2 Implementation 2009
489 
490     void EndTextEdit();             //Loescht ggf. das Objekt.
491 
492     //Ankertyp des selektierten Objektes, -1 bei Uneindeutigkeit oder
493     //Rahmenselektion; FLY_AT_PAGE bzw. FLY_AT_PARA aus frmatr.hxx sonst.
494     short GetAnchorId() const;
495 
496     //Erzeugen von DrawObjekten, beim Begin wird der Objekttyp mitgegeben.
497     //Beim End kann ein Cmd mitgegeben werden, hier ist ggf.
498     //SDRCREATE_RESTRAINTEND fuer Ende oder SDRCREATE_NEXTPOINT fuer ein
499     //Polygon relevant. Nach dem RESTRAINTEND ist das Objekt erzeugt und
500     //selektiert.
501     //Mit BreakCreate wird der Vorgang abgebrochen, dann ist kein Objekt
502     //mehr selektiert.
503     sal_Bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Point &rPos );
504     sal_Bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, sal_uInt32 eObjInventor, const Point &);
505     void MoveCreate ( const Point &rPos );
506     sal_Bool EndCreate  ( sal_uInt16 eSdrCreateCmd );
507     void BreakCreate();
508     sal_Bool IsDrawCreate() const;
509     void CreateDefaultShape( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Rectangle& rRect, sal_uInt16 nSlotId);
510 
511     // Funktionen f�r Rubberbox, um Draw-Objekte zu selektieren
512     sal_Bool BeginMark( const Point &rPos );
513     void MoveMark ( const Point &rPos );
514     sal_Bool EndMark  ();
515     void BreakMark();
516 
517     //Gruppe erzeugen, aufloesen, nix bei Rahmenselektion.
518     sal_Bool IsGroupSelected();     //Kann auch eine Mischselektion sein!
519     void GroupSelection();      //Hinterher ist die Gruppe selektiert.
520     void UnGroupSelection();    //Die Einzelobjekte sind Selektiert
521                                 //Es koennen noch immer Gruppen dabei sein.
522 
523     // OD 27.06.2003 #108784# - change return type.
524     bool IsGroupAllowed() const;
525 
526     void MirrorSelection( sal_Bool bHorizontal );   //Bei sal_False Vertikal
527 
528     //frmatr.hxx. Hier kein enum wg. Abhaengigkeiten
529     //Der sal_Bool ist nur fuer internen Gebrauch! Anker wird nur - anhand der
530     //aktuellen Dokumentposition - neu gesetzt aber nicht umgesetzt.
531     void ChgAnchor( int eAnchorId, sal_Bool bSameOnly = sal_False,
532                                    sal_Bool bPosCorr = sal_True );
533 
534     sal_Bool SetDrawingAttr( SfxItemSet &rSet );
535 
536     // hole die selectierten DrawObj als Grafik (MetaFile/Bitmap)
537     // Return-Wert besagt ob konvertiert wurde!!
538     sal_Bool GetDrawObjGraphic( sal_uLong nFmt, Graphic& rGrf ) const;
539 
540     void Paste( SvStream& rStm, sal_uInt16 nAction, const Point* pPt = 0 );
541     sal_Bool Paste( const Graphic &rGrf );
542     sal_Bool Paste( SotDataObject& rObj, const Point& rPt );
543 
544     sal_Bool IsAlignPossible() const;
545     void SetCalcFieldValueHdl(Outliner* pOutliner);
546 
547     void Insert(const String& rGrfName,
548                 const String& rFltName,
549                 const Graphic* pGraphic = 0,
550                 const SfxItemSet* pFlyAttrSet = 0,
551                 const SfxItemSet* pGrfAttrSet = 0,
552                 SwFrmFmt* = 0 );
553 
554     // Insertion of a drawing object which have to be already inserted in the DrawModel
555     void InsertDrawObj( SdrObject& rDrawObj,
556                         const Point& rInsertPosition );
557 
558     sal_Bool ReplaceSdrObj( const String& rGrfName, const String& rFltName,
559                         const Graphic* pGrf = 0 );
560 
561     // --> #i972#
562     // for starmath formulas anchored 'as char' it alignes it baseline to baseline
563     // changing the previous vertical orientation
564     void AlignFormulaToBaseline( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly = 0 );
565 
566     // aligns all formulas with anchor 'as char' to baseline
567     void AlignAllFormulasToBaseline();
568     // <--
569 
570 //------------------------------------------
571 
572     //Auskunft ueber naechstliegenden Inhalt zum uebergebenen Point
573     Point GetCntntPos( const Point& rPoint, sal_Bool bNext ) const;
574 
575     //convert document position into position relative to the current page
576     Point GetRelativePagePosition(const Point& rDocPos);
577 
578     //Layout-Selektion Hiden/Zeigen und aufruf an die CrsrSh weiterreichen.
579     void ShLooseFcs();
580     void ShGetFcs( sal_Bool bUpdate = sal_True );
581 
582     //PageDescriptor-Schnittstelle
583     void   ChgCurPageDesc( const SwPageDesc& );
584     sal_uInt16 GetCurPageDesc( const sal_Bool bCalcFrm = sal_True ) const;
585     sal_uInt16 GetMousePageDesc( const Point &rPt ) const;
586     sal_uInt16 GetPageDescCnt() const;
587     SwPageDesc* FindPageDescByName( const String& rName,
588                                     sal_Bool bGetFromPool = sal_False,
589                                     sal_uInt16* pPos = 0 );
590 
591     const SwPageDesc& GetPageDesc( sal_uInt16 i ) const;
592     void  ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
593     // if inside all selection only one PageDesc, return this.
594     // Otherwise return 0 pointer
595     const SwPageDesc* GetSelectedPageDescs() const;
596 
597     const SwRect& GetAnyCurRect( CurRectType eType,
598                                  const Point* pPt = 0,
599                                  const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& =
600                                  ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >() ) const;
601 
602     //Seitennummer der Seite in der der Point liegt, 0 wenn keine
603     //getroffen ist.
604     sal_uInt16 GetPageNumber( const Point &rPoint ) const;
605     sal_Bool GetPageNumber( long nYPos, sal_Bool bAtCrsrPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, String &rDisplay ) const;
606 
607     SwFlyFrmFmt* InsertObject( const svt::EmbeddedObjectRef&,
608                 const SfxItemSet* pFlyAttrSet = 0,
609                 const SfxItemSet* pGrfAttrSet = 0,
610                 SwFrmFmt* = 0 );
611     sal_Bool    FinishOLEObj();                             // Server wird beendet
612 
613     //Attribute der Tabelle besorgen/setzen.
614     void GetTblAttr( SfxItemSet & ) const;
615     void SetTblAttr( const SfxItemSet & );
616 
617     //Tabelle vollstaendig selektiert?
618     sal_Bool HasWholeTabSelection() const;
619     //Ist der Inhalt einer Tabellenzelle oder mindestens eine Tabellenzelle
620     //vollstaendig selektiert ist
621     sal_Bool HasBoxSelection() const;
622 
623     sal_Bool InsertRow( sal_uInt16 nCnt, sal_Bool bBehind );
624     sal_Bool InsertCol( sal_uInt16 nCnt, sal_Bool bBehind );  // 0 == am Ende
625     sal_Bool DeleteCol();
626     sal_Bool DeleteRow();
627 
628     sal_Bool DeleteTblSel();        //Aktuelle Selektion, ggf. die ganze Tabelle.
629 
630     sal_uInt16 MergeTab();          //Merged selektierte Tabellenteile zusammen
631                                 //Fehler ueber enum zurueck
632     // Zelle Vertikal oder Horizontal splitten.
633     sal_Bool SplitTab( sal_Bool nVert = sal_True, sal_uInt16 nCnt = 1, sal_Bool bSameHeight = sal_False );
634     sal_Bool Sort(const SwSortOptions&);    //Sortieren.
635 
636     void SetRowHeight( const SwFmtFrmSize &rSz );
637     //Der Pointer muss vom Aufrufer zerstoert werden wenn != 0
638     void GetRowHeight( SwFmtFrmSize *&rpSz ) const;
639 
640     void SetRowSplit( const SwFmtRowSplit &rSz );
641     void GetRowSplit( SwFmtRowSplit *&rpSz ) const;
642 
643     void   SetBoxAlign( sal_uInt16 nOrient );
644     sal_uInt16 GetBoxAlign() const;         //USHRT_MAX fuer uneindeutig!
645 
646     //Ausgleichen der Zeilenhoehen. Mit bTstOnly festellen ob mehr als eine
647     //Zeile markiert ist.
648     sal_Bool BalanceRowHeight( sal_Bool bTstOnly );
649 
650     void SetTabBorders( const SfxItemSet& rSet );
651     void GetTabBorders(       SfxItemSet& rSet) const;
652     void SetTabLineStyle(const Color* pColor, sal_Bool bSetLine = sal_False, const SvxBorderLine* pBorderLine = NULL);
653 
654     void SetTabBackground( const SvxBrushItem &rNew );
655     void GetTabBackground( SvxBrushItem &rToFill ) const;
656 
657     void SetBoxBackground( const SvxBrushItem &rNew );
658     sal_Bool GetBoxBackground( SvxBrushItem &rToFill ) const; //sal_False uneindeutig
659 
660     void SetBoxDirection( const SvxFrameDirectionItem& rNew );
661     sal_Bool GetBoxDirection( SvxFrameDirectionItem& rToFill ) const; //sal_False uneindeutig
662 
663     void SetRowBackground( const SvxBrushItem &rNew );
664     sal_Bool GetRowBackground( SvxBrushItem &rToFill ) const; //sal_False uneindeutig
665 
666     sal_uInt8 WhichMouseTabCol( const Point &rPt ) const;
667     void GetTabCols( SwTabCols &rToFill ) const; //Spalten- und Randinfo.
668     void SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly = sal_True );
669     void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const;
670     void SetMouseTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
671                           const Point &rPt );
672 
673     // --> FME 2004-07-30 #i20126# Enhanced table selection
674     // pEnd will be used during MouseMove
675     bool SelTblRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
676     // <--
677 
678     // #i24134# adjustment of table rows via Ruler
679     void GetTabRows( SwTabCols &rToFill ) const;
680     void SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly );
681     void GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const;
682     void SetMouseTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const Point &rPt );
683 
684     void ProtectCells();    //Falls eine Tabselektion besteht, wird sie ver-
685                             // nichtet, wenn der Cursor nicht in Readonly darf
686     void UnProtectCells();  // auf die Tabellenselektin
687     void UnProtectTbls();   //bei allen Tabellen in der Selektion den Schutz aufheben
688     sal_Bool HasTblAnyProtection( const String* pTblName = 0,
689                                 sal_Bool* pFullTblProtection = 0 );
690     sal_Bool CanUnProtectCells() const;
691 
692     sal_uInt16 GetRowsToRepeat() const;
693     void SetRowsToRepeat( sal_uInt16 nNumOfRows );
694     sal_uInt16 GetVirtPageNum( const sal_Bool bCalcFrm = sal_True );
695     //returns the number of table rows currently selected
696     //if the selection start at the top of the table
697     sal_uInt16    GetRowSelectionFromTop() const;
698 
699     sal_Bool IsInRepeatedHeadline() const { return CheckHeadline( true ); }
700     sal_Bool IsInHeadline() const { return CheckHeadline( false ); }
701 
702     //Stellt die Breiten der Zellen so ein, dass der Inhalt moeglichst
703     //nicht umgebrochen werden muss.
704     //bBalance sorgt fuer einen Ausgleich der markierten Spalten.
705     void AdjustCellWidth( sal_Bool bBalance = sal_False );
706     //Nicht erlaubt, wenn nur  leere Zellen selektiert sind.
707     sal_Bool IsAdjustCellWidthAllowed( sal_Bool bBalance = sal_False ) const;
708 
709     //Ausgleich der Zellenbreiten, mit bTstOnly feststellen, ob mehr als
710     //eine Zelle markiert ist.
711     sal_Bool BalanceCellWidth( sal_Bool bTstOnly );
712 
713         // AutoFormat fuer die Tabelle/TabellenSelection
714     sal_Bool SetTableAutoFmt( const SwTableAutoFmt& rNew );
715         // Erfrage wie attributiert ist
716     sal_Bool GetTableAutoFmt( SwTableAutoFmt& rGet );
717         // aender eine  Zellenbreite/-Hoehe/Spaltenbreite/Zeilenhoehe
718     sal_Bool SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff = 283 );
719         // Autosumme
720     sal_Bool GetAutoSum( String& rFml ) const;
721 
722     //Phy:  Tatsaechliche Seitenanzahl.
723     //Virt: Vom User evtl. gesetzten Offset mit einbeziehen.
724     sal_uInt16  GetPhyPageNum();
725 
726     // Setzt an der aktuellen Postion einen neuen Page Offset
727     void SetNewPageOffset( sal_uInt16 nOffset );
728     void SetPageOffset( sal_uInt16 nOffset );   //Aendert den letzten Page Offset
729     sal_uInt16 GetPageOffset() const;           //Liefert den letzten Page Offset
730 
731     //SS fuer Beschriftungen
732     void InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
733                       const String& rNumberSeparator,
734                       const sal_Bool bBefore, const sal_uInt16 nId,
735                       const String& rCharacterStyle,
736                       const sal_Bool bCpyBrd = sal_True );
737 
738     //Das Lineal will auch noch etwas von uns wissen.
739     sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = 0 ) const; //0 == in keiner Spalte
740     sal_uInt16 GetCurMouseColNum( const Point &rPt,
741                             SwGetCurColNumPara* pPara = 0 ) const;
742     sal_uInt16 GetCurTabColNum() const;     //0 == in keiner Tabelle
743     sal_uInt16 GetCurMouseTabColNum( const Point &rPt ) const;
744     sal_uInt16 GetCurOutColNum( SwGetCurColNumPara* pPara = 0 ) const;  // aktuelle aeussere Spalte
745 
746     sal_Bool IsTableRightToLeft() const;
747     sal_Bool IsMouseTableRightToLeft( const Point &rPt ) const;
748     sal_Bool IsTableVertical() const;
749 
750     sal_Bool IsLastCellInRow() const;
751     // Die Breite des aktuellen Bereichs fuer Spaltendialog
752     long GetSectionWidth( SwFmt& rFmt ) const;
753 
754     void GetConnectableFrmFmts
755     (SwFrmFmt & rFmt, const String & rReference, sal_Bool bSuccessors,
756      ::std::vector< String > & aPrevPageVec,
757      ::std::vector< String > & aThisPageVec,
758      ::std::vector< String > & aNextPageVec,
759      ::std::vector< String > & aRestVec);
760 
761     /** SwFEShell::GetShapeBackgrd
762 
763         OD 02.09.2002 for #102450#:
764         method determines background color of the page the selected drawing
765         object is on and returns this color.
766         If no color is found, because no drawing object is selected or ...,
767         color COL_BLACK (default color on constructing object of class Color)
768         is returned.
769 
770         @author OD
771 
772         @returns an object of class Color
773     */
774     const Color GetShapeBackgrd() const;
775 
776     /** Is default horizontal text direction for selected drawing object right-to-left
777 
778         OD 09.12.2002 #103045#
779         Because drawing objects only painted for each page only, the default
780         horizontal text direction of a drawing object is given by the corresponding
781         page property.
782 
783         @author OD
784 
785         @returns boolean, indicating, if the horizontal text direction of the
786         page, the selected drawing object is on, is right-to-left.
787     */
788     bool IsShapeDefaultHoriTextDirR2L() const;
789 
790     void ParkCursorInTab();
791 
792     // -> #i23726#
793     SwTxtNode * GetNumRuleNodeAtPos(const Point &rPot);
794     sal_Bool IsNumLabel( const Point &rPt, int nMaxOffset = -1 );
795     // <- #i23726#
796     // --> OD 2005-02-21 #i42921#
797     bool IsVerticalModeAtNdAndPos( const SwTxtNode& _rTxtNode,
798                                    const Point& _rDocPos ) const;
799     // <--
800 
801 };
802 
803 #endif
804