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 11:48:07 +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 11:48:07 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 11:48:07 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2008-04-10 11:48:07 +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 11:48:07 +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 11:48:07 +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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 19:41:13 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
#include <hintids.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/whiter.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/colritem.hxx>
|
|
|
|
#include <editeng/brshitem.hxx>
|
|
|
|
#include <editeng/bolnitem.hxx>
|
|
|
|
#include <editeng/boxitem.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <svx/xtable.hxx>
|
|
|
|
#include <fmtpdsc.hxx>
|
|
|
|
#include <pagedesc.hxx>
|
|
|
|
#include <charfmt.hxx>
|
|
|
|
#include <doc.hxx>
|
|
|
|
#include <node.hxx>
|
|
|
|
#include <paratr.hxx> // fuer SetModifyAtAttr
|
|
|
|
#include <cellatr.hxx> // fuer SetModifyAtAttr
|
|
|
|
#include <cmdid.h>
|
2006-12-01 14:36:34 +00:00
|
|
|
#include <istyleaccess.hxx>
|
2008-03-05 15:52:17 +00:00
|
|
|
#include <numrule.hxx>
|
2008-06-13 08:31:00 +00:00
|
|
|
#include <list.hxx>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
SwAttrPool::SwAttrPool( SwDoc* pD )
|
|
|
|
: SfxItemPool( String::CreateFromAscii(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM( "SWG" )),
|
|
|
|
POOLATTR_BEGIN, POOLATTR_END-1,
|
|
|
|
aSlotTab, aAttrTab ),
|
|
|
|
pDoc( pD )
|
|
|
|
{
|
|
|
|
SetVersionMap( 1, 1, 60, pVersionMap1 );
|
|
|
|
SetVersionMap( 2, 1, 75, pVersionMap2 );
|
|
|
|
SetVersionMap( 3, 1, 86, pVersionMap3 );
|
2000-11-20 08:41:15 +00:00
|
|
|
SetVersionMap( 4, 1,121, pVersionMap4 );
|
2011-01-28 11:09:11 +00:00
|
|
|
// #i18732# - apply new version map
|
2004-02-02 17:16:45 +00:00
|
|
|
SetVersionMap( 5, 1,130, pVersionMap5 );
|
2009-01-05 17:49:45 +00:00
|
|
|
SetVersionMap( 6, 1,136, pVersionMap6 );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
CWS-TOOLING: integrate CWS aw063
2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects
2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects
2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method
2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL
2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction
2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction
2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1
2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round
2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round
2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round
2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round
2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round
2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round
2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round
2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling
2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition
2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF
2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable
2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable
2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable
2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable
2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix
2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix
2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers
2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts
2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules
2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include
2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include
2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions
2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much
2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from
2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size
2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances
2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage
2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences
2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange
2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle
2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case
2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks
2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
2009-03-04 14:16:02 +00:00
|
|
|
SwAttrPool::~SwAttrPool()
|
|
|
|
{
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SwAttrSet::SwAttrSet( SwAttrPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2 )
|
2000-09-18 23:08:29 +00:00
|
|
|
: SfxItemSet( rPool, nWh1, nWh2 ), pOldSet( 0 ), pNewSet( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SwAttrSet::SwAttrSet( SwAttrPool& rPool, const sal_uInt16* nWhichPairTable )
|
2000-09-18 23:08:29 +00:00
|
|
|
: SfxItemSet( rPool, nWhichPairTable ), pOldSet( 0 ), pNewSet( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SwAttrSet::SwAttrSet( const SwAttrSet& rSet )
|
|
|
|
: SfxItemSet( rSet ), pOldSet( 0 ), pNewSet( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
SfxItemSet* SwAttrSet::Clone( sal_Bool bItems, SfxItemPool *pToPool ) const
|
2006-12-01 14:36:34 +00:00
|
|
|
{
|
|
|
|
if ( pToPool && pToPool != GetPool() )
|
|
|
|
{
|
|
|
|
SwAttrPool* pAttrPool = dynamic_cast< SwAttrPool* >(pToPool);
|
2007-09-27 07:25:59 +00:00
|
|
|
SfxItemSet* pTmpSet = 0;
|
2006-12-01 14:36:34 +00:00
|
|
|
if ( !pAttrPool )
|
2007-09-27 07:25:59 +00:00
|
|
|
pTmpSet = SfxItemSet::Clone( bItems, pToPool );
|
2006-12-01 14:36:34 +00:00
|
|
|
else
|
|
|
|
{
|
2007-09-27 07:25:59 +00:00
|
|
|
pTmpSet = new SwAttrSet( *pAttrPool, GetRanges() );
|
2006-12-01 14:36:34 +00:00
|
|
|
if ( bItems )
|
|
|
|
{
|
2007-09-27 07:25:59 +00:00
|
|
|
SfxWhichIter aIter(*pTmpSet);
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nWhich = aIter.FirstWhich();
|
2006-12-01 14:36:34 +00:00
|
|
|
while ( nWhich )
|
|
|
|
{
|
|
|
|
const SfxPoolItem* pItem;
|
2011-01-17 15:06:54 +01:00
|
|
|
if ( SFX_ITEM_SET == GetItemState( nWhich, sal_False, &pItem ) )
|
2007-09-27 07:25:59 +00:00
|
|
|
pTmpSet->Put( *pItem, pItem->Which() );
|
2006-12-01 14:36:34 +00:00
|
|
|
nWhich = aIter.NextWhich();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-09-27 07:25:59 +00:00
|
|
|
return pTmpSet;
|
2006-12-01 14:36:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return bItems
|
|
|
|
? new SwAttrSet( *this )
|
|
|
|
: new SwAttrSet( *GetPool(), GetRanges() );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
|
|
|
|
SwAttrSet* pOld, SwAttrSet* pNew )
|
|
|
|
{
|
|
|
|
pNewSet = pNew;
|
|
|
|
pOldSet = pOld;
|
|
|
|
int nRet = 0 != SfxItemSet::Put( rAttr );
|
|
|
|
pOldSet = pNewSet = 0;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SwAttrSet::Put_BC( const SfxItemSet& rSet,
|
|
|
|
SwAttrSet* pOld, SwAttrSet* pNew )
|
|
|
|
{
|
|
|
|
pNewSet = pNew;
|
|
|
|
pOldSet = pOld;
|
|
|
|
int nRet = 0 != SfxItemSet::Put( rSet );
|
|
|
|
pOldSet = pNewSet = 0;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich,
|
2000-09-18 23:08:29 +00:00
|
|
|
SwAttrSet* pOld, SwAttrSet* pNew )
|
|
|
|
{
|
|
|
|
pNewSet = pNew;
|
|
|
|
pOldSet = pOld;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nRet = SfxItemSet::ClearItem( nWhich );
|
2000-09-18 23:08:29 +00:00
|
|
|
pOldSet = pNewSet = 0;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
|
2000-09-18 23:08:29 +00:00
|
|
|
SwAttrSet* pOld, SwAttrSet* pNew )
|
|
|
|
{
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( nWhich1 <= nWhich2, "kein gueltiger Bereich" );
|
2000-09-18 23:08:29 +00:00
|
|
|
pNewSet = pNew;
|
|
|
|
pOldSet = pOld;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nRet = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
for( ; nWhich1 <= nWhich2; ++nWhich1 )
|
2007-09-27 07:25:59 +00:00
|
|
|
nRet = nRet + SfxItemSet::ClearItem( nWhich1 );
|
2000-09-18 23:08:29 +00:00
|
|
|
pOldSet = pNewSet = 0;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
|
|
|
|
SwAttrSet* pOld, SwAttrSet* pNew )
|
|
|
|
{
|
|
|
|
pNewSet = pNew;
|
|
|
|
pOldSet = pOld;
|
|
|
|
SfxItemSet::Intersect( rSet );
|
|
|
|
pOldSet = pNewSet = 0;
|
|
|
|
return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
|
|
|
|
}
|
|
|
|
|
2004-08-12 11:11:59 +00:00
|
|
|
// Notification-Callback
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwAttrSet::Changed( const SfxPoolItem& rOld,
|
|
|
|
const SfxPoolItem& rNew )
|
|
|
|
{
|
|
|
|
if( pOldSet )
|
|
|
|
pOldSet->PutChgd( rOld );
|
|
|
|
|
|
|
|
if( pNewSet )
|
|
|
|
pNewSet->PutChgd( rNew );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------
|
|
|
|
// Sonderbehandlung fuer einige Attribute
|
|
|
|
// Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
|
|
|
|
// - SwFmtDropCaps
|
|
|
|
// - SwFmtPageDesc
|
|
|
|
// (Wird beim Einfuegen in Formate/Nodes gerufen)
|
|
|
|
// ----------------------------------------------------------------
|
2006-12-01 14:36:34 +00:00
|
|
|
|
|
|
|
bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2006-12-01 14:36:34 +00:00
|
|
|
bool bSet = false;
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
const SfxPoolItem* pItem;
|
2011-01-17 15:06:54 +01:00
|
|
|
if( SFX_ITEM_SET == GetItemState( RES_PAGEDESC, sal_False, &pItem ) &&
|
2000-09-18 23:08:29 +00:00
|
|
|
((SwFmtPageDesc*)pItem)->GetDefinedIn() != pModify )
|
|
|
|
{
|
|
|
|
((SwFmtPageDesc*)pItem)->ChgDefinedIn( pModify );
|
2006-12-01 14:36:34 +00:00
|
|
|
bSet = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
if( SFX_ITEM_SET == GetItemState( RES_PARATR_DROP, sal_False, &pItem ) &&
|
2000-09-18 23:08:29 +00:00
|
|
|
((SwFmtDrop*)pItem)->GetDefinedIn() != pModify )
|
|
|
|
{
|
|
|
|
// CharFormat gesetzt und dann noch in unterschiedlichen
|
|
|
|
// Attribut Pools, dann muss das CharFormat kopiert werden!
|
|
|
|
SwCharFmt* pCharFmt;
|
|
|
|
if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() )
|
|
|
|
&& GetPool() != pCharFmt->GetAttrSet().GetPool() )
|
|
|
|
{
|
2006-12-01 14:36:34 +00:00
|
|
|
pCharFmt = GetDoc()->CopyCharFmt( *pCharFmt );
|
|
|
|
((SwFmtDrop*)pItem)->SetCharFmt( pCharFmt );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
((SwFmtDrop*)pItem)->ChgDefinedIn( pModify );
|
2006-12-01 14:36:34 +00:00
|
|
|
bSet = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, sal_False, &pItem ) &&
|
2000-09-18 23:08:29 +00:00
|
|
|
((SwTblBoxFormula*)pItem)->GetDefinedIn() != pModify )
|
|
|
|
{
|
|
|
|
((SwTblBoxFormula*)pItem)->ChgDefinedIn( pModify );
|
2006-12-01 14:36:34 +00:00
|
|
|
bSet = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2006-12-01 14:36:34 +00:00
|
|
|
return bSet;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
void SwAttrSet::CopyToModify( SwModify& rMod ) const
|
|
|
|
{
|
|
|
|
// kopiere die Attribute ggfs. ueber Dokumentgrenzen
|
|
|
|
SwCntntNode* pCNd = PTR_CAST( SwCntntNode, &rMod );
|
|
|
|
SwFmt* pFmt = PTR_CAST( SwFmt, &rMod );
|
|
|
|
|
|
|
|
if( pCNd || pFmt )
|
|
|
|
{
|
|
|
|
if( Count() )
|
|
|
|
{
|
2011-01-28 11:09:11 +00:00
|
|
|
// #i92811#
|
2008-08-27 08:03:54 +00:00
|
|
|
SfxStringItem* pNewListIdItem( 0 );
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
const SwDoc *pSrcDoc = GetDoc();
|
|
|
|
SwDoc *pDstDoc = pCNd ? pCNd->GetDoc() : pFmt->GetDoc();
|
|
|
|
|
|
|
|
// muss die NumRule kopiert werden?
|
|
|
|
if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_PARATR_NUMRULE, sal_False, &pItem ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const String& rNm = ((SwNumRuleItem*)pItem)->GetValue();
|
|
|
|
if( rNm.Len() )
|
|
|
|
{
|
|
|
|
SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm );
|
|
|
|
if( pDestRule )
|
2011-01-17 15:06:54 +01:00
|
|
|
pDestRule->SetInvalidRule( sal_True );
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
pDstDoc->MakeNumRule( rNm,
|
|
|
|
pSrcDoc->FindNumRulePtr( rNm ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-13 08:31:00 +00:00
|
|
|
// copy list and if needed also the corresponding list style
|
|
|
|
// for text nodes
|
|
|
|
if ( pSrcDoc != pDstDoc &&
|
|
|
|
pCNd && pCNd->IsTxtNode() &&
|
2011-01-17 15:06:54 +01:00
|
|
|
GetItemState( RES_PARATR_LIST_ID, sal_False, &pItem ) == SFX_ITEM_SET )
|
2008-06-13 08:31:00 +00:00
|
|
|
{
|
|
|
|
const String& sListId =
|
|
|
|
dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
|
|
|
|
if ( sListId.Len() > 0 &&
|
|
|
|
!pDstDoc->getListByName( sListId ) )
|
|
|
|
{
|
|
|
|
const SwList* pList = pSrcDoc->getListByName( sListId );
|
|
|
|
// copy list style, if needed
|
|
|
|
const String sDefaultListStyleName =
|
|
|
|
pList->GetDefaultListStyleName();
|
2011-01-28 11:09:11 +00:00
|
|
|
// #i92811#
|
2008-08-27 08:03:54 +00:00
|
|
|
const SwNumRule* pDstDocNumRule =
|
|
|
|
pDstDoc->FindNumRulePtr( sDefaultListStyleName );
|
|
|
|
if ( !pDstDocNumRule )
|
2008-06-13 08:31:00 +00:00
|
|
|
{
|
|
|
|
pDstDoc->MakeNumRule( sDefaultListStyleName,
|
|
|
|
pSrcDoc->FindNumRulePtr( sDefaultListStyleName ) );
|
|
|
|
}
|
2008-08-27 08:03:54 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
const SwNumRule* pSrcDocNumRule =
|
|
|
|
pSrcDoc->FindNumRulePtr( sDefaultListStyleName );
|
|
|
|
// If list id of text node equals the list style's
|
|
|
|
// default list id in the source document, the same
|
|
|
|
// should be hold in the destination document.
|
|
|
|
// Thus, create new list id item.
|
|
|
|
if ( sListId == pSrcDocNumRule->GetDefaultListId() )
|
|
|
|
{
|
|
|
|
pNewListIdItem = new SfxStringItem (
|
|
|
|
RES_PARATR_LIST_ID,
|
|
|
|
pDstDocNumRule->GetDefaultListId() );
|
|
|
|
}
|
|
|
|
}
|
2008-06-13 08:31:00 +00:00
|
|
|
// check again, if list exist, because <SwDoc::MakeNumRule(..)>
|
|
|
|
// could have also created it.
|
2008-08-27 08:03:54 +00:00
|
|
|
if ( pNewListIdItem == 0 &&
|
|
|
|
!pDstDoc->getListByName( sListId ) )
|
2008-06-13 08:31:00 +00:00
|
|
|
{
|
|
|
|
// copy list
|
|
|
|
pDstDoc->createList( sListId, sDefaultListStyleName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-28 11:09:11 +00:00
|
|
|
// Seitenvorlagenwechsel mit kopieren Gegenueber dem alten
|
|
|
|
// Verhalten, sie zu entfernen
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwPageDesc* pPgDesc;
|
|
|
|
if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
|
2011-01-17 15:06:54 +01:00
|
|
|
RES_PAGEDESC, sal_False, &pItem ) &&
|
2000-09-18 23:08:29 +00:00
|
|
|
0 != ( pPgDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc()) )
|
|
|
|
{
|
|
|
|
SfxItemSet aTmpSet( *this );
|
|
|
|
|
|
|
|
SwPageDesc* pDstPgDesc = pDstDoc->FindPageDescByName(
|
|
|
|
pPgDesc->GetName() );
|
|
|
|
if( !pDstPgDesc )
|
|
|
|
{
|
|
|
|
// dann kopieren, ansonsten den benutzen
|
|
|
|
pDstPgDesc = &pDstDoc->_GetPageDesc( pDstDoc->MakePageDesc(
|
|
|
|
pPgDesc->GetName() ));
|
|
|
|
pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc );
|
|
|
|
}
|
|
|
|
SwFmtPageDesc aDesc( pDstPgDesc );
|
|
|
|
aDesc.SetNumOffset( ((SwFmtPageDesc*)pItem)->GetNumOffset() );
|
|
|
|
aTmpSet.Put( aDesc );
|
|
|
|
|
|
|
|
if( pCNd )
|
2008-08-27 08:03:54 +00:00
|
|
|
{
|
2011-01-28 11:09:11 +00:00
|
|
|
// #i92811#
|
2008-08-27 08:03:54 +00:00
|
|
|
if ( pNewListIdItem != 0 )
|
|
|
|
{
|
|
|
|
aTmpSet.Put( *pNewListIdItem );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
pCNd->SetAttr( aTmpSet );
|
2008-08-27 08:03:54 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2008-06-13 08:31:00 +00:00
|
|
|
pFmt->SetFmtAttr( aTmpSet );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if( pCNd )
|
2008-08-27 08:03:54 +00:00
|
|
|
{
|
2011-01-28 11:09:11 +00:00
|
|
|
// #i92811#
|
2008-08-27 08:03:54 +00:00
|
|
|
if ( pNewListIdItem != 0 )
|
|
|
|
{
|
|
|
|
SfxItemSet aTmpSet( *this );
|
|
|
|
aTmpSet.Put( *pNewListIdItem );
|
|
|
|
pCNd->SetAttr( aTmpSet );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pCNd->SetAttr( *this );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2008-06-13 08:31:00 +00:00
|
|
|
pFmt->SetFmtAttr( *this );
|
2008-08-27 08:03:54 +00:00
|
|
|
|
2011-01-28 11:09:11 +00:00
|
|
|
// #i92811#
|
2008-08-27 08:03:54 +00:00
|
|
|
delete pNewListIdItem;
|
|
|
|
pNewListIdItem = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-25 17:08:45 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2010-11-25 17:08:45 +01:00
|
|
|
OSL_ENSURE( !this, "weder Format noch ContentNode - keine Attribute kopiert");
|
2000-09-18 23:08:29 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if ID is InRange of AttrSet-Ids
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
while( *pRange )
|
|
|
|
{
|
|
|
|
if( *pRange <= nId && nId <= *(pRange+1) )
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_True;
|
2000-09-18 23:08:29 +00:00
|
|
|
pRange += 2;
|
|
|
|
}
|
2011-01-17 15:06:54 +01:00
|
|
|
return sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|