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 101d2dbeb0SAndrew Rist * 111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 121d2dbeb0SAndrew Rist * 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. 191d2dbeb0SAndrew Rist * 201d2dbeb0SAndrew Rist *************************************************************/ 211d2dbeb0SAndrew Rist 221d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _VISCRS_HXX 24cdf0e10cSrcweir #define _VISCRS_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <vcl/cursor.hxx> 27cdf0e10cSrcweir #include "swcrsr.hxx" 28cdf0e10cSrcweir #include "swrect.hxx" 29cdf0e10cSrcweir #include "swregion.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir class SwCrsrShell; 32cdf0e10cSrcweir class SwShellCrsr; 33*69a74367SOliver-Rainer Wittmann class SwTxtInputFld; 34cdf0e10cSrcweir 35cdf0e10cSrcweir // -------- Ab hier Klassen / Methoden fuer den nicht Text-Cursor ------ 36cdf0e10cSrcweir 37cdf0e10cSrcweir class SwVisCrsr 38cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 39cdf0e10cSrcweir : private Timer 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir { 42cdf0e10cSrcweir friend void _InitCore(); 43cdf0e10cSrcweir friend void _FinitCore(); 44cdf0e10cSrcweir 45cdf0e10cSrcweir sal_Bool bIsVisible : 1; 46cdf0e10cSrcweir sal_Bool bIsDragCrsr : 1; 47cdf0e10cSrcweir 48cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 49cdf0e10cSrcweir sal_Bool bTimerOn : 1; 50cdf0e10cSrcweir #endif 51cdf0e10cSrcweir 52cdf0e10cSrcweir Cursor aTxtCrsr; 53cdf0e10cSrcweir const SwCrsrShell* pCrsrShell; 54cdf0e10cSrcweir 55cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 56cdf0e10cSrcweir virtual void Timeout(); 57cdf0e10cSrcweir #endif 58cdf0e10cSrcweir void _SetPosAndShow(); 59cdf0e10cSrcweir 60cdf0e10cSrcweir public: 61cdf0e10cSrcweir SwVisCrsr( const SwCrsrShell * pCShell ); 62cdf0e10cSrcweir ~SwVisCrsr(); 63cdf0e10cSrcweir 64cdf0e10cSrcweir void Show(); 65cdf0e10cSrcweir void Hide(); 66cdf0e10cSrcweir IsVisible() const67cdf0e10cSrcweir sal_Bool IsVisible() const { return bIsVisible; } SetDragCrsr(sal_Bool bFlag=sal_True)68cdf0e10cSrcweir void SetDragCrsr( sal_Bool bFlag = sal_True ) { bIsDragCrsr = bFlag; } 69cdf0e10cSrcweir 70cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 71cdf0e10cSrcweir sal_Bool ChgTimerFlag( sal_Bool bTimerOn = sal_True ); 72cdf0e10cSrcweir #endif 73cdf0e10cSrcweir }; 74cdf0e10cSrcweir 75cdf0e10cSrcweir 76cdf0e10cSrcweir // ------ Ab hier Klassen / Methoden fuer die Selectionen ------- 77cdf0e10cSrcweir 78cdf0e10cSrcweir // #i75172# predefines 79cdf0e10cSrcweir namespace sdr { namespace overlay { class OverlayObject; }} 80*69a74367SOliver-Rainer Wittmann namespace sw { namespace overlay { class OverlayRangesOutline; }} 81cdf0e10cSrcweir 82cdf0e10cSrcweir class SwSelPaintRects : public SwRects 83cdf0e10cSrcweir { 84cdf0e10cSrcweir friend void _InitCore(); 85cdf0e10cSrcweir friend void _FinitCore(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir static long nPixPtX, nPixPtY; 88cdf0e10cSrcweir static MapMode *pMapMode; 89cdf0e10cSrcweir 90cdf0e10cSrcweir // die Shell 91cdf0e10cSrcweir const SwCrsrShell* pCShell; 92cdf0e10cSrcweir 93cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir // #i75172# 96cdf0e10cSrcweir sdr::overlay::OverlayObject* mpCursorOverlay; 97cdf0e10cSrcweir 98cdf0e10cSrcweir // #i75172# access to mpCursorOverlay for swapContent getCursorOverlay() const99cdf0e10cSrcweir sdr::overlay::OverlayObject* getCursorOverlay() const { return mpCursorOverlay; } setCursorOverlay(sdr::overlay::OverlayObject * pNew)100cdf0e10cSrcweir void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; } 101cdf0e10cSrcweir 102*69a74367SOliver-Rainer Wittmann bool mbShowTxtInputFldOverlay; 103*69a74367SOliver-Rainer Wittmann sw::overlay::OverlayRangesOutline* mpTxtInputFldOverlay; 104*69a74367SOliver-Rainer Wittmann 105*69a74367SOliver-Rainer Wittmann void HighlightInputFld(); 106*69a74367SOliver-Rainer Wittmann 107cdf0e10cSrcweir public: 108cdf0e10cSrcweir SwSelPaintRects( const SwCrsrShell& rCSh ); 109cdf0e10cSrcweir virtual ~SwSelPaintRects(); 110cdf0e10cSrcweir 111*69a74367SOliver-Rainer Wittmann virtual void FillRects() = 0; 112*69a74367SOliver-Rainer Wittmann 113*69a74367SOliver-Rainer Wittmann // #i75172# in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To 114cdf0e10cSrcweir // make a complete swap access to mpCursorOverlay is needed there 115cdf0e10cSrcweir void swapContent(SwSelPaintRects& rSwap); 116cdf0e10cSrcweir 117cdf0e10cSrcweir void Show(); 118cdf0e10cSrcweir void Hide(); 119cdf0e10cSrcweir void Invalidate( const SwRect& rRect ); 120cdf0e10cSrcweir SetShowTxtInputFldOverlay(const bool bShow)121*69a74367SOliver-Rainer Wittmann inline void SetShowTxtInputFldOverlay( const bool bShow ) 122*69a74367SOliver-Rainer Wittmann { 123*69a74367SOliver-Rainer Wittmann mbShowTxtInputFldOverlay = bShow; 124*69a74367SOliver-Rainer Wittmann } 125*69a74367SOliver-Rainer Wittmann GetShell() const126cdf0e10cSrcweir const SwCrsrShell* GetShell() const { return pCShell; } 127cdf0e10cSrcweir // check current MapMode of the shell and set possibly the static members. 128cdf0e10cSrcweir // Optional set the parameters pX, pY 129cdf0e10cSrcweir static void Get1PixelInLogic( const ViewShell& rSh, 130cdf0e10cSrcweir long* pX = 0, long* pY = 0 ); 131cdf0e10cSrcweir }; 132cdf0e10cSrcweir 133cdf0e10cSrcweir 134cdf0e10cSrcweir class SwShellCrsr : public virtual SwCursor, public SwSelPaintRects 135cdf0e10cSrcweir { 136cdf0e10cSrcweir // Dokument-Positionen der Start/End-Charakter einer SSelection 137cdf0e10cSrcweir Point aMkPt, aPtPt; 138cdf0e10cSrcweir const SwPosition* pPt; // fuer Zuordung vom GetPoint() zum aPtPt 139cdf0e10cSrcweir 140cdf0e10cSrcweir using SwCursor::UpDown; 141cdf0e10cSrcweir 142cdf0e10cSrcweir public: 143cdf0e10cSrcweir SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos ); 144cdf0e10cSrcweir SwShellCrsr( const SwCrsrShell& rCrsrSh, const SwPosition &rPos, 145cdf0e10cSrcweir const Point& rPtPos, SwPaM* pRing = 0 ); 146cdf0e10cSrcweir SwShellCrsr( SwShellCrsr& ); 147cdf0e10cSrcweir virtual ~SwShellCrsr(); 148cdf0e10cSrcweir 149*69a74367SOliver-Rainer Wittmann virtual void FillRects(); // fuer Table- und normalen Crsr 150*69a74367SOliver-Rainer Wittmann 151cdf0e10cSrcweir void Show(); // Update und zeige alle Selektionen an 152cdf0e10cSrcweir void Hide(); // verstecke alle Selektionen 153cdf0e10cSrcweir void Invalidate( const SwRect& rRect ); 154cdf0e10cSrcweir GetPtPos() const155cdf0e10cSrcweir const Point& GetPtPos() const { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); } GetPtPos()156cdf0e10cSrcweir Point& GetPtPos() { return( SwPaM::GetPoint() == pPt ? aPtPt : aMkPt ); } GetMkPos() const157cdf0e10cSrcweir const Point& GetMkPos() const { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); } GetMkPos()158cdf0e10cSrcweir Point& GetMkPos() { return( SwPaM::GetMark() == pPt ? aPtPt : aMkPt ); } GetSttPos() const159cdf0e10cSrcweir const Point& GetSttPos() const { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); } GetSttPos()160cdf0e10cSrcweir Point& GetSttPos() { return( SwPaM::Start() == pPt ? aPtPt : aMkPt ); } GetEndPos() const161cdf0e10cSrcweir const Point& GetEndPos() const { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); } GetEndPos()162cdf0e10cSrcweir Point& GetEndPos() { return( SwPaM::End() == pPt ? aPtPt : aMkPt ); } 163cdf0e10cSrcweir 164cdf0e10cSrcweir virtual void SetMark(); 165cdf0e10cSrcweir 166cdf0e10cSrcweir virtual SwCursor* Create( SwPaM* pRing = 0 ) const; 167cdf0e10cSrcweir 168cdf0e10cSrcweir virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO 169cdf0e10cSrcweir virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 ); 170cdf0e10cSrcweir 171cdf0e10cSrcweir sal_Bool UpDown( sal_Bool bUp, sal_uInt16 nCnt = 1 ); 172cdf0e10cSrcweir 173cdf0e10cSrcweir // sal_True: an die Position kann der Cursor gesetzt werden 174cdf0e10cSrcweir virtual sal_Bool IsAtValidPos( sal_Bool bPoint = sal_True ) const; 175cdf0e10cSrcweir 176cdf0e10cSrcweir #ifdef DBG_UTIL 177cdf0e10cSrcweir // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung 178cdf0e10cSrcweir // am sichtbaren Cursor 179cdf0e10cSrcweir virtual sal_Bool IsSelOvr( int eFlags = 180cdf0e10cSrcweir ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | 181cdf0e10cSrcweir nsSwCursorSelOverFlags::SELOVER_TOGGLE | 182cdf0e10cSrcweir nsSwCursorSelOverFlags::SELOVER_CHANGEPOS )); 183cdf0e10cSrcweir #endif 184cdf0e10cSrcweir 185cdf0e10cSrcweir virtual bool IsReadOnlyAvailable() const; 186cdf0e10cSrcweir 187cdf0e10cSrcweir DECL_FIXEDMEMPOOL_NEWDEL( SwShellCrsr ) 188cdf0e10cSrcweir }; 189cdf0e10cSrcweir 190cdf0e10cSrcweir 191cdf0e10cSrcweir 192cdf0e10cSrcweir class SwShellTableCrsr : public virtual SwShellCrsr, public virtual SwTableCursor 193cdf0e10cSrcweir { 194cdf0e10cSrcweir // die Selection hat die gleiche Reihenfolge wie die 195cdf0e10cSrcweir // TabellenBoxen. D.h., wird aus dem einen Array an einer Position 196cdf0e10cSrcweir // etwas geloescht, dann muss es auch im anderen erfolgen!! 197cdf0e10cSrcweir 198cdf0e10cSrcweir public: 199cdf0e10cSrcweir SwShellTableCrsr( const SwCrsrShell& rCrsrSh, const SwPosition& rPos ); 200cdf0e10cSrcweir SwShellTableCrsr( const SwCrsrShell& rCrsrSh, 201cdf0e10cSrcweir const SwPosition &rMkPos, const Point& rMkPt, 202cdf0e10cSrcweir const SwPosition &rPtPos, const Point& rPtPt ); 203cdf0e10cSrcweir virtual ~SwShellTableCrsr(); 204cdf0e10cSrcweir 205cdf0e10cSrcweir virtual void FillRects(); // fuer Table- und normalen Crsr 206cdf0e10cSrcweir 207cdf0e10cSrcweir // Pruefe, ob sich der SPoint innerhalb der Tabellen-SSelection befindet 208cdf0e10cSrcweir sal_Bool IsInside( const Point& rPt ) const; 209cdf0e10cSrcweir 210cdf0e10cSrcweir virtual void SetMark(); 211cdf0e10cSrcweir virtual SwCursor* Create( SwPaM* pRing = 0 ) const; 212cdf0e10cSrcweir 213cdf0e10cSrcweir virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO 214cdf0e10cSrcweir virtual void SaveTblBoxCntnt( const SwPosition* pPos = 0 ); 215cdf0e10cSrcweir 216cdf0e10cSrcweir // sal_True: an die Position kann der Cursor gesetzt werden 217cdf0e10cSrcweir virtual sal_Bool IsAtValidPos( sal_Bool bPoint = sal_True ) const; 218cdf0e10cSrcweir 219cdf0e10cSrcweir #ifdef DBG_UTIL 220cdf0e10cSrcweir // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung 221cdf0e10cSrcweir // am sichtbaren Cursor 222cdf0e10cSrcweir virtual sal_Bool IsSelOvr( int eFlags = 223cdf0e10cSrcweir ( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | 224cdf0e10cSrcweir nsSwCursorSelOverFlags::SELOVER_TOGGLE | 225cdf0e10cSrcweir nsSwCursorSelOverFlags::SELOVER_CHANGEPOS )); 226cdf0e10cSrcweir #endif 227cdf0e10cSrcweir }; 228cdf0e10cSrcweir 229cdf0e10cSrcweir 230cdf0e10cSrcweir 231cdf0e10cSrcweir #endif // _VISCRS_HXX 232