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 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sw.hxx" 26 27 28 #include <SwPortionHandler.hxx> 29 #include "viewopt.hxx" // SwViewOptions 30 31 #include "txtcfg.hxx" 32 #include "portox.hxx" 33 #include "inftxt.hxx" // GetTxtSize() 34 35 /************************************************************************* 36 * virtual SwToxPortion::Paint() 37 *************************************************************************/ 38 39 void SwToxPortion::Paint( const SwTxtPaintInfo &rInf ) const 40 { 41 if( Width() ) 42 { 43 rInf.DrawViewOpt( *this, POR_TOX ); 44 SwTxtPortion::Paint( rInf ); 45 } 46 } 47 48 /************************************************************************* 49 * class SwIsoToxPortion 50 *************************************************************************/ 51 52 SwLinePortion *SwIsoToxPortion::Compress() { return this; } 53 54 SwIsoToxPortion::SwIsoToxPortion() : nViewWidth(0) 55 { 56 SetLen(1); 57 SetWhichPor( POR_ISOTOX ); 58 } 59 60 /************************************************************************* 61 * virtual SwIsoToxPortion::GetViewWidth() 62 *************************************************************************/ 63 64 KSHORT SwIsoToxPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const 65 { 66 // Wir stehen zwar im const, aber nViewWidth sollte erst im letzten 67 // Moment errechnet werden: 68 SwIsoToxPortion* pThis = (SwIsoToxPortion*)this; 69 // nViewWidth muss errechnet werden. 70 if( !Width() && rInf.OnWin() && 71 !rInf.GetOpt().IsPagePreview() && 72 !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() ) 73 { 74 if( !nViewWidth ) 75 pThis->nViewWidth = rInf.GetTxtSize( ' ' ).Width(); 76 } 77 else 78 pThis->nViewWidth = 0; 79 return nViewWidth; 80 } 81 82 /************************************************************************* 83 * virtual SwIsoToxPortion::Format() 84 *************************************************************************/ 85 86 sal_Bool SwIsoToxPortion::Format( SwTxtFormatInfo &rInf ) 87 { 88 const sal_Bool bFull = SwLinePortion::Format( rInf ); 89 return bFull; 90 } 91 92 /************************************************************************* 93 * virtual SwIsoToxPortion::Paint() 94 *************************************************************************/ 95 96 void SwIsoToxPortion::Paint( const SwTxtPaintInfo &rInf ) const 97 { 98 if( Width() ) 99 rInf.DrawViewOpt( *this, POR_TOX ); 100 } 101 102 /************************************************************************* 103 * virtual SwIsoToxPortion::HandlePortion() 104 *************************************************************************/ 105 106 void SwIsoToxPortion::HandlePortion( SwPortionHandler& rPH ) const 107 { 108 String aString; 109 rPH.Special( GetLen(), aString, GetWhichPor() ); 110 } 111 112