2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
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>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/brushitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/font.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <vcl/settings.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/editids.hrc>
|
|
|
|
#include <editeng/editrids.hrc>
|
|
|
|
#include <editeng/numdef.hxx>
|
2013-04-19 13:26:01 +02:00
|
|
|
#include <editeng/eeitem.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>
|
2012-05-26 13:53:19 +02:00
|
|
|
#include <com/sun/star/text/DefaultNumberingProvider.hpp>
|
2001-02-23 11:29:54 +00:00
|
|
|
#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>
|
2014-04-04 13:39:38 +03:00
|
|
|
#include <tools/mapunit.hxx>
|
2015-07-10 11:04:50 +01:00
|
|
|
#include <unotools/configmgr.hxx>
|
2016-09-20 16:29:58 +02:00
|
|
|
#include <libxml/xmlwriter.h>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/unonrule.hxx>
|
2000-09-28 11:35:03 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
#define DEF_WRITER_LSPACE 500 //Standard Indentation
|
|
|
|
#define DEF_DRAW_LSPACE 800 //Standard Indentation
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-11-17 15:13:56 +00:00
|
|
|
#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;
|
2015-11-10 10:14:16 +01:00
|
|
|
css::uno::Reference<css::text::XNumberingFormatter> SvxNumberType::xFormatter = nullptr;
|
2015-09-11 15:44:09 +02:00
|
|
|
static void lcl_getFormatter(css::uno::Reference<css::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
|
|
|
|
{
|
2012-05-26 13:53:19 +02:00
|
|
|
Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
|
|
|
|
Reference<XDefaultNumberingProvider> xRet = text::DefaultNumberingProvider::create(xContext);
|
2015-10-30 14:22:53 +02:00
|
|
|
_xFormatter.set(xRet, UNO_QUERY);
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch(const Exception&)
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
2012-05-26 13:53:19 +02:00
|
|
|
SAL_WARN("editeng", "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-08 04:57:32 +00:00
|
|
|
}
|
|
|
|
|
2017-03-02 16:09:36 +02:00
|
|
|
SvxNumberType::SvxNumberType(SvxNumType nType) :
|
2009-09-08 04:57:32 +00:00
|
|
|
nNumType(nType),
|
2014-02-25 11:55:22 +02:00
|
|
|
bShowSymbol(true)
|
2009-09-08 04:57:32 +00:00
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
nRefCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxNumberType::SvxNumberType(const SvxNumberType& rType) :
|
|
|
|
nNumType(rType.nNumType),
|
|
|
|
bShowSymbol(rType.bShowSymbol)
|
|
|
|
{
|
|
|
|
nRefCount++;
|
|
|
|
}
|
2000-09-28 11:35:03 +00:00
|
|
|
|
2001-02-23 11:29:54 +00:00
|
|
|
SvxNumberType::~SvxNumberType()
|
|
|
|
{
|
|
|
|
if(!--nRefCount)
|
2015-11-10 10:14:16 +01:00
|
|
|
xFormatter = nullptr;
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
|
|
|
|
2013-08-17 18:41:03 +02:00
|
|
|
OUString SvxNumberType::GetNumStr( sal_uLong nNo ) const
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
2015-07-10 11:04:50 +01:00
|
|
|
LanguageTag aLang = utl::ConfigManager::IsAvoidConfig() ?
|
|
|
|
LanguageTag("en-US") :
|
|
|
|
Application::GetSettings().GetLanguageTag();
|
|
|
|
return GetNumStr( nNo, aLang.getLocale() );
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2015-02-05 17:27:40 +01:00
|
|
|
OUString SvxNumberType::GetNumStr( sal_uLong nNo, const css::lang::Locale& rLocale ) const
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
2009-09-08 04:57:32 +00:00
|
|
|
lcl_getFormatter(xFormatter);
|
2001-02-23 11:29:54 +00:00
|
|
|
if(!xFormatter.is())
|
2013-08-17 18:41:03 +02:00
|
|
|
return OUString();
|
2001-02-23 11:29:54 +00:00
|
|
|
|
|
|
|
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:
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// '0' allowed for ARABIC numberings
|
2002-11-22 06:45:51 +00:00
|
|
|
if(NumberingType::ARABIC == nNumType && 0 == nNo )
|
2013-08-17 18:41:03 +02:00
|
|
|
return OUString('0');
|
2002-11-22 06:45:51 +00:00
|
|
|
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();
|
2013-11-04 14:00:40 +02:00
|
|
|
pValues[0].Name = "NumberingType";
|
2017-03-02 14:24:47 +02:00
|
|
|
pValues[0].Value <<= (sal_uInt16)nNumType;
|
2013-11-04 14:00:40 +02:00
|
|
|
pValues[1].Name = "Value";
|
2002-11-22 06:45:51 +00:00
|
|
|
pValues[1].Value <<= (sal_Int32)nNo;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2013-08-17 18:41:03 +02:00
|
|
|
return xFormatter->makeNumberingString( aProperties, rLocale );
|
2002-11-22 06:45:51 +00:00
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch(const Exception&)
|
2002-11-22 06:45:51 +00:00
|
|
|
{
|
|
|
|
}
|
2001-08-06 11:22:31 +00:00
|
|
|
}
|
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-17 18:41:03 +02:00
|
|
|
return OUString();
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2017-04-04 14:13:00 +02:00
|
|
|
SvxNumberFormat::SvxNumberFormat( SvxNumType eType )
|
2008-03-05 16:44:00 +00:00
|
|
|
: SvxNumberType(eType),
|
2017-03-07 11:19:35 +02:00
|
|
|
eNumAdjust(SvxAdjust::Left),
|
2008-03-05 16:44:00 +00:00
|
|
|
nInclUpperLevels(0),
|
|
|
|
nStart(1),
|
|
|
|
cBullet(SVX_DEF_BULLET),
|
|
|
|
nBulletRelSize(100),
|
|
|
|
nBulletColor(COL_BLACK),
|
2017-04-04 14:13:00 +02:00
|
|
|
mePositionAndSpaceMode( LABEL_WIDTH_AND_POSITION ),
|
2008-03-05 16:44:00 +00:00
|
|
|
nFirstLineOffset(0),
|
|
|
|
nAbsLSpace(0),
|
|
|
|
nCharTextDistance(0),
|
|
|
|
meLabelFollowedBy( LISTTAB ),
|
|
|
|
mnListtabPos( 0 ),
|
|
|
|
mnFirstLineIndent( 0 ),
|
|
|
|
mnIndentAt( 0 ),
|
2015-11-10 10:14:16 +01:00
|
|
|
pGraphicBrush(nullptr),
|
2008-03-05 16:44:00 +00:00
|
|
|
eVertOrient(text::VertOrientation::NONE),
|
2015-11-10 10:14:16 +01:00
|
|
|
pBulletFont(nullptr)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
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
|
|
|
mePositionAndSpaceMode( rFormat.mePositionAndSpaceMode ),
|
2015-11-10 10:14:16 +01:00
|
|
|
pGraphicBrush(nullptr),
|
|
|
|
pBulletFont(nullptr)
|
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
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2013-04-19 13:26:01 +02:00
|
|
|
SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
|
2016-07-19 21:47:29 +01:00
|
|
|
: nStart(0)
|
2014-05-23 10:48:54 +01:00
|
|
|
, nBulletRelSize(100)
|
2014-05-11 11:11:14 +01:00
|
|
|
, nFirstLineOffset(0)
|
|
|
|
, nAbsLSpace(0)
|
|
|
|
, nCharTextDistance(0)
|
2013-04-19 13:26:01 +02:00
|
|
|
{
|
2014-05-11 11:11:14 +01:00
|
|
|
sal_uInt16 nTmp16(0);
|
|
|
|
sal_Int32 nTmp32(0);
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); // Version number
|
2013-04-19 13:26:01 +02:00
|
|
|
|
2017-03-02 16:09:36 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); SetNumberingType( (SvxNumType)nTmp16 );
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); eNumAdjust = ( SvxAdjust )nTmp16;
|
|
|
|
rStream.ReadUInt16( nTmp16 ); nInclUpperLevels = nTmp16;
|
|
|
|
rStream.ReadUInt16( nStart );
|
|
|
|
rStream.ReadUInt16( nTmp16 ); cBullet = (sal_Unicode)nTmp16;
|
2013-04-19 13:26:01 +02:00
|
|
|
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadInt16( nFirstLineOffset );
|
|
|
|
rStream.ReadInt16( nAbsLSpace );
|
2014-11-11 13:44:51 +00:00
|
|
|
rStream.SeekRel(2); //skip old now unused nLSpace;
|
2013-04-19 13:26:01 +02:00
|
|
|
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadInt16( nCharTextDistance );
|
2013-04-19 13:26:01 +02:00
|
|
|
|
|
|
|
sPrefix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
|
|
|
|
sSuffix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
|
|
|
|
sCharStyleName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
|
|
|
|
|
|
|
|
sal_uInt16 hasGraphicBrush = 0;
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( hasGraphicBrush );
|
2013-04-19 13:26:01 +02:00
|
|
|
if ( hasGraphicBrush )
|
|
|
|
{
|
|
|
|
pGraphicBrush = new SvxBrushItem( SID_ATTR_BRUSH );
|
2014-09-30 09:02:35 +02:00
|
|
|
pGraphicBrush = static_cast<SvxBrushItem*>(pGraphicBrush->Create( rStream, BRUSH_GRAPHIC_VERSION ));
|
2013-04-19 13:26:01 +02:00
|
|
|
}
|
2015-11-10 10:14:16 +01:00
|
|
|
else pGraphicBrush = nullptr;
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); eVertOrient = nTmp16;
|
2013-04-19 13:26:01 +02:00
|
|
|
|
|
|
|
sal_uInt16 hasBulletFont = 0;
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( hasBulletFont );
|
2013-04-19 13:26:01 +02:00
|
|
|
if ( hasBulletFont )
|
|
|
|
{
|
2014-09-16 10:09:58 +02:00
|
|
|
pBulletFont = new vcl::Font( );
|
2014-01-30 13:46:42 +02:00
|
|
|
ReadFont( rStream, *pBulletFont );
|
2013-04-19 13:26:01 +02:00
|
|
|
}
|
2015-11-10 10:14:16 +01:00
|
|
|
else pBulletFont = nullptr;
|
2014-01-30 13:46:42 +02:00
|
|
|
ReadPair( rStream, aGraphicSize );
|
2013-04-19 13:26:01 +02:00
|
|
|
|
2014-01-30 13:46:42 +02:00
|
|
|
ReadColor( rStream, nBulletColor );
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nBulletRelSize );
|
|
|
|
rStream.ReadUInt16( nTmp16 ); SetShowSymbol( nTmp16 );
|
2013-04-19 13:26:01 +02:00
|
|
|
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); mePositionAndSpaceMode = ( SvxNumPositionAndSpaceMode )nTmp16;
|
|
|
|
rStream.ReadUInt16( nTmp16 ); meLabelFollowedBy = ( LabelFollowedBy )nTmp16;
|
|
|
|
rStream.ReadInt32( nTmp32 ); mnListtabPos = nTmp32;
|
|
|
|
rStream.ReadInt32( nTmp32 ); mnFirstLineIndent = nTmp32;
|
|
|
|
rStream.ReadInt32( nTmp32 ); mnIndentAt = nTmp32;
|
2013-04-19 13:26:01 +02:00
|
|
|
}
|
2014-05-11 11:11:14 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxNumberFormat::~SvxNumberFormat()
|
|
|
|
{
|
|
|
|
delete pGraphicBrush;
|
|
|
|
delete pBulletFont;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2016-01-11 16:02:17 +02:00
|
|
|
void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter)
|
2009-11-17 15:13:56 +00:00
|
|
|
{
|
|
|
|
if(pConverter && pBulletFont)
|
|
|
|
{
|
|
|
|
cBullet = ConvertFontToSubsFontChar(pConverter, cBullet);
|
2013-09-10 10:02:21 +02:00
|
|
|
OUString sFontName = GetFontToSubsFontName(pConverter);
|
2016-01-18 10:40:22 +11:00
|
|
|
pBulletFont->SetFamilyName(sFontName);
|
2009-11-17 15:13:56 +00:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( NUMITEM_VERSION_04 );
|
2009-11-17 15:13:56 +00:00
|
|
|
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( GetNumberingType() );
|
2017-03-07 11:19:35 +02:00
|
|
|
rStream.WriteUInt16( (sal_uInt16)eNumAdjust );
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( nInclUpperLevels );
|
2014-01-08 08:48:26 +02:00
|
|
|
rStream.WriteUInt16( nStart );
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( cBullet );
|
2009-11-17 15:13:56 +00:00
|
|
|
|
2014-01-08 08:48:26 +02:00
|
|
|
rStream.WriteInt16( nFirstLineOffset );
|
|
|
|
rStream.WriteInt16( nAbsLSpace );
|
2014-11-11 13:44:51 +00:00
|
|
|
rStream.WriteInt16( 0 ); // write a dummy for old now unused nLSpace
|
2009-11-17 15:13:56 +00:00
|
|
|
|
2014-01-08 08:48:26 +02:00
|
|
|
rStream.WriteInt16( nCharTextDistance );
|
2011-11-24 12:06:54 +01:00
|
|
|
rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
|
2011-12-21 10:45:54 +00:00
|
|
|
rStream.WriteUniOrByteString(sPrefix, eEnc);
|
|
|
|
rStream.WriteUniOrByteString(sSuffix, eEnc);
|
|
|
|
rStream.WriteUniOrByteString(sCharStyleName, eEnc);
|
2009-11-17 15:13:56 +00:00
|
|
|
if(pGraphicBrush)
|
|
|
|
{
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( 1 );
|
2009-11-17 15:13:56 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// in SD or SI force bullet itself to be stored,
|
2009-11-17 15:13:56 +00:00
|
|
|
// for that purpose throw away link when link and graphic
|
|
|
|
// are present, so Brush save is forced
|
2013-09-09 15:19:26 +02:00
|
|
|
if(!pGraphicBrush->GetGraphicLink().isEmpty() && pGraphicBrush->GetGraphic())
|
2009-11-17 15:13:56 +00:00
|
|
|
{
|
2013-09-10 10:02:21 +02:00
|
|
|
pGraphicBrush->SetGraphicLink("");
|
2009-11-17 15:13:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION);
|
|
|
|
}
|
|
|
|
else
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( 0 );
|
2009-11-17 15:13:56 +00:00
|
|
|
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( eVertOrient );
|
2009-11-17 15:13:56 +00:00
|
|
|
if(pBulletFont)
|
|
|
|
{
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( 1 );
|
2014-01-14 13:52:54 +02:00
|
|
|
WriteFont( rStream, *pBulletFont );
|
2009-11-17 15:13:56 +00:00
|
|
|
}
|
|
|
|
else
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( 0 );
|
2014-01-14 13:52:54 +02:00
|
|
|
WritePair( rStream, aGraphicSize );
|
2009-11-17 15:13:56 +00:00
|
|
|
|
|
|
|
Color nTempColor = nBulletColor;
|
|
|
|
if(COL_AUTO == nBulletColor.GetColor())
|
|
|
|
nTempColor = COL_BLACK;
|
2014-01-14 13:52:54 +02:00
|
|
|
WriteColor( rStream, nTempColor );
|
2014-01-08 08:48:26 +02:00
|
|
|
rStream.WriteUInt16( nBulletRelSize );
|
2015-01-15 14:19:24 +01:00
|
|
|
rStream.WriteUInt16( sal_uInt16(IsShowSymbol()) );
|
2009-11-17 15:13:56 +00:00
|
|
|
|
2015-01-15 12:23:20 +02:00
|
|
|
rStream.WriteUInt16( mePositionAndSpaceMode );
|
|
|
|
rStream.WriteUInt16( meLabelFollowedBy );
|
2014-09-25 20:29:27 +02:00
|
|
|
rStream.WriteInt32( mnListtabPos );
|
|
|
|
rStream.WriteInt32( mnFirstLineIndent );
|
|
|
|
rStream.WriteInt32( mnIndentAt );
|
2009-11-17 15:13:56 +00:00
|
|
|
}
|
|
|
|
|
2001-02-23 11:29:54 +00:00
|
|
|
SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
|
|
|
|
{
|
2010-12-17 10:58:57 +01:00
|
|
|
if (& rFormat == this) { return *this; }
|
|
|
|
|
2016-01-22 10:41:10 +01:00
|
|
|
SvxNumberType::SetNumberingType(rFormat.GetNumberingType());
|
2001-02-23 11:29:54 +00:00
|
|
|
eNumAdjust = rFormat.eNumAdjust ;
|
|
|
|
nInclUpperLevels = rFormat.nInclUpperLevels ;
|
|
|
|
nStart = rFormat.nStart ;
|
|
|
|
cBullet = rFormat.cBullet ;
|
2008-03-05 16:44:00 +00:00
|
|
|
mePositionAndSpaceMode = rFormat.mePositionAndSpaceMode;
|
2001-02-23 11:29:54 +00:00
|
|
|
nFirstLineOffset = rFormat.nFirstLineOffset;
|
|
|
|
nAbsLSpace = rFormat.nAbsLSpace ;
|
|
|
|
nCharTextDistance = rFormat.nCharTextDistance ;
|
2008-03-05 16:44:00 +00:00
|
|
|
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
|
|
|
}
|
2001-02-23 11:29:54 +00:00
|
|
|
DELETEZ(pBulletFont);
|
|
|
|
if(rFormat.pBulletFont)
|
2014-09-16 10:09:58 +02:00
|
|
|
pBulletFont = new vcl::Font(*rFormat.pBulletFont);
|
2001-02-23 11:29:54 +00:00
|
|
|
return *this;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2014-02-25 11:55:22 +02:00
|
|
|
bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
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
|
|
|
mePositionAndSpaceMode != rFormat.mePositionAndSpaceMode ||
|
2000-09-18 16:07:07 +00:00
|
|
|
nFirstLineOffset != rFormat.nFirstLineOffset ||
|
|
|
|
nAbsLSpace != rFormat.nAbsLSpace ||
|
|
|
|
nCharTextDistance != rFormat.nCharTextDistance ||
|
2008-03-05 16:44:00 +00:00
|
|
|
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
|
|
|
|
)
|
2014-02-25 11:55:22 +02:00
|
|
|
return false;
|
2008-12-11 07:05:03 +00:00
|
|
|
if (
|
|
|
|
(pGraphicBrush && !rFormat.pGraphicBrush) ||
|
|
|
|
(!pGraphicBrush && rFormat.pGraphicBrush) ||
|
|
|
|
(pGraphicBrush && *pGraphicBrush != *rFormat.pGraphicBrush)
|
|
|
|
)
|
|
|
|
{
|
2014-02-25 11:55:22 +02:00
|
|
|
return false;
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
|
|
|
if (
|
|
|
|
(pBulletFont && !rFormat.pBulletFont) ||
|
|
|
|
(!pBulletFont && rFormat.pBulletFont) ||
|
|
|
|
(pBulletFont && *pBulletFont != *rFormat.pBulletFont)
|
|
|
|
)
|
|
|
|
{
|
2014-02-25 11:55:22 +02:00
|
|
|
return false;
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2014-02-25 11:55:22 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
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;
|
2015-11-10 10:14:16 +01:00
|
|
|
pGraphicBrush = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2015-06-14 13:35:37 +02:00
|
|
|
else if ( !pGraphicBrush || (*pBrushItem != *pGraphicBrush) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
delete pGraphicBrush;
|
2014-09-30 09:02:35 +02:00
|
|
|
pGraphicBrush = static_cast<SvxBrushItem*>(pBrushItem->Clone());
|
2001-07-02 13:25:51 +00:00
|
|
|
}
|
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;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2013-09-06 16:52:32 +02:00
|
|
|
void SvxNumberFormat::SetGraphic( const OUString& rName )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-09 15:19:26 +02:00
|
|
|
if( pGraphicBrush && pGraphicBrush->GetGraphicLink() == rName )
|
2000-09-18 16:07:07 +00:00
|
|
|
return ;
|
|
|
|
|
|
|
|
delete pGraphicBrush;
|
2013-11-14 17:25:30 +01:00
|
|
|
pGraphicBrush = new SvxBrushItem( rName, "", GPOS_AREA, 0 );
|
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
|
|
|
|
2007-09-27 12:01:50 +00:00
|
|
|
sal_Int16 SvxNumberFormat::GetVertOrient() const
|
2001-02-23 11:29:54 +00:00
|
|
|
{
|
|
|
|
return eVertOrient;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2014-09-16 10:09:58 +02:00
|
|
|
void SvxNumberFormat::SetBulletFont(const vcl::Font* pFont)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
delete pBulletFont;
|
2015-11-10 10:14:16 +01:00
|
|
|
pBulletFont = pFont ? new vcl::Font(*pFont): nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2008-03-05 16:44:00 +00:00
|
|
|
void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
|
|
|
|
{
|
|
|
|
mePositionAndSpaceMode = ePositionAndSpaceMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
short SvxNumberFormat::GetAbsLSpace() const
|
|
|
|
{
|
2008-07-08 07:40:59 +00:00
|
|
|
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
|
|
|
return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
|
|
|
|
? nFirstLineOffset
|
|
|
|
: static_cast<short>( GetFirstLineIndent() );
|
2008-03-05 16:44:00 +00:00
|
|
|
}
|
|
|
|
short SvxNumberFormat::GetCharTextDistance() const
|
|
|
|
{
|
|
|
|
return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nCharTextDistance : 0;
|
|
|
|
}
|
|
|
|
|
2012-04-04 21:11:26 +02:00
|
|
|
void SvxNumberFormat::SetLabelFollowedBy( const LabelFollowedBy eLabelFollowedBy )
|
2008-03-05 16:44:00 +00:00
|
|
|
{
|
|
|
|
meLabelFollowedBy = eLabelFollowedBy;
|
|
|
|
}
|
|
|
|
void SvxNumberFormat::SetListtabPos( const long nListtabPos )
|
|
|
|
{
|
|
|
|
mnListtabPos = nListtabPos;
|
|
|
|
}
|
|
|
|
void SvxNumberFormat::SetFirstLineIndent( const long nFirstLineIndent )
|
|
|
|
{
|
|
|
|
mnFirstLineIndent = nFirstLineIndent;
|
|
|
|
}
|
|
|
|
void SvxNumberFormat::SetIndentAt( const long nIndentAt )
|
|
|
|
{
|
|
|
|
mnIndentAt = nIndentAt;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic)
|
|
|
|
{
|
2016-09-20 16:41:39 +02:00
|
|
|
const MapMode aMapMM100( MapUnit::Map100thMM );
|
2000-09-18 16:07:07 +00:00
|
|
|
const Size& rSize = pGraphic->GetPrefSize();
|
|
|
|
Size aRetSize;
|
2016-09-20 16:41:39 +02:00
|
|
|
if ( pGraphic->GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2014-02-25 11:55:22 +02:00
|
|
|
OUString SvxNumberFormat::CreateRomanString( sal_uLong nNo, bool bUpper )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
nNo %= 4000; // more can not be displayed
|
2000-09-18 16:07:07 +00:00
|
|
|
// 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
|
2011-02-16 16:34:02 -05:00
|
|
|
? "MDCLXVI--" // +2 Dummy entries!
|
|
|
|
: "mdclxvi--"; // +2 Dummy entries!
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-09-06 16:52:32 +02:00
|
|
|
OUString sRet;
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 nMask = 1000;
|
2000-09-18 16:07:07 +00:00
|
|
|
while( nMask )
|
|
|
|
{
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt8 nZahl = sal_uInt8(nNo / nMask);
|
|
|
|
sal_uInt8 nDiff = 1;
|
2000-09-18 16:07:07 +00:00
|
|
|
nNo %= nMask;
|
|
|
|
|
|
|
|
if( 5 < nZahl )
|
|
|
|
{
|
|
|
|
if( nZahl < 9 )
|
2013-09-06 16:52:32 +02:00
|
|
|
sRet += OUString(*(cRomanArr-1));
|
2000-09-18 16:07:07 +00:00
|
|
|
++nDiff;
|
|
|
|
nZahl -= 5;
|
|
|
|
}
|
|
|
|
switch( nZahl )
|
|
|
|
{
|
2016-05-10 17:03:59 +02:00
|
|
|
case 3: { sRet += OUString(*cRomanArr); SAL_FALLTHROUGH; }
|
|
|
|
case 2: { sRet += OUString(*cRomanArr); SAL_FALLTHROUGH; }
|
2013-09-06 16:52:32 +02:00
|
|
|
case 1: { sRet += OUString(*cRomanArr); }
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: {
|
2013-09-06 16:52:32 +02:00
|
|
|
sRet += OUString(*cRomanArr);
|
|
|
|
sRet += OUString(*(cRomanArr-nDiff));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-09-06 16:52:32 +02:00
|
|
|
case 5: { sRet += OUString(*(cRomanArr-nDiff)); }
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
nMask /= 10; // for the next decade
|
2000-09-18 16:07:07 +00:00
|
|
|
cRomanArr += 2;
|
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
OUString SvxNumberFormat::GetCharFormatName()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
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2001-02-23 11:29:54 +00:00
|
|
|
sal_Int32 SvxNumRule::nRefCount = 0;
|
2015-11-10 10:14:16 +01:00
|
|
|
static SvxNumberFormat* pStdNumFmt = nullptr;
|
|
|
|
static SvxNumberFormat* pStdOutlineNumFmt = nullptr;
|
2015-03-25 14:42:40 +02:00
|
|
|
SvxNumRule::SvxNumRule( SvxNumRuleFlags nFeatures,
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 nLevels,
|
2014-02-25 11:55:22 +02:00
|
|
|
bool bCont,
|
2008-03-05 16:44:00 +00:00
|
|
|
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;
|
2011-01-13 14:12:48 +01:00
|
|
|
for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(i < nLevels)
|
|
|
|
{
|
|
|
|
aFmts[i] = new SvxNumberFormat(SVX_NUM_CHARS_UPPER_LETTER);
|
2011-02-16 16:34:02 -05:00
|
|
|
// It is a distinction between writer and draw
|
2015-03-25 14:42:40 +02:00
|
|
|
if(nFeatures & SvxNumRuleFlags::CONTINUOUS)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-03-05 16:44:00 +00:00
|
|
|
if ( eDefaultNumberFormatPositionAndSpaceMode ==
|
|
|
|
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
|
|
|
|
{
|
2014-04-04 13:39:38 +03:00
|
|
|
aFmts[i]->SetAbsLSpace( convertMm100ToTwip(DEF_WRITER_LSPACE * (i+1)) );
|
|
|
|
aFmts[i]->SetFirstLineOffset(convertMm100ToTwip(-DEF_WRITER_LSPACE));
|
2008-03-05 16:44:00 +00:00
|
|
|
}
|
|
|
|
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]->SetAbsLSpace( DEF_DRAW_LSPACE * (i) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2015-11-10 10:14:16 +01:00
|
|
|
aFmts[i] = nullptr;
|
2014-02-25 11:55:22 +02:00
|
|
|
aFmtsSet[i] = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
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 ));
|
2011-01-13 14:12:48 +01:00
|
|
|
for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(rCopy.aFmts[i])
|
|
|
|
aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]);
|
|
|
|
else
|
2015-11-10 10:14:16 +01:00
|
|
|
aFmts[i] = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
aFmtsSet[i] = rCopy.aFmtsSet[i];
|
|
|
|
}
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2013-04-19 13:26:01 +02:00
|
|
|
SvxNumRule::SvxNumRule( SvStream &rStream )
|
2014-05-11 11:10:01 +01:00
|
|
|
: nLevelCount(0)
|
2013-04-19 13:26:01 +02:00
|
|
|
{
|
2014-05-11 11:10:01 +01:00
|
|
|
sal_uInt16 nTmp16(0);
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); // NUM_ITEM_VERSION
|
|
|
|
rStream.ReadUInt16( nLevelCount );
|
2013-04-19 13:26:01 +02:00
|
|
|
|
|
|
|
// first nFeatureFlags of old Versions
|
2015-03-25 14:42:40 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); nFeatureFlags = static_cast<SvxNumRuleFlags>(nTmp16);
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); bContinuousNumbering = nTmp16;
|
|
|
|
rStream.ReadUInt16( nTmp16 ); eNumberingType = ( SvxNumRuleType )nTmp16;
|
2013-04-19 13:26:01 +02:00
|
|
|
|
|
|
|
for (sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
{
|
2014-02-05 10:41:04 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 );
|
2014-04-09 11:03:42 +02:00
|
|
|
bool hasNumberingFormat = nTmp16 & 1;
|
2013-08-28 23:19:43 +02:00
|
|
|
aFmtsSet[i] = nTmp16 & 2; // fdo#68648 reset flag
|
2013-04-19 13:26:01 +02:00
|
|
|
if ( hasNumberingFormat ){
|
|
|
|
aFmts[i] = new SvxNumberFormat( rStream );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
aFmts[i] = nullptr;
|
2014-02-25 11:55:22 +02:00
|
|
|
aFmtsSet[i] = false; // actually only false is valid
|
2013-04-19 13:26:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//second nFeatureFlags for new versions
|
2015-03-25 14:42:40 +02:00
|
|
|
rStream.ReadUInt16( nTmp16 ); nFeatureFlags = static_cast<SvxNumRuleFlags>(nTmp16);
|
2013-04-19 13:26:01 +02:00
|
|
|
}
|
|
|
|
|
2016-01-11 16:02:17 +02:00
|
|
|
void SvxNumRule::Store( SvStream &rStream )
|
2009-11-17 15:13:56 +00:00
|
|
|
{
|
2014-09-25 17:56:24 +02:00
|
|
|
rStream.WriteUInt16( NUMITEM_VERSION_03 );
|
2014-01-08 08:48:26 +02:00
|
|
|
rStream.WriteUInt16( nLevelCount );
|
2009-11-17 15:13:56 +00:00
|
|
|
//first save of nFeatureFlags for old versions
|
2015-03-25 14:42:40 +02:00
|
|
|
rStream.WriteUInt16( static_cast<sal_uInt16>(nFeatureFlags) );
|
2015-01-15 14:19:24 +01:00
|
|
|
rStream.WriteUInt16( sal_uInt16(bContinuousNumbering) );
|
2015-03-25 15:05:00 +02:00
|
|
|
rStream.WriteUInt16( static_cast<sal_uInt16>(eNumberingType) );
|
2009-11-17 15:13:56 +00:00
|
|
|
|
2015-11-10 10:14:16 +01:00
|
|
|
FontToSubsFontConverter pConverter = nullptr;
|
2014-04-09 11:03:42 +02:00
|
|
|
bool bConvertBulletFont = ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_50 ) && ( rStream.GetVersion() );
|
2011-01-13 14:12:48 +01:00
|
|
|
for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
|
2009-11-17 15:13:56 +00:00
|
|
|
{
|
2013-08-28 23:19:43 +02:00
|
|
|
sal_uInt16 nSetFlag(aFmtsSet[i] ? 2 : 0); // fdo#68648 store that too
|
2009-11-17 15:13:56 +00:00
|
|
|
if(aFmts[i])
|
|
|
|
{
|
2014-09-25 05:27:36 +02:00
|
|
|
rStream.WriteUInt16( 1 | nSetFlag );
|
2009-11-17 15:13:56 +00:00
|
|
|
if(bConvertBulletFont && aFmts[i]->GetBulletFont())
|
|
|
|
{
|
|
|
|
if(!pConverter)
|
|
|
|
pConverter =
|
2016-01-17 13:26:25 +11:00
|
|
|
CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetFamilyName(),
|
2015-05-04 14:57:27 +02:00
|
|
|
FontToSubsFontFlags::EXPORT|FontToSubsFontFlags::ONLYOLDSOSYMBOLFONTS);
|
2009-11-17 15:13:56 +00:00
|
|
|
}
|
|
|
|
aFmts[i]->Store(rStream, pConverter);
|
|
|
|
}
|
|
|
|
else
|
2014-09-25 05:27:36 +02:00
|
|
|
rStream.WriteUInt16( 0 | nSetFlag );
|
2009-11-17 15:13:56 +00:00
|
|
|
}
|
|
|
|
//second save of nFeatureFlags for new versions
|
2015-03-25 14:42:40 +02:00
|
|
|
rStream.WriteUInt16( static_cast<sal_uInt16>(nFeatureFlags) );
|
2009-11-17 15:13:56 +00:00
|
|
|
}
|
2016-01-11 16:02:17 +02:00
|
|
|
|
2016-09-20 16:29:58 +02:00
|
|
|
void SvxNumRule::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
|
|
|
{
|
2016-11-16 08:59:00 +02:00
|
|
|
xmlTextWriterStartElement(pWriter, BAD_CAST("SvxNumRule"));
|
2016-09-20 16:29:58 +02:00
|
|
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("levelCount"), BAD_CAST(OUString::number(nLevelCount).getStr()));
|
2016-09-21 09:37:15 +02:00
|
|
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("continuousNumbering"), BAD_CAST(OUString::boolean(bContinuousNumbering).getStr()));
|
2016-09-20 16:29:58 +02:00
|
|
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("numberingType"), BAD_CAST(OUString::number((int)eNumberingType).getStr()));
|
|
|
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("featureFlags"), BAD_CAST(OUString::number((int)nFeatureFlags).getStr()));
|
|
|
|
for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
|
|
|
|
{
|
|
|
|
if(aFmts[i])
|
|
|
|
{
|
|
|
|
xmlTextWriterStartElement(pWriter, BAD_CAST("aFmts"));
|
|
|
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("i"), BAD_CAST(OUString::number(i).getStr()));
|
|
|
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", aFmts[i]);
|
|
|
|
xmlTextWriterEndElement(pWriter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xmlTextWriterEndElement(pWriter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxNumRule::~SvxNumRule()
|
|
|
|
{
|
2016-04-26 09:08:01 +02:00
|
|
|
for(SvxNumberFormat* aFmt : aFmts)
|
|
|
|
delete aFmt;
|
2001-02-23 11:29:54 +00:00
|
|
|
if(!--nRefCount)
|
|
|
|
{
|
|
|
|
DELETEZ(pStdNumFmt);
|
|
|
|
DELETEZ(pStdOutlineNumFmt);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy )
|
|
|
|
{
|
|
|
|
nLevelCount = rCopy.nLevelCount;
|
|
|
|
nFeatureFlags = rCopy.nFeatureFlags;
|
|
|
|
bContinuousNumbering = rCopy.bContinuousNumbering;
|
|
|
|
eNumberingType = rCopy.eNumberingType;
|
2011-01-13 14:12:48 +01:00
|
|
|
for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
delete aFmts[i];
|
|
|
|
if(rCopy.aFmts[i])
|
|
|
|
aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]);
|
|
|
|
else
|
2015-11-10 10:14:16 +01:00
|
|
|
aFmts[i] = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
aFmtsSet[i] = rCopy.aFmtsSet[i];
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2015-04-27 17:43:11 +02:00
|
|
|
bool SvxNumRule::operator==( const SvxNumRule& rCopy) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if(nLevelCount != rCopy.nLevelCount ||
|
|
|
|
nFeatureFlags != rCopy.nFeatureFlags ||
|
|
|
|
bContinuousNumbering != rCopy.bContinuousNumbering ||
|
|
|
|
eNumberingType != rCopy.eNumberingType)
|
2015-04-27 17:43:11 +02:00
|
|
|
return false;
|
2011-01-13 14:12:48 +01:00
|
|
|
for(sal_uInt16 i = 0; i < nLevelCount; i++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
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])
|
|
|
|
)
|
|
|
|
{
|
2015-04-27 17:43:11 +02:00
|
|
|
return false;
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2015-04-27 17:43:11 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
const SvxNumberFormat* SvxNumRule::Get(sal_uInt16 nLevel)const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" );
|
2008-06-06 11:29:22 +00:00
|
|
|
if( nLevel < SVX_MAX_NUM )
|
2015-11-10 10:14:16 +01:00
|
|
|
return aFmtsSet[nLevel] ? aFmts[nLevel] : nullptr;
|
2008-06-06 11:29:22 +00:00
|
|
|
else
|
2015-11-10 10:14:16 +01:00
|
|
|
return nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
const SvxNumberFormat& SvxNumRule::GetLevel(sal_uInt16 nLevel)const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-23 11:29:54 +00:00
|
|
|
if(!pStdNumFmt)
|
|
|
|
{
|
|
|
|
pStdNumFmt = new SvxNumberFormat(SVX_NUM_ARABIC);
|
|
|
|
pStdOutlineNumFmt = new SvxNumberFormat(SVX_NUM_NUMBER_NONE);
|
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" );
|
2008-06-06 11:29:22 +00:00
|
|
|
|
|
|
|
return ( ( nLevel < SVX_MAX_NUM ) && aFmts[nLevel] ) ?
|
2015-03-25 15:05:00 +02:00
|
|
|
*aFmts[nLevel] : eNumberingType == SvxNumRuleType::NUMBERING ?
|
2008-06-06 11:29:22 +00:00
|
|
|
*pStdNumFmt : *pStdOutlineNumFmt;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 11:55:22 +02:00
|
|
|
void SvxNumRule::SetLevel( sal_uInt16 i, const SvxNumberFormat& rNumFmt, bool bIsValid )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
DBG_ASSERT(i < SVX_MAX_NUM, "Wrong Level" );
|
2008-06-06 11:29:22 +00:00
|
|
|
|
2014-03-06 13:47:17 +00:00
|
|
|
if( (i < SVX_MAX_NUM) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-06 13:47:17 +00:00
|
|
|
bool bReplace = !aFmtsSet[i];
|
|
|
|
if (!bReplace)
|
|
|
|
{
|
|
|
|
const SvxNumberFormat *pFmt = Get(i);
|
2015-04-24 12:25:45 +02:00
|
|
|
bReplace = pFmt == nullptr || rNumFmt != *pFmt;
|
2014-03-06 13:47:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bReplace)
|
|
|
|
{
|
|
|
|
delete aFmts[i];
|
|
|
|
aFmts[i] = new SvxNumberFormat(rNumFmt);
|
|
|
|
aFmtsSet[i] = bIsValid;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2013-04-21 13:50:12 +01:00
|
|
|
void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt)
|
|
|
|
{
|
|
|
|
DBG_ASSERT(nLevel < SVX_MAX_NUM, "Wrong Level" );
|
|
|
|
|
|
|
|
if( nLevel < SVX_MAX_NUM )
|
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
aFmtsSet[nLevel] = nullptr != pFmt;
|
2013-04-21 13:50:12 +01:00
|
|
|
if(pFmt)
|
|
|
|
SetLevel(nLevel, *pFmt);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete aFmts[nLevel];
|
2015-11-10 10:14:16 +01:00
|
|
|
aFmts[nLevel] = nullptr;
|
2013-04-21 13:50:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-03 08:56:35 +02:00
|
|
|
OUString SvxNumRule::MakeNumString( const SvxNodeNum& rNum ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-09-06 16:52:32 +02:00
|
|
|
OUString aStr;
|
2000-09-18 16:07:07 +00:00
|
|
|
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
|
|
|
{
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt8 i = rNum.GetLevel();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( !IsContinuousNumbering() &&
|
2011-02-16 16:34:02 -05:00
|
|
|
1 < rMyNFmt.GetIncludeUpperLevels() ) // only on own level?
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt8 n = rMyNFmt.GetIncludeUpperLevels();
|
2000-09-18 16:07:07 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-04-09 11:03:42 +02:00
|
|
|
bool bDot = 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
|
2014-04-09 11:03:42 +02:00
|
|
|
bDot = false;
|
2001-08-06 11:22:31 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-09-06 16:52:32 +02:00
|
|
|
aStr += "0"; // all 0-levels are a 0
|
2001-08-06 11:22:31 +00:00
|
|
|
if( i != rNum.GetLevel() && bDot)
|
2013-09-06 16:52:32 +02:00
|
|
|
aStr += ".";
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-03 08:56:35 +02:00
|
|
|
aStr = rMyNFmt.GetPrefix() + aStr + rMyNFmt.GetSuffix();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return aStr;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
|
|
|
// changes linked to embedded bitmaps
|
2016-01-11 16:02:17 +02:00
|
|
|
void SvxNumRule::UnLinkGraphics()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-13 14:12:48 +01:00
|
|
|
for(sal_uInt16 i = 0; i < GetLevelCount(); i++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SvxNumberFormat aFmt(GetLevel(i));
|
|
|
|
const SvxBrushItem* pBrush = aFmt.GetBrush();
|
2001-02-23 11:29:54 +00:00
|
|
|
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-11-10 10:14:16 +01:00
|
|
|
const Graphic* pGraphic = nullptr;
|
2000-09-18 16:07:07 +00:00
|
|
|
if(pBrush &&
|
2013-09-09 15:19:26 +02:00
|
|
|
!pBrush->GetGraphicLink().isEmpty() &&
|
2015-11-10 10:14:16 +01:00
|
|
|
nullptr != (pGraphic = pBrush->GetGraphic()))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SvxBrushItem aTempItem(*pBrush);
|
2013-09-09 15:19:26 +02:00
|
|
|
aTempItem.SetGraphicLink("");
|
2000-09-18 16:07:07 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
}
|
2017-03-02 14:24:47 +02:00
|
|
|
else if((SVX_NUM_BITMAP|LINK_TOKEN) == (int)aFmt.GetNumberingType())
|
2001-02-23 11:29:54 +00:00
|
|
|
aFmt.SetNumberingType(SVX_NUM_BITMAP);
|
2000-09-18 16:07:07 +00:00
|
|
|
SetLevel(i, aFmt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule) :
|
|
|
|
SfxPoolItem(SID_ATTR_NUMBERING_RULE),
|
|
|
|
pNumRule(new SvxNumRule(rRule))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 _nWhich ) :
|
2006-06-19 15:13:27 +00:00
|
|
|
SfxPoolItem(_nWhich),
|
2000-09-18 16:07:07 +00:00
|
|
|
pNumRule(new SvxNumRule(rRule))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-19 13:26:01 +02:00
|
|
|
SfxPoolItem* SvxNumBulletItem::Create(SvStream &rStream, sal_uInt16 /*nItemVersion*/ ) const
|
2009-11-16 15:03:54 +01:00
|
|
|
{
|
2013-04-19 13:26:01 +02:00
|
|
|
SvxNumRule aNumRule( rStream );
|
|
|
|
return new SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET );
|
2009-11-16 15:03:54 +01:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :
|
|
|
|
SfxPoolItem(rCopy.Which())
|
|
|
|
{
|
2017-01-11 12:53:32 +02:00
|
|
|
pNumRule.reset( new SvxNumRule(*rCopy.pNumRule) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SvxNumBulletItem::~SvxNumBulletItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-01-10 17:01:52 +01:00
|
|
|
bool SvxNumBulletItem::operator==( const SfxPoolItem& rCopy) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-09-30 09:02:35 +02:00
|
|
|
return *pNumRule == *static_cast<const SvxNumBulletItem&>(rCopy).pNumRule;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
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);
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 SvxNumBulletItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
|
2009-11-17 15:13:56 +00:00
|
|
|
{
|
|
|
|
return NUMITEM_VERSION_03;
|
|
|
|
}
|
2010-10-04 16:20:36 +02:00
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
SvStream& SvxNumBulletItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ )const
|
2009-11-17 15:13:56 +00:00
|
|
|
{
|
|
|
|
pNumRule->Store(rStream);
|
|
|
|
return rStream;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2015-09-11 15:44:09 +02:00
|
|
|
bool SvxNumBulletItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
|
2000-09-28 11:35:03 +00:00
|
|
|
{
|
2017-01-11 12:53:32 +02:00
|
|
|
rVal <<= SvxCreateNumRule( pNumRule.get() );
|
2010-10-04 15:23:49 +01:00
|
|
|
return true;
|
2000-12-01 15:30:37 +00:00
|
|
|
}
|
2000-09-28 11:35:03 +00:00
|
|
|
|
2015-09-11 15:44:09 +02:00
|
|
|
bool SvxNumBulletItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*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;
|
|
|
|
}
|
2017-01-11 12:53:32 +02:00
|
|
|
pNumRule.reset( pNewRule );
|
2010-10-04 15:23:49 +01:00
|
|
|
return true;
|
2000-12-01 15:30:37 +00:00
|
|
|
}
|
2011-12-09 02:56:30 +09:00
|
|
|
catch(const lang::IllegalArgumentException&)
|
2000-12-01 15:30:37 +00:00
|
|
|
{
|
|
|
|
}
|
2000-09-28 11:35:03 +00:00
|
|
|
}
|
2010-10-04 15:23:49 +01:00
|
|
|
return false;
|
2000-09-28 11:35:03 +00:00
|
|
|
}
|
2000-12-01 15:30:37 +00:00
|
|
|
|
2016-09-20 16:29:58 +02:00
|
|
|
void SvxNumBulletItem::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
|
|
|
{
|
2016-11-16 08:59:00 +02:00
|
|
|
xmlTextWriterStartElement(pWriter, BAD_CAST("SvxNumBulletItem"));
|
2016-09-20 16:29:58 +02:00
|
|
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
|
|
|
|
pNumRule->dumpAsXml(pWriter);
|
|
|
|
xmlTextWriterEndElement(pWriter);
|
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevels, SvxNumRuleType eType )
|
2000-12-01 15:30:37 +00:00
|
|
|
{
|
2011-01-13 14:12:48 +01:00
|
|
|
const sal_uInt16 nSrcLevels = pRule->GetLevelCount();
|
2000-12-01 15:30:37 +00:00
|
|
|
SvxNumRule* pNewRule = new SvxNumRule( pRule->GetFeatureFlags(), nLevels, pRule->IsContinuousNumbering(), eType );
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
for( sal_uInt16 nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ )
|
2008-06-06 11:29:22 +00:00
|
|
|
pNewRule->SetLevel( nLevel, pRule->GetLevel( nLevel ) );
|
2000-12-01 15:30:37 +00:00
|
|
|
|
|
|
|
return pNewRule;
|
2001-02-23 11:29:54 +00:00
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|