1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <SwPortionHandler.hxx>
21 #include "viewopt.hxx" // SwViewOptions
24 #include "inftxt.hxx" // GetTxtSize()
26 /*************************************************************************
27 * virtual SwToxPortion::Paint()
28 *************************************************************************/
30 void SwToxPortion::Paint( const SwTxtPaintInfo
&rInf
) const
34 rInf
.DrawViewOpt( *this, POR_TOX
);
35 SwTxtPortion::Paint( rInf
);
39 /*************************************************************************
40 * class SwIsoToxPortion
41 *************************************************************************/
43 SwLinePortion
*SwIsoToxPortion::Compress() { return this; }
45 SwIsoToxPortion::SwIsoToxPortion() : nViewWidth(0)
48 SetWhichPor( POR_ISOTOX
);
51 /*************************************************************************
52 * virtual SwIsoToxPortion::GetViewWidth()
53 *************************************************************************/
55 KSHORT
SwIsoToxPortion::GetViewWidth( const SwTxtSizeInfo
&rInf
) const
57 // Although we are const, nViewWidth should be calculated in the last
59 SwIsoToxPortion
* pThis
= (SwIsoToxPortion
*)this;
60 // nViewWidth need to be calculated
61 if( !Width() && rInf
.OnWin() &&
62 !rInf
.GetOpt().IsPagePreview() &&
63 !rInf
.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() )
66 pThis
->nViewWidth
= rInf
.GetTxtSize(OUString(' ')).Width();
69 pThis
->nViewWidth
= 0;
73 /*************************************************************************
74 * virtual SwIsoToxPortion::Format()
75 *************************************************************************/
77 sal_Bool
SwIsoToxPortion::Format( SwTxtFormatInfo
&rInf
)
79 const sal_Bool bFull
= SwLinePortion::Format( rInf
);
83 /*************************************************************************
84 * virtual SwIsoToxPortion::Paint()
85 *************************************************************************/
87 void SwIsoToxPortion::Paint( const SwTxtPaintInfo
&rInf
) const
90 rInf
.DrawViewOpt( *this, POR_TOX
);
93 /*************************************************************************
94 * virtual SwIsoToxPortion::HandlePortion()
95 *************************************************************************/
97 void SwIsoToxPortion::HandlePortion( SwPortionHandler
& rPH
) const
100 rPH
.Special( GetLen(), aString
, GetWhichPor() );
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */