1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _CRSTATE_HXX 24cdf0e10cSrcweir #define _CRSTATE_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp> 27cdf0e10cSrcweir #include <tools/gen.hxx> 28cdf0e10cSrcweir #include <swtypes.hxx> 29cdf0e10cSrcweir #include <swrect.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir enum SwFillMode 33cdf0e10cSrcweir { 34cdf0e10cSrcweir FILL_TAB, // default, Auffuellen mit Tabulatoren 35cdf0e10cSrcweir FILL_SPACE, // ... mit Tabulatoren und Spaces 36cdf0e10cSrcweir FILL_MARGIN, // nur links, zentriert, rechts Ausrichten 37cdf0e10cSrcweir FILL_INDENT // durch linken Absatzeinzug 38cdf0e10cSrcweir }; 39cdf0e10cSrcweir 40cdf0e10cSrcweir struct SwFillCrsrPos 41cdf0e10cSrcweir { 42cdf0e10cSrcweir SwRect aCrsr; // Position und Groesse des Shadowcursors 43cdf0e10cSrcweir sal_uInt16 nParaCnt; // Anzahl der einzufuegenden Absaetze 44cdf0e10cSrcweir sal_uInt16 nTabCnt; // Anzahl der Tabs bzw. Groesse des Einzugs 45cdf0e10cSrcweir sal_uInt16 nSpaceCnt; // Anzahl der einzufuegenden Leerzeichen 46cdf0e10cSrcweir sal_uInt16 nColumnCnt; // Anzahl der notwendigen Spaltenumbrueche 47cdf0e10cSrcweir sal_Int16 eOrient; // Absatzausrichtung 48cdf0e10cSrcweir SwFillMode eMode; // Gewuenschte Auffuellregel SwFillCrsrPosSwFillCrsrPos49cdf0e10cSrcweir SwFillCrsrPos( SwFillMode eMd = FILL_TAB ) : 50cdf0e10cSrcweir nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nColumnCnt( 0 ), 51cdf0e10cSrcweir eOrient( com::sun::star::text::HoriOrientation::NONE ), eMode( eMd ) 52cdf0e10cSrcweir {} 53cdf0e10cSrcweir }; 54cdf0e10cSrcweir 55cdf0e10cSrcweir // Multiportion types: two lines, bidirectional, 270 degrees rotation, 56cdf0e10cSrcweir // ruby portion and 90 degrees rotation 57cdf0e10cSrcweir #define MT_TWOLINE 0 58cdf0e10cSrcweir #define MT_BIDI 1 59cdf0e10cSrcweir #define MT_ROT_270 3 60cdf0e10cSrcweir #define MT_RUBY 4 61cdf0e10cSrcweir #define MT_ROT_90 7 62cdf0e10cSrcweir 63cdf0e10cSrcweir struct Sw2LinesPos 64cdf0e10cSrcweir { 65cdf0e10cSrcweir SwRect aLine; // Position and size of the line 66cdf0e10cSrcweir SwRect aPortion; // Position and size of the multi portion 67cdf0e10cSrcweir SwRect aPortion2; // needed for nested multi portions 68cdf0e10cSrcweir sal_uInt8 nMultiType; // Multiportion type 69cdf0e10cSrcweir }; 70cdf0e10cSrcweir 71cdf0e10cSrcweir /** 72cdf0e10cSrcweir * SwSpecialPos. This structure is used to pass some additional information 73cdf0e10cSrcweir * during the call of SwTxtFrm::GetCharRect(). An SwSpecialPos defines a position 74cdf0e10cSrcweir * inside a portion which does not have a representation in the core string or 75cdf0e10cSrcweir * which is only represented by one position, e.g., field portions, 76cdf0e10cSrcweir * number portions, ergo sum and quo vadis portions. 77cdf0e10cSrcweir * 78cdf0e10cSrcweir * nCharOfst - The offset inside the special portion. Fields and its 79cdf0e10cSrcweir * follow fields are treated as one long special portion. 80cdf0e10cSrcweir * nLineOfst - The number of lines between the beginning of the special 81cdf0e10cSrcweir * portion and nCharOfst. A line offset required to be 82cdf0e10cSrcweir * nCharOfst relative to the beginning of the line. 83cdf0e10cSrcweir * nExtendRange - Setting this identifies portions which are in front or 84cdf0e10cSrcweir * behind the core string (number portion, quo vadis) 85cdf0e10cSrcweir * 86cdf0e10cSrcweir * Examples 1) 87cdf0e10cSrcweir * 88cdf0e10cSrcweir * Get the position of the second character inside a number portion: 89cdf0e10cSrcweir * nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE; 90cdf0e10cSrcweir * Call SwTxtFrm:::GetCharRect with core string position 0. 91cdf0e10cSrcweir * 92cdf0e10cSrcweir * Example 2) 93cdf0e10cSrcweir * 94cdf0e10cSrcweir * Field A - Length = 5 95cdf0e10cSrcweir * Follow field B - Length = 9 96cdf0e10cSrcweir * Get the position of the third character in follow field B, core position 97cdf0e10cSrcweir * of field A is 33. 98cdf0e10cSrcweir * nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE; 99cdf0e10cSrcweir * Call SwTxtFrm:::GetCharRect with core string position 33. 100cdf0e10cSrcweir */ 101cdf0e10cSrcweir 102cdf0e10cSrcweir #define SP_EXTEND_RANGE_NONE 0 103cdf0e10cSrcweir #define SP_EXTEND_RANGE_BEFORE 1 104cdf0e10cSrcweir #define SP_EXTEND_RANGE_BEHIND 2 105cdf0e10cSrcweir 106cdf0e10cSrcweir struct SwSpecialPos 107cdf0e10cSrcweir { 108cdf0e10cSrcweir xub_StrLen nCharOfst; 109cdf0e10cSrcweir sal_uInt16 nLineOfst; 110cdf0e10cSrcweir sal_uInt8 nExtendRange; 111cdf0e10cSrcweir 112cdf0e10cSrcweir // #i27615# SwSpecialPosSwSpecialPos113cdf0e10cSrcweir SwSpecialPos() : nCharOfst(0), nLineOfst(0), 114cdf0e10cSrcweir nExtendRange(SP_EXTEND_RANGE_NONE) 115cdf0e10cSrcweir {} 116cdf0e10cSrcweir }; 117cdf0e10cSrcweir 118cdf0e10cSrcweir // CrsrTravelling-Staties (fuer GetCrsrOfst) 119cdf0e10cSrcweir enum CrsrMoveState 120cdf0e10cSrcweir { 121cdf0e10cSrcweir MV_NONE, // default 122cdf0e10cSrcweir MV_UPDOWN, // Crsr Up/Down 123cdf0e10cSrcweir MV_RIGHTMARGIN, // an rechten Rand 124cdf0e10cSrcweir MV_LEFTMARGIN, // an linken Rand 125cdf0e10cSrcweir MV_SETONLYTEXT, // mit dem Cursr nur im Text bleiben 126cdf0e10cSrcweir MV_TBLSEL // nicht in wiederholte Headlines 127cdf0e10cSrcweir }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir // struct fuer spaetere Erweiterungen 130cdf0e10cSrcweir struct SwCrsrMoveState 131cdf0e10cSrcweir { 132cdf0e10cSrcweir SwFillCrsrPos *pFill; // fuer das automatische Auffuellen mit Tabs etc. 133cdf0e10cSrcweir Sw2LinesPos *p2Lines; // for selections inside/around 2line portions 134cdf0e10cSrcweir SwSpecialPos* pSpecialPos; // for positions inside fields 135cdf0e10cSrcweir Point aRealHeight; // enthaelt dann die Position/Hoehe des Cursors 136cdf0e10cSrcweir CrsrMoveState eState; 137cdf0e10cSrcweir sal_uInt8 nCursorBidiLevel; 138cdf0e10cSrcweir sal_Bool bStop :1; 139cdf0e10cSrcweir sal_Bool bRealHeight :1; // Soll die reale Hoehe berechnet werden? 140cdf0e10cSrcweir sal_Bool bFieldInfo :1; // Sollen Felder erkannt werden? 141cdf0e10cSrcweir sal_Bool bPosCorr :1; // Point musste korrigiert werden 142cdf0e10cSrcweir sal_Bool bFtnNoInfo :1; // Fussnotennumerierung erkannt 143cdf0e10cSrcweir sal_Bool bExactOnly :1; // GetCrsrOfst nur nach Exakten Treffern 144cdf0e10cSrcweir // suchen lassen, sprich niemals in das 145cdf0e10cSrcweir // GetCntntPos laufen. 146cdf0e10cSrcweir sal_Bool bFillRet :1; // wird nur im FillModus temp. genutzt 147cdf0e10cSrcweir sal_Bool bSetInReadOnly :1; // ReadOnlyBereiche duerfen betreten werden 148cdf0e10cSrcweir sal_Bool bRealWidth :1; // Calculation of the width required 149cdf0e10cSrcweir sal_Bool b2Lines :1; // Check 2line portions and fill p2Lines 150cdf0e10cSrcweir sal_Bool bNoScroll :1; // No scrolling of undersized textframes 151cdf0e10cSrcweir sal_Bool bPosMatchesBounds :1; // GetCrsrOfst should not return the next 152cdf0e10cSrcweir // position if screen position is inside second 153cdf0e10cSrcweir // have of bound rect 154cdf0e10cSrcweir 155cdf0e10cSrcweir sal_Bool bCntntCheck :1; // --> FME 2005-05-13 #i43742# Cursor position over content? <-- 156cdf0e10cSrcweir 157cdf0e10cSrcweir // #i27615# 158cdf0e10cSrcweir /** 159cdf0e10cSrcweir cursor in front of label 160cdf0e10cSrcweir */ 161cdf0e10cSrcweir sal_Bool bInFrontOfLabel :1; 162cdf0e10cSrcweir sal_Bool bInNumPortion :1; // point is in number portion #i23726# 163cdf0e10cSrcweir int nInNumPostionOffset; // distance from number portion's start 164cdf0e10cSrcweir SwCrsrMoveStateSwCrsrMoveState165cdf0e10cSrcweir SwCrsrMoveState( CrsrMoveState eSt = MV_NONE ) : 166cdf0e10cSrcweir pFill( NULL ), 167cdf0e10cSrcweir p2Lines( NULL ), 168cdf0e10cSrcweir pSpecialPos( NULL ), 169cdf0e10cSrcweir eState( eSt ), 170cdf0e10cSrcweir nCursorBidiLevel( 0 ), 171cdf0e10cSrcweir bStop( sal_False ), 172cdf0e10cSrcweir bRealHeight( sal_False ), 173cdf0e10cSrcweir bFieldInfo( sal_False ), 174cdf0e10cSrcweir bPosCorr( sal_False ), 175cdf0e10cSrcweir bFtnNoInfo( sal_False ), 176cdf0e10cSrcweir bExactOnly( sal_False ), 177cdf0e10cSrcweir bSetInReadOnly( sal_False ), 178cdf0e10cSrcweir bRealWidth( sal_False ), 179cdf0e10cSrcweir b2Lines( sal_False ), 180cdf0e10cSrcweir bNoScroll( sal_False ), 181cdf0e10cSrcweir bPosMatchesBounds( sal_False ), 182cdf0e10cSrcweir bCntntCheck( sal_False ), // --> FME 2005-05-13 #i43742# <-- 183cdf0e10cSrcweir bInFrontOfLabel( sal_False ), // #i27615# 184cdf0e10cSrcweir bInNumPortion(sal_False), // #i26726# 185cdf0e10cSrcweir nInNumPostionOffset(0) // #i26726# 186cdf0e10cSrcweir {} SwCrsrMoveStateSwCrsrMoveState187cdf0e10cSrcweir SwCrsrMoveState( SwFillCrsrPos *pInitFill ) : 188cdf0e10cSrcweir pFill( pInitFill ), 189cdf0e10cSrcweir pSpecialPos( NULL ), 190cdf0e10cSrcweir eState( MV_SETONLYTEXT ), 191cdf0e10cSrcweir nCursorBidiLevel( 0 ), 192cdf0e10cSrcweir bStop( sal_False ), 193cdf0e10cSrcweir bRealHeight( sal_False ), 194cdf0e10cSrcweir bFieldInfo( sal_False ), 195cdf0e10cSrcweir bPosCorr( sal_False ), 196cdf0e10cSrcweir bFtnNoInfo( sal_False ), 197cdf0e10cSrcweir bExactOnly( sal_False ), 198cdf0e10cSrcweir bSetInReadOnly( sal_False ), 199cdf0e10cSrcweir bRealWidth( sal_False ), 200cdf0e10cSrcweir b2Lines( sal_False ), 201cdf0e10cSrcweir bNoScroll( sal_False ), 202cdf0e10cSrcweir bPosMatchesBounds( sal_False ), 203cdf0e10cSrcweir bCntntCheck( sal_False ), // --> FME 2005-05-13 #i43742# <-- 204cdf0e10cSrcweir bInFrontOfLabel( sal_False ), // #i27615# 205cdf0e10cSrcweir bInNumPortion(sal_False), // #i23726# 206cdf0e10cSrcweir nInNumPostionOffset(0) // #i23726# 207cdf0e10cSrcweir {} 208cdf0e10cSrcweir }; 209cdf0e10cSrcweir 210cdf0e10cSrcweir 211cdf0e10cSrcweir #endif 212cdf0e10cSrcweir 213cdf0e10cSrcweir 214