26#include <com/sun/star/text/VertOrientation.hpp>
29#include <rtl/ustrbuf.hxx>
30#include <vcl/font.hxx>
32#include <editeng/editids.hrc>
37#include <com/sun/star/text/XNumberingFormatter.hpp>
38#include <com/sun/star/text/DefaultNumberingProvider.hpp>
39#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
40#include <com/sun/star/style/NumberingType.hpp>
41#include <com/sun/star/lang/IllegalArgumentException.hpp>
42#include <com/sun/star/beans/PropertyValue.hpp>
50#include <libxml/xmlwriter.h>
71static void lcl_getFormatter(css::uno::Reference<css::text::XNumberingFormatter>& _xFormatter)
78 Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
79 Reference<XDefaultNumberingProvider> xRet = text::DefaultNumberingProvider::create(xContext);
80 _xFormatter.set(xRet, UNO_QUERY);
84 SAL_WARN(
"editeng",
"service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
97 bShowSymbol(rType.bShowSymbol)
132 case NumberingType::CHAR_SPECIAL:
133 case NumberingType::BITMAP:
138 if(NumberingType::ARABIC ==
nNumType && 0 == nNo )
139 return OUString(
'0');
143 static constexpr OUStringLiteral sNumberingType =
u"NumberingType";
144 static constexpr OUStringLiteral sValue =
u"Value";
167 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SvxNumberType"));
168 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"NumType"), BAD_CAST(OString::number(
nNumType).getStr()));
169 (void)xmlTextWriterEndElement(pWriter);
180 mePositionAndSpaceMode( LABEL_WIDTH_AND_POSITION ),
183 nCharTextDistance(0),
184 meLabelFollowedBy( LISTTAB ),
186 mnFirstLineIndent( 0 ),
188 eVertOrient(
text::VertOrientation::
NONE)
194 mePositionAndSpaceMode( rFormat.mePositionAndSpaceMode )
201 , nBulletRelSize(100)
204 , nCharTextDistance(0)
206 sal_uInt16 nTmp16(0);
230 sal_uInt16 hasGraphicBrush = 0;
232 if ( hasGraphicBrush )
240 sal_uInt16 hasBulletFont = 0;
295 rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
344 if (& rFormat ==
this) {
return *
this; }
427 const Size* pSize,
const sal_Int16* pOrient)
514 SAL_WARN(
"editeng",
"Unknown SvxNumberFormat::GetLabelFollowedBy() return value");
535 const MapMode aMapMM100( MapUnit::Map100thMM );
555 constexpr char romans[][13] = {
"M",
"CM",
"D",
"CD",
"C",
"XC",
"L",
"XL",
"X",
"IX",
"V",
"IV",
"I"};
556 constexpr sal_Int32
values[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
558 for (
size_t i = 0;
i < std::size(romans); ++
i)
562 sRet.appendAscii(romans[
i]);
567 return bUpper ? sRet.makeStringAndClear()
568 : sRet.makeStringAndClear().toAsciiLowerCase();
621 if (!oSet.has_value())
629 sal_Int32 nFirstReplacement =
sListFormat->indexOf(
'%');
630 sal_Int32 nLastReplacement =
sListFormat->lastIndexOf(
'%') + 1;
631 if (nFirstReplacement > 0)
634 if (nLastReplacement >= 0 && nLastReplacement < sListFormat->
getLength())
658 if (bIncludePrefixSuffix)
678 eDefaultNumberFormatPositionAndSpaceMode )
679 : nLevelCount(nLevels),
680 nFeatureFlags(nFeatures),
681 eNumberingType(
eType),
682 bContinuousNumbering(bCont)
693 if ( eDefaultNumberFormatPositionAndSpaceMode ==
699 else if ( eDefaultNumberFormatPositionAndSpaceMode ==
710 aFmts[
i]->SetListtabPos( cIndentAt * (
i+2) );
711 aFmts[
i]->SetFirstLineIndent( cFirstLineIndent );
712 aFmts[
i]->SetIndentAt( cIndentAt * (
i+2) );
746 nLevelCount = rCopy.nLevelCount ;
747 nFeatureFlags = rCopy.nFeatureFlags ;
748 bContinuousNumbering = rCopy.bContinuousNumbering;
749 eNumberingType = rCopy.eNumberingType;
753 aFmts[
i] = std::move(rCopy.aFmts[
i]);
754 aFmtsSet[
i] = rCopy.aFmtsSet[
i];
761 sal_uInt16 nTmp16(0);
779 bool hasNumberingFormat = nTmp16 & 1;
781 if ( hasNumberingFormat ){
807 sal_uInt16 nSetFlag(
aFmtsSet[
i] ? 2 : 0);
811 if(bConvertBulletFont &&
aFmts[
i]->GetBulletFont())
816 FontToSubsFontFlags::EXPORT);
818 aFmts[
i]->Store(rStream, pConverter);
829 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SvxNumRule"));
830 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"levelCount"), BAD_CAST(OString::number(
nLevelCount).getStr()));
831 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"continuousNumbering"), BAD_CAST(OString::boolean(
bContinuousNumbering).getStr()));
832 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"numberingType"), BAD_CAST(OString::number(
static_cast<int>(
eNumberingType)).getStr()));
833 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"featureFlags"), BAD_CAST(OString::number(
static_cast<int>(
nFeatureFlags)).getStr()));
838 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"aFmts"));
839 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"i"), BAD_CAST(OString::number(
i).getStr()));
840 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
aFmts[
i].get());
841 (void)xmlTextWriterEndElement(pWriter);
844 (void)xmlTextWriterEndElement(pWriter);
884 nFeatureFlags = rCopy.nFeatureFlags;
885 bContinuousNumbering = rCopy.bContinuousNumbering;
886 eNumberingType = rCopy.eNumberingType;
890 aFmts[
i] = std::move(rCopy.aFmts[
i]);
891 aFmtsSet[
i] = rCopy.aFmtsSet[
i];
954 bReplace = pFmt ==
nullptr || rNumFmt != *pFmt;
975 aFmts[nLevel].reset();
1032 return aStr.makeStringAndClear();
1071 maNumRule(
std::move(rRule))
1083 maNumRule(
std::move(rRule))
1089 maNumRule(rCopy.maNumRule)
1116 uno::Reference< container::XIndexReplace > xRule;
1117 if( rVal >>= xRule )
1130 catch(
const lang::IllegalArgumentException&)
1139 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SvxNumBulletItem"));
1140 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"whichId"), BAD_CAST(OString::number(
Which()).getStr()));
1142 (void)xmlTextWriterEndElement(pWriter);
1150 for( sal_uInt16 nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ )
PropertiesInfo aProperties
constexpr sal_uInt16 BRUSH_GRAPHIC_VERSION
const LanguageTag & GetLanguageTag() const
static OutputDevice * GetDefaultDevice()
static const AllSettings & GetSettings()
MapMode GetPrefMapMode() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
const MapMode & GetMapMode() const
virtual bool operator==(const SfxPoolItem &) const=0
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
SvStream & WriteInt32(sal_Int32 nInt32)
SvStream & WriteUniOrByteString(std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet)
SvStream & ReadInt16(sal_Int16 &rInt16)
SvStream & WriteInt16(sal_Int16 nInt16)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
sal_Int32 GetVersion() const
SvStream & ReadInt32(sal_Int32 &rInt32)
rtl_TextEncoding GetStreamCharSet() const
sal_uInt64 SeekRel(sal_Int64 nPos)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
void SetGraphicLink(const OUString &rNew)
const Graphic * GetGraphic(OUString const &referer=OUString()) const
const OUString & GetGraphicLink() const
void SetGraphic(const Graphic &rNew)
virtual SvxBrushItem * Clone(SfxItemPool *pPool=nullptr) const override
sal_uInt8 GetLevel() const
const sal_uInt16 * GetLevelVal() const
SvxNumBulletItem(SvxNumRule const &rRule)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool operator==(const SfxPoolItem &) const override
virtual SvxNumBulletItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
virtual ~SvxNumBulletItem() override
void Store(SvStream &rStream)
bool aFmtsSet[SVX_MAX_NUM]
OUString MakeNumString(const SvxNodeNum &) const
std::unique_ptr< SvxNumberFormat > aFmts[SVX_MAX_NUM]
sal_uInt16 GetLevelCount() const
SvxNumRuleFlags GetFeatureFlags() const
const SvxNumberFormat * Get(sal_uInt16 nLevel) const
const SvxNumberFormat & GetLevel(sal_uInt16 nLevel) const
static sal_Int32 nRefCount
SvxNumRuleType GetNumRuleType() const
bool operator==(const SvxNumRule &) const
SvxNumRuleType eNumberingType
SvxNumRule & operator=(const SvxNumRule &)
bool IsContinuousNumbering() const
bool bContinuousNumbering
SvxNumRuleFlags nFeatureFlags
SvxNumRule(SvxNumRuleFlags nFeatures, sal_uInt16 nLevels, bool bCont, SvxNumRuleType eType=SvxNumRuleType::NUMBERING, SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
void dumpAsXml(xmlTextWriterPtr pWriter) const
void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat &rFmt, bool bIsValid=true)
static css::uno::Reference< css::text::XNumberingFormatter > xFormatter
void dumpAsXml(xmlTextWriterPtr w) const
bool IsShowSymbol() const
void SetNumberingType(SvxNumType nSet)
SvxNumType GetNumberingType() const
void SetShowSymbol(bool bSet)
SvxNumberType(SvxNumType nType=SVX_NUM_ARABIC)
static sal_Int32 nRefCount
OUString GetNumStr(sal_Int32 nNo) const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define DBG_ASSERT(sCon, aError)
struct _xmlTextWriter * xmlTextWriterPtr
UNOTOOLS_DLLPUBLIC OUString GetFontToSubsFontName(FontToSubsFontConverter hConverter)
UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter(std::u16string_view rFontName, FontToSubsFontFlags nFlags)
UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar(FontToSubsFontConverter hConverter, sal_Unicode c)
void * FontToSubsFontConverter
VCL_DLLPUBLIC SvStream & ReadFont(SvStream &rIStm, vcl::Font &)
VCL_DLLPUBLIC SvStream & WriteFont(SvStream &rOStm, const vcl::Font &)
sal_Int32 nFirstLineOffset
#define SAL_WARN(area, stream)
double getLength(const B2DPolygon &rCandidate)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
SvStream & Store(const SvxBrushItem &rItem, SvStream &rStrm, sal_uInt16)
void Create(SvxBrushItem &rItem, SvStream &rStrm, sal_uInt16 nItemVersion)
constexpr auto toTwips(N number, Length from)
static SvxNumberFormat * pStdNumFmt
static void lcl_getFormatter(css::uno::Reference< css::text::XNumberingFormatter > &_xFormatter)
constexpr sal_uInt16 NUMITEM_VERSION_04
constexpr sal_uInt16 NUMITEM_VERSION_03
SvxNumRule SvxConvertNumRule(const SvxNumRule &rRule, sal_uInt16 nLevels, SvxNumRuleType eType)
constexpr sal_Int32 DEF_WRITER_LSPACE
constexpr sal_Int32 DEF_DRAW_LSPACE
static bool isArabicNumberingType(SvxNumType t)
static SvxNumberFormat * pStdOutlineNumFmt
std::vector< char * > values
SvxNumType
these must match the values in css::style::NumberingType
@ SVX_NUM_CHARS_UPPER_LETTER
css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(const SvxNumRule &rRule)
const SvxNumRule & SvxGetNumRule(Reference< XIndexReplace > const &xRule)