2000-09-18 16:07:07 +00:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
2008-04-10 23:23:43 +00:00
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2008-04-10 23:23:43 +00:00
|
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2008-04-10 23:23:43 +00:00
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2008-04-10 23:23:43 +00:00
|
|
|
|
* $RCSfile: editdoc2.cxx,v $
|
|
|
|
|
* $Revision: 1.19 $
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2008-04-10 23:23:43 +00:00
|
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2008-04-10 23:23:43 +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 16:07:07 +00:00
|
|
|
|
*
|
2008-04-10 23:23:43 +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 16:07:07 +00:00
|
|
|
|
*
|
2008-04-10 23:23:43 +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 16:07:07 +00:00
|
|
|
|
*
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
2006-09-17 03:48:51 +00:00
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
|
#include "precompiled_svx.hxx"
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
#include <eeng_pch.hxx>
|
|
|
|
|
#include <svtools/smplhint.hxx>
|
|
|
|
|
#include <tools/rtti.hxx>
|
2007-06-27 16:55:06 +00:00
|
|
|
|
#include <svx/lspcitem.hxx>
|
|
|
|
|
#include <svx/adjitem.hxx>
|
|
|
|
|
#include <svx/tstpitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
#include <editdoc.hxx>
|
|
|
|
|
#include <impedit.hxx>
|
|
|
|
|
#include <editdbg.hxx>
|
|
|
|
|
|
2007-06-27 16:55:06 +00:00
|
|
|
|
#include <svx/numitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2007-06-27 16:55:06 +00:00
|
|
|
|
#include <svx/akrnitem.hxx>
|
|
|
|
|
#include <svx/cntritem.hxx>
|
|
|
|
|
#include <svx/colritem.hxx>
|
|
|
|
|
#include <svx/crsditem.hxx>
|
|
|
|
|
#include <svx/escpitem.hxx>
|
|
|
|
|
#include <svx/fhgtitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
#include "fontitem.hxx"
|
2007-06-27 16:55:06 +00:00
|
|
|
|
#include <svx/kernitem.hxx>
|
|
|
|
|
#include <svx/lrspitem.hxx>
|
|
|
|
|
#include <svx/postitem.hxx>
|
|
|
|
|
#include <svx/shdditem.hxx>
|
|
|
|
|
#include <svx/udlnitem.hxx>
|
|
|
|
|
#include <svx/ulspitem.hxx>
|
|
|
|
|
#include <svx/wghtitem.hxx>
|
|
|
|
|
#include <svx/wrlmitem.hxx>
|
|
|
|
|
#include <svx/charscaleitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
#include <vcl/svapp.hxx> // Fuer AppWindow...
|
|
|
|
|
|
2006-10-12 11:35:40 +00:00
|
|
|
|
DBG_NAME( EE_ParaPortion )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-04-19 12:47:56 +00:00
|
|
|
|
SV_IMPL_VARARR( CharPosArray, sal_Int32 );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
BOOL EditStyleSheet::HasStyleAsAnyParent( SfxStyleSheet& rStyle )
|
|
|
|
|
{
|
|
|
|
|
if ( GetParent() == rStyle.GetName() )
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
if ( GetParent().Len() && ( GetParent() != GetName() ) )
|
|
|
|
|
{
|
|
|
|
|
EditStyleSheet* pS = (EditStyleSheet*)GetPool().Find( GetParent(), rStyle.GetFamily() );
|
|
|
|
|
if ( pS )
|
|
|
|
|
return pS->HasStyleAsAnyParent( rStyle );
|
|
|
|
|
}
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// class TextPortionList
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
TextPortionList::TextPortionList()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextPortionList::~TextPortionList()
|
|
|
|
|
{
|
|
|
|
|
Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TextPortionList::Reset()
|
|
|
|
|
{
|
|
|
|
|
for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
|
|
|
|
|
delete GetObject( nPortion );
|
|
|
|
|
Remove( 0, Count() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TextPortionList::DeleteFromPortion( USHORT nDelFrom )
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( ( nDelFrom < Count() ) || ( (nDelFrom == 0) && (Count() == 0) ), "DeleteFromPortion: Out of range" );
|
|
|
|
|
for ( USHORT nP = nDelFrom; nP < Count(); nP++ )
|
|
|
|
|
delete GetObject( nP );
|
|
|
|
|
Remove( nDelFrom, Count()-nDelFrom );
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-12 09:31:21 +00:00
|
|
|
|
USHORT TextPortionList::FindPortion( USHORT nCharPos, USHORT& nPortionStart, BOOL bPreferStartingPortion )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
// Bei nCharPos an Portion-Grenze wird die linke Portion gefunden
|
|
|
|
|
USHORT nTmpPos = 0;
|
|
|
|
|
for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
|
|
|
|
|
{
|
|
|
|
|
TextPortion* pPortion = GetObject( nPortion );
|
2006-10-12 11:35:40 +00:00
|
|
|
|
nTmpPos = nTmpPos + pPortion->GetLen();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
if ( nTmpPos >= nCharPos )
|
|
|
|
|
{
|
2002-07-12 09:31:21 +00:00
|
|
|
|
// take this one if we don't prefer the starting portion, or if it's the last one
|
|
|
|
|
if ( ( nTmpPos != nCharPos ) || !bPreferStartingPortion || ( nPortion == Count() - 1 ) )
|
|
|
|
|
{
|
|
|
|
|
nPortionStart = nTmpPos - pPortion->GetLen();
|
|
|
|
|
return nPortion;
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DBG_ERROR( "FindPortion: Nicht gefunden!" );
|
|
|
|
|
return ( Count() - 1 );
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-21 11:47:31 +00:00
|
|
|
|
USHORT TextPortionList::GetStartPos( USHORT nPortion )
|
|
|
|
|
{
|
|
|
|
|
USHORT nPos = 0;
|
|
|
|
|
for ( USHORT n = 0; n < nPortion; n++ )
|
|
|
|
|
{
|
|
|
|
|
TextPortion* pPortion = GetObject( n );
|
2006-10-12 11:35:40 +00:00
|
|
|
|
nPos = nPos + pPortion->GetLen();
|
2001-06-21 11:47:31 +00:00
|
|
|
|
}
|
|
|
|
|
return nPos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// class ExtraPortionInfo
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
ExtraPortionInfo::ExtraPortionInfo()
|
|
|
|
|
{
|
|
|
|
|
nOrgWidth = 0;
|
|
|
|
|
nWidthFullCompression = 0;
|
|
|
|
|
nMaxCompression100thPercent = 0;
|
|
|
|
|
nAsianCompressionTypes = 0;
|
|
|
|
|
nPortionOffsetX = 0;
|
|
|
|
|
bFirstCharIsRightPunktuation = FALSE;
|
|
|
|
|
bCompressed = FALSE;
|
|
|
|
|
pOrgDXArray = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExtraPortionInfo::~ExtraPortionInfo()
|
|
|
|
|
{
|
2002-07-12 12:31:17 +00:00
|
|
|
|
delete[] pOrgDXArray;
|
2001-06-21 11:47:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-10-05 12:23:48 +00:00
|
|
|
|
void ExtraPortionInfo::SaveOrgDXArray( const sal_Int32* pDXArray, USHORT nLen )
|
2001-06-21 11:47:31 +00:00
|
|
|
|
{
|
2002-07-12 12:31:17 +00:00
|
|
|
|
delete[] pOrgDXArray;
|
2005-10-05 12:23:48 +00:00
|
|
|
|
pOrgDXArray = new sal_Int32[nLen];
|
|
|
|
|
memcpy( pOrgDXArray, pDXArray, nLen*sizeof(sal_Int32) );
|
2001-06-21 11:47:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExtraPortionInfo::DestroyOrgDXArray()
|
|
|
|
|
{
|
2002-07-12 12:31:17 +00:00
|
|
|
|
delete[] pOrgDXArray;
|
2001-06-21 11:47:31 +00:00
|
|
|
|
pOrgDXArray = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
|
// class ParaPortion
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
ParaPortion::ParaPortion( ContentNode* pN )
|
|
|
|
|
{
|
|
|
|
|
DBG_CTOR( EE_ParaPortion, 0 );
|
|
|
|
|
|
|
|
|
|
pNode = pN;
|
|
|
|
|
bInvalid = TRUE;
|
|
|
|
|
bVisible = TRUE;
|
|
|
|
|
bSimple = FALSE;
|
|
|
|
|
bForceRepaint = FALSE;
|
|
|
|
|
nInvalidPosStart = 0;
|
|
|
|
|
nInvalidDiff = 0;
|
|
|
|
|
nHeight = 0;
|
|
|
|
|
nFirstLineOffset = 0;
|
|
|
|
|
nBulletX = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ParaPortion::~ParaPortion()
|
|
|
|
|
{
|
|
|
|
|
DBG_DTOR( EE_ParaPortion, 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ParaPortion::MarkInvalid( USHORT nStart, short nDiff )
|
|
|
|
|
{
|
|
|
|
|
if ( bInvalid == FALSE )
|
|
|
|
|
{
|
|
|
|
|
// nInvalidPosEnd = nStart; // ??? => CreateLines
|
|
|
|
|
nInvalidPosStart = ( nDiff >= 0 ) ? nStart : ( nStart + nDiff );
|
|
|
|
|
nInvalidDiff = nDiff;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Einfaches hintereinander tippen
|
|
|
|
|
if ( ( nDiff > 0 ) && ( nInvalidDiff > 0 ) &&
|
|
|
|
|
( ( nInvalidPosStart+nInvalidDiff ) == nStart ) )
|
|
|
|
|
{
|
2006-10-12 11:35:40 +00:00
|
|
|
|
nInvalidDiff = nInvalidDiff + nDiff;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
// Einfaches hintereinander loeschen
|
|
|
|
|
else if ( ( nDiff < 0 ) && ( nInvalidDiff < 0 ) && ( nInvalidPosStart == nStart ) )
|
|
|
|
|
{
|
2006-10-12 11:35:40 +00:00
|
|
|
|
nInvalidPosStart = nInvalidPosStart + nDiff;
|
|
|
|
|
nInvalidDiff = nInvalidDiff + nDiff;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// nInvalidPosEnd = pNode->Len();
|
|
|
|
|
DBG_ASSERT( ( nDiff >= 0 ) || ( (nStart+nDiff) >= 0 ), "MarkInvalid: Diff out of Range" );
|
|
|
|
|
nInvalidPosStart = Min( nInvalidPosStart, (USHORT) ( nDiff < 0 ? nStart+nDiff : nDiff ) );
|
|
|
|
|
nInvalidDiff = 0;
|
|
|
|
|
bSimple = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bInvalid = TRUE;
|
2000-11-02 14:25:36 +00:00
|
|
|
|
aScriptInfos.Remove( 0, aScriptInfos.Count() );
|
2002-07-12 09:31:21 +00:00
|
|
|
|
aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() );
|
2001-06-21 11:47:31 +00:00
|
|
|
|
// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-12 11:35:40 +00:00
|
|
|
|
void ParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT /* nEnd */ )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
if ( bInvalid == FALSE )
|
|
|
|
|
{
|
|
|
|
|
nInvalidPosStart = nStart;
|
|
|
|
|
// nInvalidPosEnd = nEnd;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nInvalidPosStart = Min( nInvalidPosStart, nStart );
|
|
|
|
|
// nInvalidPosEnd = pNode->Len();
|
|
|
|
|
}
|
|
|
|
|
nInvalidDiff = 0;
|
|
|
|
|
bInvalid = TRUE;
|
|
|
|
|
bSimple = FALSE;
|
2000-11-02 14:25:36 +00:00
|
|
|
|
aScriptInfos.Remove( 0, aScriptInfos.Count() );
|
2002-07-12 09:31:21 +00:00
|
|
|
|
aWritingDirectionInfos.Remove( 0, aWritingDirectionInfos.Count() );
|
2001-06-21 11:47:31 +00:00
|
|
|
|
// aExtraCharInfos.Remove( 0, aExtraCharInfos.Count() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
USHORT ParaPortion::GetLineNumber( USHORT nIndex )
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERTWARNING( aLineList.Count(), "Leere ParaPortion in GetLine!" );
|
|
|
|
|
DBG_ASSERT( bVisible, "Wozu GetLine() bei einem unsichtbaren Absatz?" );
|
|
|
|
|
|
|
|
|
|
for ( USHORT nLine = 0; nLine < aLineList.Count(); nLine++ )
|
|
|
|
|
{
|
|
|
|
|
if ( aLineList[nLine]->IsIn( nIndex ) )
|
|
|
|
|
return nLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Dann sollte es am Ende der letzten Zeile sein!
|
|
|
|
|
DBG_ASSERT( nIndex == aLineList[ aLineList.Count() - 1 ]->GetEnd(), "Index voll daneben!" );
|
|
|
|
|
return (aLineList.Count()-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ParaPortion::SetVisible( BOOL bMakeVisible )
|
|
|
|
|
{
|
|
|
|
|
bVisible = bMakeVisible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ParaPortion::CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLine )
|
|
|
|
|
{
|
|
|
|
|
USHORT nLines = aLineList.Count();
|
|
|
|
|
DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Leere Portion?" );
|
|
|
|
|
if ( nLastFormattedLine < ( nLines - 1 ) )
|
|
|
|
|
{
|
|
|
|
|
const EditLine* pLastFormatted = aLineList[ nLastFormattedLine ];
|
|
|
|
|
const EditLine* pUnformatted = aLineList[ nLastFormattedLine+1 ];
|
|
|
|
|
short nPortionDiff = pUnformatted->GetStartPortion() - pLastFormatted->GetEndPortion();
|
|
|
|
|
short nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd();
|
|
|
|
|
nTextDiff++; // LastFormatted->GetEnd() war incl. => 1 zuviel abgezogen!
|
|
|
|
|
|
|
|
|
|
// Die erste unformatierte muss genau eine Portion hinter der letzten der
|
|
|
|
|
// formatierten beginnen:
|
|
|
|
|
// Wenn in der geaenderten Zeile eine Portion gesplittet wurde,
|
|
|
|
|
// kann nLastEnd > nNextStart sein!
|
2006-10-12 11:35:40 +00:00
|
|
|
|
int nPDiff = -( nPortionDiff-1 );
|
|
|
|
|
int nTDiff = -( nTextDiff-1 );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
if ( nPDiff || nTDiff )
|
|
|
|
|
{
|
|
|
|
|
for ( USHORT nL = nLastFormattedLine+1; nL < nLines; nL++ )
|
|
|
|
|
{
|
|
|
|
|
EditLine* pLine = aLineList[ nL ];
|
|
|
|
|
|
2006-10-12 11:35:40 +00:00
|
|
|
|
pLine->GetStartPortion() = sal::static_int_cast< USHORT >(
|
|
|
|
|
pLine->GetStartPortion() + nPDiff);
|
|
|
|
|
pLine->GetEndPortion() = sal::static_int_cast< USHORT >(
|
|
|
|
|
pLine->GetEndPortion() + nPDiff);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-10-12 11:35:40 +00:00
|
|
|
|
pLine->GetStart() = sal::static_int_cast< USHORT >(
|
|
|
|
|
pLine->GetStart() + nTDiff);
|
|
|
|
|
pLine->GetEnd() = sal::static_int_cast< USHORT >(
|
|
|
|
|
pLine->GetEnd() + nTDiff);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
pLine->SetValid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DBG_ASSERT( aLineList[ aLineList.Count()-1 ]->GetEnd() == pNode->Len(), "CorrectLines: Ende stimmt nicht!" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// class ParaPortionList
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
ParaPortionList::ParaPortionList()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ParaPortionList::~ParaPortionList()
|
|
|
|
|
{
|
|
|
|
|
Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ParaPortionList::Reset()
|
|
|
|
|
{
|
|
|
|
|
for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
|
|
|
|
|
delete GetObject( nPortion );
|
|
|
|
|
Remove( 0, Count() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long ParaPortionList::GetYOffset( ParaPortion* pPPortion )
|
|
|
|
|
{
|
|
|
|
|
long nHeight = 0;
|
|
|
|
|
for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
|
|
|
|
|
{
|
|
|
|
|
ParaPortion* pTmpPortion = GetObject(nPortion);
|
|
|
|
|
if ( pTmpPortion == pPPortion )
|
|
|
|
|
return nHeight;
|
|
|
|
|
nHeight += pTmpPortion->GetHeight();
|
|
|
|
|
}
|
|
|
|
|
DBG_ERROR( "GetYOffset: Portion nicht gefunden" );
|
|
|
|
|
return nHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
USHORT ParaPortionList::FindParagraph( long nYOffset )
|
|
|
|
|
{
|
|
|
|
|
long nY = 0;
|
|
|
|
|
for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
|
|
|
|
|
{
|
|
|
|
|
nY += GetObject(nPortion)->GetHeight(); // sollte auch bei !bVisible richtig sein!
|
|
|
|
|
if ( nY > nYOffset )
|
|
|
|
|
return nPortion;
|
|
|
|
|
}
|
|
|
|
|
return 0xFFFF; // solte mal ueber EE_PARA_NOT_FOUND erreicht werden!
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-12 11:35:40 +00:00
|
|
|
|
void ParaPortionList::DbgCheck( EditDoc&
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
rDoc
|
|
|
|
|
#endif
|
|
|
|
|
)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
DBG_ASSERT( Count() == rDoc.Count(), "ParaPortionList::DbgCheck() - Count() ungleich!" );
|
|
|
|
|
for ( USHORT i = 0; i < Count(); i++ )
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( SaveGetObject(i), "ParaPortionList::DbgCheck() - Null-Pointer in Liste!" );
|
|
|
|
|
DBG_ASSERT( GetObject(i)->GetNode(), "ParaPortionList::DbgCheck() - Null-Pointer in Liste(2)!" );
|
|
|
|
|
DBG_ASSERT( GetObject(i)->GetNode() == rDoc.GetObject(i), "ParaPortionList::DbgCheck() - Eintraege kreuzen sich!" );
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ContentAttribsInfo::ContentAttribsInfo( const SfxItemSet& rParaAttribs ) :
|
|
|
|
|
aPrevParaAttribs( rParaAttribs)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit )
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( eSourceUnit != eDestUnit, "ConvertItem - Why?!" );
|
|
|
|
|
|
|
|
|
|
switch ( rPoolItem.Which() )
|
|
|
|
|
{
|
|
|
|
|
case EE_PARA_LRSPACE:
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLRSpaceItem ) ), "ConvertItem: Ungueltiges Item!" );
|
|
|
|
|
SvxLRSpaceItem& rItem = (SvxLRSpaceItem&)rPoolItem;
|
2006-10-12 11:35:40 +00:00
|
|
|
|
rItem.SetTxtFirstLineOfst( sal::static_int_cast< short >( OutputDevice::LogicToLogic( rItem.GetTxtFirstLineOfst(), eSourceUnit, eDestUnit ) ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
rItem.SetTxtLeft( OutputDevice::LogicToLogic( rItem.GetTxtLeft(), eSourceUnit, eDestUnit ) );
|
2002-01-16 09:41:58 +00:00
|
|
|
|
// rItem.SetLeft( OutputDevice::LogicToLogic( rItem.GetLeft(), eSourceUnit, eDestUnit ) ); // #96298# SetLeft manipulates nTxtLeft!
|
2000-09-18 16:07:07 +00:00
|
|
|
|
rItem.SetRight( OutputDevice::LogicToLogic( rItem.GetRight(), eSourceUnit, eDestUnit ) );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EE_PARA_ULSPACE:
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( rPoolItem.IsA( TYPE( SvxULSpaceItem ) ), "ConvertItem: Ungueltiges Item!" );
|
|
|
|
|
SvxULSpaceItem& rItem = (SvxULSpaceItem&)rPoolItem;
|
2006-10-12 11:35:40 +00:00
|
|
|
|
rItem.SetUpper( sal::static_int_cast< USHORT >( OutputDevice::LogicToLogic( rItem.GetUpper(), eSourceUnit, eDestUnit ) ) );
|
|
|
|
|
rItem.SetLower( sal::static_int_cast< USHORT >( OutputDevice::LogicToLogic( rItem.GetLower(), eSourceUnit, eDestUnit ) ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EE_PARA_SBL:
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( rPoolItem.IsA( TYPE( SvxLineSpacingItem ) ), "ConvertItem: Ungueltiges Item!" );
|
|
|
|
|
SvxLineSpacingItem& rItem = (SvxLineSpacingItem&)rPoolItem;
|
2002-01-16 09:41:58 +00:00
|
|
|
|
// #96298# SetLineHeight changes also eLineSpace!
|
|
|
|
|
if ( rItem.GetLineSpaceRule() == SVX_LINE_SPACE_MIN )
|
2006-10-12 11:35:40 +00:00
|
|
|
|
rItem.SetLineHeight( sal::static_int_cast< USHORT >( OutputDevice::LogicToLogic( rItem.GetLineHeight(), eSourceUnit, eDestUnit ) ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EE_PARA_TABS:
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( rPoolItem.IsA( TYPE( SvxTabStopItem ) ), "ConvertItem: Ungueltiges Item!" );
|
|
|
|
|
SvxTabStopItem& rItem = (SvxTabStopItem&)rPoolItem;
|
|
|
|
|
SvxTabStopItem aNewItem( EE_PARA_TABS );
|
|
|
|
|
for ( USHORT i = 0; i < rItem.Count(); i++ )
|
|
|
|
|
{
|
|
|
|
|
const SvxTabStop& rTab = rItem[i];
|
|
|
|
|
SvxTabStop aNewStop( OutputDevice::LogicToLogic( rTab.GetTabPos(), eSourceUnit, eDestUnit ), rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() );
|
|
|
|
|
aNewItem.Insert( aNewStop );
|
|
|
|
|
}
|
|
|
|
|
rItem = aNewItem;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EE_CHAR_FONTHEIGHT:
|
2000-11-02 14:25:36 +00:00
|
|
|
|
case EE_CHAR_FONTHEIGHT_CJK:
|
|
|
|
|
case EE_CHAR_FONTHEIGHT_CTL:
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( rPoolItem.IsA( TYPE( SvxFontHeightItem ) ), "ConvertItem: Ungueltiges Item!" );
|
|
|
|
|
SvxFontHeightItem& rItem = (SvxFontHeightItem&)rPoolItem;
|
|
|
|
|
rItem.SetHeight( OutputDevice::LogicToLogic( rItem.GetHeight(), eSourceUnit, eDestUnit ) );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit, const MapUnit* pDestUnit )
|
|
|
|
|
{
|
|
|
|
|
const SfxItemPool* pSourcePool = rSource.GetPool();
|
|
|
|
|
const SfxItemPool* pDestPool = rDest.GetPool();
|
|
|
|
|
|
|
|
|
|
for ( USHORT nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ )
|
|
|
|
|
{
|
|
|
|
|
// Wenn moeglich ueber SlotID gehen...
|
|
|
|
|
|
|
|
|
|
USHORT nSourceWhich = nWhich;
|
|
|
|
|
USHORT nSlot = pDestPool->GetTrueSlotId( nWhich );
|
|
|
|
|
if ( nSlot )
|
|
|
|
|
{
|
|
|
|
|
USHORT nW = pSourcePool->GetTrueWhich( nSlot );
|
|
|
|
|
if ( nW )
|
|
|
|
|
nSourceWhich = nW;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( rSource.GetItemState( nSourceWhich, FALSE ) == SFX_ITEM_ON )
|
|
|
|
|
{
|
|
|
|
|
MapUnit eSourceUnit = pSourceUnit ? *pSourceUnit : (MapUnit)pSourcePool->GetMetric( nSourceWhich );
|
|
|
|
|
MapUnit eDestUnit = pDestUnit ? *pDestUnit : (MapUnit)pDestPool->GetMetric( nWhich );
|
|
|
|
|
if ( eSourceUnit != eDestUnit )
|
|
|
|
|
{
|
|
|
|
|
SfxPoolItem* pItem = rSource.Get( nSourceWhich ).Clone();
|
|
|
|
|
// pItem->SetWhich( nWhich );
|
|
|
|
|
ConvertItem( *pItem, eSourceUnit, eDestUnit );
|
|
|
|
|
rDest.Put( *pItem, nWhich );
|
|
|
|
|
delete pItem;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rDest.Put( rSource.Get( nSourceWhich ), nWhich );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// MT 3.3.99: Waere so eigentlich richtig, aber schon seit Jahren nicht so...
|
|
|
|
|
// rDest.ClearItem( nWhich );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|