2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 00:56:41 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:56:41 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:56:41 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:56:41 +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-11 00:56:41 +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-11 00:56:41 +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 04:21:28 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
2010-01-06 19:26:54 +01:00
|
|
|
#include "precompiled_editeng.hxx"
|
2006-09-17 04:21:28 +00:00
|
|
|
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/numitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-09-27 12:01:50 +00:00
|
|
|
#include <com/sun/star/text/HoriOrientation.hpp>
|
|
|
|
#include <com/sun/star/text/VertOrientation.hpp>
|
|
|
|
#include <com/sun/star/text/RelOrientation.hpp>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/brshitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/font.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/editids.hrc>
|
|
|
|
#include <editeng/editrids.hrc>
|
|
|
|
#include <editeng/numdef.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/graph.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/unolingu.hxx>
|
2001-02-23 11:29:54 +00:00
|
|
|
#include <com/sun/star/text/XNumberingFormatter.hpp>
|
|
|
|
#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
|
2001-08-06 11:22:31 +00:00
|
|
|
#include <com/sun/star/style/NumberingType.hpp>
|
2001-02-23 11:29:54 +00:00
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
|
|
#include <comphelper/processfactory.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/unonrule.hxx>
|
2000-09-28 11:35:03 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#define MM100_TO_TWIP(MM100) ((MM100*72L+63L)/127L)
|
|
|
|
|
|
|
|
#define DEF_WRITER_LSPACE 500 //Standardeinrueckung
|
|
|
|
#define DEF_DRAW_LSPACE 800 //Standardeinrueckung
|
|
|
|
|
2009-11-17 15:13:56 +00:00
|
|
|
#define NUMITEM_VERSION_01 0x01
|
|
|
|
#define NUMITEM_VERSION_02 0x02
|
|
|
|
#define NUMITEM_VERSION_03 0x03
|
|
|
|
#define NUMITEM_VERSION_04 0x04
|
|
|
|
|
2000-09-28 11:35:03 +00:00
|
|
|
using namespace ::com::sun::star;
|
2001-02-23 11:29:54 +00:00
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::text;
|
|
|
|
using namespace ::com::sun::star::beans;
|
2001-08-06 11:22:31 +00:00
|
|
|
using namespace ::com::sun::star::style;
|
2001-02-23 11:29:54 +00:00
|
|
|
|
|
|
|
sal_Int32 SvxNumberType::nRefCount = 0;
|
|
|
|
com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> SvxNumberType::xFormatter = 0;
|
2009-09-08 04:57:32 +00:00
|
|
|
void lcl_getFormatter(com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& _xFormatter)
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
2009-09-08 04:57:32 +00:00
|
|
|
if(!_xFormatter.is())
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
|
|
|
|
Reference < XInterface > xI = xMSF->createInstance(
|
|
|
|
::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );
|
|
|
|
Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY);
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
|
2009-09-08 04:57:32 +00:00
|
|
|
_xFormatter = Reference<XNumberingFormatter> (xRet, UNO_QUERY);
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
|
|
|
catch(Exception& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2009-09-08 04:57:32 +00:00
|
|
|
}
|
|
|
|
/* -----------------------------22.02.01 14:24--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SvxNumberType::SvxNumberType(sal_Int16 nType) :
|
|
|
|
nNumType(nType),
|
|
|
|
bShowSymbol(sal_True)
|
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
nRefCount++;
|
|
|
|
}
|
|
|
|
/* -----------------------------22.02.01 14:31--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SvxNumberType::SvxNumberType(const SvxNumberType& rType) :
|
|
|
|
nNumType(rType.nNumType),
|
|
|
|
bShowSymbol(rType.bShowSymbol)
|
|
|
|
{
|
|
|
|
nRefCount++;
|
|
|
|
}
|
|
|
|
/* -----------------------------22.02.01 14:24--------------------------------
|
2000-09-28 11:35:03 +00:00
|
|
|
|
2001-02-23 11:29:54 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SvxNumberType::~SvxNumberType()
|
|
|
|
{
|
|
|
|
if(!--nRefCount)
|
|
|
|
xFormatter = 0;
|
|
|
|
}
|
|
|
|
/* -----------------------------22.02.01 11:09--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
String SvxNumberType::GetNumStr( ULONG nNo ) const
|
|
|
|
{
|
2001-07-11 10:48:57 +00:00
|
|
|
LanguageType eLang = Application::GetSettings().GetLanguage();
|
2001-02-23 11:29:54 +00:00
|
|
|
Locale aLocale = SvxCreateLocale(eLang);
|
|
|
|
return GetNumStr( nNo, aLocale );
|
|
|
|
}
|
|
|
|
/* -----------------28.10.98 15:56-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
String SvxNumberType::GetNumStr( ULONG nNo, const Locale& rLocale ) const
|
|
|
|
{
|
2009-09-08 04:57:32 +00:00
|
|
|
lcl_getFormatter(xFormatter);
|
2001-02-23 11:29:54 +00:00
|
|
|
String aTmpStr;
|
|
|
|
if(!xFormatter.is())
|
|
|
|
return aTmpStr;
|
|
|
|
|
|
|
|
if(bShowSymbol)
|
|
|
|
{
|
2001-08-06 11:22:31 +00:00
|
|
|
switch(nNumType)
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
2001-08-06 11:22:31 +00:00
|
|
|
case NumberingType::CHAR_SPECIAL:
|
|
|
|
case NumberingType::BITMAP:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
2002-11-22 06:45:51 +00:00
|
|
|
//#95525# '0' allowed for ARABIC numberings
|
|
|
|
if(NumberingType::ARABIC == nNumType && 0 == nNo )
|
|
|
|
aTmpStr = '0';
|
|
|
|
else
|
2001-08-06 11:22:31 +00:00
|
|
|
{
|
2002-11-22 06:45:51 +00:00
|
|
|
Sequence< PropertyValue > aProperties(2);
|
|
|
|
PropertyValue* pValues = aProperties.getArray();
|
|
|
|
pValues[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingType"));
|
|
|
|
pValues[0].Value <<= nNumType;
|
|
|
|
pValues[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"));
|
|
|
|
pValues[1].Value <<= (sal_Int32)nNo;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
aTmpStr = xFormatter->makeNumberingString( aProperties, rLocale );
|
|
|
|
}
|
|
|
|
catch(Exception&)
|
|
|
|
{
|
|
|
|
}
|
2001-08-06 11:22:31 +00:00
|
|
|
}
|
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return aTmpStr;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
/* -----------------27.10.98 10:33-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
SvxNumberFormat::SvxNumberFormat( sal_Int16 eType,
|
|
|
|
SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
|
|
|
|
// <--
|
|
|
|
: SvxNumberType(eType),
|
|
|
|
eNumAdjust(SVX_ADJUST_LEFT),
|
|
|
|
nInclUpperLevels(0),
|
|
|
|
nStart(1),
|
|
|
|
cBullet(SVX_DEF_BULLET),
|
|
|
|
nBulletRelSize(100),
|
|
|
|
nBulletColor(COL_BLACK),
|
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
mePositionAndSpaceMode( ePositionAndSpaceMode ),
|
|
|
|
// <--
|
|
|
|
nFirstLineOffset(0),
|
|
|
|
nAbsLSpace(0),
|
|
|
|
nLSpace(0),
|
|
|
|
nCharTextDistance(0),
|
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
meLabelFollowedBy( LISTTAB ),
|
|
|
|
mnListtabPos( 0 ),
|
|
|
|
mnFirstLineIndent( 0 ),
|
|
|
|
mnIndentAt( 0 ),
|
|
|
|
// <--
|
|
|
|
pGraphicBrush(0),
|
|
|
|
eVertOrient(text::VertOrientation::NONE),
|
|
|
|
pBulletFont(0)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:56-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2001-02-23 11:29:54 +00:00
|
|
|
SvxNumberFormat::SvxNumberFormat(const SvxNumberFormat& rFormat) :
|
2001-07-02 13:25:51 +00:00
|
|
|
SvxNumberType(rFormat),
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
mePositionAndSpaceMode( rFormat.mePositionAndSpaceMode ),
|
|
|
|
// <--
|
2001-07-02 13:25:51 +00:00
|
|
|
pGraphicBrush(0),
|
|
|
|
pBulletFont(0)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-02 13:25:51 +00:00
|
|
|
*this = rFormat;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:56-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumberFormat::~SvxNumberFormat()
|
|
|
|
{
|
|
|
|
delete pGraphicBrush;
|
|
|
|
delete pBulletFont;
|
|
|
|
}
|
|
|
|
/* -----------------08.12.98 11:14-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2009-11-17 15:13:56 +00:00
|
|
|
SvxNumberFormat::SvxNumberFormat(SvStream &rStream)
|
|
|
|
: mePositionAndSpaceMode( LABEL_WIDTH_AND_POSITION ),
|
|
|
|
meLabelFollowedBy( LISTTAB ),
|
|
|
|
mnListtabPos( 0 ),
|
|
|
|
mnFirstLineIndent( 0 ),
|
|
|
|
mnIndentAt( 0 )
|
|
|
|
{
|
|
|
|
|
|
|
|
USHORT nVersion;
|
|
|
|
rStream >> nVersion;
|
|
|
|
|
|
|
|
USHORT nUSHORT;
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
SetNumberingType((sal_Int16)nUSHORT);
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
eNumAdjust = (SvxAdjust)nUSHORT;
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
nInclUpperLevels = (BYTE)nUSHORT;
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
nStart = nUSHORT;
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
cBullet = nUSHORT;
|
|
|
|
|
|
|
|
short nShort;
|
|
|
|
rStream >> nShort;
|
|
|
|
nFirstLineOffset = nShort;
|
|
|
|
rStream >> nShort;
|
|
|
|
nAbsLSpace = nShort;
|
|
|
|
rStream >> nShort;
|
|
|
|
nLSpace = nShort;
|
|
|
|
|
|
|
|
rStream >> nShort;
|
|
|
|
nCharTextDistance = nShort;
|
|
|
|
rtl_TextEncoding eEnc = gsl_getSystemTextEncoding();
|
|
|
|
rStream.ReadByteString(sPrefix, eEnc);
|
|
|
|
rStream.ReadByteString(sSuffix, eEnc);
|
|
|
|
rStream.ReadByteString(sCharStyleName, eEnc);
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
if(nUSHORT)
|
|
|
|
{
|
|
|
|
SvxBrushItem aHelper(0);
|
|
|
|
pGraphicBrush = (SvxBrushItem*) aHelper.Create( rStream, BRUSH_GRAPHIC_VERSION );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pGraphicBrush = 0;
|
|
|
|
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
eVertOrient = (sal_Int16)nUSHORT;
|
|
|
|
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
if(nUSHORT)
|
|
|
|
{
|
|
|
|
pBulletFont = new Font;
|
|
|
|
rStream >> *pBulletFont;
|
|
|
|
if(!pBulletFont->GetCharSet())
|
|
|
|
pBulletFont->SetCharSet(rStream.GetStreamCharSet());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pBulletFont = 0;
|
|
|
|
rStream >> aGraphicSize;
|
|
|
|
|
|
|
|
rStream >> nBulletColor;
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
nBulletRelSize = nUSHORT;
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
SetShowSymbol((BOOL)nUSHORT);
|
|
|
|
|
|
|
|
if( nVersion < NUMITEM_VERSION_03 )
|
|
|
|
cBullet = ByteString::ConvertToUnicode( (sal_Char)cBullet,
|
|
|
|
(pBulletFont&&pBulletFont->GetCharSet()) ? pBulletFont->GetCharSet()
|
|
|
|
: RTL_TEXTENCODING_SYMBOL );
|
|
|
|
if(pBulletFont)
|
|
|
|
{
|
|
|
|
BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50;
|
|
|
|
if(bConvertBulletFont)
|
|
|
|
{
|
|
|
|
|
|
|
|
FontToSubsFontConverter pConverter =
|
|
|
|
CreateFontToSubsFontConverter(pBulletFont->GetName(),
|
|
|
|
FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS);
|
|
|
|
if(pConverter)
|
|
|
|
{
|
|
|
|
cBullet = ConvertFontToSubsFontChar(pConverter, cBullet);
|
|
|
|
String sFontName = GetFontToSubsFontName(pConverter);
|
|
|
|
pBulletFont->SetName(sFontName);
|
|
|
|
DestroyFontToSubsFontConverter(pConverter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( NUMITEM_VERSION_04 <= nVersion )
|
|
|
|
{
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
mePositionAndSpaceMode = (SvxNumPositionAndSpaceMode) nUSHORT;
|
|
|
|
rStream >> nUSHORT;
|
|
|
|
meLabelFollowedBy = ( SvxNumLabelFollowedBy ) nUSHORT;
|
|
|
|
long nLong;
|
|
|
|
rStream >> nLong;
|
|
|
|
mnListtabPos = nLong;
|
|
|
|
rStream >> nLong;
|
|
|
|
mnFirstLineIndent = nLong;
|
|
|
|
rStream >> nLong;
|
|
|
|
mnIndentAt = nLong;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
/* -----------------08.12.98 11:14-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2009-11-17 15:13:56 +00:00
|
|
|
SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter)
|
|
|
|
{
|
|
|
|
if(pConverter && pBulletFont)
|
|
|
|
{
|
|
|
|
cBullet = ConvertFontToSubsFontChar(pConverter, cBullet);
|
|
|
|
String sFontName = GetFontToSubsFontName(pConverter);
|
|
|
|
pBulletFont->SetName(sFontName);
|
|
|
|
}
|
|
|
|
|
|
|
|
rStream << (USHORT)NUMITEM_VERSION_04;
|
|
|
|
|
|
|
|
rStream << (USHORT)GetNumberingType();
|
|
|
|
rStream << (USHORT)eNumAdjust;
|
|
|
|
rStream << (USHORT)nInclUpperLevels;
|
|
|
|
rStream << nStart;
|
|
|
|
rStream << (USHORT)cBullet;
|
|
|
|
|
|
|
|
rStream << nFirstLineOffset;
|
|
|
|
rStream << nAbsLSpace;
|
|
|
|
rStream << nLSpace;
|
|
|
|
|
|
|
|
rStream << nCharTextDistance;
|
|
|
|
rtl_TextEncoding eEnc = gsl_getSystemTextEncoding();
|
|
|
|
rStream.WriteByteString(sPrefix, eEnc);
|
|
|
|
rStream.WriteByteString(sSuffix, eEnc);
|
|
|
|
rStream.WriteByteString(sCharStyleName, eEnc);
|
|
|
|
if(pGraphicBrush)
|
|
|
|
{
|
|
|
|
rStream << (USHORT)1;
|
|
|
|
|
|
|
|
// #75113# in SD or SI force bullet itself to be stored,
|
|
|
|
// for that purpose throw away link when link and graphic
|
|
|
|
// are present, so Brush save is forced
|
|
|
|
if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic())
|
|
|
|
{
|
|
|
|
String aEmpty;
|
|
|
|
pGraphicBrush->SetGraphicLink(aEmpty);
|
|
|
|
}
|
|
|
|
|
|
|
|
pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rStream << (USHORT)0;
|
|
|
|
|
|
|
|
rStream << (USHORT)eVertOrient;
|
|
|
|
if(pBulletFont)
|
|
|
|
{
|
|
|
|
rStream << (USHORT)1;
|
|
|
|
rStream << *pBulletFont;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rStream << (USHORT)0;
|
|
|
|
rStream << aGraphicSize;
|
|
|
|
|
|
|
|
Color nTempColor = nBulletColor;
|
|
|
|
if(COL_AUTO == nBulletColor.GetColor())
|
|
|
|
nTempColor = COL_BLACK;
|
|
|
|
rStream << nTempColor;
|
|
|
|
rStream << nBulletRelSize;
|
|
|
|
rStream << (USHORT)IsShowSymbol();
|
|
|
|
|
|
|
|
rStream << ( USHORT ) mePositionAndSpaceMode;
|
|
|
|
rStream << ( USHORT ) meLabelFollowedBy;
|
|
|
|
rStream << ( long ) mnListtabPos;
|
|
|
|
rStream << ( long ) mnFirstLineIndent;
|
|
|
|
rStream << ( long ) mnIndentAt;
|
|
|
|
|
|
|
|
return rStream;
|
|
|
|
}
|
|
|
|
|
2001-02-23 11:29:54 +00:00
|
|
|
/* -----------------------------23.02.01 11:10--------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-23 11:29:54 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
|
|
|
|
{
|
|
|
|
SetNumberingType(rFormat.GetNumberingType());
|
|
|
|
eNumAdjust = rFormat.eNumAdjust ;
|
|
|
|
nInclUpperLevels = rFormat.nInclUpperLevels ;
|
|
|
|
nStart = rFormat.nStart ;
|
|
|
|
cBullet = rFormat.cBullet ;
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
mePositionAndSpaceMode = rFormat.mePositionAndSpaceMode;
|
|
|
|
// <--
|
2001-02-23 11:29:54 +00:00
|
|
|
nFirstLineOffset = rFormat.nFirstLineOffset;
|
|
|
|
nAbsLSpace = rFormat.nAbsLSpace ;
|
|
|
|
nLSpace = rFormat.nLSpace ;
|
|
|
|
nCharTextDistance = rFormat.nCharTextDistance ;
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
meLabelFollowedBy = rFormat.meLabelFollowedBy;
|
|
|
|
mnListtabPos = rFormat.mnListtabPos;
|
|
|
|
mnFirstLineIndent = rFormat.mnFirstLineIndent;
|
|
|
|
mnIndentAt = rFormat.mnIndentAt;
|
|
|
|
// <--
|
2001-02-23 11:29:54 +00:00
|
|
|
eVertOrient = rFormat.eVertOrient ;
|
|
|
|
sPrefix = rFormat.sPrefix ;
|
|
|
|
sSuffix = rFormat.sSuffix ;
|
|
|
|
aGraphicSize = rFormat.aGraphicSize ;
|
|
|
|
nBulletColor = rFormat.nBulletColor ;
|
|
|
|
nBulletRelSize = rFormat.nBulletRelSize;
|
|
|
|
SetShowSymbol(rFormat.IsShowSymbol());
|
|
|
|
sCharStyleName = rFormat.sCharStyleName;
|
|
|
|
DELETEZ(pGraphicBrush);
|
|
|
|
if(rFormat.pGraphicBrush)
|
2001-07-02 13:25:51 +00:00
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
pGraphicBrush = new SvxBrushItem(*rFormat.pGraphicBrush);
|
2001-07-02 13:25:51 +00:00
|
|
|
pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) );
|
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
DELETEZ(pBulletFont);
|
|
|
|
if(rFormat.pBulletFont)
|
|
|
|
pBulletFont = new Font(*rFormat.pBulletFont);
|
|
|
|
return *this;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
/* -----------------27.10.98 10:56-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
BOOL SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const
|
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
if( GetNumberingType() != rFormat.GetNumberingType() ||
|
2000-09-18 16:07:07 +00:00
|
|
|
eNumAdjust != rFormat.eNumAdjust ||
|
|
|
|
nInclUpperLevels != rFormat.nInclUpperLevels ||
|
|
|
|
nStart != rFormat.nStart ||
|
|
|
|
cBullet != rFormat.cBullet ||
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
mePositionAndSpaceMode != rFormat.mePositionAndSpaceMode ||
|
|
|
|
// <--
|
2000-09-18 16:07:07 +00:00
|
|
|
nFirstLineOffset != rFormat.nFirstLineOffset ||
|
|
|
|
nAbsLSpace != rFormat.nAbsLSpace ||
|
|
|
|
nLSpace != rFormat.nLSpace ||
|
|
|
|
nCharTextDistance != rFormat.nCharTextDistance ||
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
meLabelFollowedBy != rFormat.meLabelFollowedBy ||
|
|
|
|
mnListtabPos != rFormat.mnListtabPos ||
|
|
|
|
mnFirstLineIndent != rFormat.mnFirstLineIndent ||
|
|
|
|
mnIndentAt != rFormat.mnIndentAt ||
|
|
|
|
// <--
|
2000-09-18 16:07:07 +00:00
|
|
|
eVertOrient != rFormat.eVertOrient ||
|
|
|
|
sPrefix != rFormat.sPrefix ||
|
|
|
|
sSuffix != rFormat.sSuffix ||
|
|
|
|
aGraphicSize != rFormat.aGraphicSize ||
|
|
|
|
nBulletColor != rFormat.nBulletColor ||
|
|
|
|
nBulletRelSize != rFormat.nBulletRelSize ||
|
2001-02-23 11:29:54 +00:00
|
|
|
IsShowSymbol() != rFormat.IsShowSymbol() ||
|
2000-09-18 16:07:07 +00:00
|
|
|
sCharStyleName != rFormat.sCharStyleName
|
|
|
|
)
|
|
|
|
return FALSE;
|
2008-12-11 07:05:03 +00:00
|
|
|
if (
|
|
|
|
(pGraphicBrush && !rFormat.pGraphicBrush) ||
|
|
|
|
(!pGraphicBrush && rFormat.pGraphicBrush) ||
|
|
|
|
(pGraphicBrush && *pGraphicBrush != *rFormat.pGraphicBrush)
|
|
|
|
)
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
return FALSE;
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
|
|
|
if (
|
|
|
|
(pBulletFont && !rFormat.pBulletFont) ||
|
|
|
|
(!pBulletFont && rFormat.pBulletFont) ||
|
|
|
|
(pBulletFont && *pBulletFont != *rFormat.pBulletFont)
|
|
|
|
)
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
return FALSE;
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
/* -----------------28.10.98 09:53-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem,
|
2007-09-27 12:01:50 +00:00
|
|
|
const Size* pSize, const sal_Int16* pOrient)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(!pBrushItem)
|
|
|
|
{
|
|
|
|
delete pGraphicBrush;
|
|
|
|
pGraphicBrush = 0;
|
|
|
|
}
|
2008-12-11 07:05:03 +00:00
|
|
|
else if ( !pGraphicBrush || (pGraphicBrush && !(*pBrushItem == *pGraphicBrush)) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
delete pGraphicBrush;
|
|
|
|
pGraphicBrush = (SvxBrushItem*)pBrushItem->Clone();
|
2001-07-02 13:25:51 +00:00
|
|
|
pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if(pOrient)
|
|
|
|
eVertOrient = *pOrient;
|
|
|
|
else
|
2007-09-27 12:01:50 +00:00
|
|
|
eVertOrient = text::VertOrientation::NONE;
|
2000-09-18 16:07:07 +00:00
|
|
|
if(pSize)
|
|
|
|
aGraphicSize = *pSize;
|
|
|
|
else
|
|
|
|
aGraphicSize.Width() = aGraphicSize.Height() = 0;
|
|
|
|
}
|
|
|
|
/* -----------------28.10.98 09:59-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
void SvxNumberFormat::SetGraphic( const String& rName )
|
|
|
|
{
|
|
|
|
const String* pName;
|
|
|
|
if( pGraphicBrush &&
|
|
|
|
0 != (pName = pGraphicBrush->GetGraphicLink())
|
|
|
|
&& *pName == rName )
|
|
|
|
return ;
|
|
|
|
|
|
|
|
delete pGraphicBrush;
|
|
|
|
String sTmp;
|
2007-05-10 13:52:13 +00:00
|
|
|
pGraphicBrush = new SvxBrushItem( rName, sTmp, GPOS_AREA, 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) );
|
2007-09-27 12:01:50 +00:00
|
|
|
if( eVertOrient == text::VertOrientation::NONE )
|
|
|
|
eVertOrient = text::VertOrientation::TOP;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
aGraphicSize.Width() = aGraphicSize.Height() = 0;
|
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
/* -----------------------------22.02.01 15:55--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
2007-09-27 12:01:50 +00:00
|
|
|
void SvxNumberFormat::SetVertOrient(sal_Int16 eSet)
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
|
|
|
eVertOrient = eSet;
|
|
|
|
}
|
|
|
|
/* -----------------------------22.02.01 15:55--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
2007-09-27 12:01:50 +00:00
|
|
|
sal_Int16 SvxNumberFormat::GetVertOrient() const
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
|
|
|
return eVertOrient;
|
|
|
|
}
|
|
|
|
/* -----------------28.10.98 09:59-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2000-09-18 16:07:07 +00:00
|
|
|
void SvxNumberFormat::SetBulletFont(const Font* pFont)
|
|
|
|
{
|
|
|
|
delete pBulletFont;
|
|
|
|
pBulletFont = pFont ? new Font(*pFont): 0;
|
|
|
|
}
|
|
|
|
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-01-09 #newlistlevelattrs#
|
|
|
|
SvxNumberFormat::SvxNumPositionAndSpaceMode SvxNumberFormat::GetPositionAndSpaceMode() const
|
|
|
|
{
|
|
|
|
return mePositionAndSpaceMode;
|
|
|
|
}
|
|
|
|
void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
|
|
|
|
{
|
|
|
|
mePositionAndSpaceMode = ePositionAndSpaceMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
short SvxNumberFormat::GetLSpace() const
|
|
|
|
{
|
2008-07-08 07:40:59 +00:00
|
|
|
//#if OSL_DEBUG_LEVEL > 1
|
|
|
|
// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION,
|
|
|
|
// "<SvxNumberFormat::GetLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION");
|
|
|
|
//#endif
|
2008-03-05 16:44:00 +00:00
|
|
|
return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nLSpace : 0;
|
|
|
|
}
|
|
|
|
short SvxNumberFormat::GetAbsLSpace() const
|
|
|
|
{
|
2008-07-08 07:40:59 +00:00
|
|
|
//#if OSL_DEBUG_LEVEL > 1
|
|
|
|
// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION,
|
|
|
|
// "<SvxNumberFormat::GetAbsLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION");
|
|
|
|
//#endif
|
|
|
|
return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
|
|
|
|
? nAbsLSpace
|
|
|
|
: static_cast<short>( GetFirstLineIndent() + GetIndentAt() );
|
2008-03-05 16:44:00 +00:00
|
|
|
}
|
|
|
|
short SvxNumberFormat::GetFirstLineOffset() const
|
|
|
|
{
|
2008-07-08 07:40:59 +00:00
|
|
|
//#if OSL_DEBUG_LEVEL > 1
|
|
|
|
// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION,
|
|
|
|
// "<SvxNumberFormat::GetFirstLineOffset()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION");
|
|
|
|
//#endif
|
|
|
|
return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
|
|
|
|
? nFirstLineOffset
|
|
|
|
: static_cast<short>( GetFirstLineIndent() );
|
2008-03-05 16:44:00 +00:00
|
|
|
}
|
|
|
|
short SvxNumberFormat::GetCharTextDistance() const
|
|
|
|
{
|
2008-07-08 07:40:59 +00:00
|
|
|
//#if OSL_DEBUG_LEVEL > 1
|
|
|
|
// DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION,
|
|
|
|
// "<SvxNumberFormat::GetCharTextDistance()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION");
|
|
|
|
//#endif
|
2008-03-05 16:44:00 +00:00
|
|
|
return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nCharTextDistance : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxNumberFormat::SetLabelFollowedBy( const SvxNumLabelFollowedBy eLabelFollowedBy )
|
|
|
|
{
|
|
|
|
meLabelFollowedBy = eLabelFollowedBy;
|
|
|
|
}
|
|
|
|
SvxNumberFormat::SvxNumLabelFollowedBy SvxNumberFormat::GetLabelFollowedBy() const
|
|
|
|
{
|
|
|
|
return meLabelFollowedBy;
|
|
|
|
}
|
|
|
|
void SvxNumberFormat::SetListtabPos( const long nListtabPos )
|
|
|
|
{
|
|
|
|
mnListtabPos = nListtabPos;
|
|
|
|
}
|
|
|
|
long SvxNumberFormat::GetListtabPos() const
|
|
|
|
{
|
|
|
|
return mnListtabPos;
|
|
|
|
}
|
|
|
|
void SvxNumberFormat::SetFirstLineIndent( const long nFirstLineIndent )
|
|
|
|
{
|
|
|
|
mnFirstLineIndent = nFirstLineIndent;
|
|
|
|
}
|
|
|
|
long SvxNumberFormat::GetFirstLineIndent() const
|
|
|
|
{
|
|
|
|
return mnFirstLineIndent;
|
|
|
|
}
|
|
|
|
void SvxNumberFormat::SetIndentAt( const long nIndentAt )
|
|
|
|
{
|
|
|
|
mnIndentAt = nIndentAt;
|
|
|
|
}
|
|
|
|
long SvxNumberFormat::GetIndentAt() const
|
|
|
|
{
|
|
|
|
return mnIndentAt;
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
/* -----------------28.10.98 10:03-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
IMPL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void *, EMPTYARG )
|
|
|
|
{
|
|
|
|
// ggfs. die GrfSize setzen:
|
|
|
|
if( !pThis->aGraphicSize.Width() || !pThis->aGraphicSize.Height() )
|
|
|
|
{
|
|
|
|
const Graphic* pGrf = pThis->pGraphicBrush->GetGraphic();
|
|
|
|
if( pGrf )
|
|
|
|
pThis->aGraphicSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf );
|
|
|
|
}
|
2001-07-02 13:25:51 +00:00
|
|
|
pThis->NotifyGraphicArrived();
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-07-02 13:25:51 +00:00
|
|
|
/* -----------------------------02.07.01 15:36--------------------------------
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
void SvxNumberFormat::NotifyGraphicArrived()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
/* -----------------28.10.98 10:38-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic)
|
|
|
|
{
|
|
|
|
const MapMode aMapMM100( MAP_100TH_MM );
|
|
|
|
const Size& rSize = pGraphic->GetPrefSize();
|
|
|
|
Size aRetSize;
|
|
|
|
if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
|
|
|
|
{
|
|
|
|
OutputDevice* pOutDev = Application::GetDefaultDevice();
|
|
|
|
MapMode aOldMap( pOutDev->GetMapMode() );
|
|
|
|
pOutDev->SetMapMode( aMapMM100 );
|
|
|
|
aRetSize = pOutDev->PixelToLogic( rSize );
|
|
|
|
pOutDev->SetMapMode( aOldMap );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aRetSize = OutputDevice::LogicToLogic( rSize, pGraphic->GetPrefMapMode(), aMapMM100 );
|
|
|
|
return aRetSize;
|
|
|
|
}
|
|
|
|
/* -----------------28.10.98 15:57-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
String SvxNumberFormat::CreateRomanString( ULONG nNo, BOOL bUpper )
|
|
|
|
{
|
|
|
|
nNo %= 4000; // mehr kann nicht dargestellt werden
|
|
|
|
// i, ii, iii, iv, v, vi, vii, vii, viii, ix
|
|
|
|
// (Dummy),1000,500,100,50,10,5,1
|
2001-10-17 12:44:30 +00:00
|
|
|
const char *cRomanArr = bUpper
|
2000-09-18 16:07:07 +00:00
|
|
|
? "MDCLXVI--" // +2 Dummy-Eintraege !!
|
|
|
|
: "mdclxvi--"; // +2 Dummy-Eintraege !!
|
|
|
|
|
|
|
|
String sRet;
|
|
|
|
USHORT nMask = 1000;
|
|
|
|
while( nMask )
|
|
|
|
{
|
|
|
|
BYTE nZahl = BYTE(nNo / nMask);
|
|
|
|
BYTE nDiff = 1;
|
|
|
|
nNo %= nMask;
|
|
|
|
|
|
|
|
if( 5 < nZahl )
|
|
|
|
{
|
|
|
|
if( nZahl < 9 )
|
|
|
|
sRet += sal_Unicode(*(cRomanArr-1));
|
|
|
|
++nDiff;
|
|
|
|
nZahl -= 5;
|
|
|
|
}
|
|
|
|
switch( nZahl )
|
|
|
|
{
|
|
|
|
case 3: { sRet += sal_Unicode(*cRomanArr); }
|
|
|
|
case 2: { sRet += sal_Unicode(*cRomanArr); }
|
|
|
|
case 1: { sRet += sal_Unicode(*cRomanArr); }
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: {
|
|
|
|
sRet += sal_Unicode(*cRomanArr);
|
|
|
|
sRet += sal_Unicode(*(cRomanArr-nDiff));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5: { sRet += sal_Unicode(*(cRomanArr-nDiff)); }
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
nMask /= 10; // zur naechsten Dekade
|
|
|
|
cRomanArr += 2;
|
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
#ifdef OLD_NUMBER_FORMATTING
|
2000-09-18 16:07:07 +00:00
|
|
|
void SvxNumberFormat::GetCharStr( ULONG nNo, String& rStr ) const
|
|
|
|
{
|
|
|
|
DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" );
|
|
|
|
|
|
|
|
const ULONG coDiff = 'Z' - 'A' +1;
|
|
|
|
char cAdd = (SVX_NUM_CHARS_UPPER_LETTER == eNumType ? 'A' : 'a') - 1;
|
|
|
|
ULONG nCalc;
|
|
|
|
|
|
|
|
do {
|
|
|
|
nCalc = nNo % coDiff;
|
|
|
|
if( !nCalc )
|
|
|
|
nCalc = coDiff;
|
|
|
|
rStr.Insert( sal_Unicode(cAdd + nCalc ), 0 );
|
|
|
|
nNo -= nCalc;
|
|
|
|
if( nNo )
|
|
|
|
nNo /= coDiff;
|
|
|
|
} while( nNo );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxNumberFormat::GetCharStrN( ULONG nNo, String& rStr ) const
|
|
|
|
{
|
|
|
|
DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" );
|
|
|
|
|
|
|
|
const ULONG coDiff = 'Z' - 'A' +1;
|
|
|
|
char cChar = (char)(--nNo % coDiff);
|
|
|
|
if( SVX_NUM_CHARS_UPPER_LETTER_N == eNumType )
|
|
|
|
cChar += 'A';
|
|
|
|
else
|
|
|
|
cChar += 'a';
|
|
|
|
|
|
|
|
rStr.Fill( (USHORT)(nNo / coDiff) + 1, sal_Unicode(cChar) );
|
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
#endif //OLD_NUMBER_FORMATTING
|
|
|
|
/* -----------------------------22.02.01 13:31--------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-23 11:29:54 +00:00
|
|
|
---------------------------------------------------------------------------*/
|
|
|
|
const String& SvxNumberFormat::GetCharFmtName()const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
return sCharStyleName;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:38-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2001-02-23 11:29:54 +00:00
|
|
|
sal_Int32 SvxNumRule::nRefCount = 0;
|
|
|
|
static SvxNumberFormat* pStdNumFmt = 0;
|
|
|
|
static SvxNumberFormat* pStdOutlineNumFmt = 0;
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-02-11 #newlistlevelattrs#
|
|
|
|
SvxNumRule::SvxNumRule( ULONG nFeatures,
|
|
|
|
USHORT nLevels,
|
|
|
|
BOOL bCont,
|
|
|
|
SvxNumRuleType eType,
|
|
|
|
SvxNumberFormat::SvxNumPositionAndSpaceMode
|
|
|
|
eDefaultNumberFormatPositionAndSpaceMode )
|
|
|
|
: nLevelCount(nLevels),
|
|
|
|
nFeatureFlags(nFeatures),
|
|
|
|
eNumberingType(eType),
|
|
|
|
bContinuousNumbering(bCont)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
++nRefCount;
|
2001-07-11 10:48:57 +00:00
|
|
|
LanguageType eLang = Application::GetSettings().GetLanguage();
|
2001-02-23 11:29:54 +00:00
|
|
|
aLocale = SvxCreateLocale(eLang);
|
2000-09-18 16:07:07 +00:00
|
|
|
for(USHORT i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
{
|
|
|
|
if(i < nLevels)
|
|
|
|
{
|
|
|
|
aFmts[i] = new SvxNumberFormat(SVX_NUM_CHARS_UPPER_LETTER);
|
|
|
|
//daran wird zwischen writer und draw unterschieden
|
2002-09-10 07:07:34 +00:00
|
|
|
if(nFeatures & NUM_CONTINUOUS)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-03-05 16:44:00 +00:00
|
|
|
// --> OD 2008-02-11 #newlistlevelattrs#
|
|
|
|
if ( eDefaultNumberFormatPositionAndSpaceMode ==
|
|
|
|
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
|
|
|
|
{
|
|
|
|
aFmts[i]->SetLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE) );
|
|
|
|
aFmts[i]->SetAbsLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE * (i+1)) );
|
|
|
|
aFmts[i]->SetFirstLineOffset(MM100_TO_TWIP(-DEF_WRITER_LSPACE));
|
|
|
|
}
|
|
|
|
else if ( eDefaultNumberFormatPositionAndSpaceMode ==
|
|
|
|
SvxNumberFormat::LABEL_ALIGNMENT )
|
|
|
|
{
|
|
|
|
// first line indent of general numbering in inch: -0,25 inch
|
|
|
|
const long cFirstLineIndent = -1440/4;
|
|
|
|
// indent values of general numbering in inch:
|
|
|
|
// 0,5 0,75 1,0 1,25 1,5
|
|
|
|
// 1,75 2,0 2,25 2,5 2,75
|
|
|
|
const long cIndentAt = 1440/4;
|
|
|
|
aFmts[i]->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
|
|
|
|
aFmts[i]->SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
|
|
|
|
aFmts[i]->SetListtabPos( cIndentAt * (i+2) );
|
|
|
|
aFmts[i]->SetFirstLineIndent( cFirstLineIndent );
|
|
|
|
aFmts[i]->SetIndentAt( cIndentAt * (i+2) );
|
|
|
|
}
|
|
|
|
// <--
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aFmts[i]->SetLSpace( DEF_DRAW_LSPACE );
|
|
|
|
aFmts[i]->SetAbsLSpace( DEF_DRAW_LSPACE * (i) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aFmts[i] = 0;
|
|
|
|
aFmtsSet[i] = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumRule::SvxNumRule(const SvxNumRule& rCopy)
|
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
++nRefCount;
|
|
|
|
aLocale = rCopy.aLocale;
|
2000-09-18 16:07:07 +00:00
|
|
|
nLevelCount = rCopy.nLevelCount ;
|
|
|
|
nFeatureFlags = rCopy.nFeatureFlags ;
|
|
|
|
bContinuousNumbering = rCopy.bContinuousNumbering;
|
|
|
|
eNumberingType = rCopy.eNumberingType;
|
|
|
|
memset( aFmts, 0, sizeof( aFmts ));
|
|
|
|
for(USHORT i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
{
|
|
|
|
if(rCopy.aFmts[i])
|
|
|
|
aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]);
|
|
|
|
else
|
|
|
|
aFmts[i] = 0;
|
|
|
|
aFmtsSet[i] = rCopy.aFmtsSet[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* -----------------08.12.98 11:07-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2009-11-17 15:13:56 +00:00
|
|
|
SvxNumRule::SvxNumRule(SvStream &rStream)
|
|
|
|
{
|
|
|
|
++nRefCount;
|
|
|
|
LanguageType eLang = Application::GetSettings().GetLanguage();
|
|
|
|
aLocale = SvxCreateLocale(eLang);
|
|
|
|
USHORT nVersion;
|
|
|
|
USHORT nTemp;
|
|
|
|
rStream >> nVersion;
|
|
|
|
rStream >> nLevelCount;
|
|
|
|
rStream >> nTemp;
|
|
|
|
nFeatureFlags = nTemp;
|
|
|
|
rStream >> nTemp;
|
|
|
|
bContinuousNumbering = (BOOL)nTemp;
|
|
|
|
rStream >> nTemp;
|
|
|
|
eNumberingType = (SvxNumRuleType)nTemp;
|
|
|
|
memset( aFmts, 0, sizeof( aFmts ));
|
|
|
|
|
|
|
|
for(USHORT i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
{
|
|
|
|
USHORT nSet;
|
|
|
|
rStream >> nSet;
|
|
|
|
if(nSet)
|
|
|
|
aFmts[i] = new SvxNumberFormat(rStream);
|
|
|
|
else
|
|
|
|
aFmts[i] = 0;
|
|
|
|
aFmtsSet[i] = aFmts[i] ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
if(NUMITEM_VERSION_02 <= nVersion)
|
|
|
|
{
|
|
|
|
USHORT nShort;
|
|
|
|
rStream >> nShort;
|
|
|
|
nFeatureFlags = nShort;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
/* -----------------08.12.98 11:07-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2009-11-17 15:13:56 +00:00
|
|
|
SvStream& SvxNumRule::Store(SvStream &rStream)
|
|
|
|
{
|
|
|
|
rStream<<(USHORT)NUMITEM_VERSION_03;
|
|
|
|
rStream<<nLevelCount;
|
|
|
|
//first save of nFeatureFlags for old versions
|
|
|
|
rStream<<(USHORT)nFeatureFlags;
|
|
|
|
rStream<<(USHORT)bContinuousNumbering;
|
|
|
|
rStream<<(USHORT)eNumberingType;
|
|
|
|
|
|
|
|
FontToSubsFontConverter pConverter = 0;
|
|
|
|
BOOL bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50;
|
|
|
|
for(USHORT i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
{
|
|
|
|
if(aFmts[i])
|
|
|
|
{
|
|
|
|
rStream << USHORT(1);
|
|
|
|
if(bConvertBulletFont && aFmts[i]->GetBulletFont())
|
|
|
|
{
|
|
|
|
if(!pConverter)
|
|
|
|
pConverter =
|
|
|
|
CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(),
|
|
|
|
FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS);
|
|
|
|
}
|
|
|
|
aFmts[i]->Store(rStream, pConverter);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rStream << USHORT(0);
|
|
|
|
}
|
|
|
|
//second save of nFeatureFlags for new versions
|
|
|
|
rStream<<(USHORT)nFeatureFlags;
|
|
|
|
if(pConverter)
|
|
|
|
DestroyFontToSubsFontConverter(pConverter);
|
|
|
|
|
|
|
|
return rStream;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumRule::~SvxNumRule()
|
|
|
|
{
|
|
|
|
for(USHORT i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
delete aFmts[i];
|
2001-02-23 11:29:54 +00:00
|
|
|
if(!--nRefCount)
|
|
|
|
{
|
|
|
|
DELETEZ(pStdNumFmt);
|
|
|
|
DELETEZ(pStdOutlineNumFmt);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
/* -----------------29.10.98 16:07-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy )
|
|
|
|
{
|
|
|
|
nLevelCount = rCopy.nLevelCount;
|
|
|
|
nFeatureFlags = rCopy.nFeatureFlags;
|
|
|
|
bContinuousNumbering = rCopy.bContinuousNumbering;
|
|
|
|
eNumberingType = rCopy.eNumberingType;
|
|
|
|
for(USHORT i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
{
|
|
|
|
delete aFmts[i];
|
|
|
|
if(rCopy.aFmts[i])
|
|
|
|
aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]);
|
|
|
|
else
|
|
|
|
aFmts[i] = 0;
|
|
|
|
aFmtsSet[i] = rCopy.aFmtsSet[i];
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
int SvxNumRule::operator==( const SvxNumRule& rCopy) const
|
|
|
|
{
|
|
|
|
if(nLevelCount != rCopy.nLevelCount ||
|
|
|
|
nFeatureFlags != rCopy.nFeatureFlags ||
|
|
|
|
bContinuousNumbering != rCopy.bContinuousNumbering ||
|
|
|
|
eNumberingType != rCopy.eNumberingType)
|
|
|
|
return FALSE;
|
|
|
|
for(USHORT i = 0; i < nLevelCount; i++)
|
|
|
|
{
|
2008-12-11 07:05:03 +00:00
|
|
|
if (
|
|
|
|
(aFmtsSet[i] != rCopy.aFmtsSet[i]) ||
|
|
|
|
(!aFmts[i] && rCopy.aFmts[i]) ||
|
|
|
|
(aFmts[i] && !rCopy.aFmts[i]) ||
|
|
|
|
(aFmts[i] && *aFmts[i] != *rCopy.aFmts[i])
|
|
|
|
)
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
return FALSE;
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
const SvxNumberFormat* SvxNumRule::Get(USHORT nLevel)const
|
|
|
|
{
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" );
|
2008-06-06 11:29:22 +00:00
|
|
|
if( nLevel < SVX_MAX_NUM )
|
|
|
|
return aFmtsSet[nLevel] ? aFmts[nLevel] : 0;
|
|
|
|
else
|
|
|
|
return 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
/* -----------------02.11.98 09:10-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
const SvxNumberFormat& SvxNumRule::GetLevel(USHORT nLevel)const
|
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
if(!pStdNumFmt)
|
|
|
|
{
|
|
|
|
pStdNumFmt = new SvxNumberFormat(SVX_NUM_ARABIC);
|
|
|
|
pStdOutlineNumFmt = new SvxNumberFormat(SVX_NUM_NUMBER_NONE);
|
|
|
|
}
|
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" );
|
2008-06-06 11:29:22 +00:00
|
|
|
|
|
|
|
return ( ( nLevel < SVX_MAX_NUM ) && aFmts[nLevel] ) ?
|
|
|
|
*aFmts[nLevel] : eNumberingType == SVX_RULETYPE_NUMBERING ?
|
|
|
|
*pStdNumFmt : *pStdOutlineNumFmt;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -----------------29.10.98 09:08-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
void SvxNumRule::SetLevel( USHORT i, const SvxNumberFormat& rNumFmt, BOOL bIsValid )
|
|
|
|
{
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT(i < SVX_MAX_NUM, "falsches Level" );
|
2008-06-06 11:29:22 +00:00
|
|
|
|
|
|
|
if( (i < SVX_MAX_NUM) && (!aFmtsSet[i] || !(rNumFmt == *Get( i ))) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
delete aFmts[ i ];
|
|
|
|
aFmts[ i ] = new SvxNumberFormat( rNumFmt );
|
|
|
|
aFmtsSet[i] = bIsValid;
|
|
|
|
// bInvalidRuleFlag = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* -----------------30.10.98 12:44-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
void SvxNumRule::SetLevel(USHORT nLevel, const SvxNumberFormat* pFmt)
|
|
|
|
{
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" );
|
2008-06-06 11:29:22 +00:00
|
|
|
|
|
|
|
if( nLevel < SVX_MAX_NUM )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-06-06 11:29:22 +00:00
|
|
|
aFmtsSet[nLevel] = 0 != pFmt;
|
|
|
|
if(pFmt)
|
|
|
|
SetLevel(nLevel, *pFmt);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete aFmts[nLevel];
|
|
|
|
aFmts[nLevel] = 0;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* -----------------28.10.98 15:38-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, BOOL bInclStrings ) const
|
|
|
|
{
|
|
|
|
String aStr;
|
|
|
|
if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) )
|
|
|
|
{
|
|
|
|
const SvxNumberFormat& rMyNFmt = GetLevel( rNum.GetLevel() );
|
2001-02-23 11:29:54 +00:00
|
|
|
if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
BYTE i = rNum.GetLevel();
|
|
|
|
|
|
|
|
if( !IsContinuousNumbering() &&
|
|
|
|
1 < rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ?
|
|
|
|
{
|
|
|
|
BYTE n = rMyNFmt.GetIncludeUpperLevels();
|
|
|
|
if( 1 < n )
|
|
|
|
{
|
|
|
|
if( i+1 >= n )
|
|
|
|
i -= n - 1;
|
|
|
|
else
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( ; i <= rNum.GetLevel(); ++i )
|
|
|
|
{
|
|
|
|
const SvxNumberFormat& rNFmt = GetLevel( i );
|
2001-02-23 11:29:54 +00:00
|
|
|
if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Soll aus 1.1.1 --> 2. NoNum --> 1..1 oder 1.1 ??
|
|
|
|
// if( i != rNum.nMyLevel )
|
|
|
|
// aStr += aDotStr;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-08-06 11:22:31 +00:00
|
|
|
sal_Bool bDot = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( rNum.GetLevelVal()[ i ] )
|
2001-08-06 11:22:31 +00:00
|
|
|
{
|
|
|
|
if(SVX_NUM_BITMAP != rNFmt.GetNumberingType())
|
|
|
|
aStr += rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], aLocale );
|
|
|
|
else
|
|
|
|
bDot = sal_False;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
aStr += sal_Unicode('0'); // alle 0-Level sind eine 0
|
2001-08-06 11:22:31 +00:00
|
|
|
if( i != rNum.GetLevel() && bDot)
|
2000-09-18 16:07:07 +00:00
|
|
|
aStr += sal_Unicode('.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bInclStrings )
|
|
|
|
{
|
|
|
|
aStr.Insert( rMyNFmt.GetPrefix(), 0 );
|
|
|
|
aStr += rMyNFmt.GetSuffix();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aStr;
|
|
|
|
}
|
|
|
|
/* -----------------18.08.99 10:18-------------------
|
|
|
|
Description: changes linked to embedded bitmaps
|
|
|
|
--------------------------------------------------*/
|
|
|
|
BOOL SvxNumRule::UnLinkGraphics()
|
|
|
|
{
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
for(USHORT i = 0; i < GetLevelCount(); i++)
|
|
|
|
{
|
|
|
|
SvxNumberFormat aFmt(GetLevel(i));
|
|
|
|
const SvxBrushItem* pBrush = aFmt.GetBrush();
|
|
|
|
const String* pLinkStr;
|
|
|
|
const Graphic* pGraphic;
|
2001-02-23 11:29:54 +00:00
|
|
|
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(pBrush &&
|
|
|
|
0 != (pLinkStr = pBrush->GetGraphicLink()) &&
|
|
|
|
pLinkStr->Len() &&
|
|
|
|
0 !=(pGraphic = pBrush->GetGraphic()))
|
|
|
|
{
|
|
|
|
SvxBrushItem aTempItem(*pBrush);
|
|
|
|
aTempItem.SetGraphicLink( String());
|
|
|
|
aTempItem.SetGraphic(*pGraphic);
|
2007-09-27 12:01:50 +00:00
|
|
|
sal_Int16 eOrient = aFmt.GetVertOrient();
|
2000-09-18 16:07:07 +00:00
|
|
|
aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient );
|
|
|
|
bRet = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
else if((SVX_NUM_BITMAP|LINK_TOKEN) == aFmt.GetNumberingType())
|
|
|
|
aFmt.SetNumberingType(SVX_NUM_BITMAP);
|
2000-09-18 16:07:07 +00:00
|
|
|
SetLevel(i, aFmt);
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule) :
|
|
|
|
SfxPoolItem(SID_ATTR_NUMBERING_RULE),
|
|
|
|
pNumRule(new SvxNumRule(rRule))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-----------------23.11.98 10:36-------------------
|
|
|
|
MT: Das sind ja sehr sinnige Kommentare...
|
|
|
|
--------------------------------------------------*/
|
2006-06-19 15:13:27 +00:00
|
|
|
SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, USHORT _nWhich ) :
|
|
|
|
SfxPoolItem(_nWhich),
|
2000-09-18 16:07:07 +00:00
|
|
|
pNumRule(new SvxNumRule(rRule))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-16 15:03:54 +01:00
|
|
|
SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, USHORT n) const
|
|
|
|
{
|
|
|
|
return SfxPoolItem::Create(s, n );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :
|
|
|
|
SfxPoolItem(rCopy.Which())
|
|
|
|
{
|
|
|
|
pNumRule = new SvxNumRule(*rCopy.pNumRule);
|
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumBulletItem::~SvxNumBulletItem()
|
|
|
|
{
|
|
|
|
delete pNumRule;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
int SvxNumBulletItem::operator==( const SfxPoolItem& rCopy) const
|
|
|
|
{
|
|
|
|
return *pNumRule == *((SvxNumBulletItem&)rCopy).pNumRule;
|
|
|
|
}
|
|
|
|
/* -----------------27.10.98 10:41-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2006-10-12 11:55:07 +00:00
|
|
|
SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return new SvxNumBulletItem(*this);
|
|
|
|
}
|
|
|
|
/* -----------------08.12.98 10:43-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2009-11-17 15:13:56 +00:00
|
|
|
USHORT SvxNumBulletItem::GetVersion( USHORT /*nFileVersion*/ ) const
|
|
|
|
{
|
|
|
|
return NUMITEM_VERSION_03;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
/* -----------------08.12.98 10:43-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2009-11-17 15:13:56 +00:00
|
|
|
SvStream& SvxNumBulletItem::Store(SvStream &rStream, USHORT /*nItemVersion*/ )const
|
|
|
|
{
|
|
|
|
pNumRule->Store(rStream);
|
|
|
|
return rStream;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-09-28 11:35:03 +00:00
|
|
|
/* -----------------08.12.98 10:43-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
2000-12-01 15:30:37 +00:00
|
|
|
|
2006-06-19 15:13:27 +00:00
|
|
|
sal_Bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const
|
2000-09-28 11:35:03 +00:00
|
|
|
{
|
2000-12-01 15:30:37 +00:00
|
|
|
rVal <<= SvxCreateNumRule( pNumRule );
|
|
|
|
return sal_True;
|
|
|
|
}
|
2000-09-28 11:35:03 +00:00
|
|
|
|
2006-06-19 15:13:27 +00:00
|
|
|
sal_Bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ )
|
2000-12-01 15:30:37 +00:00
|
|
|
{
|
|
|
|
uno::Reference< container::XIndexReplace > xRule;
|
|
|
|
if( rVal >>= xRule )
|
2000-09-28 11:35:03 +00:00
|
|
|
{
|
2000-12-01 15:30:37 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
SvxNumRule* pNewRule = new SvxNumRule( SvxGetNumRule( xRule ) );
|
|
|
|
if( pNewRule->GetLevelCount() != pNumRule->GetLevelCount() ||
|
|
|
|
pNewRule->GetNumRuleType() != pNumRule->GetNumRuleType() )
|
|
|
|
{
|
|
|
|
SvxNumRule* pConverted = SvxConvertNumRule( pNewRule, pNumRule->GetLevelCount(), pNumRule->GetNumRuleType() );
|
|
|
|
delete pNewRule;
|
|
|
|
pNewRule = pConverted;
|
|
|
|
}
|
|
|
|
delete pNumRule;
|
|
|
|
pNumRule = pNewRule;
|
|
|
|
return sal_True;
|
|
|
|
}
|
2002-07-16 09:28:53 +00:00
|
|
|
catch(lang::IllegalArgumentException&)
|
2000-12-01 15:30:37 +00:00
|
|
|
{
|
|
|
|
}
|
2000-09-28 11:35:03 +00:00
|
|
|
}
|
2000-12-01 15:30:37 +00:00
|
|
|
return sal_False;
|
2000-09-28 11:35:03 +00:00
|
|
|
}
|
2000-12-01 15:30:37 +00:00
|
|
|
|
|
|
|
/* -----------------08.12.98 10:43-------------------
|
|
|
|
*
|
|
|
|
* --------------------------------------------------*/
|
|
|
|
SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, USHORT nLevels, SvxNumRuleType eType )
|
|
|
|
{
|
|
|
|
const USHORT nSrcLevels = pRule->GetLevelCount();
|
|
|
|
SvxNumRule* pNewRule = new SvxNumRule( pRule->GetFeatureFlags(), nLevels, pRule->IsContinuousNumbering(), eType );
|
|
|
|
|
2008-06-06 11:29:22 +00:00
|
|
|
for( USHORT nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ )
|
|
|
|
pNewRule->SetLevel( nLevel, pRule->GetLevel( nLevel ) );
|
2000-12-01 15:30:37 +00:00
|
|
|
|
|
|
|
return pNewRule;
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|