2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 02:18:04 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 02:18:04 +00:00
|
|
|
* $RCSfile: number.cxx,v $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2007-09-27 07:39:02 +00:00
|
|
|
* $Revision: 1.41 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2007-09-27 07:39:02 +00:00
|
|
|
* last change: $Author: hr $ $Date: 2007-09-27 08:39:02 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 02:18:04 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 02:18:04 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 02:18:04 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 02:18:04 +00:00
|
|
|
* This library 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 for more details.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 02:18:04 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 19:57:32 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
#ifndef _HINTIDS_HXX
|
|
|
|
#include <hintids.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#ifndef _SV_FONT_HXX //autogen
|
|
|
|
#include <vcl/font.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_BRSHITEM_HXX //autogen
|
|
|
|
#include <svx/brshitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_LRSPITEM_HXX //autogen
|
|
|
|
#include <svx/lrspitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_NUMITEM_HXX //autogen
|
|
|
|
#include <svx/numitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTORNT_HXX //autogen
|
|
|
|
#include <fmtornt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DOC_HXX
|
|
|
|
#include <doc.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _PAM_HXX
|
|
|
|
#include <pam.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _CHARFMT_HXX
|
|
|
|
#include <charfmt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _PARATR_HXX
|
|
|
|
#include <paratr.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FRMFMT_HXX
|
|
|
|
#include <frmfmt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _NDTXT_HXX
|
|
|
|
#include <ndtxt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DOCARY_HXX
|
|
|
|
#include <docary.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DOCSH_HXX
|
|
|
|
#include <docsh.hxx>
|
|
|
|
#endif
|
2001-07-20 09:40:14 +00:00
|
|
|
#ifndef _SWSTYLENAMEMAPPER_HXX
|
|
|
|
#include <SwStyleNameMapper.hxx>
|
|
|
|
#endif
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-28 #b6440955#
|
|
|
|
// Needed to load default bullet list configuration
|
|
|
|
#ifndef _UTL_CONFIGITEM_HXX_
|
|
|
|
#include <unotools/configitem.hxx>
|
|
|
|
#endif
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-10-22 07:12:03 +00:00
|
|
|
#include <hash_map>
|
|
|
|
|
2007-09-27 07:39:02 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
USHORT SwNumRule::nRefCount = 0;
|
|
|
|
SwNumFmt* SwNumRule::aBaseFmts[ RULE_END ][ MAXLEVEL ] = {
|
2007-09-27 07:39:02 +00:00
|
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-27 #b6440955#
|
|
|
|
// variable moved to class <numfunc::SwDefBulletListConfig>
|
|
|
|
//Font* SwNumRule::pDefBulletFont = 0;
|
|
|
|
// <--
|
2007-09-27 07:39:02 +00:00
|
|
|
|
|
|
|
char sOutline[] = "Outline";
|
|
|
|
char* SwNumRule::pDefOutlineName = sOutline;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-07-05 13:39:02 +00:00
|
|
|
// #i30312#
|
2000-09-18 23:08:29 +00:00
|
|
|
USHORT SwNumRule::aDefNumIndents[ MAXLEVEL ] = {
|
2004-07-05 13:39:02 +00:00
|
|
|
//inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
|
|
|
|
1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2,
|
|
|
|
1440*9/4, 1440*5/2
|
2000-09-18 23:08:29 +00:00
|
|
|
};
|
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-27 #b6440955#
|
|
|
|
// variable moved to function <numfunc::SwDefBulletListConfig>
|
|
|
|
//#if defined( UNX ) && defined( GCC )
|
|
|
|
//extern const sal_Char __FAR_DATA sBulletFntName[];
|
|
|
|
//const sal_Char __FAR_DATA sBulletFntName[] = "StarSymbol";
|
|
|
|
//#else
|
|
|
|
//extern const sal_Char __FAR_DATA sBulletFntName[] = "StarSymbol";
|
|
|
|
//#endif
|
|
|
|
// <--
|
2004-03-08 11:24:46 +00:00
|
|
|
|
2004-03-11 16:21:38 +00:00
|
|
|
BYTE GetRealLevel( const BYTE nLvl )
|
2004-03-11 15:28:09 +00:00
|
|
|
{
|
|
|
|
return nLvl & (NO_NUMLEVEL - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL IsNum( BYTE nLvl )
|
|
|
|
{
|
|
|
|
return 0 == (nLvl & NO_NUMLEVEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL IsShowNum( BYTE nLvl )
|
|
|
|
{
|
|
|
|
return IsNum(nLvl) && nLvl != NO_NUMBERING;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetNoNum( BYTE * nLvl, BOOL nVal )
|
|
|
|
{
|
|
|
|
if (nVal)
|
|
|
|
*nLvl |= NO_NUMLEVEL;
|
|
|
|
else
|
|
|
|
*nLvl &= ~NO_NUMLEVEL;
|
|
|
|
}
|
2004-03-08 11:24:46 +00:00
|
|
|
|
2004-11-26 12:24:48 +00:00
|
|
|
void SetLevel(BYTE * nLvl, BYTE nNewLevel)
|
|
|
|
{
|
2004-12-08 16:41:17 +00:00
|
|
|
if (IsNum(*nLvl))
|
2004-11-26 12:24:48 +00:00
|
|
|
*nLvl = nNewLevel;
|
|
|
|
else
|
|
|
|
*nLvl = nNewLevel | NO_NUMLEVEL;
|
|
|
|
}
|
|
|
|
|
2004-03-08 11:24:46 +00:00
|
|
|
const SwNumFmt& SwNumRule::Get( USHORT i ) const
|
|
|
|
{
|
|
|
|
ASSERT_ID( i < MAXLEVEL && eRuleType < RULE_END, ERR_NUMLEVEL);
|
|
|
|
return aFmts[ i ] ? *aFmts[ i ]
|
|
|
|
: *aBaseFmts[ eRuleType ][ i ];
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwNumFmt* SwNumRule::GetNumFmt( USHORT i ) const
|
|
|
|
{
|
|
|
|
ASSERT_ID( i < MAXLEVEL && eRuleType < RULE_END, ERR_NUMLEVEL);
|
|
|
|
return aFmts[ i ];
|
|
|
|
}
|
2004-10-22 07:12:03 +00:00
|
|
|
|
2004-11-27 10:41:31 +00:00
|
|
|
void SwNumRule::SetName(const String & rName)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (pNumRuleMap)
|
|
|
|
{
|
|
|
|
pNumRuleMap->erase(sName);
|
|
|
|
(*pNumRuleMap)[rName] = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
sName = rName;
|
|
|
|
}
|
|
|
|
|
2006-09-22 08:19:04 +00:00
|
|
|
// --> OD 2006-09-12 #i69145#
|
|
|
|
// Creates list of associated text nodes by copying contents of provided list <_pList>
|
|
|
|
void SwNumRule::SetList( const SwTxtNodeTable& rList )
|
2004-10-22 07:12:03 +00:00
|
|
|
{
|
2006-09-22 08:19:04 +00:00
|
|
|
if ( pList )
|
2004-10-22 07:12:03 +00:00
|
|
|
delete pList;
|
|
|
|
|
2006-09-22 08:19:04 +00:00
|
|
|
pList = new SwTxtNodeTable( rList );
|
2004-10-22 07:12:03 +00:00
|
|
|
}
|
2006-09-22 08:19:04 +00:00
|
|
|
// <--
|
2004-10-22 07:12:03 +00:00
|
|
|
|
2004-11-27 10:41:31 +00:00
|
|
|
void SwNumRule::SetNumRuleMap(std::hash_map<String, SwNumRule *, StringHash> *
|
|
|
|
_pNumRuleMap)
|
|
|
|
{
|
|
|
|
pNumRuleMap = _pNumRuleMap;
|
|
|
|
}
|
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-27 #b6440955#
|
|
|
|
// function move to namespace <numfunc>
|
|
|
|
//const Font& SwNumRule::GetDefBulletFont()
|
|
|
|
//{
|
|
|
|
// if( !pDefBulletFont )
|
|
|
|
// SwNumRule::_MakeDefBulletFont();
|
|
|
|
// return *pDefBulletFont;
|
|
|
|
//}
|
|
|
|
// <--
|
2004-03-08 11:24:46 +00:00
|
|
|
|
|
|
|
USHORT SwNumRule::GetNumIndent( BYTE nLvl )
|
|
|
|
{
|
|
|
|
ASSERT( MAXLEVEL > nLvl, "NumLevel is out of range" );
|
|
|
|
return aDefNumIndents[ nLvl ];
|
|
|
|
}
|
2004-11-27 10:41:31 +00:00
|
|
|
|
2004-03-08 11:24:46 +00:00
|
|
|
USHORT SwNumRule::GetBullIndent( BYTE nLvl )
|
|
|
|
{
|
|
|
|
ASSERT( MAXLEVEL > nLvl, "NumLevel is out of range" );
|
|
|
|
return aDefNumIndents[ nLvl ];
|
|
|
|
}
|
|
|
|
|
2005-02-21 15:04:08 +00:00
|
|
|
|
2004-03-08 11:24:46 +00:00
|
|
|
|
2004-08-12 11:19:02 +00:00
|
|
|
static void lcl_SetRuleChgd( SwTxtNode& rNd, BYTE nLevel )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2005-11-08 16:17:38 +00:00
|
|
|
if( rNd.GetLevel() == nLevel )
|
2001-02-23 11:45:30 +00:00
|
|
|
rNd.NumRuleChgd();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:41--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SwNumFmt::SwNumFmt() :
|
|
|
|
SvxNumberFormat(SVX_NUM_ARABIC),
|
2007-09-27 07:39:02 +00:00
|
|
|
SwClient( 0 ),
|
|
|
|
pVertOrient(new SwFmtVertOrient( 0, text::VertOrientation::NONE))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:42--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SwNumFmt::SwNumFmt( const SwNumFmt& rFmt) :
|
|
|
|
SvxNumberFormat(rFmt),
|
2007-09-27 07:39:02 +00:00
|
|
|
SwClient( rFmt.pRegisteredIn ),
|
|
|
|
pVertOrient(new SwFmtVertOrient( 0, rFmt.GetVertOrient()))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
sal_Int16 eMyVertOrient = rFmt.GetVertOrient();
|
2001-02-23 11:45:30 +00:00
|
|
|
SetGraphicBrush( rFmt.GetBrush(), &rFmt.GetGraphicSize(),
|
2007-09-27 07:39:02 +00:00
|
|
|
&eMyVertOrient);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:58--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SwNumFmt::SwNumFmt(const SvxNumberFormat& rNumFmt, SwDoc* pDoc) :
|
|
|
|
SvxNumberFormat(rNumFmt),
|
2007-09-27 07:39:02 +00:00
|
|
|
pVertOrient(new SwFmtVertOrient( 0, rNumFmt.GetVertOrient()))
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
sal_Int16 eMyVertOrient = rNumFmt.GetVertOrient();
|
2001-06-01 06:00:09 +00:00
|
|
|
SetGraphicBrush( rNumFmt.GetBrush(), &rNumFmt.GetGraphicSize(),
|
2007-09-27 07:39:02 +00:00
|
|
|
&eMyVertOrient);
|
2001-02-23 11:45:30 +00:00
|
|
|
const String& rCharStyleName = rNumFmt.SvxNumberFormat::GetCharFmtName();
|
|
|
|
if( rCharStyleName.Len() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
SwCharFmt* pCFmt = pDoc->FindCharFmtByName( rCharStyleName );
|
|
|
|
if( !pCFmt )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-07-20 09:40:14 +00:00
|
|
|
USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rCharStyleName,
|
2007-09-27 07:39:02 +00:00
|
|
|
nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
|
2001-02-23 11:45:30 +00:00
|
|
|
pCFmt = nId != USHRT_MAX
|
|
|
|
? pDoc->GetCharFmtFromPool( nId )
|
|
|
|
: pDoc->MakeCharFmt( rCharStyleName, 0 );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
pCFmt->Add( this );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
else if( GetRegisteredIn() )
|
|
|
|
pRegisteredIn->Remove( this );
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:42--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SwNumFmt::~SwNumFmt()
|
|
|
|
{
|
|
|
|
delete pVertOrient;
|
|
|
|
}
|
2001-07-02 13:25:51 +00:00
|
|
|
/* -----------------------------02.07.01 15:37--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
void SwNumFmt::NotifyGraphicArrived()
|
|
|
|
{
|
|
|
|
if( GetCharFmt() )
|
|
|
|
UpdateNumNodes( (SwDoc*)GetCharFmt()->GetDoc() );
|
|
|
|
}
|
2004-06-11 14:21:42 +00:00
|
|
|
|
|
|
|
// #i22362#
|
|
|
|
BOOL SwNumFmt::IsEnumeration() const
|
|
|
|
{
|
2004-08-31 12:52:44 +00:00
|
|
|
// --> FME 2004-08-12 #i30655# native numbering did not work any longer
|
|
|
|
// using this code. Therefore HBRINKM and I agreed upon defining
|
|
|
|
// IsEnumeration() as !IsItemize()
|
|
|
|
return !IsItemize();
|
|
|
|
// <--
|
|
|
|
|
|
|
|
/*
|
2004-06-11 14:21:42 +00:00
|
|
|
BOOL bResult;
|
|
|
|
|
|
|
|
switch(GetNumberingType())
|
|
|
|
{
|
|
|
|
case SVX_NUM_CHARS_UPPER_LETTER:
|
|
|
|
case SVX_NUM_CHARS_LOWER_LETTER:
|
|
|
|
case SVX_NUM_ROMAN_UPPER:
|
|
|
|
case SVX_NUM_ROMAN_LOWER:
|
|
|
|
case SVX_NUM_ARABIC:
|
|
|
|
case SVX_NUM_PAGEDESC:
|
|
|
|
case SVX_NUM_CHARS_UPPER_LETTER_N:
|
|
|
|
case SVX_NUM_CHARS_LOWER_LETTER_N:
|
|
|
|
bResult = TRUE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
bResult = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
2004-08-31 12:52:44 +00:00
|
|
|
*/
|
2004-06-11 14:21:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// #i29560#
|
|
|
|
BOOL SwNumFmt::IsItemize() const
|
|
|
|
{
|
|
|
|
BOOL bResult;
|
|
|
|
|
|
|
|
switch(GetNumberingType())
|
|
|
|
{
|
|
|
|
case SVX_NUM_CHAR_SPECIAL:
|
|
|
|
case SVX_NUM_BITMAP:
|
|
|
|
bResult = TRUE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
bResult = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------23.02.01 09:28--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SwNumFmt& SwNumFmt::operator=( const SwNumFmt& rNumFmt)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
SvxNumberFormat::operator=(rNumFmt);
|
2000-09-18 23:08:29 +00:00
|
|
|
if( rNumFmt.GetRegisteredIn() )
|
|
|
|
rNumFmt.pRegisteredIn->Add( this );
|
|
|
|
else if( GetRegisteredIn() )
|
|
|
|
pRegisteredIn->Remove( this );
|
|
|
|
return *this;
|
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------23.02.01 09:28--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
BOOL SwNumFmt::operator==( const SwNumFmt& rNumFmt) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
BOOL bRet = SvxNumberFormat::operator==(rNumFmt) &&
|
|
|
|
pRegisteredIn == rNumFmt.pRegisteredIn;
|
2000-09-18 23:08:29 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:44--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
void SwNumFmt::SetCharFmt( SwCharFmt* pChFmt)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( pChFmt )
|
|
|
|
pChFmt->Add( this );
|
|
|
|
else if( GetRegisteredIn() )
|
|
|
|
pRegisteredIn->Remove( this );
|
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:45--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwNumFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
|
|
|
|
{
|
|
|
|
// dann suche mal in dem Doc nach dem NumRules-Object, in dem dieses
|
|
|
|
// NumFormat gesetzt ist. Das Format muss es nicht geben!
|
|
|
|
const SwCharFmt* pFmt = 0;
|
|
|
|
switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
|
|
|
|
{
|
|
|
|
case RES_ATTRSET_CHG:
|
|
|
|
case RES_FMT_CHG:
|
|
|
|
pFmt = GetCharFmt();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pFmt && !pFmt->GetDoc()->IsInDtor() )
|
|
|
|
UpdateNumNodes( (SwDoc*)pFmt->GetDoc() );
|
|
|
|
else
|
|
|
|
SwClient::Modify( pOld, pNew );
|
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------23.02.01 11:08--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
void SwNumFmt::SetCharFmtName(const String& rSet)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
SvxNumberFormat::SetCharFmtName(rSet);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:47--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
const String& SwNumFmt::GetCharFmtName() const
|
|
|
|
{
|
|
|
|
if((SwCharFmt*)pRegisteredIn)
|
|
|
|
return ((SwCharFmt*)pRegisteredIn)->GetName();
|
|
|
|
else
|
|
|
|
return aEmptyStr;
|
|
|
|
}
|
|
|
|
/* -----------------------------22.02.01 16:05--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
void SwNumFmt::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize,
|
2007-09-27 07:39:02 +00:00
|
|
|
const sal_Int16* pOrient)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
if(pOrient)
|
2007-09-27 07:39:02 +00:00
|
|
|
pVertOrient->SetVertOrient( *pOrient );
|
2001-02-23 11:45:30 +00:00
|
|
|
SvxNumberFormat::SetGraphicBrush( pBrushItem, pSize, pOrient);
|
|
|
|
}
|
|
|
|
/* -----------------------------22.02.01 16:05--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
2007-09-27 07:39:02 +00:00
|
|
|
void SwNumFmt::SetVertOrient(sal_Int16 eSet)
|
2001-02-23 11:45:30 +00:00
|
|
|
{
|
|
|
|
SvxNumberFormat::SetVertOrient(eSet);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 16:05--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
2007-09-27 07:39:02 +00:00
|
|
|
sal_Int16 SwNumFmt::GetVertOrient() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-06-01 06:00:09 +00:00
|
|
|
return SvxNumberFormat::GetVertOrient();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-02-23 11:45:30 +00:00
|
|
|
/* -----------------------------22.02.01 13:54--------------------------------
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-02-23 11:45:30 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwNumFmt::UpdateNumNodes( SwDoc* pDoc )
|
|
|
|
{
|
|
|
|
BOOL bDocIsModified = pDoc->IsModified();
|
|
|
|
BOOL bFnd = FALSE;
|
|
|
|
const SwNumRule* pRule;
|
|
|
|
for( USHORT n = pDoc->GetNumRuleTbl().Count(); !bFnd && n; )
|
|
|
|
{
|
|
|
|
pRule = pDoc->GetNumRuleTbl()[ --n ];
|
|
|
|
for( BYTE i = 0; i < MAXLEVEL; ++i )
|
|
|
|
if( pRule->GetNumFmt( i ) == this )
|
|
|
|
{
|
|
|
|
const String& rRuleNm = pRule->GetName();
|
|
|
|
|
|
|
|
SwModify* pMod;
|
|
|
|
const SfxPoolItem* pItem;
|
|
|
|
USHORT k, nMaxItems = pDoc->GetAttrPool().GetItemCount(
|
|
|
|
RES_PARATR_NUMRULE );
|
|
|
|
for( k = 0; k < nMaxItems; ++k )
|
|
|
|
if( 0 != (pItem = pDoc->GetAttrPool().GetItem(
|
|
|
|
RES_PARATR_NUMRULE, k ) ) &&
|
|
|
|
0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->
|
|
|
|
GetDefinedIn()) &&
|
|
|
|
((SwNumRuleItem*)pItem)->GetValue() == rRuleNm )
|
|
|
|
{
|
|
|
|
if( pMod->IsA( TYPE( SwFmt )) )
|
|
|
|
{
|
|
|
|
SwNumRuleInfo aInfo( rRuleNm );
|
|
|
|
pMod->GetInfo( aInfo );
|
|
|
|
|
|
|
|
for( ULONG nFirst = 0, nLast = aInfo.GetList().Count();
|
|
|
|
nFirst < nLast; ++nFirst )
|
|
|
|
lcl_SetRuleChgd(
|
|
|
|
*aInfo.GetList().GetObject( nFirst ), i );
|
|
|
|
}
|
|
|
|
else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
|
|
|
|
lcl_SetRuleChgd( *(SwTxtNode*)pMod, i );
|
|
|
|
}
|
|
|
|
bFnd = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bFnd && !bDocIsModified )
|
|
|
|
pDoc->ResetModified();
|
|
|
|
}
|
2001-06-01 06:00:09 +00:00
|
|
|
/* -----------------------------31.05.01 16:08--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
const SwFmtVertOrient* SwNumFmt::GetGraphicOrientation() const
|
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
sal_Int16 eOrient = SvxNumberFormat::GetVertOrient();
|
|
|
|
if(text::VertOrientation::NONE == eOrient)
|
2001-06-01 06:00:09 +00:00
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
pVertOrient->SetVertOrient(eOrient);
|
2001-06-01 06:00:09 +00:00
|
|
|
return pVertOrient;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2005-07-18 12:34:24 +00:00
|
|
|
#ifndef PRODUCT
|
|
|
|
long int SwNumRule::nInstances = 0;
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
SwNumRule::SwNumRule( const String& rNm, SwNumRuleType eType, BOOL bAutoFlg )
|
2007-09-27 07:39:02 +00:00
|
|
|
: pList(0),
|
|
|
|
aMarkedLevels( MAXLEVEL ), // #i27615#
|
|
|
|
pNumRuleMap(0),
|
2000-09-18 23:08:29 +00:00
|
|
|
sName( rNm ),
|
2007-09-27 07:39:02 +00:00
|
|
|
eRuleType( eType ),
|
|
|
|
nPoolFmtId( USHRT_MAX ),
|
|
|
|
nPoolHelpId( USHRT_MAX ),
|
|
|
|
nPoolHlpFileId( UCHAR_MAX ),
|
2000-09-18 23:08:29 +00:00
|
|
|
bAutoRuleFlag( bAutoFlg ),
|
|
|
|
bInvalidRuleFlag( TRUE ),
|
|
|
|
bContinusNum( FALSE ),
|
|
|
|
bAbsSpaces( FALSE ),
|
2005-11-08 16:17:38 +00:00
|
|
|
// --> OD 2005-10-21 - initialize member <mbCountPhantoms>
|
|
|
|
mbCountPhantoms( true )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2005-07-18 12:34:24 +00:00
|
|
|
#ifndef PRODUCT
|
|
|
|
nSerial = nInstances++;
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !nRefCount++ ) // zum erstmal, also initialisiern
|
|
|
|
{
|
|
|
|
SwNumFmt* pFmt;
|
2007-09-27 07:39:02 +00:00
|
|
|
BYTE n;
|
2003-12-01 15:36:27 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
// Nummerierung:
|
2003-12-01 15:36:27 +00:00
|
|
|
for( n = 0; n < MAXLEVEL; ++n )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
pFmt = new SwNumFmt;
|
2001-02-23 11:45:30 +00:00
|
|
|
pFmt->SetIncludeUpperLevels( 1 );
|
|
|
|
pFmt->SetStart( 1 );
|
2000-09-18 23:08:29 +00:00
|
|
|
pFmt->SetLSpace( lNumIndent );
|
2004-07-05 13:39:02 +00:00
|
|
|
pFmt->SetAbsLSpace( lNumIndent + SwNumRule::GetNumIndent( n ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
pFmt->SetFirstLineOffset( lNumFirstLineOffset );
|
2001-02-23 11:45:30 +00:00
|
|
|
pFmt->SetSuffix( aDotStr );
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-29 #b6440955#
|
|
|
|
pFmt->SetBulletChar( numfunc::GetBulletChar(n));
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
SwNumRule::aBaseFmts[ NUM_RULE ][ n ] = pFmt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Gliederung:
|
|
|
|
for( n = 0; n < MAXLEVEL; ++n )
|
|
|
|
{
|
|
|
|
pFmt = new SwNumFmt;
|
2001-02-23 11:45:30 +00:00
|
|
|
pFmt->SetNumberingType(SVX_NUM_NUMBER_NONE);
|
2002-10-08 12:51:25 +00:00
|
|
|
pFmt->SetIncludeUpperLevels( MAXLEVEL );
|
2001-02-23 11:45:30 +00:00
|
|
|
pFmt->SetStart( 1 );
|
2005-03-23 10:51:45 +00:00
|
|
|
pFmt->SetCharTextDistance( lOutlineMinTextDistance );
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-29 #b6440955#
|
|
|
|
pFmt->SetBulletChar( numfunc::GetBulletChar(n));
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
SwNumRule::aBaseFmts[ OUTLINE_RULE ][ n ] = pFmt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memset( aFmts, 0, sizeof( aFmts ));
|
|
|
|
ASSERT( sName.Len(), "NumRule ohne Namen!" );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRule::SwNumRule( const SwNumRule& rNumRule )
|
2007-09-27 07:39:02 +00:00
|
|
|
: pList(0),
|
2004-05-17 15:14:02 +00:00
|
|
|
aMarkedLevels( MAXLEVEL ), // #i27615#
|
2007-09-27 07:39:02 +00:00
|
|
|
pNumRuleMap(0),
|
|
|
|
sName( rNumRule.sName ),
|
|
|
|
eRuleType( rNumRule.eRuleType ),
|
|
|
|
nPoolFmtId( rNumRule.GetPoolFmtId() ),
|
|
|
|
nPoolHelpId( rNumRule.GetPoolHelpId() ),
|
|
|
|
nPoolHlpFileId( rNumRule.GetPoolHlpFileId() ),
|
2000-09-18 23:08:29 +00:00
|
|
|
bAutoRuleFlag( rNumRule.bAutoRuleFlag ),
|
|
|
|
bInvalidRuleFlag( TRUE ),
|
|
|
|
bContinusNum( rNumRule.bContinusNum ),
|
|
|
|
bAbsSpaces( rNumRule.bAbsSpaces ),
|
2005-11-08 16:17:38 +00:00
|
|
|
// --> OD 2005-10-21 - initialize member <mbCountPhantoms>
|
|
|
|
mbCountPhantoms( true )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2005-07-18 12:34:24 +00:00
|
|
|
#ifndef PRODUCT
|
|
|
|
nSerial = nInstances++;
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
++nRefCount;
|
|
|
|
memset( aFmts, 0, sizeof( aFmts ));
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
if( rNumRule.aFmts[ n ] )
|
|
|
|
Set( n, *rNumRule.aFmts[ n ] );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRule::~SwNumRule()
|
|
|
|
{
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
delete aFmts[ n ];
|
|
|
|
|
2004-11-27 10:41:31 +00:00
|
|
|
if (pNumRuleMap)
|
|
|
|
{
|
|
|
|
pNumRuleMap->erase(GetName());
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !--nRefCount ) // der letzte macht die Tuer zu
|
|
|
|
{
|
|
|
|
// Nummerierung:
|
|
|
|
SwNumFmt** ppFmts = (SwNumFmt**)SwNumRule::aBaseFmts;
|
2003-12-01 15:36:27 +00:00
|
|
|
int n;
|
|
|
|
|
|
|
|
for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
|
2000-09-18 23:08:29 +00:00
|
|
|
delete *ppFmts, *ppFmts = 0;
|
|
|
|
|
|
|
|
// Gliederung:
|
|
|
|
for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
|
|
|
|
delete *ppFmts, *ppFmts = 0;
|
|
|
|
}
|
2005-11-08 16:17:38 +00:00
|
|
|
|
|
|
|
tPamAndNums::iterator aIt;
|
|
|
|
|
|
|
|
for(aIt = aNumberRanges.begin(); aIt != aNumberRanges.end(); aIt++)
|
|
|
|
{
|
|
|
|
delete (*aIt).first;
|
2006-03-21 14:32:58 +00:00
|
|
|
// --> OD 2006-03-07 #131436#
|
|
|
|
SwNodeNum::HandleNumberTreeRootNodeDelete( *((*aIt).second) );
|
|
|
|
// <--
|
2005-11-08 16:17:38 +00:00
|
|
|
delete (*aIt).second;
|
|
|
|
}
|
|
|
|
|
2006-09-22 08:19:04 +00:00
|
|
|
// --> OD 2006-09-12 #i69145#
|
|
|
|
delete pList;
|
|
|
|
pList = 0;
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-27 #b6440955# - no longer needed
|
|
|
|
//void SwNumRule::_MakeDefBulletFont()
|
|
|
|
//{
|
|
|
|
// pDefBulletFont = new Font( String::CreateFromAscii( sBulletFntName ),
|
|
|
|
// aEmptyStr, Size( 0, 14 ) );
|
|
|
|
// pDefBulletFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
|
|
|
|
// pDefBulletFont->SetFamily( FAMILY_DONTKNOW );
|
|
|
|
// pDefBulletFont->SetPitch( PITCH_DONTKNOW );
|
|
|
|
// pDefBulletFont->SetWeight( WEIGHT_DONTKNOW );
|
|
|
|
// pDefBulletFont->SetTransparent( TRUE );
|
|
|
|
//}
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
void SwNumRule::CheckCharFmts( SwDoc* pDoc )
|
|
|
|
{
|
|
|
|
SwCharFmt* pFmt;
|
|
|
|
for( BYTE n = 0; n < MAXLEVEL; ++n )
|
|
|
|
if( aFmts[ n ] && 0 != ( pFmt = aFmts[ n ]->GetCharFmt() ) &&
|
|
|
|
pFmt->GetDoc() != pDoc )
|
|
|
|
{
|
|
|
|
// dann kopieren!
|
|
|
|
SwNumFmt* pNew = new SwNumFmt( *aFmts[ n ] );
|
|
|
|
pNew->SetCharFmt( pDoc->CopyCharFmt( *pFmt ) );
|
|
|
|
delete aFmts[ n ];
|
|
|
|
aFmts[ n ] = pNew;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule )
|
|
|
|
{
|
|
|
|
if( this != &rNumRule )
|
|
|
|
{
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
Set( n, rNumRule.aFmts[ n ] );
|
|
|
|
|
|
|
|
eRuleType = rNumRule.eRuleType;
|
|
|
|
sName = rNumRule.sName;
|
|
|
|
bAutoRuleFlag = rNumRule.bAutoRuleFlag;
|
|
|
|
bInvalidRuleFlag = TRUE;
|
|
|
|
bContinusNum = rNumRule.bContinusNum;
|
|
|
|
bAbsSpaces = rNumRule.bAbsSpaces;
|
|
|
|
nPoolFmtId = rNumRule.GetPoolFmtId();
|
|
|
|
nPoolHelpId = rNumRule.GetPoolHelpId();
|
|
|
|
nPoolHlpFileId = rNumRule.GetPoolHlpFileId();
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL SwNumRule::operator==( const SwNumRule& rRule ) const
|
|
|
|
{
|
|
|
|
BOOL bRet = eRuleType == rRule.eRuleType &&
|
|
|
|
sName == rRule.sName &&
|
|
|
|
bAutoRuleFlag == rRule.bAutoRuleFlag &&
|
|
|
|
bContinusNum == rRule.bContinusNum &&
|
|
|
|
bAbsSpaces == rRule.bAbsSpaces &&
|
|
|
|
nPoolFmtId == rRule.GetPoolFmtId() &&
|
|
|
|
nPoolHelpId == rRule.GetPoolHelpId() &&
|
|
|
|
nPoolHlpFileId == rRule.GetPoolHlpFileId();
|
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
for( BYTE n = 0; n < MAXLEVEL; ++n )
|
|
|
|
if( !( rRule.Get( n ) == Get( n ) ))
|
|
|
|
{
|
|
|
|
bRet = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SwNumRule::Set( USHORT i, const SwNumFmt& rNumFmt )
|
|
|
|
{
|
|
|
|
if( !aFmts[ i ] || !(rNumFmt == Get( i )) )
|
|
|
|
{
|
|
|
|
delete aFmts[ i ];
|
|
|
|
aFmts[ i ] = new SwNumFmt( rNumFmt );
|
|
|
|
bInvalidRuleFlag = TRUE;
|
2005-02-22 09:02:55 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRule::Set( USHORT i, const SwNumFmt* pNumFmt )
|
|
|
|
{
|
|
|
|
SwNumFmt* pOld = aFmts[ i ];
|
|
|
|
if( !pOld )
|
|
|
|
{
|
|
|
|
if( pNumFmt )
|
|
|
|
{
|
|
|
|
aFmts[ i ] = new SwNumFmt( *pNumFmt );
|
|
|
|
bInvalidRuleFlag = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( !pNumFmt )
|
|
|
|
delete pOld, aFmts[ i ] = 0, bInvalidRuleFlag = TRUE;
|
|
|
|
else if( *pOld != *pNumFmt )
|
|
|
|
*pOld = *pNumFmt, bInvalidRuleFlag = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String SwNumRule::MakeNumString( const SwNodeNum& rNum, BOOL bInclStrings,
|
|
|
|
BOOL bOnlyArabic ) const
|
|
|
|
{
|
|
|
|
String aStr;
|
2005-11-08 16:17:38 +00:00
|
|
|
|
|
|
|
if (rNum.IsCounted())
|
|
|
|
aStr = MakeNumString(rNum.GetNumberVector(),
|
|
|
|
bInclStrings, bOnlyArabic);
|
|
|
|
|
|
|
|
return aStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
String SwNumRule::MakeNumString( const SwNodeNum::tNumberVector & rNumVector,
|
|
|
|
const BOOL bInclStrings,
|
|
|
|
const BOOL bOnlyArabic,
|
|
|
|
const unsigned int _nRestrictToThisLevel ) const
|
|
|
|
{
|
|
|
|
String aStr;
|
|
|
|
|
|
|
|
unsigned int nLevel = rNumVector.size() - 1;
|
|
|
|
// --> OD 2005-10-17 #126238#
|
|
|
|
if ( nLevel > _nRestrictToThisLevel )
|
|
|
|
{
|
|
|
|
nLevel = _nRestrictToThisLevel;
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2007-09-27 07:39:02 +00:00
|
|
|
if (nLevel < MAXLEVEL)
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
const SwNumFmt& rMyNFmt = Get( static_cast<USHORT>(nLevel) );
|
2006-07-10 13:57:53 +00:00
|
|
|
// --> OD 2006-06-02 #b6432095#
|
|
|
|
// - levels with numbering none has to provide prefix and suffix string
|
|
|
|
// if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
BYTE i = static_cast<BYTE>(nLevel);
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if( !IsContinusNum() &&
|
2006-09-26 13:19:38 +00:00
|
|
|
// --> OD 2006-09-19 #i69672#
|
|
|
|
// - do not include upper levels, if level isn't numbered.
|
|
|
|
rMyNFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE &&
|
|
|
|
// <--
|
2004-11-26 12:24:48 +00:00
|
|
|
rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ?
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2001-02-23 11:45:30 +00:00
|
|
|
BYTE n = rMyNFmt.GetIncludeUpperLevels();
|
2000-09-18 23:08:29 +00:00
|
|
|
if( 1 < n )
|
|
|
|
{
|
|
|
|
if( i+1 >= n )
|
|
|
|
i -= n - 1;
|
|
|
|
else
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-08 16:17:38 +00:00
|
|
|
for( ; i <= nLevel; ++i )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwNumFmt& rNFmt = Get( i );
|
2001-02-23 11:45:30 +00:00
|
|
|
if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2005-11-08 16:17:38 +00:00
|
|
|
// Soll aus 1.1.1 --> 2. NoNum --> 1..1 oder 1.1 ??
|
|
|
|
// if( i != rNum.nMyLevel )
|
|
|
|
// aStr += aDotStr;
|
2000-09-18 23:08:29 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-11-08 16:17:38 +00:00
|
|
|
if( rNumVector[ i ] )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if( bOnlyArabic )
|
2005-11-08 16:17:38 +00:00
|
|
|
aStr += String::CreateFromInt32( rNumVector[ i ] );
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2005-11-08 16:17:38 +00:00
|
|
|
aStr += rNFmt.GetNumStr( rNumVector[ i ] );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
aStr += '0'; // alle 0-Level sind eine 0
|
2005-11-08 16:17:38 +00:00
|
|
|
if( i != nLevel && aStr.Len() )
|
2000-09-18 23:08:29 +00:00
|
|
|
aStr += aDotStr;
|
|
|
|
}
|
|
|
|
|
2005-11-08 16:17:38 +00:00
|
|
|
//JP 14.12.99: the type dont have any number, so dont append
|
|
|
|
// the Post-/Prefix String
|
|
|
|
if( bInclStrings && !bOnlyArabic &&
|
|
|
|
SVX_NUM_CHAR_SPECIAL != rMyNFmt.GetNumberingType() &&
|
|
|
|
SVX_NUM_BITMAP != rMyNFmt.GetNumberingType() )
|
|
|
|
{
|
|
|
|
aStr.Insert( rMyNFmt.GetPrefix(), 0 );
|
|
|
|
aStr += rMyNFmt.GetSuffix();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2005-11-08 16:17:38 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
return aStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----- Copy-Methode vom SwNumRule ------
|
|
|
|
|
|
|
|
// eine Art Copy-Constructor, damit die Num-Formate auch an den
|
|
|
|
// richtigen CharFormaten eines Dokumentes haengen !!
|
|
|
|
// (Kopiert die NumFormate und returnt sich selbst)
|
|
|
|
|
|
|
|
SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const SwNumRule& rNumRule )
|
|
|
|
{
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
{
|
|
|
|
Set( n, rNumRule.aFmts[ n ] );
|
|
|
|
if( aFmts[ n ] && aFmts[ n ]->GetCharFmt() &&
|
|
|
|
USHRT_MAX == pDoc->GetCharFmts()->GetPos( aFmts[n]->GetCharFmt() ))
|
|
|
|
// ueber unterschiedliche Dokumente kopieren, dann
|
|
|
|
// kopiere das entsprechende Char-Format ins neue
|
|
|
|
// Dokument.
|
|
|
|
aFmts[n]->SetCharFmt( pDoc->CopyCharFmt( *aFmts[n]->
|
|
|
|
GetCharFmt() ) );
|
|
|
|
}
|
|
|
|
eRuleType = rNumRule.eRuleType;
|
|
|
|
sName = rNumRule.sName;
|
|
|
|
bAutoRuleFlag = rNumRule.bAutoRuleFlag;
|
|
|
|
nPoolFmtId = rNumRule.GetPoolFmtId();
|
|
|
|
nPoolHelpId = rNumRule.GetPoolHelpId();
|
|
|
|
nPoolHlpFileId = rNumRule.GetPoolHlpFileId();
|
|
|
|
bInvalidRuleFlag = TRUE;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
/* -----------------30.10.98 08:33-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
void SwNumRule::SetSvxRule(const SvxNumRule& rNumRule, SwDoc* pDoc)
|
|
|
|
{
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
{
|
|
|
|
const SvxNumberFormat* pSvxFmt = rNumRule.Get(n);
|
|
|
|
delete aFmts[n];
|
|
|
|
aFmts[n] = pSvxFmt ? new SwNumFmt(*pSvxFmt, pDoc) : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// eRuleType = rNumRule.eRuleType;
|
|
|
|
// sName = rNumRule.sName;
|
|
|
|
// bAutoRuleFlag = rNumRule.bAutoRuleFlag;
|
|
|
|
bInvalidRuleFlag = TRUE;
|
|
|
|
bContinusNum = rNumRule.IsContinuousNumbering();
|
|
|
|
//!!! bAbsSpaces = rNumRule.IsAbsSpaces();
|
|
|
|
}
|
|
|
|
/* -----------------30.10.98 08:33-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumRule SwNumRule::MakeSvxNumRule() const
|
|
|
|
{
|
|
|
|
SvxNumRule aRule(NUM_CONTINUOUS|NUM_CHAR_TEXT_DISTANCE|NUM_CHAR_STYLE|
|
|
|
|
NUM_ENABLE_LINKED_BMP|NUM_ENABLE_EMBEDDED_BMP,
|
2007-09-27 07:39:02 +00:00
|
|
|
MAXLEVEL, bContinusNum,
|
2000-09-18 23:08:29 +00:00
|
|
|
eRuleType ==
|
|
|
|
NUM_RULE ?
|
|
|
|
SVX_RULETYPE_NUMBERING :
|
|
|
|
SVX_RULETYPE_OUTLINE_NUMBERING );
|
|
|
|
//!!! aRule.SetAbsSpaces( bAbsSpaces );
|
|
|
|
for( USHORT n = 0; n < MAXLEVEL; ++n )
|
|
|
|
{
|
2001-07-09 12:35:49 +00:00
|
|
|
SwNumFmt aNumFmt = Get(n);
|
|
|
|
if(aNumFmt.GetCharFmt())
|
|
|
|
aNumFmt.SetCharFmtName(aNumFmt.GetCharFmt()->GetName());
|
|
|
|
aRule.SetLevel(n, aNumFmt, aFmts[n] != 0);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
return aRule;
|
|
|
|
}
|
|
|
|
|
2004-10-22 07:12:03 +00:00
|
|
|
void SwNumRule::SetInvalidRule(BOOL bFlag)
|
|
|
|
{
|
2005-11-08 16:17:38 +00:00
|
|
|
if (bFlag)
|
2004-10-22 07:12:03 +00:00
|
|
|
{
|
2005-11-08 16:17:38 +00:00
|
|
|
if (pList != NULL)
|
|
|
|
{
|
|
|
|
delete pList;
|
|
|
|
pList = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
tPamAndNums::iterator aIt;
|
|
|
|
|
|
|
|
for (aIt = aNumberRanges.begin(); aIt != aNumberRanges.end(); aIt++)
|
|
|
|
(*aIt).second->InvalidateTree();
|
2004-10-22 07:12:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bInvalidRuleFlag = bFlag;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-05-17 15:14:02 +00:00
|
|
|
// #i27615#
|
|
|
|
SwBitArray SwNumRule::SetLevelMarked(BYTE nLvl, BOOL bVal)
|
|
|
|
{
|
|
|
|
SwBitArray aTmpMarkedLevels(aMarkedLevels);
|
|
|
|
|
|
|
|
aMarkedLevels.Set(nLvl, bVal);
|
|
|
|
|
|
|
|
aTmpMarkedLevels = aTmpMarkedLevels ^ aMarkedLevels;
|
|
|
|
|
|
|
|
return aTmpMarkedLevels;
|
|
|
|
}
|
|
|
|
|
2004-04-07 11:43:33 +00:00
|
|
|
// #i23725#, #i23726#
|
|
|
|
void SwNumRule::Indent(short nAmount, int nLevel, int nReferenceLevel,
|
|
|
|
BOOL bRelative, BOOL bFirstLine, BOOL bCheckGtZero)
|
|
|
|
{
|
|
|
|
int nStartLevel = 0;
|
|
|
|
int nEndLevel = MAXLEVEL - 1;
|
|
|
|
BOOL bGotInvalid = FALSE;
|
|
|
|
|
|
|
|
if (nLevel >= 0)
|
|
|
|
nStartLevel = nEndLevel = nLevel;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
short nRealAmount = nAmount;
|
|
|
|
|
|
|
|
if (! bRelative)
|
|
|
|
{
|
|
|
|
if (bFirstLine)
|
|
|
|
{
|
|
|
|
if (nReferenceLevel >= 0)
|
2007-09-27 07:39:02 +00:00
|
|
|
nAmount = nAmount - Get(static_cast<USHORT>(nReferenceLevel)).GetFirstLineOffset();
|
2004-04-07 11:43:33 +00:00
|
|
|
else
|
2007-09-27 07:39:02 +00:00
|
|
|
nAmount = nAmount - Get(static_cast<USHORT>(nStartLevel)).GetFirstLineOffset();
|
2004-04-07 11:43:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL bFirst = TRUE;
|
|
|
|
|
|
|
|
if (nReferenceLevel >= 0)
|
2007-09-27 07:39:02 +00:00
|
|
|
nRealAmount = nAmount - Get(static_cast<USHORT>(nReferenceLevel)).GetAbsLSpace();
|
2004-04-07 11:43:33 +00:00
|
|
|
else
|
|
|
|
for (i = nStartLevel; i < nEndLevel + 1; i++)
|
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
short nTmp = nAmount - Get(static_cast<USHORT>(i)).GetAbsLSpace();
|
2004-04-07 11:43:33 +00:00
|
|
|
|
|
|
|
if (bFirst || nTmp > nRealAmount)
|
|
|
|
{
|
|
|
|
nRealAmount = nTmp;
|
|
|
|
bFirst = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nRealAmount < 0)
|
|
|
|
for (i = nStartLevel; i < nEndLevel + 1; i++)
|
2007-09-27 07:39:02 +00:00
|
|
|
if (Get(static_cast<USHORT>(i)).GetAbsLSpace() + nRealAmount < 0)
|
|
|
|
nRealAmount = -Get(static_cast<USHORT>(i)).GetAbsLSpace();
|
2004-04-07 11:43:33 +00:00
|
|
|
|
|
|
|
for (i = nStartLevel; i < nEndLevel + 1; i++)
|
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
short nNew = Get(static_cast<USHORT>(i)).GetAbsLSpace() + nRealAmount;
|
2004-04-07 11:43:33 +00:00
|
|
|
|
|
|
|
if (bCheckGtZero && nNew < 0)
|
|
|
|
nNew = 0;
|
|
|
|
|
2007-09-27 07:39:02 +00:00
|
|
|
SwNumFmt aTmpNumFmt(Get(static_cast<USHORT>(i)));
|
2004-04-07 11:43:33 +00:00
|
|
|
aTmpNumFmt.SetAbsLSpace(nNew);
|
|
|
|
|
2007-09-27 07:39:02 +00:00
|
|
|
Set(static_cast<USHORT>(i), aTmpNumFmt);
|
2004-04-07 11:43:33 +00:00
|
|
|
|
|
|
|
bGotInvalid = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bGotInvalid)
|
|
|
|
SetInvalidRule(bGotInvalid);
|
|
|
|
}
|
2005-02-22 09:02:55 +00:00
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-27 #6440955#
|
|
|
|
// move to namespace <numfunc>
|
|
|
|
//sal_Unicode GetBulletChar(BYTE nLevel)
|
|
|
|
//{
|
|
|
|
// static sal_Unicode nLevelChars[MAXLEVEL] =
|
|
|
|
// { 0x25cf, 0x25cb, 0x25a0, 0x25cf, 0x25cb,
|
|
|
|
// 0x25a0, 0x25cf, 0x25cb, 0x25a0, 0x25cf };
|
2005-02-22 09:02:55 +00:00
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// if (nLevel > MAXLEVEL)
|
|
|
|
// nLevel = MAXLEVEL;
|
2005-02-22 09:02:55 +00:00
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// return nLevelChars[nLevel];
|
|
|
|
//}
|
|
|
|
// <--
|
2005-11-08 16:17:38 +00:00
|
|
|
|
|
|
|
void SwNumRule::NewNumberRange(const SwPaM & rPam)
|
|
|
|
{
|
|
|
|
SwNodeNum * pNum = new SwNodeNum();
|
|
|
|
// --> OD 2005-10-21 - apply numbering rule to number tree root node for
|
|
|
|
// correct creation of phantoms.
|
|
|
|
pNum->SetNumRule( this );
|
|
|
|
// <--
|
|
|
|
|
|
|
|
SwPaM * pPam = new SwPaM(*rPam.Start(), *rPam.End());
|
|
|
|
tPamAndNum aPamAndNum(pPam, pNum);
|
|
|
|
|
|
|
|
aNumberRanges.push_back(aPamAndNum);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRule::AddNumber(SwNodeNum * pNum, unsigned int nLevel)
|
|
|
|
{
|
|
|
|
tPamAndNums::iterator aIt;
|
|
|
|
|
|
|
|
SwPosition aPos(pNum->GetPosition());
|
|
|
|
|
|
|
|
for (aIt = aNumberRanges.begin(); aIt != aNumberRanges.end(); aIt++)
|
|
|
|
{
|
|
|
|
SwPosition * pStart = (*aIt).first->Start();
|
|
|
|
SwPosition * pEnd = (*aIt).first->End();
|
|
|
|
SwNodes * pRangeNodes = &(pStart->nNode.GetNode().GetNodes());
|
|
|
|
SwNodes * pNodes = &(aPos.nNode.GetNode().GetNodes());
|
|
|
|
|
|
|
|
if (pRangeNodes == pNodes && *pStart <= aPos && aPos <= *pEnd)
|
|
|
|
{
|
|
|
|
pNum->SetNumRule(this);
|
|
|
|
(*aIt).second->AddChild(pNum, nLevel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRule::Validate()
|
|
|
|
{
|
|
|
|
tPamAndNums::iterator aIt;
|
|
|
|
|
|
|
|
for (aIt = aNumberRanges.begin(); aIt != aNumberRanges.end(); aIt++)
|
|
|
|
(*aIt).second->NotifyInvalidChildren();
|
|
|
|
|
|
|
|
SetInvalidRule(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SwNumRule::IsCountPhantoms() const
|
|
|
|
{
|
|
|
|
return mbCountPhantoms;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwNumRule::SetCountPhantoms(bool bCountPhantoms)
|
|
|
|
{
|
|
|
|
mbCountPhantoms = bCountPhantoms;
|
|
|
|
}
|
|
|
|
|
2006-07-25 10:47:05 +00:00
|
|
|
// --> OD 2006-06-27 #b6440955#
|
|
|
|
namespace numfunc
|
|
|
|
{
|
|
|
|
/** class containing default bullet list configuration data
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
class SwDefBulletConfig : private utl::ConfigItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static SwDefBulletConfig* getInstance()
|
|
|
|
{
|
|
|
|
if ( mpInstance == 0L )
|
|
|
|
{
|
|
|
|
mpInstance = new SwDefBulletConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mpInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const String& GetFontname() const
|
|
|
|
{
|
|
|
|
return msFontname;
|
|
|
|
}
|
|
|
|
inline const Font& GetFont() const
|
|
|
|
{
|
|
|
|
return *mpFont;
|
|
|
|
}
|
|
|
|
inline const short GetFontWeight() const
|
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
return static_cast<short>(meFontWeight);
|
2006-07-25 10:47:05 +00:00
|
|
|
}
|
|
|
|
inline const short GetFontItalic() const
|
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
return static_cast<short>(meFontItalic);
|
2006-07-25 10:47:05 +00:00
|
|
|
}
|
|
|
|
inline const sal_Unicode GetChar( BYTE p_nListLevel ) const
|
|
|
|
{
|
|
|
|
if ( p_nListLevel > MAXLEVEL )
|
|
|
|
{
|
|
|
|
p_nListLevel = MAXLEVEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mnLevelChars[p_nListLevel];
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
SwDefBulletConfig();
|
|
|
|
|
|
|
|
/** sets internal default bullet configuration data to default values
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void SetToDefault();
|
|
|
|
|
|
|
|
/** returns sequence of default bullet configuration property names
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2007-09-27 07:39:02 +00:00
|
|
|
uno::Sequence<rtl::OUString> GetPropNames() const;
|
2006-07-25 10:47:05 +00:00
|
|
|
|
|
|
|
/** loads default bullet configuration properties and applies
|
|
|
|
values to internal data
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void LoadConfig();
|
|
|
|
|
|
|
|
/** initialize font instance for default bullet list
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void InitFont();
|
|
|
|
|
|
|
|
/** catches notification about changed default bullet configuration data
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
2007-09-27 07:39:02 +00:00
|
|
|
virtual void Notify( const uno::Sequence<rtl::OUString>& aPropertyNames );
|
2006-07-25 10:47:05 +00:00
|
|
|
|
|
|
|
static SwDefBulletConfig* mpInstance;
|
|
|
|
|
|
|
|
// default bullet list configuration data
|
|
|
|
String msFontname;
|
|
|
|
FontWeight meFontWeight;
|
|
|
|
FontItalic meFontItalic;
|
|
|
|
sal_Unicode mnLevelChars[MAXLEVEL];
|
|
|
|
|
|
|
|
// default bullet list font instance
|
|
|
|
Font* mpFont;
|
|
|
|
};
|
|
|
|
|
|
|
|
SwDefBulletConfig* SwDefBulletConfig::mpInstance = 0L;
|
|
|
|
|
|
|
|
SwDefBulletConfig::SwDefBulletConfig()
|
|
|
|
: ConfigItem( rtl::OUString::createFromAscii("Office.Writer/Numbering/DefaultBulletList") ),
|
|
|
|
msFontname( String::CreateFromAscii("StarSymbol") ),
|
|
|
|
meFontWeight( WEIGHT_DONTKNOW ),
|
|
|
|
meFontItalic( ITALIC_NONE ),
|
|
|
|
mpFont( 0L )
|
|
|
|
{
|
|
|
|
SetToDefault();
|
|
|
|
LoadConfig();
|
|
|
|
InitFont();
|
|
|
|
|
|
|
|
// enable notification for changes on default bullet configuration change
|
|
|
|
EnableNotification( GetPropNames() );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDefBulletConfig::SetToDefault()
|
|
|
|
{
|
|
|
|
msFontname = String::CreateFromAscii("StarSymbol");
|
|
|
|
meFontWeight = WEIGHT_DONTKNOW;
|
|
|
|
meFontItalic = ITALIC_NONE;
|
|
|
|
|
|
|
|
mnLevelChars[0] = 0x25cf;
|
|
|
|
mnLevelChars[1] = 0x25cb;
|
|
|
|
mnLevelChars[2] = 0x25a0;
|
|
|
|
mnLevelChars[3] = 0x25cf;
|
|
|
|
mnLevelChars[4] = 0x25cb;
|
|
|
|
mnLevelChars[5] = 0x25a0;
|
|
|
|
mnLevelChars[6] = 0x25cf;
|
|
|
|
mnLevelChars[7] = 0x25cb;
|
|
|
|
mnLevelChars[8] = 0x25a0;
|
|
|
|
mnLevelChars[9] = 0x25cf;
|
|
|
|
}
|
|
|
|
|
2007-09-27 07:39:02 +00:00
|
|
|
uno::Sequence<rtl::OUString> SwDefBulletConfig::GetPropNames() const
|
2006-07-25 10:47:05 +00:00
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
uno::Sequence<rtl::OUString> aPropNames(13);
|
2006-07-25 10:47:05 +00:00
|
|
|
rtl::OUString* pNames = aPropNames.getArray();
|
|
|
|
pNames[0] = rtl::OUString::createFromAscii("BulletFont/FontFamilyname");
|
|
|
|
pNames[1] = rtl::OUString::createFromAscii("BulletFont/FontWeight");
|
|
|
|
pNames[2] = rtl::OUString::createFromAscii("BulletFont/FontItalic");
|
|
|
|
pNames[3] = rtl::OUString::createFromAscii("BulletCharLvl1");
|
|
|
|
pNames[4] = rtl::OUString::createFromAscii("BulletCharLvl2");
|
|
|
|
pNames[5] = rtl::OUString::createFromAscii("BulletCharLvl3");
|
|
|
|
pNames[6] = rtl::OUString::createFromAscii("BulletCharLvl4");
|
|
|
|
pNames[7] = rtl::OUString::createFromAscii("BulletCharLvl5");
|
|
|
|
pNames[8] = rtl::OUString::createFromAscii("BulletCharLvl6");
|
|
|
|
pNames[9] = rtl::OUString::createFromAscii("BulletCharLvl7");
|
|
|
|
pNames[10] = rtl::OUString::createFromAscii("BulletCharLvl8");
|
|
|
|
pNames[11] = rtl::OUString::createFromAscii("BulletCharLvl9");
|
|
|
|
pNames[12] = rtl::OUString::createFromAscii("BulletCharLvl10");
|
|
|
|
|
|
|
|
return aPropNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDefBulletConfig::LoadConfig()
|
|
|
|
{
|
2007-09-27 07:39:02 +00:00
|
|
|
uno::Sequence<rtl::OUString> aPropNames = GetPropNames();
|
|
|
|
uno::Sequence<uno::Any> aValues =
|
2006-07-25 10:47:05 +00:00
|
|
|
GetProperties( aPropNames );
|
2007-09-27 07:39:02 +00:00
|
|
|
const uno::Any* pValues = aValues.getConstArray();
|
2006-07-25 10:47:05 +00:00
|
|
|
ASSERT( aValues.getLength() == aPropNames.getLength(),
|
|
|
|
"<SwDefBulletConfig::SwDefBulletConfig()> - GetProperties failed")
|
|
|
|
if ( aValues.getLength() == aPropNames.getLength() )
|
|
|
|
{
|
|
|
|
for ( int nProp = 0; nProp < aPropNames.getLength(); ++nProp )
|
|
|
|
{
|
|
|
|
if ( pValues[nProp].hasValue() )
|
|
|
|
{
|
|
|
|
switch ( nProp )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
rtl::OUString aStr;
|
|
|
|
pValues[nProp] >>= aStr;
|
|
|
|
msFontname = aStr;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
sal_uInt8 nTmp;
|
|
|
|
pValues[nProp] >>= nTmp;
|
|
|
|
if ( nProp == 1 )
|
|
|
|
meFontWeight = static_cast<FontWeight>(nTmp);
|
|
|
|
else if ( nProp == 2 )
|
|
|
|
meFontItalic = static_cast<FontItalic>(nTmp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
{
|
|
|
|
sal_Unicode cChar;
|
|
|
|
pValues[nProp] >>= cChar;
|
|
|
|
mnLevelChars[nProp-3] = cChar;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDefBulletConfig::InitFont()
|
|
|
|
{
|
|
|
|
delete mpFont;
|
|
|
|
|
|
|
|
mpFont = new Font( msFontname, aEmptyStr, Size( 0, 14 ) );
|
|
|
|
mpFont->SetWeight( meFontWeight );
|
|
|
|
mpFont->SetItalic( meFontItalic );
|
|
|
|
}
|
|
|
|
|
2007-09-27 07:39:02 +00:00
|
|
|
void SwDefBulletConfig::Notify( const uno::Sequence<rtl::OUString>& )
|
2006-07-25 10:47:05 +00:00
|
|
|
{
|
|
|
|
SetToDefault();
|
|
|
|
LoadConfig();
|
|
|
|
InitFont();
|
|
|
|
}
|
|
|
|
|
|
|
|
const String& GetDefBulletFontname()
|
|
|
|
{
|
|
|
|
return SwDefBulletConfig::getInstance()->GetFontname();
|
|
|
|
}
|
|
|
|
|
|
|
|
const Font& GetDefBulletFont()
|
|
|
|
{
|
|
|
|
return SwDefBulletConfig::getInstance()->GetFont();
|
|
|
|
}
|
|
|
|
|
|
|
|
const sal_Unicode GetBulletChar( BYTE nLevel )
|
|
|
|
{
|
|
|
|
return SwDefBulletConfig::getInstance()->GetChar( nLevel );
|
|
|
|
}
|
|
|
|
}
|