32#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
33#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
34#include <com/sun/star/beans/PropertyValue.hpp>
35#include <com/sun/star/container/XNameAccess.hpp>
36#include <com/sun/star/container/XNameContainer.hpp>
37#include <com/sun/star/container/XIndexContainer.hpp>
38#include <com/sun/star/util/PathSubstitution.hpp>
39#include <com/sun/star/util/DateTime.hpp>
40#include <com/sun/star/formula/SymbolDescriptor.hpp>
41#include <com/sun/star/document/PrinterIndependentLayout.hpp>
67 const OUString& rName)
const
72 uno::TypeClass eClass = aAny.getValueTypeClass();
75 case uno::TypeClass_VOID:
85 case uno::TypeClass_BOOLEAN:
90 case uno::TypeClass_BYTE:
95 case uno::TypeClass_SHORT:
102 case uno::TypeClass_LONG:
104 sal_Int32 nInt32 = 0;
109 case uno::TypeClass_HYPER:
111 sal_Int64 nInt64 = 0;
116 case uno::TypeClass_DOUBLE:
118 double fDouble = 0.0;
123 case uno::TypeClass_STRING:
132 const uno::Type& aType = aAny.getValueType();
133 if (aType.equals(
cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get() ) )
135 uno::Sequence< beans::PropertyValue> aProps;
139 else if( aType.equals(
cppu::UnoType<uno::Sequence<sal_Int8>>::get() ) )
141 uno::Sequence< sal_Int8 > aProps;
148 uno::Reference< container::XNameAccess> aNamed;
155 uno::Reference<container::XIndexAccess> aIndexed;
161 util::DateTime aDateTime;
169 else if( aType.equals(
cppu::UnoType<uno::Sequence<formula::SymbolDescriptor>>::get() ) )
171 uno::Sequence< formula::SymbolDescriptor > aProps;
176 OSL_FAIL(
"this type is not implemented now");
200 OSL_ENSURE(
false,
"XMLSettingsExportHelper::exportByte(): #i114162#:\n"
201 "config-items of type \"byte\" are not valid ODF, "
202 "so storing them is disabled!\n"
203 "Use a different type instead (e.g. \"short\").");
241 OUStringBuffer sBuffer;
253 if (!sValue.isEmpty())
263 OUStringBuffer sBuffer;
271 const uno::Sequence<beans::PropertyValue>& aProps,
272 const OUString& rName)
const
275 if(aProps.hasElements())
279 for (
const auto& rProp : aProps)
285 const uno::Sequence < formula::SymbolDescriptor > &rProps,
286 const OUString& rName)
const
290 static constexpr OUStringLiteral
sName (
u"Name" );
291 static constexpr OUStringLiteral sExportName (
u"ExportName" );
292 static constexpr OUStringLiteral sSymbolSet (
u"SymbolSet" );
293 static constexpr OUStringLiteral sCharacter (
u"Character" );
294 static constexpr OUStringLiteral sFontName (
u"FontName" );
295 static constexpr OUStringLiteral sCharSet (
u"CharSet" );
296 static constexpr OUStringLiteral sFamily (
u"Family" );
297 static constexpr OUStringLiteral sPitch (
u"Pitch" );
298 static constexpr OUStringLiteral sWeight (
u"Weight" );
299 static constexpr OUStringLiteral sItalic (
u"Italic" );
301 sal_Int32
nCount = rProps.getLength();
302 const formula::SymbolDescriptor *pDescriptor = rProps.getConstArray();
307 beans::PropertyValue *pSymbol = aSequence.getArray();
336 const uno::Sequence<sal_Int8>& aProps,
337 const OUString& rName)
const
343 if(aProps.hasElements())
345 OUStringBuffer sBuffer;
353 const OUString& rName,
354 const bool bNameAccess)
const
356 DBG_ASSERT((bNameAccess && !rName.isEmpty()) || !bNameAccess,
"no name");
357 uno::Sequence<beans::PropertyValue> aProps;
359 if (aProps.hasElements())
364 for (
const auto& rProp : std::as_const(aProps))
371 const uno::Reference<container::XNameAccess>& aNamed,
372 const OUString& rName)
const
376 "wrong NameAccess" );
377 if(aNamed->hasElements())
381 const uno::Sequence< OUString > aNames(aNamed->getElementNames());
382 for (
const auto& rElementName : aNames)
383 exportMapEntry(aNamed->getByName(rElementName), rElementName,
true);
389 const uno::Reference<container::XIndexAccess>& rIndexed,
390 const OUString& rName)
const
394 "wrong IndexAccess" );
395 if (rIndexed->hasElements())
399 sal_Int32
nCount = rIndexed->getCount();
410 const OUString& rName)
const
412 uno::Reference<i18n::XForbiddenCharacters> xForbChars;
413 uno::Reference<linguistic2::XSupportedLocales> xLocales;
418 SAL_WARN_IF( !(xForbChars.is() && xLocales.is()),
"xmloff",
"XMLSettingsExportHelper::exportForbiddenCharacters: got illegal forbidden characters!" );
420 if( !xForbChars.is() || !xLocales.is() )
424 const uno::Sequence< lang::Locale > aLocales( xLocales->getLocales() );
430 static constexpr OUStringLiteral sLanguage (
u"Language" );
431 static constexpr OUStringLiteral sCountry (
u"Country" );
432 static constexpr OUStringLiteral sVariant (
u"Variant" );
433 static constexpr OUStringLiteral sBeginLine (
u"BeginLine" );
434 static constexpr OUStringLiteral sEndLine (
u"EndLine" );
437 for(
const auto& rLocale : aLocales )
439 if( xForbChars->hasForbiddenCharacters( rLocale ) )
441 const i18n::ForbiddenCharacters aChars( xForbChars->getForbiddenCharacters( rLocale ) );
445 beans::PropertyValue *pForChar = aSequence.getArray();
465 const uno::Sequence<beans::PropertyValue>& aProps,
466 const OUString& rName)
const
481 sal_Int16 nTmp = sal_Int16();
484 if( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
485 rAny <<= OUString(
"low-resolution");
486 else if( nTmp == document::PrinterIndependentLayout::DISABLED )
487 rAny <<= OUString(
"disabled");
488 else if( nTmp == document::PrinterIndependentLayout::HIGH_RESOLUTION )
489 rAny <<= OUString(
"high-resolution");
502 catch( uno::Exception& )
constexpr OUStringLiteral gsBitmapTableURL(u"BitmapTableURL")
constexpr OUStringLiteral gsLineEndTableURL(u"LineEndTableURL")
constexpr OUStringLiteral gsColorTableURL(u"ColorTableURL")
constexpr OUStringLiteral gsPrinterIndependentLayout(u"PrinterIndependentLayout")
constexpr OUStringLiteral gsGradientTableURL(u"GradientTableURL")
constexpr OUStringLiteral gsDashTableURL(u"DashTableURL")
constexpr OUStringLiteral gsHatchTableURL(u"HatchTableURL")
void exportDateTime(const css::util::DateTime &aValue, const OUString &rName) const
void exportInt(const sal_Int32 nValue, const OUString &rName) const
void CallTypeFunction(const css::uno::Any &rAny, const OUString &rName) const
void exportDouble(const double fValue, const OUString &rName) const
void exportLong(const sal_Int64 nValue, const OUString &rName) const
void exportString(const OUString &sValue, const OUString &rName) const
void exportIndexAccess(const css::uno::Reference< css::container::XIndexAccess > &rIndexed, const OUString &rName) const
void exportSequencePropertyValue(const css::uno::Sequence< css::beans::PropertyValue > &aProps, const OUString &rName) const
void exportBool(const bool bValue, const OUString &rName) const
~XMLSettingsExportHelper()
css::uno::Reference< css::util::XStringSubstitution > mxStringSubstitution
void exportAllSettings(const css::uno::Sequence< css::beans::PropertyValue > &aProps, const OUString &rName) const
void exportShort(const sal_Int16 nValue, const OUString &rName) const
void exportbase64Binary(const css::uno::Sequence< sal_Int8 > &aProps, const OUString &rName) const
void exportMapEntry(const css::uno::Any &rAny, const OUString &rName, const bool bNameAccess) const
XMLSettingsExportHelper(::xmloff::XMLSettingsExportContext &i_rContext)
void exportForbiddenCharacters(const css::uno::Any &rAny, const OUString &rName) const
void ManipulateSetting(css::uno::Any &rAny, std::u16string_view rName) const
For some settings we may want to change their API representation from their XML settings representati...
void exportSymbolDescriptors(const css::uno::Sequence< css::formula::SymbolDescriptor > &rProps, const OUString &rName) const
::xmloff::XMLSettingsExportContext & m_rContext
void exportNameAccess(const css::uno::Reference< css::container::XNameAccess > &rNamed, const OUString &rName) const
static void encode(OUStringBuffer &aStrBuffer, const css::uno::Sequence< sal_Int8 > &aPass)
static void convertDateTime(OUStringBuffer &rBuffer, const css::util::DateTime &rDateTime, sal_Int16 const *pTimeZoneOffset, bool bAddTimeIf0AM=false)
static void convertDouble(OUStringBuffer &rBuffer, double fNumber, bool bWriteUnits, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
virtual void StartElement(enum ::xmloff::token::XMLTokenEnum i_eName)=0
virtual css::uno::Reference< css::uno::XComponentContext > GetComponentContext() const =0
virtual void AddAttribute(enum ::xmloff::token::XMLTokenEnum i_eName, const OUString &i_rValue)=0
virtual void EndElement(const bool i_bIgnoreWhitespace)=0
virtual void Characters(const OUString &i_rCharacters)=0
#define DBG_ASSERT(sCon, aError)
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_WARN_IF(condition, area, stream)
Handling of tokens in XML:
@ XML_CONFIG_ITEM_MAP_NAMED
@ XML_CONFIG_ITEM_MAP_ENTRY
@ XML_CONFIG_ITEM_MAP_INDEXED
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
const Reference< XComponentContext > & m_rContext
@ XML_SYMBOL_DESCRIPTOR_FAMILY
@ XML_SYMBOL_DESCRIPTOR_NAME
@ XML_SYMBOL_DESCRIPTOR_CHARACTER
@ XML_SYMBOL_DESCRIPTOR_MAX
@ XML_SYMBOL_DESCRIPTOR_SYMBOL_SET
@ XML_SYMBOL_DESCRIPTOR_WEIGHT
@ XML_SYMBOL_DESCRIPTOR_ITALIC
@ XML_SYMBOL_DESCRIPTOR_FONT_NAME
@ XML_SYMBOL_DESCRIPTOR_EXPORT_NAME
@ XML_SYMBOL_DESCRIPTOR_PITCH
@ XML_SYMBOL_DESCRIPTOR_CHAR_SET
@ XML_FORBIDDEN_CHARACTER_END_LINE
@ XML_FORBIDDEN_CHARACTER_VARIANT
@ XML_FORBIDDEN_CHARACTER_LANGUAGE
@ XML_FORBIDDEN_CHARACTER_MAX
@ XML_FORBIDDEN_CHARACTER_BEGIN_LINE
@ XML_FORBIDDEN_CHARACTER_COUNTRY