android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / text / porref.cxx
bloba64f2df1fe1d6dd3544ed9b2083f50ea063cf2d1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
23 #include "porref.hxx"
24 #include "inftxt.hxx"
26 void SwRefPortion::Paint( const SwTextPaintInfo &rInf ) const
28 if( Width() )
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
46 // moment possible
47 SwIsoRefPortion* pThis = const_cast<SwIsoRefPortion*>(this);
48 if( !Width() && rInf.OnWin() && rInf.GetOpt().IsFieldShadings() &&
49 !rInf.GetOpt().IsReadonly() && !rInf.GetOpt().IsPagePreview() )
51 if( !m_nViewWidth )
52 pThis->m_nViewWidth = rInf.GetTextSize(OUString(' ')).Width();
54 else
55 pThis->m_nViewWidth = 0;
56 return m_nViewWidth;
59 bool SwIsoRefPortion::Format( SwTextFormatInfo &rInf )
61 return SwLinePortion::Format( rInf );
64 void SwIsoRefPortion::Paint( const SwTextPaintInfo &rInf ) const
66 if( Width() )
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: */