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 _PORTXT_HXX 24 #define _PORTXT_HXX 25 26 #include <tools/mempool.hxx> 27 28 #include "porlin.hxx" 29 30 class SwTxtGuess; 31 32 /************************************************************************* 33 * class SwTxtPortion 34 *************************************************************************/ 35 36 class SwTxtPortion : public SwLinePortion 37 { 38 void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess ); 39 void BreakUnderflow( SwTxtFormatInfo &rInf ); 40 sal_Bool _Format( SwTxtFormatInfo &rInf ); 41 42 public: 43 inline SwTxtPortion(){ SetWhichPor( POR_TXT ); } 44 SwTxtPortion( const SwLinePortion &rPortion ); 45 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 46 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 47 virtual void FormatEOL( SwTxtFormatInfo &rInf ); 48 virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const; 49 virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; 50 virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; 51 virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const; 52 53 // zaehlt die Spaces fuer Blocksatz 54 xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const; 55 56 sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ); 57 58 // Accessibility: pass information about this portion to the PortionHandler 59 virtual void HandlePortion( SwPortionHandler& rPH ) const; 60 61 OUTPUT_OPERATOR 62 DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion) 63 }; 64 65 /************************************************************************* 66 * class SwHolePortion 67 *************************************************************************/ 68 69 class SwHolePortion : public SwLinePortion 70 { 71 KSHORT nBlankWidth; 72 public: 73 SwHolePortion( const SwTxtPortion &rPor ); 74 inline KSHORT GetBlankWidth( ) const { return nBlankWidth; } 75 inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; } 76 virtual SwLinePortion *Compress(); 77 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 78 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 79 80 // Accessibility: pass information about this portion to the PortionHandler 81 virtual void HandlePortion( SwPortionHandler& rPH ) const; 82 83 OUTPUT_OPERATOR 84 DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion) 85 }; 86 87 class SwFieldMarkPortion : public SwTxtPortion 88 { 89 public: 90 inline SwFieldMarkPortion() : SwTxtPortion() 91 { } 92 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 93 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 94 }; 95 96 class SwFieldFormPortion : public SwTxtPortion 97 { 98 public: 99 inline SwFieldFormPortion() : SwTxtPortion() 100 { } 101 virtual void Paint( const SwTxtPaintInfo &rInf ) const; 102 virtual sal_Bool Format( SwTxtFormatInfo &rInf ); 103 }; 104 105 106 CLASSIO( SwTxtPortion ) 107 CLASSIO( SwHolePortion ) 108 109 #endif 110