1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _PORTXT_HXX 28 #define _PORTXT_HXX 29 #ifdef GCC 30 #include <sys/types.h> 31 #else 32 #include <new.h> //fuer size_t, FIXEDMEM aus tools 33 #endif 34 #include <tools/mempool.hxx> 35 36 #include "porlin.hxx" 37 38 class SwTxtGuess; 39 40 /************************************************************************* 41 * class SwTxtPortion 42 *************************************************************************/ 43 44 class SwTxtPortion : public SwLinePortion 45 { 46 void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess ); 47 void BreakUnderflow( SwTxtFormatInfo &rInf ); 48 sal_Bool _Format( SwTxtFormatInfo &rInf ); 49 50 public: 51 inline SwTxtPortion(){ SetWhichPor( POR_TXT ); } 52 SwTxtPortion( const SwLinePortion &rPortion ); 53 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 54 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 55 virtual void FormatEOL( SwTxtFormatInfo &rInf ); 56 virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const; 57 virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; 58 virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; 59 virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const; 60 61 // zaehlt die Spaces fuer Blocksatz 62 xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const; 63 64 sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ); 65 66 // Accessibility: pass information about this portion to the PortionHandler 67 virtual void HandlePortion( SwPortionHandler& rPH ) const; 68 69 OUTPUT_OPERATOR 70 DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion) 71 }; 72 73 /************************************************************************* 74 * class SwHolePortion 75 *************************************************************************/ 76 77 class SwHolePortion : public SwLinePortion 78 { 79 KSHORT nBlankWidth; 80 public: 81 SwHolePortion( const SwTxtPortion &rPor ); 82 inline KSHORT GetBlankWidth( ) const { return nBlankWidth; } 83 inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; } 84 virtual SwLinePortion *Compress(); 85 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 86 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 87 88 // Accessibility: pass information about this portion to the PortionHandler 89 virtual void HandlePortion( SwPortionHandler& rPH ) const; 90 91 OUTPUT_OPERATOR 92 DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion) 93 }; 94 95 class SwFieldMarkPortion : public SwTxtPortion 96 { 97 public: 98 inline SwFieldMarkPortion() : SwTxtPortion() 99 { } 100 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 101 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 102 }; 103 104 class SwFieldFormPortion : public SwTxtPortion 105 { 106 public: 107 inline SwFieldFormPortion() : SwTxtPortion() 108 { } 109 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 110 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 111 }; 112 113 114 CLASSIO( SwTxtPortion ) 115 CLASSIO( SwHolePortion ) 116 117 #endif 118