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>
26 void SwRefPortion::Paint( const SwTextPaintInfo
&rInf
) const
30 rInf
.DrawViewOpt( *this, PortionType::Ref
);
31 SwTextPortion::Paint( rInf
);
35 SwLinePortion
*SwIsoRefPortion::Compress() { return this; }
37 SwIsoRefPortion::SwIsoRefPortion() : m_nViewWidth(0)
39 SetLen(TextFrameIndex(1));
40 SetWhichPor( PortionType::IsoRef
);
43 sal_uInt16
SwIsoRefPortion::GetViewWidth( const SwTextSizeInfo
&rInf
) const
45 // Although we are const, nViewWidth should be calculated in the last
47 SwIsoRefPortion
* pThis
= const_cast<SwIsoRefPortion
*>(this);
48 if( !Width() && rInf
.OnWin() && rInf
.GetOpt().IsFieldShadings() &&
49 !rInf
.GetOpt().IsReadonly() && !rInf
.GetOpt().IsPagePreview() )
52 pThis
->m_nViewWidth
= rInf
.GetTextSize(OUString(' ')).Width();
55 pThis
->m_nViewWidth
= 0;
59 bool SwIsoRefPortion::Format( SwTextFormatInfo
&rInf
)
61 return SwLinePortion::Format( rInf
);
64 void SwIsoRefPortion::Paint( const SwTextPaintInfo
&rInf
) const
67 rInf
.DrawViewOpt( *this, PortionType::Ref
);
70 void SwIsoRefPortion::HandlePortion( SwPortionHandler
& rPH
) const
72 rPH
.Special( GetLen(), OUString(), GetWhichPor() );
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */