2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 14:30:50 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 14:30:50 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 14:30:50 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 14:30:50 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 14:30:50 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 14:30:50 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2002-04-04 11:27:19 +00:00
|
|
|
#include <SwPortionHandler.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "viewopt.hxx" // SwViewOptions
|
|
|
|
|
|
|
|
#include "portox.hxx"
|
|
|
|
#include "inftxt.hxx" // GetTxtSize()
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* virtual SwToxPortion::Paint()
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
void SwToxPortion::Paint( const SwTxtPaintInfo &rInf ) const
|
|
|
|
{
|
|
|
|
if( Width() )
|
|
|
|
{
|
|
|
|
rInf.DrawViewOpt( *this, POR_TOX );
|
|
|
|
SwTxtPortion::Paint( rInf );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* class SwIsoToxPortion
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
SwLinePortion *SwIsoToxPortion::Compress() { return this; }
|
|
|
|
|
|
|
|
SwIsoToxPortion::SwIsoToxPortion() : nViewWidth(0)
|
|
|
|
{
|
|
|
|
SetLen(1);
|
|
|
|
SetWhichPor( POR_ISOTOX );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* virtual SwIsoToxPortion::GetViewWidth()
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
KSHORT SwIsoToxPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
|
|
|
|
{
|
2012-03-28 17:24:08 +02:00
|
|
|
// Although we are const, nViewWidth should be calculated in the last
|
|
|
|
// moment possible
|
2000-09-18 23:08:29 +00:00
|
|
|
SwIsoToxPortion* pThis = (SwIsoToxPortion*)this;
|
2012-03-28 17:24:08 +02:00
|
|
|
// nViewWidth need to be calculated
|
2002-04-25 13:00:16 +00:00
|
|
|
if( !Width() && rInf.OnWin() &&
|
2002-06-20 08:28:20 +00:00
|
|
|
!rInf.GetOpt().IsPagePreview() &&
|
|
|
|
!rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( !nViewWidth )
|
2012-10-24 07:28:15 +02:00
|
|
|
pThis->nViewWidth = rInf.GetTxtSize(OUString(' ')).Width();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pThis->nViewWidth = 0;
|
|
|
|
return nViewWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* virtual SwIsoToxPortion::Format()
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
sal_Bool SwIsoToxPortion::Format( SwTxtFormatInfo &rInf )
|
|
|
|
{
|
|
|
|
const sal_Bool bFull = SwLinePortion::Format( rInf );
|
|
|
|
return bFull;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* virtual SwIsoToxPortion::Paint()
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
void SwIsoToxPortion::Paint( const SwTxtPaintInfo &rInf ) const
|
|
|
|
{
|
|
|
|
if( Width() )
|
|
|
|
rInf.DrawViewOpt( *this, POR_TOX );
|
|
|
|
}
|
|
|
|
|
2002-04-04 11:27:19 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* virtual SwIsoToxPortion::HandlePortion()
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
void SwIsoToxPortion::HandlePortion( SwPortionHandler& rPH ) const
|
|
|
|
{
|
|
|
|
String aString;
|
|
|
|
rPH.Special( GetLen(), aString, GetWhichPor() );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|