android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / text / portox.cxx
blobbd72e83b042dfb0ecc4abf682226f56e0a163e23
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 "portox.hxx"
24 #include "inftxt.hxx"
26 void SwToxPortion::Paint( const SwTextPaintInfo &rInf ) const
28 if( Width() )
30 rInf.DrawViewOpt( *this, PortionType::Tox );
31 SwTextPortion::Paint( rInf );
35 SwLinePortion *SwIsoToxPortion::Compress() { return this; }
37 SwIsoToxPortion::SwIsoToxPortion() : m_nViewWidth(0)
39 SetLen(TextFrameIndex(1));
40 SetWhichPor( PortionType::IsoTox );
43 sal_uInt16 SwIsoToxPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
45 // Although we are const, nViewWidth should be calculated in the last
46 // moment possible
47 SwIsoToxPortion* pThis = const_cast<SwIsoToxPortion*>(this);
48 // nViewWidth need to be calculated
49 if( !Width() && rInf.OnWin() &&
50 !rInf.GetOpt().IsPagePreview() &&
51 !rInf.GetOpt().IsReadonly() && rInf.GetOpt().IsFieldShadings() )
53 if( !m_nViewWidth )
54 pThis->m_nViewWidth = rInf.GetTextSize(OUString(' ')).Width();
56 else
57 pThis->m_nViewWidth = 0;
58 return m_nViewWidth;
61 bool SwIsoToxPortion::Format( SwTextFormatInfo &rInf )
63 return SwLinePortion::Format( rInf );
66 void SwIsoToxPortion::Paint( const SwTextPaintInfo &rInf ) const
68 if( Width() )
69 rInf.DrawViewOpt( *this, PortionType::Tox );
72 void SwIsoToxPortion::HandlePortion( SwPortionHandler& rPH ) const
74 rPH.Special( GetLen(), OUString(), GetWhichPor() );
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */