xref: /trunk/main/sw/source/ui/inc/edtwin.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _EDTWIN_HXX
24cdf0e10cSrcweir #define _EDTWIN_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svx/svdobj.hxx>
27cdf0e10cSrcweir #include <tools/link.hxx>
28cdf0e10cSrcweir #include <vcl/timer.hxx>
29cdf0e10cSrcweir #include <vcl/window.hxx>
30cdf0e10cSrcweir #include <svtools/transfer.hxx>
31cdf0e10cSrcweir #include <swevent.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #define _SVSTDARR_STRINGSISORTDTOR
34cdf0e10cSrcweir #include <svl/svstdarr.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class   SwWrtShell;
37cdf0e10cSrcweir class   SwView;
38cdf0e10cSrcweir class   SwRect;
39cdf0e10cSrcweir class   ViewShell;
40cdf0e10cSrcweir class   SwAnchorMarker;
41cdf0e10cSrcweir class   SdrObject;
42cdf0e10cSrcweir class   SwShadowCursor;
43cdf0e10cSrcweir class   DataChangedEvent;
44cdf0e10cSrcweir class   SvxAutoCorrCfg;
45cdf0e10cSrcweir class   SvxAutoCorrect;
46cdf0e10cSrcweir class   SwPaM;
47cdf0e10cSrcweir struct  SwApplyTemplate;
48cdf0e10cSrcweir struct  QuickHelpData;
49cdf0e10cSrcweir class SdrDropMarkerOverlay;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir /*--------------------------------------------------------------------
52cdf0e10cSrcweir     Beschreibung:   Eingabe-Fenster
53cdf0e10cSrcweir  --------------------------------------------------------------------*/
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class SwEditWin: public Window,
56cdf0e10cSrcweir                 public DropTargetHelper, public DragSourceHelper
57cdf0e10cSrcweir {
58cdf0e10cSrcweir friend void     ScrollMDI(ViewShell* pVwSh, const SwRect&,
59cdf0e10cSrcweir                           sal_uInt16 nRangeX, sal_uInt16 nRangeY);
60cdf0e10cSrcweir friend sal_Bool     IsScrollMDI(ViewShell* pVwSh, const SwRect&);
61cdf0e10cSrcweir 
62cdf0e10cSrcweir friend void     SizeNotify(ViewShell* pVwSh, const Size &);
63cdf0e10cSrcweir 
64cdf0e10cSrcweir friend void     PageNumNotify(  ViewShell* pVwSh,
65cdf0e10cSrcweir                                 sal_uInt16 nPhyNum,
66cdf0e10cSrcweir                                 sal_uInt16 nVirtNum,
67cdf0e10cSrcweir                                 const String& rPg );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     static  QuickHelpData* pQuickHlpData;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     static  sal_Bool    bReplaceQuote;
72cdf0e10cSrcweir     static  long    nDDStartPosX, nDDStartPosY;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     static  Color   aTextColor;     //Textfarbe, fuer die Giesskanne
75cdf0e10cSrcweir     static  sal_Bool    bTransparentBackColor; // Hintergrund transparent
76cdf0e10cSrcweir     static  Color   aTextBackColor; //Texthintergrundfarbe, fuer die Giesskanne
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     /*
79cdf0e10cSrcweir      * Timer und Handler fuer das Weiterscrollen, wenn der
80cdf0e10cSrcweir      * Mauspointer innerhalb eines Drag-Vorgangs ausserhalb des
81cdf0e10cSrcweir      * EditWin stehen bleibt.  In regelmaessigen Intervallen wird
82cdf0e10cSrcweir      * die Selektion in Richtung der Mausposition vergroessert.
83cdf0e10cSrcweir      */
84cdf0e10cSrcweir     AutoTimer       aTimer;
85cdf0e10cSrcweir     // Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
86cdf0e10cSrcweir     Timer           aKeyInputTimer;
87cdf0e10cSrcweir     // timer for ANY-KeyInut question without a following KeyInputEvent
88cdf0e10cSrcweir     Timer           aKeyInputFlushTimer;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     String          aInBuffer;
91cdf0e10cSrcweir     LanguageType    eBufferLanguage;
92cdf0e10cSrcweir     Point           aStartPos;
93cdf0e10cSrcweir     Point           aMovePos;
94cdf0e10cSrcweir     Point           aRszMvHdlPt;
95cdf0e10cSrcweir     Timer           aTemplateTimer;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     // Type/Objecte ueber dem der MousePointer steht
98cdf0e10cSrcweir     SwCallMouseEvent aSaveCallEvent;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     SwApplyTemplate     *pApplyTempl;
101cdf0e10cSrcweir     SwAnchorMarker      *pAnchorMarker; // zum Verschieben eines Ankers
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     SdrDropMarkerOverlay    *pUserMarker;
104cdf0e10cSrcweir     SdrObject               *pUserMarkerObj;
105cdf0e10cSrcweir     SwShadowCursor          *pShadCrsr;
106cdf0e10cSrcweir     Point                   *pRowColumnSelectionStart; // save position where table row/column selection has been started
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     SwView         &rView;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     int             aActHitType;    // aktueller Mauspointer
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     sal_uLong           m_nDropFormat;   //Format aus dem letzten QueryDrop
113cdf0e10cSrcweir     sal_uInt16          m_nDropAction;   //Action aus dem letzten QueryDrop
114cdf0e10cSrcweir     sal_uInt16          m_nDropDestination;  //Ziel aus dem letzten QueryDrop
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     sal_uInt16          eBezierMode;
117cdf0e10cSrcweir     sal_uInt16          nInsFrmColCount; //Spaltenzahl fuer interaktiven Rahmen
118cdf0e10cSrcweir     SdrObjKind      eDrawMode;
119cdf0e10cSrcweir     sal_Bool            bLinkRemoved    : 1,
120cdf0e10cSrcweir                     bMBPressed      : 1,
121cdf0e10cSrcweir                     bInsDraw        : 1,
122cdf0e10cSrcweir                     bInsFrm         : 1,
123cdf0e10cSrcweir                     bIsInMove       : 1,
124cdf0e10cSrcweir                     bIsInDrag       : 1, //StartExecuteDrag nich doppelt ausfuehren
125cdf0e10cSrcweir                     bOldIdle        : 1, //Zum abschalten des Idle'ns
126cdf0e10cSrcweir                     bOldIdleSet     : 1, //waehrend QeueryDrop
127cdf0e10cSrcweir                     bTblInsDelMode  : 1, //
128cdf0e10cSrcweir                     bTblIsInsMode   : 1, //
129cdf0e10cSrcweir                     bTblIsColMode   : 1, //
130cdf0e10cSrcweir                     bChainMode      : 1, //Rahmen verbinden
131cdf0e10cSrcweir                     bWasShdwCrsr    : 1, //ShadowCrsr war im MouseButtonDown an
132cdf0e10cSrcweir                     bLockInput      : 1, //Lock waehrend die Rechenleiste aktiv ist
133cdf0e10cSrcweir                     bIsRowDrag      : 1, //selection of rows is used, in combination with pRowColumnSelectionStart
134cdf0e10cSrcweir                     /** #i42732# display status of font size/name depending on either the input language or the
135cdf0e10cSrcweir                         selection position depending on what has changed lately
136cdf0e10cSrcweir                      */
137cdf0e10cSrcweir                     bUseInputLanguage: 1,
138cdf0e10cSrcweir                     bObjectSelect   : 1;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     sal_uInt16          nKS_NUMDOWN_Count; // #i23725#
142cdf0e10cSrcweir     sal_uInt16          nKS_NUMINDENTINC_Count;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     void            LeaveArea(const Point &);
145cdf0e10cSrcweir     void            JustifyAreaTimer();
146cdf0e10cSrcweir     inline void     EnterArea();
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     void            RstMBDownFlags();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     void            ChangeFly( sal_uInt8 nDir, sal_Bool bWeb = sal_False );
151cdf0e10cSrcweir     void            ChangeDrawing( sal_uInt8 nDir );
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     sal_Bool            EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
154cdf0e10cSrcweir     sal_Bool            RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode);
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     //Hilfsfunktionen fuer D&D
157cdf0e10cSrcweir     void            DropCleanup();
158cdf0e10cSrcweir     void            CleanupDropUserMarker();
159cdf0e10cSrcweir     sal_uInt16          GetDropDestination( const Point& rPixPnt,
160cdf0e10cSrcweir                                         SdrObject ** ppObj = 0 );
161cdf0e10cSrcweir     //select the object/cursor at the mouse position of the context menu request
162cdf0e10cSrcweir     sal_Bool            SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     /*
165cdf0e10cSrcweir      * Handler fuer das Weiterscrollen, wenn der Mauspointer innerhalb eines
166cdf0e10cSrcweir      * Drag-Vorgangs ausserhalb des EditWin stehen bleibt. In regelmaessigen
167cdf0e10cSrcweir      * Intervallen wird die Selektion in Richtung der Mausposition
168cdf0e10cSrcweir      * vergroessert.
169cdf0e10cSrcweir      */
170cdf0e10cSrcweir     DECL_LINK( TimerHandler, Timer * );
171cdf0e10cSrcweir     void            StartDDTimer();
172cdf0e10cSrcweir     void            StopDDTimer(SwWrtShell *, const Point &);
173cdf0e10cSrcweir     DECL_LINK( DDHandler, Timer * );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     // timer for ANY-KeyInut question without a following KeyInputEvent
176cdf0e10cSrcweir     DECL_LINK( KeyInputFlushHandler, Timer * );
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     // Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
179cdf0e10cSrcweir     DECL_LINK( KeyInputTimerHandler, Timer * );
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     // Timer fuer das ApplyTemplates per Maus (verkapptes Drag&Drop)
182cdf0e10cSrcweir     DECL_LINK( TemplateTimerHdl, Timer* );
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     using OutputDevice::GetTextColor;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir protected:
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& );
189cdf0e10cSrcweir     virtual void    PrePaint();
190cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
191cdf0e10cSrcweir     virtual void    KeyInput(const KeyEvent &rKEvt);
192cdf0e10cSrcweir 
193cdf0e10cSrcweir     virtual void    GetFocus();
194cdf0e10cSrcweir     virtual void    LoseFocus();
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     virtual void    MouseMove(const MouseEvent& rMEvt);
198cdf0e10cSrcweir     virtual void    MouseButtonDown(const MouseEvent& rMEvt);
199cdf0e10cSrcweir     virtual void    MouseButtonUp(const MouseEvent& rMEvt);
200cdf0e10cSrcweir     virtual void    RequestHelp(const HelpEvent& rEvt);
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     virtual void    Command( const CommandEvent& rCEvt );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir                                 // Drag & Drop Interface
205cdf0e10cSrcweir     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
206cdf0e10cSrcweir     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
207cdf0e10cSrcweir     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel );
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     virtual XubString GetSurroundingText() const;
210cdf0e10cSrcweir     virtual Selection GetSurroundingTextSelection() const;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     void    ShowAutoTextCorrectQuickHelp( const String& rWord, SvxAutoCorrCfg* pACfg,
213cdf0e10cSrcweir                                 SvxAutoCorrect* pACorr, sal_Bool bFromIME = sal_False );
214cdf0e10cSrcweir public:
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     void            UpdatePointer(const Point &, sal_uInt16 nButtons = 0);
217cdf0e10cSrcweir 
218cdf0e10cSrcweir     sal_Bool            IsDrawSelMode();
IsDrawAction()219cdf0e10cSrcweir     sal_Bool            IsDrawAction()                  { return (bInsDraw); }
SetDrawAction(sal_Bool bFlag)220cdf0e10cSrcweir     void            SetDrawAction(sal_Bool bFlag)       { bInsDraw = bFlag; }
221cdf0e10cSrcweir 
SetObjectSelect(sal_Bool bVal)222cdf0e10cSrcweir     void            SetObjectSelect( sal_Bool bVal )    { bObjectSelect = bVal; }
IsObjectSelect() const223cdf0e10cSrcweir     sal_Bool            IsObjectSelect() const          { return bObjectSelect; }
224cdf0e10cSrcweir 
GetSdrDrawMode() const225cdf0e10cSrcweir     inline SdrObjKind   GetSdrDrawMode(/*sal_Bool bBuf = sal_False*/) const { return eDrawMode; }
SetSdrDrawMode(SdrObjKind eSdrObjectKind)226cdf0e10cSrcweir     inline void         SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { eDrawMode = eSdrObjectKind; SetObjectSelect( sal_False ); }
227cdf0e10cSrcweir     void                StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect );
228cdf0e10cSrcweir 
IsFrmAction()229cdf0e10cSrcweir     sal_Bool            IsFrmAction()                   { return (bInsFrm); }
GetBezierMode()230cdf0e10cSrcweir     inline sal_uInt16   GetBezierMode()                 { return eBezierMode; }
SetBezierMode(sal_uInt16 eBezMode)231cdf0e10cSrcweir     void            SetBezierMode(sal_uInt16 eBezMode)  { eBezierMode = eBezMode; }
232cdf0e10cSrcweir     void            EnterDrawTextMode(const Point& aDocPos); // DrawTextEditMode einschalten
233cdf0e10cSrcweir     void            InsFrm(sal_uInt16 nCols);
234cdf0e10cSrcweir     void            StopInsFrm();
GetFrmColCount() const235cdf0e10cSrcweir     sal_uInt16          GetFrmColCount() const {return nInsFrmColCount;} //Spaltenzahl fuer interaktiven Rahmen
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     void            SetChainMode( sal_Bool bOn );
IsChainMode() const239cdf0e10cSrcweir     sal_Bool            IsChainMode() const             { return bChainMode; }
240cdf0e10cSrcweir 
241cdf0e10cSrcweir     void            FlushInBuffer();
242cdf0e10cSrcweir     sal_Bool            IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const;
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 
SetReplaceQuote(sal_Bool bOn=sal_True)245cdf0e10cSrcweir     static  void    SetReplaceQuote(sal_Bool bOn = sal_True) { bReplaceQuote = bOn; }
IsReplaceQuote()246cdf0e10cSrcweir     static  sal_Bool    IsReplaceQuote() { return bReplaceQuote; }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     void             SetApplyTemplate(const SwApplyTemplate &);
GetApplyTemplate() const249cdf0e10cSrcweir     SwApplyTemplate* GetApplyTemplate() const { return pApplyTempl; }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     void            StartExecuteDrag();
252cdf0e10cSrcweir     void            DragFinished();
GetDropAction() const253cdf0e10cSrcweir     sal_uInt16          GetDropAction() const { return m_nDropAction; }
GetDropFormat() const254cdf0e10cSrcweir     sal_uLong           GetDropFormat() const { return m_nDropFormat; }
255cdf0e10cSrcweir 
GetTextColor()256cdf0e10cSrcweir     Color           GetTextColor() { return aTextColor; }
257cdf0e10cSrcweir 
SetTextColor(const Color & rCol)258cdf0e10cSrcweir     void            SetTextColor(const Color& rCol ) { aTextColor = rCol; }
259cdf0e10cSrcweir 
GetTextBackColor()260cdf0e10cSrcweir     Color           GetTextBackColor()
261cdf0e10cSrcweir                                             { return aTextBackColor; }
SetTextBackColor(const Color & rCol)262cdf0e10cSrcweir     void            SetTextBackColor(const Color& rCol )
263cdf0e10cSrcweir                                             { aTextBackColor = rCol; }
SetTextBackColorTransparent(sal_Bool bSet)264cdf0e10cSrcweir     void            SetTextBackColorTransparent(sal_Bool bSet)
265cdf0e10cSrcweir                                     { bTransparentBackColor = bSet; }
IsTextBackColorTransparent()266cdf0e10cSrcweir     sal_Bool            IsTextBackColorTransparent()
267cdf0e10cSrcweir                                     { return bTransparentBackColor; }
LockKeyInput(sal_Bool bSet)268cdf0e10cSrcweir     void            LockKeyInput(sal_Bool bSet){bLockInput = bSet;}
269cdf0e10cSrcweir 
GetView() const270cdf0e10cSrcweir     const SwView &GetView() const { return rView; }
GetView()271cdf0e10cSrcweir           SwView &GetView()       { return rView; }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     // Tipfenster loeschen
276cdf0e10cSrcweir     static void ClearTip();
277cdf0e10cSrcweir 
GetDDStartPosX()278cdf0e10cSrcweir     static inline long GetDDStartPosX() { return nDDStartPosX; }
GetDDStartPosY()279cdf0e10cSrcweir     static inline long GetDDStartPosY() { return nDDStartPosY; }
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     static void _InitStaticData();
282cdf0e10cSrcweir     static void _FinitStaticData();
283cdf0e10cSrcweir 
284cdf0e10cSrcweir     //#i3370# remove quick help to prevent saving of autocorrection suggestions
285cdf0e10cSrcweir     void StopQuickHelp();
286cdf0e10cSrcweir 
287cdf0e10cSrcweir     // --> OD 2005-02-18 #i42921# - add parameter <bVerticalMode>
288cdf0e10cSrcweir     sal_Bool RulerMarginDrag( const MouseEvent& rMEvt,
289cdf0e10cSrcweir                                      const bool bVerticalMode );
290cdf0e10cSrcweir     // <--
291cdf0e10cSrcweir 
292cdf0e10cSrcweir     /** #i42732# display status of font size/name depending on either the input
293cdf0e10cSrcweir         language or the selection position depending on what has changed lately
294cdf0e10cSrcweir      */
295cdf0e10cSrcweir     void        SetUseInputLanguage( sal_Bool bNew );
IsUseInputLanguage() const296cdf0e10cSrcweir     sal_Bool    IsUseInputLanguage() const { return bUseInputLanguage; }
297cdf0e10cSrcweir 
298cdf0e10cSrcweir     SwEditWin(Window *pParent, SwView &);
299cdf0e10cSrcweir     virtual ~SwEditWin();
300*ca62e2c2SSteve Yin     virtual void SwitchView();
301cdf0e10cSrcweir };
302cdf0e10cSrcweir 
303cdf0e10cSrcweir #endif
304