summaryrefslogtreecommitdiffstats
path: root/include/svl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /include/svl
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/IndexedStyleSheets.hxx182
-rw-r--r--include/svl/PasswordHelper.hxx80
-rw-r--r--include/svl/SfxBroadcaster.hxx66
-rw-r--r--include/svl/adrparse.hxx50
-rw-r--r--include/svl/asiancfg.hxx78
-rw-r--r--include/svl/broadcast.hxx103
-rw-r--r--include/svl/cenumitm.hxx60
-rw-r--r--include/svl/cintitem.hxx176
-rw-r--r--include/svl/cjkoptions.hxx38
-rw-r--r--include/svl/converter.hxx33
-rw-r--r--include/svl/cryptosign.hxx98
-rw-r--r--include/svl/ctloptions.hxx85
-rw-r--r--include/svl/currencytable.hxx43
-rw-r--r--include/svl/custritm.hxx68
-rw-r--r--include/svl/documentlockfile.hxx71
-rw-r--r--include/svl/eitem.hxx107
-rw-r--r--include/svl/filenotation.hxx62
-rw-r--r--include/svl/flagitem.hxx56
-rw-r--r--include/svl/fstathelper.hxx58
-rw-r--r--include/svl/globalnameitem.hxx54
-rw-r--r--include/svl/grabbagitem.hxx46
-rw-r--r--include/svl/gridprinter.hxx38
-rw-r--r--include/svl/hint.hxx268
-rw-r--r--include/svl/ilstitem.hxx55
-rw-r--r--include/svl/imageitm.hxx54
-rw-r--r--include/svl/inethist.hxx99
-rw-r--r--include/svl/inettype.hxx254
-rw-r--r--include/svl/instrm.hxx63
-rw-r--r--include/svl/int64item.hxx51
-rw-r--r--include/svl/intitem.hxx130
-rw-r--r--include/svl/itemiter.hxx60
-rw-r--r--include/svl/itempool.hxx278
-rw-r--r--include/svl/itemprop.hxx204
-rw-r--r--include/svl/itemset.hxx357
-rw-r--r--include/svl/languageoptions.hxx85
-rw-r--r--include/svl/lckbitem.hxx53
-rw-r--r--include/svl/legacyitem.hxx52
-rw-r--r--include/svl/listener.hxx69
-rw-r--r--include/svl/lngmisc.hxx56
-rw-r--r--include/svl/lockfilecommon.hxx77
-rw-r--r--include/svl/lstner.hxx78
-rw-r--r--include/svl/macitem.hxx152
-rw-r--r--include/svl/memberid.h93
-rw-r--r--include/svl/metitem.hxx37
-rw-r--r--include/svl/msodocumentlockfile.hxx56
-rw-r--r--include/svl/nfkeytab.hxx102
-rw-r--r--include/svl/nfsymbol.hxx63
-rw-r--r--include/svl/numformat.hxx753
-rw-r--r--include/svl/numuno.hxx72
-rw-r--r--include/svl/ondemand.hxx349
-rw-r--r--include/svl/outstrm.hxx54
-rw-r--r--include/svl/ownlist.hxx75
-rw-r--r--include/svl/pickerhistoryaccess.hxx44
-rw-r--r--include/svl/poolitem.hxx317
-rw-r--r--include/svl/ptitem.hxx62
-rw-r--r--include/svl/rectitem.hxx55
-rw-r--r--include/svl/rngitem.hxx48
-rw-r--r--include/svl/setitem.hxx51
-rw-r--r--include/svl/sharecontrolfile.hxx74
-rw-r--r--include/svl/sharedstring.hxx162
-rw-r--r--include/svl/sharedstringpool.hxx65
-rw-r--r--include/svl/sigstruct.hxx177
-rw-r--r--include/svl/slstitm.hxx72
-rw-r--r--include/svl/solar.hrc96
-rw-r--r--include/svl/srchdefs.hxx50
-rw-r--r--include/svl/srchitem.hxx326
-rw-r--r--include/svl/stritem.hxx45
-rw-r--r--include/svl/style.hxx349
-rw-r--r--include/svl/stylepool.hxx88
-rw-r--r--include/svl/stylesheetuser.hxx41
-rw-r--r--include/svl/svdde.hxx326
-rw-r--r--include/svl/svl.hrc37
-rw-r--r--include/svl/svldllapi.h34
-rw-r--r--include/svl/svlresid.hxx21
-rw-r--r--include/svl/typedwhich.hxx70
-rw-r--r--include/svl/undo.hxx344
-rw-r--r--include/svl/urihelper.hxx178
-rw-r--r--include/svl/urlbmk.hxx53
-rw-r--r--include/svl/visitem.hxx59
-rw-r--r--include/svl/voiditem.hxx51
-rw-r--r--include/svl/whichranges.hxx149
-rw-r--r--include/svl/whiter.hxx52
-rw-r--r--include/svl/zforlist.hxx381
-rw-r--r--include/svl/zformat.hxx763
84 files changed, 10441 insertions, 0 deletions
diff --git a/include/svl/IndexedStyleSheets.hxx b/include/svl/IndexedStyleSheets.hxx
new file mode 100644
index 0000000000..910acd9e25
--- /dev/null
+++ b/include/svl/IndexedStyleSheets.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_INDEXEDSTYLESHEETS_HXX
+#define INCLUDED_SVL_INDEXEDSTYLESHEETS_HXX
+
+#include <svl/style.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
+
+#include <svl/svldllapi.h>
+
+#include <unordered_map>
+#include <vector>
+
+namespace svl
+{
+/** Function object to check whether a style sheet a fulfills specific criteria.
+ * Derive from this class and override the Check() method.
+ */
+struct StyleSheetPredicate
+{
+ virtual bool Check(const SfxStyleSheetBase& styleSheet) = 0;
+ virtual ~StyleSheetPredicate() {}
+};
+
+/** Function object for cleanup-Strategy for IndexedSfxStyleSheets::Clear().
+ * Derive from it and do what is necessary to dispose of a style sheet in Dispose().
+ */
+struct StyleSheetDisposer
+{
+ virtual void Dispose(rtl::Reference<SfxStyleSheetBase> styleSheet) = 0;
+ virtual ~StyleSheetDisposer() {}
+};
+
+/** Function object to apply a method on all style sheets.
+ * Derive from it and do whatever you want to with the style sheet in the DoIt() method.
+ */
+struct StyleSheetCallback
+{
+ virtual void DoIt(const SfxStyleSheetBase& styleSheet) = 0;
+ virtual ~StyleSheetCallback() {}
+};
+
+/** This class holds SfxStyleSheets and allows for access via an id and a name.
+ *
+ * @warning
+ * The identification of style sheets happens by their name. If the name of a sheet changes,
+ * it will not be found again! Please call Reindex() after changing a style sheet's name.
+ *
+ * @internal
+ * This class was implemented to mitigate solve #fdo 30770.
+ * The issue describes an Excel file which takes several hours to open.
+ * An analysis revealed that the time is spent searching for style sheets with linear scans in an array.
+ * This class implements access to the style sheets via their name in (usually) constant time.
+ *
+ * The return type for most methods is a vector of unsigned integers which denote the position
+ * of the style sheets in the vector, and not of pointers to style sheets.
+ * You will need a non-const StyleSheetPool to obtain the actual style sheets.
+ *
+ *
+ * Index-based access is required in several code portions. Hence we have to store the style sheets
+ * in a vector as well as in a map.
+ */
+class SVL_DLLPUBLIC IndexedStyleSheets final
+{
+public:
+ IndexedStyleSheets();
+
+ /** Destructor.
+ *
+ * @internal
+ * Is explicit because it has to know how to dispose of SfxStyleSheetBase objects.
+ */
+ ~IndexedStyleSheets();
+
+ /** Adds a style sheet.
+ *
+ * If the style sheet is already contained, this call has no effect.
+ */
+ void AddStyleSheet(const rtl::Reference<SfxStyleSheetBase>& style);
+
+ /** Removes a style sheet. */
+ bool RemoveStyleSheet(const rtl::Reference<SfxStyleSheetBase>& style);
+
+ /** Check whether a specified style sheet is stored. */
+ bool HasStyleSheet(const rtl::Reference<SfxStyleSheetBase>& style) const;
+
+ /** Obtain the number of style sheets which are held */
+ sal_Int32 GetNumberOfStyleSheets() const;
+
+ /** Obtain the number of style sheets for which a certain condition holds */
+ sal_Int32 GetNumberOfStyleSheetsWithPredicate(StyleSheetPredicate& predicate) const;
+
+ /** Return the stylesheet by its position.
+ * You can obtain the position by, e.g., FindStyleSheetPosition()
+ * @internal
+ * Method is not const because the returned style sheet is not const
+ */
+ SfxStyleSheetBase* GetStyleSheetByPosition(sal_Int32 pos);
+
+ /** Find the position of a provided style.
+ *
+ * @throws std::runtime_error if the style has not been found.
+ */
+ sal_Int32 FindStyleSheetPosition(const SfxStyleSheetBase& style) const;
+
+ /** Obtain the positions of all styles which have a given name
+ */
+ std::vector<sal_Int32> FindPositionsByName(const OUString& name) const;
+
+ enum class SearchBehavior
+ {
+ ReturnAll,
+ ReturnFirst
+ };
+ /** Obtain the positions of all styles which have a certain name and fulfill a certain condition.
+ *
+ * This method is fast because it can use the name-based index
+ */
+ std::vector<sal_Int32>
+ FindPositionsByNameAndPredicate(const OUString& name, StyleSheetPredicate& predicate,
+ SearchBehavior behavior = SearchBehavior::ReturnAll) const;
+
+ /** Obtain the positions of all styles which fulfill a certain condition.
+ *
+ * This method is slow because it cannot use the name-based index
+ */
+ std::vector<sal_Int32> FindPositionsByPredicate(StyleSheetPredicate& predicate) const;
+
+ /** Execute a callback on all style sheets */
+ void ApplyToAllStyleSheets(StyleSheetCallback& callback) const;
+
+ /** Clear the contents of the index.
+ * The StyleSheetDisposer::Dispose() method is called on each style sheet, e.g., if you want to broadcast
+ * changes.
+ */
+ void Clear(StyleSheetDisposer& cleanup);
+
+ void Reindex();
+
+ /** Warning: counting for n starts at 0, i.e., the 0th style sheet is the first that is found. */
+ SfxStyleSheetBase* GetNthStyleSheetThatMatchesPredicate(sal_Int32 n,
+ StyleSheetPredicate& predicate,
+ sal_Int32 startAt = 0);
+
+ /** Get the positions of the style sheets which belong to a certain family.
+ */
+ const std::vector<sal_Int32>& GetStyleSheetPositionsByFamily(SfxStyleFamily) const;
+
+private:
+ /** Register the position of a styleName in the index */
+ void Register(const SfxStyleSheetBase& style, sal_Int32 pos);
+
+ typedef std::vector<rtl::Reference<SfxStyleSheetBase>> VectorType;
+ /** Vector with the stylesheets to allow for index-based access.
+ */
+ VectorType mStyleSheets;
+
+ /** The map type that is used to store the mapping from strings to ids in mStyleSheets
+ *
+ * @internal
+ * Must be an unordered map. A regular map is too slow for some files. */
+ typedef std::unordered_multimap<OUString, unsigned> MapType;
+
+ /** A map which stores the positions of style sheets by their name */
+ MapType mPositionsByName;
+
+ std::vector<std::vector<sal_Int32>> mStyleSheetPositionsByFamily;
+};
+
+} /* namespace svl */
+
+#endif // INCLUDED_SVL_INDEXEDSTYLESHEETS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/PasswordHelper.hxx b/include/svl/PasswordHelper.hxx
new file mode 100644
index 0000000000..405b3962aa
--- /dev/null
+++ b/include/svl/PasswordHelper.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_PASSWORDHELPER_HXX
+#define INCLUDED_SVL_PASSWORDHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+#include <optional>
+
+#include <svl/svldllapi.h>
+#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
+class SvPasswordHelper
+{
+ static void GetHashPasswordLittleEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ static void GetHashPasswordBigEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+
+public:
+ SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence <sal_Int8>& rPassHash, const char* pPass, sal_uInt32 nLen);
+
+ SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ SVL_DLLPUBLIC static void GetHashPasswordSHA1UTF8(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ SVL_DLLPUBLIC static void GetHashPasswordSHA256(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ /**
+ Use this method to compare a given string with another given Hash value.
+ This is necessary, because in older versions exists different hashes of the same string. They were endian dependent.
+ We need this to handle old files. This method will compare against big and
+ little endian UTF-16.
+ tdf#115483: also check 2 different new ways of hashing that were added in
+ ODF 1.2, requiring UTF-8 encoding.
+ */
+ SVL_DLLPUBLIC static bool CompareHashPassword(const css::uno::Sequence<sal_Int8>& rOldPassHash, std::u16string_view sNewPass);
+
+ /** Get password strength percentage
+
+ Maps the calculated password entropy bit amount to password strength percentage:
+ 0 bits -> 0%
+ >= 112 bits -> 100%
+
+ @param pPassword null terminated password string.
+ @returns Password strength percentage in the range [0.0, 100.0]
+ */
+ SVL_DLLPUBLIC static double GetPasswordStrengthPercentage(const char* pPassword);
+ SVL_DLLPUBLIC static double GetPasswordStrengthPercentage(const OUString& aPassword);
+
+ /** Checks if the password meets the password policies
+
+ @param pPassword null terminated password string.
+ @param oPasswordPolicy Regular expression string that defines the password policy.
+
+ @returns true if password meets the policy or there is no policy enforced.
+ */
+ SVL_DLLPUBLIC static bool PasswordMeetsPolicy(const char* pPassword,
+ const std::optional<OUString>& oPasswordPolicy);
+ SVL_DLLPUBLIC static bool PasswordMeetsPolicy(const OUString& aPassword,
+ const std::optional<OUString>& oPasswordPolicy);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/SfxBroadcaster.hxx b/include/svl/SfxBroadcaster.hxx
new file mode 100644
index 0000000000..b026f4c7e4
--- /dev/null
+++ b/include/svl/SfxBroadcaster.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_BRDCST_HXX
+#define INCLUDED_SVL_BRDCST_HXX
+
+#include <svl/svldllapi.h>
+#include <vector>
+#include <functional>
+
+class SfxListener;
+class SfxHint;
+class SfxBroadcasterTest;
+
+class SVL_DLLPUBLIC SfxBroadcaster
+{
+ /** Contains the positions of removed listeners. */
+ std::vector<size_t> m_RemovedPositions;
+ std::vector<SfxListener*> m_Listeners;
+
+private:
+ void AddListener( SfxListener& rListener );
+ void RemoveListener( SfxListener& rListener );
+ const SfxBroadcaster& operator=(const SfxBroadcaster &) = delete;
+
+protected:
+ void Forward(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+public:
+
+ SfxBroadcaster() {}
+ SfxBroadcaster( const SfxBroadcaster &rBC );
+ virtual ~SfxBroadcaster() COVERITY_NOEXCEPT_FALSE;
+
+ void Broadcast( const SfxHint &rHint );
+ bool HasListeners() const;
+
+ /** Get the number of listeners which are registered at this broadcaster */
+ size_t GetListenerCount() const;
+
+ /** Iterate over all the listeners and call the passed function.
+ return true to break the loop. */
+ void ForAllListeners(std::function<bool(SfxListener*)> f) const;
+
+ friend class SfxListener;
+ friend class ::SfxBroadcasterTest;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/adrparse.hxx b/include/svl/adrparse.hxx
new file mode 100644
index 0000000000..f19fc7ef06
--- /dev/null
+++ b/include/svl/adrparse.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_ADRPARSE_HXX
+#define INCLUDED_SVL_ADRPARSE_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+#include <vector>
+
+
+class SVL_DLLPUBLIC SvAddressParser
+{
+ friend class SvAddressParser_Impl;
+
+ ::std::vector< OUString >
+ m_vAddresses;
+
+public:
+ SvAddressParser(const OUString& rInput);
+
+ ~SvAddressParser();
+
+ sal_Int32 Count() const { return m_vAddresses.size(); }
+
+ const OUString& GetEmailAddress(sal_Int32 nIndex) const
+ {
+ return m_vAddresses[nIndex];
+ }
+};
+
+#endif // INCLUDED_SVL_ADRPARSE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/asiancfg.hxx b/include/svl/asiancfg.hxx
new file mode 100644
index 0000000000..6ee88fe357
--- /dev/null
+++ b/include/svl/asiancfg.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_ASIANCFG_HXX
+#define INCLUDED_SVL_ASIANCFG_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svl/svldllapi.h>
+
+namespace com::sun::star::lang {
+ struct Locale;
+}
+
+/// These constants define character compression in Asian text.
+/// Must match the values in com::sun::star::text::CharacterCompressionType.
+/// For bonus points, also appears to be directly stored in the ww8 file format.
+enum class CharCompressType {
+ NONE, /// No Compression
+ PunctuationOnly, /// Only punctuation is compressed
+ PunctuationAndKana, /// Punctuation and Japanese Kana are compressed.
+ Invalid = 0xff /// only used in SC
+};
+
+class SVL_DLLPUBLIC SvxAsianConfig {
+public:
+ SvxAsianConfig();
+ ~SvxAsianConfig();
+ SvxAsianConfig(const SvxAsianConfig&) = delete;
+ SvxAsianConfig& operator=( const SvxAsianConfig& ) = delete;
+
+ void Commit();
+
+ bool IsKerningWesternTextOnly() const;
+
+ void SetKerningWesternTextOnly(bool value);
+
+ CharCompressType GetCharDistanceCompression() const;
+
+ void SetCharDistanceCompression(CharCompressType value);
+
+ css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales() const;
+
+ bool GetStartEndChars(
+ css::lang::Locale const & locale, OUString & startChars,
+ OUString & endChars) const;
+
+ void SetStartEndChars(
+ css::lang::Locale const & locale,
+ OUString const * startChars, OUString const * endChars);
+
+private:
+ struct Impl;
+
+ std::unique_ptr< Impl > impl_;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/broadcast.hxx b/include/svl/broadcast.hxx
new file mode 100644
index 0000000000..30592d22c6
--- /dev/null
+++ b/include/svl/broadcast.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_BROADCAST_HXX
+#define INCLUDED_SVL_BROADCAST_HXX
+
+#include <svl/svldllapi.h>
+
+#include <vector>
+
+class SvtListener;
+class SfxHint;
+
+class SVL_DLLPUBLIC SvtBroadcaster
+{
+public:
+ friend class SvtListener;
+
+ typedef std::vector<SvtListener*> ListenersType;
+
+private:
+ const SvtBroadcaster& operator=(const SvtBroadcaster &) = delete;
+
+ /**
+ * Ensure that the container doesn't contain any duplicated listener
+ * entries. As a side effect, the listeners get sorted by pointer values
+ * after this call.
+ */
+ void Normalize() const;
+
+ void Add( SvtListener* p );
+ void Remove( SvtListener* p );
+
+protected:
+ virtual void ListenersGone();
+
+public:
+ SvtBroadcaster()
+ : mnEmptySlots(0), mnListenersFirstUnsorted(0), mbAboutToDie(false)
+ , mbDisposing(false), mbDestNormalized(true) {}
+ SvtBroadcaster( const SvtBroadcaster &rBC );
+ virtual ~SvtBroadcaster();
+
+ void Broadcast( const SfxHint &rHint );
+
+ ListenersType& GetAllListeners();
+ const ListenersType& GetAllListeners() const;
+
+ bool HasListeners() const { return (maListeners.size() - mnEmptySlots) > 0; }
+
+ /**
+ * Listeners and broadcasters are M:N relationship. If you want to
+ * destruct them, you easily end up in O(M*N) situation; where for every
+ * listener, you iterate all broadcasters, to remove that one listener.
+ *
+ * To avoid that, use this call to announce to the broadcaster it is going
+ * to die, and the listeners do not have to bother with removing
+ * themselves from the broadcaster - the broadcaster will not broadcast
+ * anything after the PrepareForDestruction() call anyway.
+ */
+ void PrepareForDestruction();
+
+private:
+ /// contains only one of each listener, which is enforced by SvtListener
+ mutable ListenersType maListeners;
+
+ /// When the broadcaster is about to die, collect listeners that asked for removal.
+ mutable ListenersType maDestructedListeners;
+
+ /**
+ Note that this class is very performance sensitive, so the following fields have been
+ carefully sized and packed so we can access them quickly, while also taking as little CPU cache
+ space as possible (because e.g. calc can have a LOT of them)
+ */
+ mutable sal_Int32 mnEmptySlots;
+ // The first item in maListeners that is not sorted. The container can become large, so this optimizes sorting.
+ mutable sal_Int32 mnListenersFirstUnsorted;
+ /// Indicate that this broadcaster will be destructed (we indicate this on all ScColumn's broadcasters during the ScTable destruction, eg.)
+ bool mbAboutToDie:1;
+ bool mbDisposing:1;
+ // Whether maDestructedListeners is sorted or not.
+ mutable bool mbDestNormalized:1;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cenumitm.hxx b/include/svl/cenumitm.hxx
new file mode 100644
index 0000000000..9428e095ce
--- /dev/null
+++ b/include/svl/cenumitm.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_CENUMITM_HXX
+#define INCLUDED_SVL_CENUMITM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+
+class SVL_DLLPUBLIC SfxEnumItemInterface: public SfxPoolItem
+{
+protected:
+ explicit SfxEnumItemInterface(sal_uInt16 which): SfxPoolItem(which) {}
+
+ SfxEnumItemInterface(const SfxEnumItemInterface &) = default;
+
+public:
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&) const override;
+
+ virtual bool QueryValue(css::uno::Any & rVal, sal_uInt8 = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any & rVal, sal_uInt8 ) override;
+
+ virtual sal_uInt16 GetValueCount() const = 0;
+
+ virtual sal_uInt16 GetEnumValue() const = 0;
+
+ virtual void SetEnumValue(sal_uInt16 nValue) = 0;
+
+ virtual bool HasBoolValue() const;
+
+ virtual bool GetBoolValue() const;
+
+ virtual void SetBoolValue(bool bValue);
+};
+
+#endif // INCLUDED_SVL_CENUMITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx
new file mode 100644
index 0000000000..bde59c3990
--- /dev/null
+++ b/include/svl/cintitem.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_CINTITEM_HXX
+#define INCLUDED_SVL_CINTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/debug.hxx>
+#include <svl/poolitem.hxx>
+
+class SVL_DLLPUBLIC CntByteItem: public SfxPoolItem
+{
+ sal_uInt8 m_nValue;
+
+public:
+
+ CntByteItem(sal_uInt16 which, sal_uInt8 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue) {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntByteItem* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_uInt8 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt8 nTheValue);
+};
+
+inline void CntByteItem::SetValue(sal_uInt8 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntByteItem::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+class SVL_DLLPUBLIC CntUInt16Item: public SfxPoolItem
+{
+ sal_uInt16 m_nValue;
+
+public:
+
+ CntUInt16Item(sal_uInt16 which, sal_uInt16 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntUInt16Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_uInt16 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt16 nTheValue);
+};
+
+inline void CntUInt16Item::SetValue(sal_uInt16 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntUInt16Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+class SVL_DLLPUBLIC CntInt32Item: public SfxPoolItem
+{
+ sal_Int32 m_nValue;
+
+public:
+
+ CntInt32Item(sal_uInt16 which, sal_Int32 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntInt32Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_Int32 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_Int32 nTheValue);
+};
+
+inline void CntInt32Item::SetValue(sal_Int32 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntInt32Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+class SVL_DLLPUBLIC CntUInt32Item: public SfxPoolItem
+{
+ sal_uInt32 m_nValue;
+
+public:
+
+ CntUInt32Item(sal_uInt16 which, sal_uInt32 nTheValue):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal,
+ sal_uInt8 nMemberId) override;
+
+ virtual CntUInt32Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_uInt32 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt32 nTheValue);
+};
+
+inline void CntUInt32Item::SetValue(sal_uInt32 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntUInt32Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+#endif // INCLUDED_SVL_CINTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cjkoptions.hxx b/include/svl/cjkoptions.hxx
new file mode 100644
index 0000000000..cec2f035b7
--- /dev/null
+++ b/include/svl/cjkoptions.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include <svl/svldllapi.h>
+
+namespace SvtCJKOptions
+{
+SVL_DLLPUBLIC bool IsCJKFontEnabled();
+SVL_DLLPUBLIC bool IsVerticalTextEnabled();
+SVL_DLLPUBLIC bool IsAsianTypographyEnabled();
+SVL_DLLPUBLIC bool IsJapaneseFindEnabled();
+SVL_DLLPUBLIC bool IsRubyEnabled();
+SVL_DLLPUBLIC bool IsChangeCaseMapEnabled();
+SVL_DLLPUBLIC bool IsDoubleLinesEnabled();
+
+SVL_DLLPUBLIC void SetAll(bool bSet);
+SVL_DLLPUBLIC bool IsAnyEnabled();
+SVL_DLLPUBLIC bool IsAnyReadOnly();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/converter.hxx b/include/svl/converter.hxx
new file mode 100644
index 0000000000..7b2000c88e
--- /dev/null
+++ b/include/svl/converter.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_CONVERTER_HXX
+#define INCLUDED_SVL_CONVERTER_HXX
+
+#include <svl/svldllapi.h>
+
+class SvDbaseConverter
+{
+public:
+ SVL_DLLPUBLIC static sal_Int32 ConvertPrecisionToDbase(sal_Int32 _nLen, sal_Int32 _nScale);
+ SVL_DLLPUBLIC static sal_Int32 ConvertPrecisionToOdbc(sal_Int32 _nLen, sal_Int32 _nScale);
+};
+
+#endif //_CONVERTER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cryptosign.hxx b/include/svl/cryptosign.hxx
new file mode 100644
index 0000000000..3bb682916e
--- /dev/null
+++ b/include/svl/cryptosign.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#include <sal/types.h>
+
+#include <utility>
+#include <vector>
+
+#include <rtl/strbuf.hxx>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <svl/svldllapi.h>
+
+// Is this length truly the maximum possible, or just a number that
+// seemed large enough when the author tested this (with some type of
+// certificates)? I suspect the latter.
+
+// Used to be 0x4000 = 16384, but a sample signed PDF (produced by
+// some other software) provided by the customer has a signature
+// content that is 30000 bytes. The SampleSignedPDFDocument.pdf from
+// Adobe has one that is 21942 bytes. So let's be careful. Pity this
+// can't be dynamic, at least not without restructuring the code. Also
+// note that the checks in the code for this being too small
+// apparently are broken, if this overflows you end up with an invalid
+// PDF. Need to fix that.
+
+#define MAX_SIGNATURE_CONTENT_LENGTH 50000
+
+namespace com::sun::star::security { class XCertificate; }
+class SvStream;
+struct SignatureInformation;
+
+namespace svl::crypto {
+
+/// Converts a hex-encoded string into a byte array.
+SVL_DLLPUBLIC std::vector<unsigned char> DecodeHexString(std::string_view rHex);
+
+/// Helper to cryptographically sign and verify
+/// arbitrary data blocks.
+class SVL_DLLPUBLIC Signing
+{
+public:
+
+ Signing(css::uno::Reference<css::security::XCertificate> xCertificate) :
+ m_xCertificate(std::move(xCertificate))
+ {
+ }
+
+ /// Add a range to sign.
+ /// Note: for efficiency this takes a naked pointer, which must remain valid
+ /// until this object is discarded.
+ void AddDataRange(const void* pData, sal_Int32 size)
+ {
+ m_dataBlocks.emplace_back(pData, size);
+ }
+
+ void SetSignTSA(const OUString& tsa) { m_aSignTSA = tsa; }
+ void SetSignPassword(const OUString& password) { m_aSignPassword = password; }
+
+ /// Signs one or more data blocks (as a single, contiguous, array).
+ /// Returns the signature (in PKCS#7 format) as string (hex).
+ bool Sign(OStringBuffer& rCMSHexBuffer);
+
+ /// Verify and get Signature Information given a byte array.
+ static bool Verify(const std::vector<unsigned char>& aData,
+ const bool bNonDetached,
+ const std::vector<unsigned char>& aSignature,
+ SignatureInformation& rInformation);
+
+ /// Verify and get Signature Information given a signature and stream.
+ static bool Verify(SvStream& rStream,
+ const std::vector<std::pair<size_t, size_t>>& aByteRanges,
+ const bool bNonDetached,
+ const std::vector<unsigned char>& aSignature,
+ SignatureInformation& rInformation);
+
+private:
+ /// The certificate to use for signing.
+ const css::uno::Reference<css::security::XCertificate> m_xCertificate;
+
+ /// Data blocks (pointer-size pairs).
+ std::vector<std::pair<const void*, sal_Int32>> m_dataBlocks;
+ OUString m_aSignTSA;
+ OUString m_aSignPassword;
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/include/svl/ctloptions.hxx b/include/svl/ctloptions.hxx
new file mode 100644
index 0000000000..fe34326589
--- /dev/null
+++ b/include/svl/ctloptions.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_CTLOPTIONS_HXX
+#define INCLUDED_SVL_CTLOPTIONS_HXX
+
+#include <svl/svldllapi.h>
+#include <unotools/options.hxx>
+#include <memory>
+
+class SvtCTLOptions_Impl;
+
+// class SvtCTLOptions --------------------------------------------------------
+
+class SVL_DLLPUBLIC SvtCTLOptions final : public utl::detail::Options
+{
+private:
+ std::shared_ptr<SvtCTLOptions_Impl> m_pImpl;
+
+public:
+
+ // bDontLoad is for referencing purposes only
+ SvtCTLOptions( bool bDontLoad = false );
+ virtual ~SvtCTLOptions() override;
+
+ void SetCTLFontEnabled( bool _bEnabled );
+ static bool IsCTLFontEnabled();
+
+ void SetCTLSequenceChecking( bool _bEnabled );
+ static bool IsCTLSequenceChecking();
+
+ void SetCTLSequenceCheckingRestricted( bool _bEnable );
+ static bool IsCTLSequenceCheckingRestricted();
+
+ void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable );
+ static bool IsCTLSequenceCheckingTypeAndReplace();
+
+ enum CursorMovement
+ {
+ MOVEMENT_LOGICAL = 0,
+ MOVEMENT_VISUAL
+ };
+ void SetCTLCursorMovement( CursorMovement _eMovement );
+ static CursorMovement GetCTLCursorMovement();
+
+ enum TextNumerals
+ {
+ NUMERALS_ARABIC = 0,
+ NUMERALS_HINDI,
+ NUMERALS_SYSTEM,
+ NUMERALS_CONTEXT
+ };
+ void SetCTLTextNumerals( TextNumerals _eNumerals );
+ static TextNumerals GetCTLTextNumerals();
+
+ enum EOption
+ {
+ E_CTLFONT,
+ E_CTLSEQUENCECHECKING,
+ E_CTLCURSORMOVEMENT,
+ E_CTLTEXTNUMERALS,
+ E_CTLSEQUENCECHECKINGRESTRICTED,
+ E_CTLSEQUENCECHECKINGTYPEANDREPLACE
+ };
+ bool IsReadOnly(EOption eOption) const;
+};
+
+#endif // INCLUDED_SVL_CTLOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/currencytable.hxx b/include/svl/currencytable.hxx
new file mode 100644
index 0000000000..a990ba4e00
--- /dev/null
+++ b/include/svl/currencytable.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+* 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/.
+*/
+
+#ifndef INCLUDED_SVL_CURRENCYTABLE_HXX
+#define INCLUDED_SVL_CURRENCYTABLE_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/zforlist.hxx>
+
+#include <vector>
+
+class SVL_DLLPUBLIC NfCurrencyTable
+{
+ typedef std::vector<NfCurrencyEntry> DataType;
+ DataType maData;
+
+ NfCurrencyTable(NfCurrencyTable const&) = delete;
+ void operator=(NfCurrencyTable const&) = delete;
+
+public:
+ NfCurrencyTable() {}
+ typedef DataType::iterator iterator;
+ typedef DataType::const_iterator const_iterator;
+
+ iterator begin();
+
+ NfCurrencyEntry& operator[](size_t i);
+ const NfCurrencyEntry& operator[](size_t i) const;
+
+ size_t size() const;
+
+ void insert(const iterator& it, NfCurrencyEntry p);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx
new file mode 100644
index 0000000000..3159c41dfc
--- /dev/null
+++ b/include/svl/custritm.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_CUSTRITM_HXX
+#define INCLUDED_SVL_CUSTRITM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <cassert>
+#include <utility>
+
+class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem
+{
+ OUString m_aValue;
+
+public:
+
+ CntUnencodedStringItem(sal_uInt16 which): SfxPoolItem(which)
+ {}
+
+ CntUnencodedStringItem(sal_uInt16 which, OUString aTheValue):
+ SfxPoolItem(which), m_aValue(std::move(aTheValue))
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&) const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+
+ virtual CntUnencodedStringItem* Clone(SfxItemPool * = nullptr) const override;
+
+ const OUString & GetValue() const { return m_aValue; }
+
+ inline void SetValue(const OUString & rTheValue);
+};
+
+inline void CntUnencodedStringItem::SetValue(const OUString & rTheValue)
+{
+ assert(GetRefCount() == 0 && "cannot modify name of pooled item");
+ m_aValue = rTheValue;
+}
+
+#endif // INCLUDED_SVL_CUSTRITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/documentlockfile.hxx b/include/svl/documentlockfile.hxx
new file mode 100644
index 0000000000..d5dee52561
--- /dev/null
+++ b/include/svl/documentlockfile.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_DOCUMENTLOCKFILE_HXX
+#define INCLUDED_SVL_DOCUMENTLOCKFILE_HXX
+
+#include <svl/svldllapi.h>
+
+#include <svl/lockfilecommon.hxx>
+
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XOutputStream; }
+
+namespace svt {
+
+/// Generalized class for LO and MSO lockfile handling.
+class SVL_DLLPUBLIC GenDocumentLockFile : public LockFileCommon
+{
+public:
+ GenDocumentLockFile(const OUString& aLockFileURL);
+ virtual ~GenDocumentLockFile() override;
+
+ bool CreateOwnLockFile();
+ bool OverwriteOwnLockFile();
+ /// Delete the Lockfile, if current user is the owner
+ virtual void RemoveFile();
+ /// Only delete lockfile, disregarding ownership
+ void RemoveFileDirectly();
+
+ LockFileEntry GetLockData();
+
+protected:
+ virtual LockFileEntry GetLockDataImpl(std::unique_lock<std::mutex>& rGuard) = 0;
+ virtual void WriteEntryToStream( std::unique_lock<std::mutex>& rGuard, const LockFileEntry& aEntry, const css::uno::Reference< css::io::XOutputStream >& xStream ) = 0;
+ virtual css::uno::Reference< css::io::XInputStream > OpenStream(std::unique_lock<std::mutex>& rGuard);
+};
+
+/// Class implementing reading and writing LO lockfiles.
+class SVL_DLLPUBLIC DocumentLockFile final : public GenDocumentLockFile
+{
+ virtual void WriteEntryToStream( std::unique_lock<std::mutex>& rGuard, const LockFileEntry& aEntry, const css::uno::Reference< css::io::XOutputStream >& xStream ) override;
+
+public:
+ DocumentLockFile( std::u16string_view aOrigURL );
+ virtual ~DocumentLockFile() override;
+
+protected:
+ virtual LockFileEntry GetLockDataImpl(std::unique_lock<std::mutex>& rGuard) override;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx
new file mode 100644
index 0000000000..114e451c06
--- /dev/null
+++ b/include/svl/eitem.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_EITEM_HXX
+#define INCLUDED_SVL_EITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/cenumitm.hxx>
+
+
+template<typename EnumT>
+class SAL_DLLPUBLIC_RTTI SfxEnumItem : public SfxEnumItemInterface
+{
+ EnumT m_nValue;
+
+protected:
+ explicit SfxEnumItem(sal_uInt16 const nWhich, EnumT const nValue)
+ : SfxEnumItemInterface(nWhich)
+ , m_nValue(nValue)
+ { }
+
+ SfxEnumItem(const SfxEnumItem &) = default;
+
+public:
+
+ EnumT GetValue() const { return m_nValue; }
+
+ void SetValue(EnumT nTheValue)
+ {
+ assert(GetRefCount() == 0 && "SfxEnumItem::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+ }
+
+ virtual sal_uInt16 GetEnumValue() const override
+ {
+ return static_cast<sal_uInt16>(GetValue());
+ }
+
+ virtual void SetEnumValue(sal_uInt16 nTheValue) override
+ {
+ SetValue(static_cast<EnumT>(nTheValue));
+ }
+
+ virtual bool operator==(SfxPoolItem const & other) const override
+ {
+ return SfxEnumItemInterface::operator==(other) &&
+ m_nValue == static_cast<const SfxEnumItem<EnumT> &>(other).m_nValue;
+ }
+};
+
+class SVL_DLLPUBLIC SfxBoolItem
+ : public SfxPoolItem
+{
+ bool m_bValue;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxBoolItem(sal_uInt16 const nWhich = 0, bool const bValue = false)
+ : SfxPoolItem(nWhich)
+ , m_bValue(bValue)
+ { }
+
+ bool GetValue() const { return m_bValue; }
+
+ void SetValue(bool const bTheValue) { m_bValue = bTheValue; }
+
+ // SfxPoolItem
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 = 0) const override;
+
+ virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8) override;
+
+
+ virtual SfxBoolItem* Clone(SfxItemPool * = nullptr) const override;
+
+ virtual OUString GetValueTextByVal(bool bTheValue) const;
+};
+
+#endif // INCLUDED_SVL_EITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/filenotation.hxx b/include/svl/filenotation.hxx
new file mode 100644
index 0000000000..d33e442b93
--- /dev/null
+++ b/include/svl/filenotation.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_FILENOTATION_HXX
+#define INCLUDED_SVL_FILENOTATION_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+
+
+namespace svt
+{
+
+
+ //= OFileNotation
+
+ class SVL_DLLPUBLIC OFileNotation final
+ {
+ public:
+ enum NOTATION
+ {
+ N_SYSTEM,
+ N_URL
+ };
+
+ OFileNotation( const OUString& _rUrlOrPath );
+ OFileNotation( const OUString& _rUrlOrPath, NOTATION _eInputNotation );
+
+ OUString get(NOTATION _eOutputNotation) const;
+
+ private:
+ SVL_DLLPRIVATE void construct( const OUString& _rUrlOrPath );
+ SVL_DLLPRIVATE bool implInitWithSystemNotation( const OUString& _rSystemPath );
+ SVL_DLLPRIVATE void implInitWithURLNotation( const OUString& _rURL );
+
+ OUString m_sSystem;
+ OUString m_sFileURL;
+ };
+
+
+} // namespace svt
+
+
+#endif // INCLUDED_SVL_FILENOTATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/flagitem.hxx b/include/svl/flagitem.hxx
new file mode 100644
index 0000000000..70b968f2c9
--- /dev/null
+++ b/include/svl/flagitem.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_FLAGITEM_HXX
+#define INCLUDED_SVL_FLAGITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+#include <tools/debug.hxx>
+
+class SvStream;
+
+class SVL_DLLPUBLIC SfxFlagItem: public SfxPoolItem
+{
+ sal_uInt16 nVal;
+
+public:
+
+ explicit SfxFlagItem( sal_uInt16 nWhich = 0, sal_uInt16 nValue = 0 );
+
+ virtual sal_uInt8 GetFlagCount() const;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual SfxFlagItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString & rText,
+ const IntlWrapper& ) const override;
+ sal_uInt16 GetValue() const { return nVal; }
+ void SetValue( sal_uInt16 nNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nVal = nNewVal;
+ }
+ bool GetFlag( sal_uInt8 nFlag ) const { return (nVal & ( 1<<nFlag)); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/fstathelper.hxx b/include/svl/fstathelper.hxx
new file mode 100644
index 0000000000..f6e4343f41
--- /dev/null
+++ b/include/svl/fstathelper.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_FSTATHELPER_HXX
+#define INCLUDED_SVL_FSTATHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+
+class Date;
+namespace tools { class Time; }
+
+namespace FStatHelper {
+
+/** Return the modified time and date stamp for this URL.
+
+ @param URL the asking URL
+
+ @param pDate if unequal 0, the function set the date stamp
+
+ @param pTime if unequal 0, the function set the time stamp
+
+ @return it was be able to get the date/time stamp
+*/
+SVL_DLLPUBLIC bool GetModifiedDateTimeOfFile( const OUString& rURL,
+ Date* pDate, tools::Time* pTime );
+
+/** Return if under the URL a document exist. This is only a wrapper for the
+ UCB.IsContent.
+*/
+SVL_DLLPUBLIC bool IsDocument( const OUString& rURL );
+
+/** Return if under the URL a folder exist. This is only a wrapper for the
+ UCB.isFolder.
+*/
+SVL_DLLPUBLIC bool IsFolder( const OUString& rURL );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/globalnameitem.hxx b/include/svl/globalnameitem.hxx
new file mode 100644
index 0000000000..edbb562732
--- /dev/null
+++ b/include/svl/globalnameitem.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_GLOBALNAMEITEM_HXX
+#define INCLUDED_SVL_GLOBALNAMEITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/globname.hxx>
+#include <svl/poolitem.hxx>
+
+class SVL_DLLPUBLIC SfxGlobalNameItem final : public SfxPoolItem
+{
+ SvGlobalName m_aName;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SfxGlobalNameItem();
+ SfxGlobalNameItem( sal_uInt16 nWhich, const SvGlobalName& );
+ virtual ~SfxGlobalNameItem() override;
+
+ SfxGlobalNameItem(SfxGlobalNameItem const &) = default;
+ SfxGlobalNameItem(SfxGlobalNameItem &&) = default;
+ SfxGlobalNameItem & operator =(SfxGlobalNameItem const &) = delete; // due to SfxPoolItem
+ SfxGlobalNameItem & operator =(SfxGlobalNameItem &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxGlobalNameItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ const SvGlobalName& GetValue() const { return m_aName; }
+
+ virtual bool PutValue ( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/grabbagitem.hxx b/include/svl/grabbagitem.hxx
new file mode 100644
index 0000000000..77a619aec4
--- /dev/null
+++ b/include/svl/grabbagitem.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+#ifndef INCLUDED_SVL_GRABBAGITEM_HXX
+#define INCLUDED_SVL_GRABBAGITEM_HXX
+
+#include <map>
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+/// Grab bag item provides a string-any map for keys with untyped values.
+class SVL_DLLPUBLIC SfxGrabBagItem final : public SfxPoolItem
+{
+private:
+ std::map<OUString, css::uno::Any> m_aMap;
+
+public:
+ SfxGrabBagItem();
+ SfxGrabBagItem(sal_uInt16 nWhich);
+ ~SfxGrabBagItem() override;
+
+ SfxGrabBagItem(SfxGrabBagItem const&) = default;
+ SfxGrabBagItem(SfxGrabBagItem&&) = default;
+ SfxGrabBagItem& operator=(SfxGrabBagItem const&) = delete; // due to SfxPoolItem
+ SfxGrabBagItem& operator=(SfxGrabBagItem&&) = delete; // due to SfxPoolItem
+
+ const std::map<OUString, css::uno::Any>& GetGrabBag() const { return m_aMap; }
+
+ std::map<OUString, css::uno::Any>& GetGrabBag() { return m_aMap; }
+
+ bool operator==(const SfxPoolItem& rItem) const override;
+ SfxGrabBagItem* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
+ bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/gridprinter.hxx b/include/svl/gridprinter.hxx
new file mode 100644
index 0000000000..e69d9f50ca
--- /dev/null
+++ b/include/svl/gridprinter.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_GRIDPRINTER_HXX
+#define INCLUDED_SVL_GRIDPRINTER_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+#include <memory>
+
+namespace svl
+{
+/**
+ * Print 2-dimensional data in a nice and pleasant fashion. Useful when
+ * debugging grid layout data.
+ */
+class SVL_DLLPUBLIC GridPrinter
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+public:
+ GridPrinter(size_t nRows, size_t nCols, bool bPrint);
+ ~GridPrinter();
+ void set(size_t nRow, size_t nCol, const OUString& rStr);
+ void print(const char* pHeader) const;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
new file mode 100644
index 0000000000..ec0c7b1d98
--- /dev/null
+++ b/include/svl/hint.hxx
@@ -0,0 +1,268 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_HINT_HXX
+#define INCLUDED_SVL_HINT_HXX
+
+#include <ostream>
+#include <string>
+
+#include <svl/svldllapi.h>
+
+/// hint ids, mostly used to avoid dynamic_cast of SfxHint
+enum class SfxHintId {
+ NONE,
+ Dying,
+ NameChanged,
+ TitleChanged,
+ DataChanged,
+ DocChanged,
+ UpdateDone,
+ Deinitializing,
+ ModeChanged,
+ ColorsChanged,
+ LanguageChanged,
+ RedlineChanged,
+ DocumentRepair,
+ SvxViewChanged,
+
+// VCL text hints
+ TextParaInserted,
+ TextParaRemoved,
+ TextParaContentChanged,
+ TextHeightChanged,
+ TextFormatPara,
+ TextFormatted,
+ TextModified,
+ TextProcessNotifications,
+ TextViewScrolled,
+ TextViewSelectionChanged,
+ TextViewCaretChanged,
+
+// BASIC hints
+ BasicDataWanted,
+ BasicDataChanged,
+ BasicInfoWanted,
+ BasicStart,
+ BasicStop,
+
+// SVX edit source
+ EditSourceParasMoved,
+ EditSourceSelectionChanged,
+
+// SC hints
+ ScDataChanged,
+ ScTableOpDirty,
+ ScCalcAll,
+ ScReference,
+ ScDrawLayerNew,
+ ScDbAreasChanged,
+ ScAreaChanged,
+ ScAreasChanged,
+ ScTablesChanged,
+ ScDrawChanged,
+ ScDocNameChanged,
+ ScAreaLinksChanged,
+ ScShowRangeFinder,
+ ScDocSaved,
+ ScForceSetTab,
+ ScNavigatorUpdateAll,
+ ScAnyDataChanged,
+ ScPrintOptions,
+ ScRefModeChanged,
+ ScKillEditView,
+ ScKillEditViewNoPaint,
+ ScHiddenRowsChanged,
+ ScSelectionChanged,
+ ScClearCache,
+
+// SC accessibility hints
+ ScAccTableChanged,
+ ScAccCursorChanged,
+ ScAccVisAreaChanged,
+ ScAccEnterEditMode,
+ ScAccLeaveEditMode,
+ ScAccMakeDrawLayer,
+ ScAccWindowResized,
+
+
+// SFX stylesheet
+ StyleSheetCreated, // new
+ StyleSheetModified, // changed
+ StyleSheetChanged, // erased and re-created (replaced)
+ StyleSheetErased, // erased
+ StyleSheetInDestruction, // in the process of being destructed
+
+// STARMATH
+ MathFormatChanged,
+
+// Sw
+ SwDrawViewsCreated,
+ SwSplitNodeOperation,
+ SwSectionFrameMoveAndDelete,
+ SwNavigatorUpdateTracking,
+ SwNavigatorSelectOutlinesWithSelections,
+ SwPreGraphicArrived,
+ SwGraphicPieceArrived,
+ SwLinkedGraphicStreamArrived,
+ SwLegacyModify,
+ SwCollectTextMarks,
+ SwCollectTextTOXMarksForLayout,
+ SwDrawFrameFormat,
+ SwCheckDrawFrameFormatLayer,
+ SwContactChanged,
+ SwDrawFormatLayoutCopy,
+ SwRestoreFlyAnchor,
+ SwCreatePortion,
+ SwCollectTextObjects,
+ SwGetZOrder,
+ SwGetObjectConnected,
+ SwFindSdrObject,
+ SwWW8AnchorConv,
+ SwField,
+ SwFindFormatForField,
+ SwFindFormatForPostItId,
+ SwCollectPostIts,
+ SwHasHiddenInformationNotes,
+ SwGatherNodeIndex,
+ SwGatherRefFields,
+ SwGatherFields,
+ SwNameChanged, // this can possibly be replaced by the generic NameChanged above
+ SwInsertText,
+ SwDeleteText,
+ SwDeleteChar,
+ SwSectionHidden,
+ SwTitleChanged,
+ SwDescriptionChanged,
+ SwDocPosUpdate,
+ SwDocPosUpdateAtIndex,
+ SwTableHeadingChange,
+ SwVirtPageNumHint,
+ SwAutoFormatUsedHint,
+
+ ThisIsAnSdrHint,
+ ThisIsAnSfxEventHint
+};
+
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const SfxHintId& id )
+{
+ switch(id)
+ {
+ case SfxHintId::NONE: return stream << "NONE";
+ case SfxHintId::Dying: return stream << "Dying";
+ case SfxHintId::NameChanged: return stream << "NameChanged";
+ case SfxHintId::TitleChanged: return stream << "TitleChanged";
+ case SfxHintId::DataChanged: return stream << "DataChanged";
+ case SfxHintId::DocChanged: return stream << "DocChanged";
+ case SfxHintId::UpdateDone: return stream << "UpdateDone";
+ case SfxHintId::Deinitializing: return stream << "Deinitializing";
+ case SfxHintId::ModeChanged: return stream << "ModeChanged";
+ case SfxHintId::ColorsChanged: return stream << "ColorsChanged";
+ case SfxHintId::LanguageChanged: return stream << "LanguageChanged";
+ case SfxHintId::RedlineChanged: return stream << "RedlineChanged";
+ case SfxHintId::DocumentRepair: return stream << "DocumentRepair";
+ case SfxHintId::TextParaInserted: return stream << "TextParaInserted";
+ case SfxHintId::TextParaRemoved: return stream << "TextParaRemoved";
+ case SfxHintId::TextParaContentChanged: return stream << "TextParaContentChanged";
+ case SfxHintId::TextHeightChanged: return stream << "TextHeightChanged";
+ case SfxHintId::TextFormatPara: return stream << "TextFormatPara";
+ case SfxHintId::TextFormatted: return stream << "TextFormatted";
+ case SfxHintId::TextModified: return stream << "TextModified";
+ case SfxHintId::TextProcessNotifications: return stream << "TextProcessNotifications";
+ case SfxHintId::TextViewScrolled: return stream << "TextViewScrolled";
+ case SfxHintId::TextViewSelectionChanged: return stream << "TextViewSelectionChanged";
+ case SfxHintId::TextViewCaretChanged: return stream << "TextViewCaretChanged";
+ case SfxHintId::BasicDataWanted: return stream << "BasicDataWanted";
+ case SfxHintId::BasicDataChanged: return stream << "BasicDataChanged";
+ case SfxHintId::BasicInfoWanted: return stream << "BasicInfoWanted";
+ case SfxHintId::BasicStart: return stream << "BasicStart";
+ case SfxHintId::BasicStop: return stream << "BasicStop";
+ case SfxHintId::EditSourceParasMoved: return stream << "EditSourceParasMoved";
+ case SfxHintId::EditSourceSelectionChanged: return stream << "EditSourceSelectionChanged";
+ case SfxHintId::ScDataChanged: return stream << "ScDataChanged";
+ case SfxHintId::ScTableOpDirty: return stream << "ScTableOpDirty";
+ case SfxHintId::ScCalcAll: return stream << "ScCalcAll";
+ case SfxHintId::ScReference: return stream << "ScReference";
+ case SfxHintId::ScDrawLayerNew: return stream << "ScDrawLayerNew";
+ case SfxHintId::ScDbAreasChanged: return stream << "ScDbAreasChanged";
+ case SfxHintId::ScAreaChanged: return stream << "ScAreaChanged";
+ case SfxHintId::ScAreasChanged: return stream << "ScAreasChanged";
+ case SfxHintId::ScTablesChanged: return stream << "ScTablesChanged";
+ case SfxHintId::ScDrawChanged: return stream << "ScDrawChanged";
+ case SfxHintId::ScDocNameChanged: return stream << "ScDocNameChanged";
+ case SfxHintId::ScAreaLinksChanged: return stream << "ScAreaLinksChanged";
+ case SfxHintId::ScShowRangeFinder: return stream << "ScShowRangeFinder";
+ case SfxHintId::ScDocSaved: return stream << "ScDocSaved";
+ case SfxHintId::ScForceSetTab: return stream << "ScForceSetTab";
+ case SfxHintId::ScNavigatorUpdateAll: return stream << "ScNavigatorUpdateAll";
+ case SfxHintId::ScAnyDataChanged: return stream << "ScAnyDataChanged";
+ case SfxHintId::ScPrintOptions: return stream << "ScPrintOptions";
+ case SfxHintId::ScRefModeChanged: return stream << "ScRefModeChanged";
+ case SfxHintId::ScKillEditView: return stream << "ScKillEditView";
+ case SfxHintId::ScKillEditViewNoPaint: return stream << "ScKillEditViewNoPaint";
+ case SfxHintId::ScHiddenRowsChanged: return stream << "ScHiddenRowsChanged";
+ case SfxHintId::ScSelectionChanged: return stream << "ScSelectionChanged";
+ case SfxHintId::ScClearCache: return stream << "ScClearCache";
+ case SfxHintId::ScAccTableChanged: return stream << "ScAccTableChanged";
+ case SfxHintId::ScAccCursorChanged: return stream << "ScAccCursorChanged";
+ case SfxHintId::ScAccVisAreaChanged: return stream << "ScAccVisAreaChanged";
+ case SfxHintId::ScAccEnterEditMode: return stream << "ScAccEnterEditMode";
+ case SfxHintId::ScAccLeaveEditMode: return stream << "ScAccLeaveEditMode";
+ case SfxHintId::ScAccMakeDrawLayer: return stream << "ScAccMakeDrawLayer";
+ case SfxHintId::ScAccWindowResized: return stream << "ScAccWindowResized";
+ case SfxHintId::StyleSheetCreated: return stream << "StyleSheetCreated";
+ case SfxHintId::StyleSheetModified: return stream << "StyleSheetModified";
+ case SfxHintId::StyleSheetChanged: return stream << "StyleSheetChanged";
+ case SfxHintId::StyleSheetErased: return stream << "StyleSheetErased";
+ case SfxHintId::StyleSheetInDestruction: return stream << "StyleSheetInDestruction";
+ case SfxHintId::MathFormatChanged: return stream << "MathFormatChanged";
+ case SfxHintId::SwDrawViewsCreated: return stream << "SwDrawViewsCreated";
+ case SfxHintId::SwSplitNodeOperation: return stream << "SwSplitNodeOperation";
+ case SfxHintId::SwSectionFrameMoveAndDelete: return stream << "SwSectionFrameMoveAndDelete";
+ case SfxHintId::SwNavigatorUpdateTracking: return stream << "SwNavigatorUpdateTracking";
+ case SfxHintId::SwNavigatorSelectOutlinesWithSelections:
+ return stream << "SwNavigatorSelectOutlinesWithSelections";
+ case SfxHintId::SwCollectTextMarks: return stream << "SwCollectTextMarks";
+ case SfxHintId::SwCollectTextTOXMarksForLayout: return stream << "SwCollectTextTOXMarksForLayout";
+ case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint";
+ default: return stream << "unk(" << std::to_string(int(id)) << ")";
+ }
+}
+
+class SVL_DLLPUBLIC SfxHint
+{
+private:
+ SfxHintId mnId;
+public:
+ SfxHint() : mnId(SfxHintId::NONE) {}
+ explicit SfxHint( SfxHintId nId ) : mnId(nId) {}
+ virtual ~SfxHint() {};
+
+ SfxHint(SfxHint const &) = default;
+ SfxHint(SfxHint &&) = default;
+ SfxHint & operator =(SfxHint const &) = default;
+ SfxHint & operator =(SfxHint &&) = default;
+
+ SfxHintId GetId() const { return mnId; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ilstitem.hxx b/include/svl/ilstitem.hxx
new file mode 100644
index 0000000000..bb49d18c9d
--- /dev/null
+++ b/include/svl/ilstitem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_ILSTITEM_HXX
+#define INCLUDED_SVL_ILSTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <vector>
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+class SVL_DLLPUBLIC SfxIntegerListItem final : public SfxPoolItem
+{
+ std::vector < sal_Int32 > m_aList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxIntegerListItem();
+ SfxIntegerListItem( sal_uInt16 nWhich, std::vector < sal_Int32 >&& rList );
+ SfxIntegerListItem( sal_uInt16 nWhich, const css::uno::Sequence < sal_Int32 >& rList );
+ virtual ~SfxIntegerListItem() override;
+
+ SfxIntegerListItem(SfxIntegerListItem const &) = default;
+ SfxIntegerListItem(SfxIntegerListItem &&) = default;
+ SfxIntegerListItem & operator =(SfxIntegerListItem const &) = delete; // due to SfxPoolItem
+ SfxIntegerListItem & operator =(SfxIntegerListItem &&) = delete; // due to SfxPoolItem
+
+ const std::vector< sal_Int32 >& GetList() const { return m_aList; }
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxIntegerListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool PutValue ( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+};
+
+#endif // INCLUDED_SVL_ILSTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx
new file mode 100644
index 0000000000..f06eb7fd69
--- /dev/null
+++ b/include/svl/imageitm.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_IMAGEITM_HXX
+#define INCLUDED_SVL_IMAGEITM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/intitem.hxx>
+#include <tools/degree.hxx>
+
+struct SfxImageItem_Impl;
+class SVL_DLLPUBLIC SfxImageItem final : public SfxInt16Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxImageItem( sal_uInt16 nWhich = 0 );
+ SfxImageItem( const SfxImageItem& );
+ virtual ~SfxImageItem() override;
+
+ virtual SfxImageItem* Clone( SfxItemPool* pPool = nullptr ) const override;
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ void SetRotation( Degree10 nValue ) { mnAngle = nValue; }
+ Degree10 GetRotation() const { return mnAngle; }
+ void SetMirrored( bool bSet ) { mbMirrored = bSet; }
+ bool IsMirrored() const { return mbMirrored; }
+
+private:
+ OUString maURL;
+ Degree10 mnAngle;
+ bool mbMirrored;
+};
+
+#endif // _SFX_IMAGEITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/inethist.hxx b/include/svl/inethist.hxx
new file mode 100644
index 0000000000..9f88fd84ba
--- /dev/null
+++ b/include/svl/inethist.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_INETHIST_HXX
+#define INCLUDED_SVL_INETHIST_HXX
+
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/hint.hxx>
+#include <svl/svldllapi.h>
+#include <tools/urlobj.hxx>
+#include <memory>
+
+class INetURLHistory_Impl;
+class SVL_DLLPUBLIC INetURLHistory final : public SfxBroadcaster
+{
+ /** Representation.
+ */
+ std::unique_ptr<INetURLHistory_Impl> m_pImpl;
+
+ /** Construction/Destruction.
+ */
+ SAL_DLLPRIVATE INetURLHistory();
+ SAL_DLLPRIVATE virtual ~INetURLHistory() override;
+
+ /** Implementation.
+ */
+ SAL_DLLPRIVATE static void NormalizeUrl_Impl (INetURLObject &rUrl);
+
+ void PutUrl_Impl (const INetURLObject &rUrl);
+ bool QueryUrl_Impl (INetURLObject rUrl) const;
+
+ /** Not implemented.
+ */
+ INetURLHistory (const INetURLHistory&) = delete;
+ INetURLHistory& operator= (const INetURLHistory&) = delete;
+
+public:
+ /** GetOrCreate.
+ */
+ static INetURLHistory* GetOrCreate();
+
+ /** QueryProtocol.
+ */
+ bool QueryProtocol (INetProtocol eProto) const
+ {
+ return ((eProto == INetProtocol::File ) ||
+ (eProto == INetProtocol::Ftp ) ||
+ (eProto == INetProtocol::Http ) ||
+ (eProto == INetProtocol::Https) );
+ }
+
+ /** QueryUrl.
+ */
+ bool QueryUrl (const INetURLObject &rUrl) const
+ {
+ if (QueryProtocol (rUrl.GetProtocol()))
+ return QueryUrl_Impl (rUrl);
+ else
+ return false;
+ }
+
+ bool QueryUrl (std::u16string_view rUrl) const;
+
+ /** PutUrl.
+ */
+ void PutUrl (const INetURLObject &rUrl)
+ {
+ if (QueryProtocol (rUrl.GetProtocol()))
+ PutUrl_Impl (rUrl);
+ }
+};
+
+// broadcasted from PutUrl().
+class SVL_DLLPUBLIC INetURLHistoryHint final : public SfxHint
+{
+ const INetURLObject* pObj;
+public:
+ explicit INetURLHistoryHint( const INetURLObject* Object ) : pObj(Object) {}
+ const INetURLObject* GetObject() const { return pObj; }
+};
+
+#endif // INCLUDED_SVL_INETHIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/inettype.hxx b/include/svl/inettype.hxx
new file mode 100644
index 0000000000..b0ecc300ac
--- /dev/null
+++ b/include/svl/inettype.hxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_INETTYPE_HXX
+#define INCLUDED_SVL_INETTYPE_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/inetmime.hxx>
+
+/** Definitions for frequently used media type names.
+ */
+inline constexpr OUString CONTENT_TYPE_STR_APP_OCTSTREAM = u"application/octet-stream"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_PDF = u"application/pdf"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_RTF = u"application/rtf"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_CALC = u"application/vnd.stardivision.calc"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_CHART
+ = u"application/vnd.stardivision.chart"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_DRAW = u"application/vnd.stardivision.draw"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_IMAGE
+ = u"application/vnd.stardivision.image"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED
+ = u"application/vnd.stardivision.impress-packed"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_IMPRESS
+ = u"application/vnd.stardivision.impress"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_MAIL = u"application/vnd.stardivision.mail"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_MATH = u"application/vnd.stardivision.math"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_NEWS = u"application/vnd.stardivision.news"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_OUTTRAY
+ = u"application/vnd.stardivision.outtray"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_TEMPLATE
+ = u"application/vnd.stardivision.template"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL
+ = u"application/vnd.stardivision.writer-global"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_WRITER_WEB
+ = u"application/vnd.stardivision.writer-web"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_WRITER
+ = u"application/vnd.stardivision.writer"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_FRAMESET = u"application/x-frameset"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_GALLERY_THEME = u"application/x-gallery-theme"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_GALLERY = u"application/x-gallery"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_JAR = u"application/x-jar"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_MACRO = u"application/x-macro"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL
+ = u"application/x-msexcel-template"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_MSEXCEL = u"application/x-msexcel"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL
+ = u"application/x-mspowerpoint-template"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_MSPPOINT = u"application/x-mspowerpoint"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_MSWORD_TEMPL = u"application/x-msword-template"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_MSWORD = u"application/x-msword"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARCALC = u"application/x-starcalc"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARCHART = u"application/x-starchart;"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARDRAW = u"application/x-stardraw"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARHELP = u"application/x-starhelp"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARIMAGE = u"application/x-starimage"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARIMPRESS = u"application/x-starimpress"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARMAIL_SDM = u"application/x-starmail-sdm"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARMAIL_SMD = u"application/x-starmail-smd"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARMATH = u"application/x-starmath"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARWRITER_GLOB
+ = u"application/x-starwriter-global"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_STARWRITER = u"application/x-starwriter"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP = u"application/x-sun-ae-file"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_ZIP = u"application/x-zip-compressed"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_AUDIO_AIFF = u"audio/aiff"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_AUDIO_BASIC = u"audio/basic"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_AUDIO_MIDI = u"audio/midi"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_AUDIO_VORBIS = u"audio/vorbis"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_AUDIO_WAV = u"audio/wav"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_AUDIO_WEBM = u"audio/webm"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_X_CNT_FSYSBOX = u".chaos/fsys-box"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_X_CNT_FSYSFOLDER = u".chaos/fsys-folder"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER
+ = u".chaos/fsys-special-folder"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_IMAGE_GENERIC = u"image/generic"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_IMAGE_GIF = u"image/gif"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_IMAGE_JPEG = u"image/jpeg"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_IMAGE_PCX = u"image/pcx"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_IMAGE_PNG = u"image/png"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_IMAGE_TIFF = u"image/tiff"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_IMAGE_BMP = u"image/x-MS-bmp"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_INET_MSG_RFC822 = u"message/rfc822"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE = u"multipart/alternative"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_INET_MULTI_DIGEST = u"multipart/digest"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_INET_MULTI_MIXED = u"multipart/mixed"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_INET_MULTI_PARALLEL = u"multipart/parallel"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_INET_MULTI_RELATED = u"multipart/related"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_TEXT_ICALENDAR = u"text/calendar"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_TEXT_HTML = u"text/html"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_TEXT_PLAIN = u"text/plain"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_TEXT_XMLICALENDAR = u"text/x-icalxml"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_TEXT_URL = u"text/x-url"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_TEXT_VCALENDAR = u"text/x-vCalendar"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_TEXT_VCARD = u"text/x-vCard"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_VIDEO_MSVIDEO = u"video/x-msvideo"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_VIDEO_THEORA = u"video/theora"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_VIDEO_VDO = u"video/vdo"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_VIDEO_WEBM = u"audio/webm"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_X_STARMAIL = u"x-starmail"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_X_VRML = u"x-world/x-vrml"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER
+ = u"application/vnd.sun.xml.writer"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC
+ = u"application/vnd.sun.xml.calc"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS
+ = u"application/vnd.sun.xml.impress"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW
+ = u"application/vnd.sun.xml.draw"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART
+ = u"application/vnd.sun.xml.chart"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH
+ = u"application/vnd.sun.xml.math"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL
+ = u"application/vnd.sun.xml.writer-global"_ustr;
+inline constexpr OUString CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED
+ = u"application/vnd.sun.xml.impress-packed"_ustr;
+
+/** Definitions for matching parts of URIs.
+ */
+#define INETTYPE_URL_PROT_DATA "data"
+#define INETTYPE_URL_PROT_FILE "file"
+#define INETTYPE_URL_PROT_HTTP "http"
+#define INETTYPE_URL_PROT_HTTPS "https"
+#define INETTYPE_URL_PROT_MACRO "macro"
+#define INETTYPE_URL_PROT_MAILTO "mailto"
+#define INETTYPE_URL_PROT_PRIVATE "private"
+
+enum INetContentType
+{
+ CONTENT_TYPE_UNKNOWN,
+ CONTENT_TYPE_APP_OCTSTREAM,
+ CONTENT_TYPE_APP_PDF,
+ CONTENT_TYPE_APP_RTF,
+ CONTENT_TYPE_APP_MSWORD,
+ CONTENT_TYPE_APP_MSWORD_TEMPL,
+ CONTENT_TYPE_APP_STARCALC,
+ CONTENT_TYPE_APP_STARCHART,
+ CONTENT_TYPE_APP_STARDRAW,
+ CONTENT_TYPE_APP_STARHELP,
+ CONTENT_TYPE_APP_STARIMAGE,
+ CONTENT_TYPE_APP_STARIMPRESS,
+ CONTENT_TYPE_APP_STARMATH,
+ CONTENT_TYPE_APP_STARWRITER,
+ CONTENT_TYPE_APP_ZIP,
+ CONTENT_TYPE_AUDIO_AIFF,
+ CONTENT_TYPE_AUDIO_BASIC,
+ CONTENT_TYPE_AUDIO_MIDI,
+ CONTENT_TYPE_AUDIO_VORBIS,
+ CONTENT_TYPE_AUDIO_WAV,
+ CONTENT_TYPE_AUDIO_WEBM,
+ CONTENT_TYPE_IMAGE_GIF,
+ CONTENT_TYPE_IMAGE_JPEG,
+ CONTENT_TYPE_IMAGE_PCX,
+ CONTENT_TYPE_IMAGE_PNG,
+ CONTENT_TYPE_IMAGE_TIFF,
+ CONTENT_TYPE_IMAGE_BMP,
+ CONTENT_TYPE_IMAGE_WEBP,
+ CONTENT_TYPE_TEXT_HTML,
+ CONTENT_TYPE_TEXT_PLAIN,
+ CONTENT_TYPE_TEXT_URL,
+ CONTENT_TYPE_TEXT_VCARD,
+ CONTENT_TYPE_VIDEO_MSVIDEO,
+ CONTENT_TYPE_VIDEO_THEORA,
+ CONTENT_TYPE_VIDEO_VDO,
+ CONTENT_TYPE_VIDEO_WEBM,
+ CONTENT_TYPE_X_CNT_FSYSBOX,
+ CONTENT_TYPE_X_CNT_FSYSFOLDER,
+ CONTENT_TYPE_X_STARMAIL,
+ CONTENT_TYPE_X_VRML,
+ CONTENT_TYPE_APP_GALLERY,
+ CONTENT_TYPE_APP_GALLERY_THEME,
+ CONTENT_TYPE_APP_STARWRITER_GLOB,
+ CONTENT_TYPE_APP_STARMAIL_SDM,
+ CONTENT_TYPE_APP_STARMAIL_SMD,
+ CONTENT_TYPE_APP_VND_CALC,
+ CONTENT_TYPE_APP_VND_CHART,
+ CONTENT_TYPE_APP_VND_DRAW,
+ CONTENT_TYPE_APP_VND_IMAGE,
+ CONTENT_TYPE_APP_VND_IMPRESS,
+ CONTENT_TYPE_APP_VND_MAIL,
+ CONTENT_TYPE_APP_VND_MATH,
+ CONTENT_TYPE_APP_VND_WRITER,
+ CONTENT_TYPE_APP_VND_WRITER_GLOBAL,
+ CONTENT_TYPE_APP_VND_WRITER_WEB,
+ CONTENT_TYPE_APP_FRAMESET,
+ CONTENT_TYPE_APP_MACRO,
+ CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER,
+ CONTENT_TYPE_APP_VND_TEMPLATE,
+ CONTENT_TYPE_IMAGE_GENERIC,
+ CONTENT_TYPE_APP_VND_NEWS,
+ CONTENT_TYPE_APP_VND_OUTTRAY,
+ CONTENT_TYPE_APP_MSEXCEL,
+ CONTENT_TYPE_APP_MSEXCEL_TEMPL,
+ CONTENT_TYPE_APP_MSPPOINT,
+ CONTENT_TYPE_APP_MSPPOINT_TEMPL,
+ CONTENT_TYPE_TEXT_VCALENDAR,
+ CONTENT_TYPE_TEXT_ICALENDAR,
+ CONTENT_TYPE_TEXT_XMLICALENDAR,
+ CONTENT_TYPE_APP_CDE_CALENDAR_APP,
+ CONTENT_TYPE_INET_MESSAGE_RFC822,
+ CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE,
+ CONTENT_TYPE_INET_MULTIPART_DIGEST,
+ CONTENT_TYPE_INET_MULTIPART_PARALLEL,
+ CONTENT_TYPE_INET_MULTIPART_RELATED,
+ CONTENT_TYPE_INET_MULTIPART_MIXED,
+ CONTENT_TYPE_APP_VND_IMPRESSPACKED,
+ CONTENT_TYPE_APP_JAR,
+ CONTENT_TYPE_APP_VND_SUN_XML_WRITER,
+ CONTENT_TYPE_APP_VND_SUN_XML_CALC,
+ CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS,
+ CONTENT_TYPE_APP_VND_SUN_XML_DRAW,
+ CONTENT_TYPE_APP_VND_SUN_XML_CHART,
+ CONTENT_TYPE_APP_VND_SUN_XML_MATH,
+ CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL,
+ CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED,
+ CONTENT_TYPE_LAST = CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
+};
+
+class SVL_DLLPUBLIC INetContentTypes
+{
+public:
+ static INetContentType GetContentType(OUString const& rTypeName);
+
+ static OUString GetContentType(INetContentType eTypeID);
+
+ static INetContentType GetContentType4Extension(OUString const& rExtension);
+
+ static INetContentType GetContentTypeFromURL(std::u16string_view aURL);
+
+ static bool GetExtensionFromURL(std::u16string_view rURL, OUString& rExtension);
+
+ static bool parse(OUString const& rMediaType, OUString& rType, OUString& rSubType,
+ INetContentTypeParameterList* pParameters = nullptr);
+};
+
+#endif // INCLUDED_SVL_INETTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/instrm.hxx b/include/svl/instrm.hxx
new file mode 100644
index 0000000000..66f30a107a
--- /dev/null
+++ b/include/svl/instrm.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_INSTRM_HXX
+#define INCLUDED_SVL_INSTRM_HXX
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/uno/Reference.h>
+#include <tools/stream.hxx>
+#include <memory>
+
+namespace com::sun::star::io {
+ class XInputStream;
+ class XSeekable;
+}
+
+class SvDataPipe_Impl;
+
+
+class SVL_DLLPUBLIC SvInputStream final : public SvStream
+{
+ css::uno::Reference< css::io::XInputStream > m_xStream;
+ css::uno::Reference< css::io::XSeekable > m_xSeekable;
+ std::unique_ptr<SvDataPipe_Impl> m_pPipe;
+ sal_uInt64 m_nSeekedFrom;
+
+ SVL_DLLPRIVATE bool open();
+
+ SVL_DLLPRIVATE virtual std::size_t GetData(void * pData, std::size_t nSize) override;
+
+ SVL_DLLPRIVATE virtual std::size_t PutData(void const *, std::size_t) override;
+
+ SVL_DLLPRIVATE virtual sal_uInt64 SeekPos(sal_uInt64 nPos) override;
+
+ SVL_DLLPRIVATE virtual void FlushData() override;
+
+ SVL_DLLPRIVATE virtual void SetSize(sal_uInt64) override;
+
+public:
+ SvInputStream( css::uno::Reference< css::io::XInputStream > xTheStream );
+
+ virtual ~SvInputStream() override;
+};
+
+#endif // INCLUDED_SVL_INSTRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/int64item.hxx b/include/svl/int64item.hxx
new file mode 100644
index 0000000000..70a502c645
--- /dev/null
+++ b/include/svl/int64item.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_INT64ITEM_HXX
+#define INCLUDED_SVL_INT64ITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+
+class SVL_DLLPUBLIC SfxInt64Item final : public SfxPoolItem
+{
+ sal_Int64 mnValue;
+
+public:
+ SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal );
+
+ virtual ~SfxInt64Item() override;
+
+ SfxInt64Item(SfxInt64Item const &) = default;
+ SfxInt64Item(SfxInt64Item &&) = default;
+ SfxInt64Item & operator =(SfxInt64Item const &) = delete; // due to SfxPoolItem;
+ SfxInt64Item & operator =(SfxInt64Item &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator== ( const SfxPoolItem& rItem ) const override;
+
+ virtual bool GetPresentation(
+ SfxItemPresentation, MapUnit, MapUnit,
+ OUString& rText, const IntlWrapper& rIntlWrapper ) const override;
+
+ virtual bool QueryValue(
+ css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+
+ virtual bool PutValue(
+ const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+
+ virtual SfxInt64Item* Clone( SfxItemPool* pOther = nullptr ) const override;
+
+ sal_Int64 GetValue() const { return mnValue;}
+
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx
new file mode 100644
index 0000000000..92999568b7
--- /dev/null
+++ b/include/svl/intitem.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_INTITEM_HXX
+#define INCLUDED_SVL_INTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/cintitem.hxx>
+#include <boost/property_tree/ptree_fwd.hpp>
+
+
+class SVL_DLLPUBLIC SfxByteItem: public CntByteItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxByteItem(sal_uInt16 which = 0, sal_uInt8 nValue = 0):
+ CntByteItem(which, nValue) {}
+
+ virtual SfxByteItem* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxByteItem(*this); }
+};
+
+class SVL_DLLPUBLIC SfxInt16Item: public SfxPoolItem
+{
+ sal_Int16 m_nValue;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxInt16Item(sal_uInt16 which = 0, sal_Int16 nTheValue = 0):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ {}
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+
+ virtual SfxInt16Item* Clone(SfxItemPool * = nullptr) const override;
+
+ sal_Int16 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_Int16 nTheValue);
+};
+
+inline void SfxInt16Item::SetValue(sal_Int16 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "SfxInt16Item::SetValue(); Pooled item");
+ m_nValue = nTheValue;
+}
+
+
+class SVL_DLLPUBLIC SfxUInt16Item: public CntUInt16Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxUInt16Item(sal_uInt16 which = 0, sal_uInt16 nValue = 0):
+ CntUInt16Item(which, nValue) {}
+
+ virtual SfxUInt16Item* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxUInt16Item(*this); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+
+class SVL_DLLPUBLIC SfxInt32Item: public CntInt32Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxInt32Item(sal_uInt16 which = 0, sal_Int32 nValue = 0):
+ CntInt32Item(which, nValue) {}
+
+ virtual SfxInt32Item* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxInt32Item(*this); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+
+class SVL_DLLPUBLIC SfxUInt32Item: public CntUInt32Item
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxUInt32Item(sal_uInt16 which = 0, sal_uInt32 nValue = 0):
+ CntUInt32Item(which, nValue) {}
+
+ virtual SfxUInt32Item* Clone(SfxItemPool * = nullptr) const override
+ { return new SfxUInt32Item(*this); }
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+ virtual boost::property_tree::ptree dumpAsJSON() const override;
+};
+
+#endif // INCLUDED_SVL_INTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx
new file mode 100644
index 0000000000..13cf14b610
--- /dev/null
+++ b/include/svl/itemiter.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_ITEMITER_HXX
+#define INCLUDED_SVL_ITEMITER_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/itemset.hxx>
+
+class SfxPoolItem;
+
+class SVL_DLLPUBLIC SfxItemIter
+{
+ const SfxItemSet& m_rSet;
+ sal_uInt16 m_nStart;
+ sal_uInt16 m_nEnd;
+ sal_uInt16 m_nCurrent;
+
+public:
+ SfxItemIter(const SfxItemSet& rSet);
+
+ /// get item, or null if no items
+ const SfxPoolItem* GetCurItem() const
+ {
+ return m_rSet.m_nCount ? *(m_rSet.m_ppItems + m_nCurrent) : nullptr;
+ }
+ const SfxPoolItem* NextItem() { return (m_nCurrent < m_nEnd) ? ImplNextItem() : nullptr; }
+
+ bool IsAtEnd() const { return m_nCurrent == m_nEnd; }
+
+ sal_uInt16 GetCurPos() const { return m_nCurrent; }
+ sal_uInt16 GetFirstPos() const { return m_nStart; }
+ sal_uInt16 GetLastPos() const { return m_nEnd; }
+
+ SfxItemState GetItemState(bool bSrchInParent = true,
+ const SfxPoolItem** ppItem = nullptr) const;
+ void ClearItem();
+
+private:
+ const SfxPoolItem* ImplNextItem();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
new file mode 100644
index 0000000000..f5949f1700
--- /dev/null
+++ b/include/svl/itempool.hxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <rtl/ref.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+#include <svl/typedwhich.hxx>
+#include <svl/whichranges.hxx>
+#include <memory>
+#include <vector>
+#include <unordered_set>
+#include <o3tl/sorted_vector.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+class SfxBroadcaster;
+struct SfxItemPool_Impl;
+
+struct SfxItemInfo
+{
+ // Defines a mapping between WhichID <-> SlotID
+ sal_uInt16 _nSID;
+
+ // Defines if this Item needs to be registered at the pool
+ // to make it accessible for the GetItemSurrogates call. It
+ // will not be included when this flag is not set, but also
+ // needs no registration. There are SAL_INFO calls in the
+ // GetItemSurrogates impl that will mention that
+ bool _bNeedsPoolRegistration : 1;
+
+ // Defines if the Item can be shared/RefCounted else it will be cloned.
+ // Default is true - as it should be for all Items. It is needed by some
+ // SW items, so protected to let them set it in constructor. If this could
+ // be fixed at that Items we may remove this again.
+ bool _bShareable : 1;
+};
+
+class SfxItemPool;
+typedef std::unordered_set<const SfxPoolItem*> registeredSfxPoolItems;
+
+#ifdef DBG_UTIL
+SVL_DLLPUBLIC size_t getAllDirectlyPooledSfxPoolItemCount();
+SVL_DLLPUBLIC size_t getRemainingDirectlyPooledSfxPoolItemCount();
+#endif
+
+/** Base class for providers of defaults of SfxPoolItems.
+ *
+ * The derived classes hold the concrete (const) instances which are referenced in several places
+ * (usually within a single document).
+ * This helps to lower the amount of calls to lifecycle methods, speeds up comparisons within a document
+ * and facilitates loading and saving of attributes.
+ */
+class SVL_DLLPUBLIC SfxItemPool : public salhelper::SimpleReferenceObject
+{
+ friend struct SfxItemPool_Impl;
+ friend class SfxItemSet;
+ friend class SfxAllItemSet;
+
+ // allow ItemSetTooling to access
+ friend SfxPoolItem const* implCreateItemEntry(SfxItemPool&, SfxPoolItem const*, sal_uInt16, bool);
+ friend void implCleanupItemEntry(SfxItemPool&, SfxPoolItem const*);
+
+ // unit testing
+ friend class PoolItemTest;
+
+ const SfxItemInfo* pItemInfos;
+ std::unique_ptr<SfxItemPool_Impl> pImpl;
+
+ registeredSfxPoolItems** ppRegisteredSfxPoolItems;
+
+private:
+ sal_uInt16 GetIndex_Impl(sal_uInt16 nWhich) const;
+ sal_uInt16 GetSize_Impl() const;
+
+ SVL_DLLPRIVATE bool NeedsPoolRegistration_Impl(sal_uInt16 nPos) const
+ { return pItemInfos[nPos]._bNeedsPoolRegistration; }
+ SVL_DLLPRIVATE bool Shareable_Impl(sal_uInt16 nPos) const
+ { return pItemInfos[nPos]._bShareable; }
+
+public:
+ // for default SfxItemSet::CTOR, set default WhichRanges
+ void FillItemIdRanges_Impl( WhichRangesContainer& pWhichRanges ) const;
+ const WhichRangesContainer & GetFrozenIdRanges() const;
+
+protected:
+ static inline void ClearRefCount(SfxPoolItem& rItem);
+ static inline void AddRef(const SfxPoolItem& rItem);
+ static inline sal_uInt32 ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n = 1);
+
+public:
+ SfxItemPool( const SfxItemPool &rPool,
+ bool bCloneStaticDefaults = false );
+ SfxItemPool( const OUString &rName,
+ sal_uInt16 nStart, sal_uInt16 nEnd,
+ const SfxItemInfo *pItemInfos,
+ std::vector<SfxPoolItem*> *pDefaults = nullptr );
+
+public:
+ virtual ~SfxItemPool();
+
+ SfxBroadcaster& BC();
+
+ void SetPoolDefaultItem( const SfxPoolItem& );
+
+ const SfxPoolItem* GetPoolDefaultItem( sal_uInt16 nWhich ) const;
+ template<class T> const T* GetPoolDefaultItem( TypedWhichId<T> nWhich ) const
+ { return static_cast<const T*>(GetPoolDefaultItem(sal_uInt16(nWhich))); }
+
+ void ResetPoolDefaultItem( sal_uInt16 nWhich );
+
+ void SetDefaults(std::vector<SfxPoolItem*>* pDefaults);
+ void ClearDefaults();
+ void ReleaseDefaults( bool bDelete = false );
+ static void ReleaseDefaults( std::vector<SfxPoolItem*> *pDefaults, bool bDelete = false );
+
+ virtual MapUnit GetMetric( sal_uInt16 nWhich ) const;
+ void SetDefaultMetric( MapUnit eNewMetric );
+ MapUnit GetDefaultMetric() const;
+
+ /** Request string representation of pool items.
+
+ This virtual function produces a string representation
+ from the respective SfxItemPool subclass' known SfxPoolItems.
+
+ Subclasses, please override this method, and handle
+ SfxPoolItems that don't return useful/complete information on
+ SfxPoolItem::GetPresentation()
+
+ This baseclass yields the unmodified string representation of
+ rItem.
+
+ @param[in] rItem
+ SfxPoolItem to query the string representation of
+
+ @param[in] ePresent
+ requested kind of representation - see SfxItemPresentation
+
+ @param[in] eMetric
+ requested unit of measure of the representation
+
+ @param[out] rText
+ string representation of 'rItem'
+
+ @return true if it has a valid string representation
+ */
+ virtual bool GetPresentation( const SfxPoolItem& rItem,
+ MapUnit ePresentationMetric,
+ OUString& rText,
+ const IntlWrapper& rIntlWrapper ) const;
+ virtual rtl::Reference<SfxItemPool> Clone() const;
+ const OUString& GetName() const;
+
+ template<class T> const T& DirectPutItemInPool( std::unique_ptr<T> xItem, sal_uInt16 nWhich = 0 )
+ { return static_cast<const T&>(DirectPutItemInPoolImpl( *xItem.release(), nWhich, /*bPassingOwnership*/true)); }
+ template<class T> const T& DirectPutItemInPool( const T& rItem, sal_uInt16 nWhich = 0 )
+ { return static_cast<const T&>(DirectPutItemInPoolImpl( rItem, nWhich, /*bPassingOwnership*/false)); }
+ void DirectRemoveItemFromPool( const SfxPoolItem& );
+
+ const SfxPoolItem& GetDefaultItem( sal_uInt16 nWhich ) const;
+ template<class T> const T& GetDefaultItem( TypedWhichId<T> nWhich ) const
+ { return static_cast<const T&>(GetDefaultItem(sal_uInt16(nWhich))); }
+
+ struct Item2Range
+ {
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator m_begin;
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator m_end;
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator const & begin() const { return m_begin; }
+ o3tl::sorted_vector<SfxPoolItem*>::const_iterator const & end() const { return m_end; }
+ };
+ const SfxPoolItem * GetItem2Default(sal_uInt16 nWhich) const;
+ template<class T> const T* GetItem2Default( TypedWhichId<T> nWhich ) const
+ { return static_cast<const T*>(GetItem2Default(sal_uInt16(nWhich))); }
+
+ const registeredSfxPoolItems& GetItemSurrogates(sal_uInt16 nWhich) const;
+ /*
+ This is only valid for SfxPoolItem that override IsSortable and operator<.
+ Returns a range of items defined by using operator<.
+ @param rNeedle must be the same type or a supertype of the pool items for nWhich.
+ */
+ std::vector<const SfxPoolItem*> FindItemSurrogate(sal_uInt16 nWhich, SfxPoolItem const & rNeedle) const;
+
+ sal_uInt16 GetFirstWhich() const;
+ sal_uInt16 GetLastWhich() const;
+ bool IsInRange( sal_uInt16 nWhich ) const;
+ void SetSecondaryPool( SfxItemPool *pPool );
+ SfxItemPool* GetSecondaryPool() const;
+ /* get the last pool by following the GetSecondaryPool chain */
+ SfxItemPool* GetLastPoolInChain();
+ SfxItemPool* GetMasterPool() const;
+ void FreezeIdRanges();
+
+ void Delete();
+
+ bool NeedsPoolRegistration(sal_uInt16 nWhich) const;
+ bool NeedsPoolRegistration(const SfxPoolItem &rItem) const
+ { return NeedsPoolRegistration(rItem.Which()); }
+
+ bool Shareable(sal_uInt16 nWhich) const;
+ bool Shareable(const SfxPoolItem &rItem) const
+ { return Shareable(rItem.Which()); }
+
+ void SetItemInfos( const SfxItemInfo *pInfos );
+ sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const;
+ template<class T>
+ TypedWhichId<T> GetWhich( TypedWhichId<T> nSlot, bool bDeep = true ) const
+ { return TypedWhichId<T>(GetWhich(sal_uInt16(nSlot), bDeep)); }
+ sal_uInt16 GetSlotId( sal_uInt16 nWhich ) const;
+ sal_uInt16 GetTrueWhich( sal_uInt16 nSlot, bool bDeep = true ) const;
+ sal_uInt16 GetTrueSlotId( sal_uInt16 nWhich ) const;
+
+ static bool IsWhich(sal_uInt16 nId) {
+ return nId && nId <= SFX_WHICH_MAX; }
+ static bool IsSlot(sal_uInt16 nId) {
+ return nId && nId > SFX_WHICH_MAX; }
+
+ // This method will try to register the Item at this Pool.
+ void registerSfxPoolItem(const SfxPoolItem& rItem);
+
+ // this method will unregister an Item from this Pool
+ void unregisterSfxPoolItem(const SfxPoolItem& rItem);
+
+ // check if this Item is registered at this Pool, needed to detect
+ // if an Item is to be set at another Pool and needs to be cloned
+ bool isSfxPoolItemRegisteredAtThisPool(const SfxPoolItem& rItem) const;
+
+ // try to find an equal existing Item to given one in pool
+ const SfxPoolItem* tryToGetEqualItem(const SfxPoolItem& rItem, sal_uInt16 nWhich) const;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+protected:
+ const SfxPoolItem& DirectPutItemInPoolImpl( const SfxPoolItem&, sal_uInt16 nWhich = 0, bool bPassingOwnership = false );
+ virtual void newItem_Callback(const SfxPoolItem& rItem) const;
+ virtual bool newItem_UseDirect(const SfxPoolItem& rItem) const;
+
+private:
+ const SfxItemPool& operator=(const SfxItemPool &) = delete;
+
+ //IDs below or equal are Which IDs, IDs above slot IDs
+ static const sal_uInt16 SFX_WHICH_MAX = 4999;
+};
+
+// only the pool may manipulate the reference counts
+inline void SfxItemPool::ClearRefCount(SfxPoolItem& rItem)
+{
+ rItem.SetRefCount(0);
+}
+
+// only the pool may manipulate the reference counts
+inline void SfxItemPool::AddRef(const SfxPoolItem& rItem)
+{
+ rItem.AddRef();
+}
+
+// only the pool may manipulate the reference counts
+inline sal_uInt32 SfxItemPool::ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n)
+{
+ return rItem.ReleaseRef(n);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx
new file mode 100644
index 0000000000..219b04e69a
--- /dev/null
+++ b/include/svl/itemprop.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_ITEMPROP_HXX
+#define INCLUDED_SVL_ITEMPROP_HXX
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <comphelper/propertysetinfo.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <svl/itemset.hxx>
+#include <svl/svldllapi.h>
+#include <o3tl/sorted_vector.hxx>
+#include <span>
+#include <string_view>
+#include <utility>
+
+// values from com/sun/star/beans/PropertyAttribute
+#define PROPERTY_NONE 0
+
+/// map a property between beans::XPropertySet and SfxPoolItem
+struct SfxItemPropertyMapEntry
+{
+ OUString aName; ///< name of property
+ css::uno::Type aType; ///< UNO type of property
+ sal_uInt16 nWID; ///< WhichId of SfxPoolItem
+ /// flag bitmap, @see css::beans::PropertyAttribute
+ sal_Int16 nFlags;
+ /// "member ID" to tell QueryValue/PutValue which property it is
+ /// (when multiple properties map to the same nWID)
+ sal_uInt8 nMemberId;
+ PropertyMoreFlags nMoreFlags;
+
+ SfxItemPropertyMapEntry(OUString _aName, sal_uInt16 _nWID, css::uno::Type const & _rType,
+ sal_Int16 _nFlags, sal_uInt8 const _nMemberId, PropertyMoreFlags _nMoreFlags = PropertyMoreFlags::NONE)
+ : aName(std::move( _aName ))
+ , aType( _rType )
+ , nWID( _nWID )
+ , nFlags( _nFlags )
+ , nMemberId( _nMemberId )
+ , nMoreFlags( _nMoreFlags )
+ {
+ assert(_nFlags <= 0x1ff );
+ assert( (_nMemberId & 0x40) == 0 );
+ // Verify that if METRIC_ITEM is set, we are one of the types supported by
+ // SvxUnoConvertToMM.
+ assert(!(_nMoreFlags & PropertyMoreFlags::METRIC_ITEM) ||
+ ( (aType.getTypeClass() == css::uno::TypeClass_BYTE)
+ || (aType.getTypeClass() == css::uno::TypeClass_SHORT)
+ || (aType.getTypeClass() == css::uno::TypeClass_UNSIGNED_SHORT)
+ || (aType.getTypeClass() == css::uno::TypeClass_LONG)
+ || (aType.getTypeClass() == css::uno::TypeClass_UNSIGNED_LONG)
+ ) );
+ }
+};
+
+struct SfxItemPropertyMapCompare
+{
+ bool operator() ( const SfxItemPropertyMapEntry * lhs, const SfxItemPropertyMapEntry * rhs ) const
+ {
+ return lhs->aName < rhs->aName;
+ }
+};
+class SVL_DLLPUBLIC SfxItemPropertyMap
+{
+ o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare > m_aMap;
+ mutable css::uno::Sequence< css::beans::Property > m_aPropSeq;
+public:
+ SfxItemPropertyMap( std::span<const SfxItemPropertyMapEntry> pEntries );
+ SfxItemPropertyMap( const SfxItemPropertyMap& rSource );
+ ~SfxItemPropertyMap();
+
+ const SfxItemPropertyMapEntry* getByName( std::u16string_view rName ) const;
+ css::uno::Sequence< css::beans::Property > const & getProperties() const;
+ /// @throws css::beans::UnknownPropertyException
+ css::beans::Property getPropertyByName( const OUString & rName ) const;
+ bool hasPropertyByName( std::u16string_view rName ) const;
+
+ const o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare >& getPropertyEntries() const { return m_aMap; }
+};
+
+class SVL_DLLPUBLIC SfxItemPropertySet final
+{
+ SfxItemPropertyMap m_aMap;
+ mutable css::uno::Reference<css::beans::XPropertySetInfo> m_xInfo;
+
+public:
+ SfxItemPropertySet( std::span<const SfxItemPropertyMapEntry> pMap ) :
+ m_aMap(pMap) {}
+ ~SfxItemPropertySet();
+
+ /// @throws css::uno::RuntimeException
+ void getPropertyValue( const SfxItemPropertyMapEntry& rEntry,
+ const SfxItemSet& rSet,
+ css::uno::Any& rAny) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::beans::UnknownPropertyException
+ void getPropertyValue( const OUString &rName,
+ const SfxItemSet& rSet,
+ css::uno::Any& rAny) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::beans::UnknownPropertyException
+ css::uno::Any
+ getPropertyValue( const OUString &rName,
+ const SfxItemSet& rSet ) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::IllegalArgumentException
+ void setPropertyValue( const SfxItemPropertyMapEntry& rEntry,
+ const css::uno::Any& aVal,
+ SfxItemSet& rSet ) const;
+ /// @throws css::uno::RuntimeException
+ /// @throws css::lang::IllegalArgumentException
+ /// @throws css::beans::UnknownPropertyException
+ void setPropertyValue( const OUString& rPropertyName,
+ const css::uno::Any& aVal,
+ SfxItemSet& rSet ) const;
+
+ /// @throws css::beans::UnknownPropertyException
+ css::beans::PropertyState
+ getPropertyState(const OUString& rName, const SfxItemSet& rSet)const;
+ css::beans::PropertyState
+ getPropertyState(const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet) const
+ noexcept;
+
+ css::uno::Reference<css::beans::XPropertySetInfo> const &
+ getPropertySetInfo() const;
+ const SfxItemPropertyMap& getPropertyMap() const {return m_aMap;}
+};
+
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE SfxItemPropertySetInfo_Base : public cppu::WeakImplHelper< css::beans::XPropertySetInfo > {};
+
+class SVL_DLLPUBLIC SfxItemPropertySetInfo final : public SfxItemPropertySetInfo_Base
+{
+ SfxItemPropertyMap m_aOwnMap;
+
+public:
+ SfxItemPropertySetInfo(const SfxItemPropertyMap &rMap );
+ SfxItemPropertySetInfo(std::span<const SfxItemPropertyMapEntry> pEntries );
+ virtual ~SfxItemPropertySetInfo() override;
+
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL
+ getProperties( ) override;
+
+ virtual css::beans::Property SAL_CALL
+ getPropertyByName( const OUString& aName ) override;
+
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const OUString& Name ) override;
+
+};
+
+struct SfxItemPropertyMapCompare2
+{
+ bool operator() ( const SfxItemPropertyMapEntry & lhs, const SfxItemPropertyMapEntry & rhs ) const
+ {
+ return lhs.aName < rhs.aName;
+ }
+};
+
+// workaround for incremental linking bugs in MSVC2015
+class SAL_DLLPUBLIC_TEMPLATE SfxExtItemPropertySetInfo_Base : public cppu::WeakImplHelper< css::beans::XPropertySetInfo > {};
+
+class SVL_DLLPUBLIC SfxExtItemPropertySetInfo final : public SfxExtItemPropertySetInfo_Base
+{
+public:
+ SfxExtItemPropertySetInfo(
+ std::span<const SfxItemPropertyMapEntry> pMap,
+ const css::uno::Sequence<css::beans::Property>& rPropSeq );
+ virtual ~SfxExtItemPropertySetInfo() override;
+
+ virtual css::uno::Sequence< css::beans::Property > SAL_CALL
+ getProperties( ) override;
+
+ virtual css::beans::Property SAL_CALL
+ getPropertyByName( const OUString& aName ) override;
+
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const OUString& Name ) override;
+
+private:
+ const SfxItemPropertyMapEntry* getByName( std::u16string_view rName ) const;
+ o3tl::sorted_vector< SfxItemPropertyMapEntry, SfxItemPropertyMapCompare2 > maMap;
+ mutable css::uno::Sequence< css::beans::Property > m_aPropSeq;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
new file mode 100644
index 0000000000..774fe131c1
--- /dev/null
+++ b/include/svl/itemset.hxx
@@ -0,0 +1,357 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <cassert>
+#include <memory>
+#include <utility>
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <svl/typedwhich.hxx>
+#include <svl/whichranges.hxx>
+
+class SfxItemPool;
+
+#ifdef DBG_UTIL
+SVL_DLLPUBLIC size_t getAllocatedSfxItemSetCount();
+SVL_DLLPUBLIC size_t getUsedSfxItemSetCount();
+SVL_DLLPUBLIC size_t getAllocatedSfxPoolItemHolderCount();
+SVL_DLLPUBLIC size_t getUsedSfxPoolItemHolderCount();
+#endif
+
+// ItemSet/ItemPool helpers
+SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, SfxPoolItem const* pSource, sal_uInt16 nWhich, bool bPassingOwnership);
+void implCleanupItemEntry(SfxItemPool& rPool, SfxPoolItem const* pSource);
+
+class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxPoolItemHolder
+{
+ SfxItemPool* m_pPool;
+ const SfxPoolItem* m_pItem;
+#ifndef NDEBUG
+ bool m_bDeleted;
+#endif
+public:
+ SfxPoolItemHolder();
+ SfxPoolItemHolder(SfxItemPool&, const SfxPoolItem*, bool bPassingOwnership = false);
+ SfxPoolItemHolder(const SfxPoolItemHolder&);
+ ~SfxPoolItemHolder();
+
+#ifndef NDEBUG
+ bool isDeleted() const { return m_bDeleted; }
+#endif
+
+ const SfxPoolItemHolder& operator=(const SfxPoolItemHolder&);
+ bool operator==(const SfxPoolItemHolder &) const;
+ SfxItemPool& getPool() const { assert(!isDeleted() && "Destructed instance used (!)"); return *m_pPool; }
+ const SfxPoolItem* getItem() const { assert(!isDeleted() && "Destructed instance used (!)"); return m_pItem; }
+ sal_uInt16 Which() const { if(nullptr != m_pItem) return m_pItem->Which(); return 0; }
+};
+
+class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxItemSet
+{
+ friend class SfxItemIter;
+ friend class SfxWhichIter;
+
+ // allow ItemSetTooling to access
+ friend SfxPoolItem const* implCreateItemEntry(SfxItemPool&, SfxPoolItem const*, sal_uInt16, bool);
+ friend void implCleanupItemEntry(SfxItemPool&, SfxPoolItem const*);
+
+ SfxItemPool* m_pPool; ///< pool that stores the items
+ const SfxItemSet* m_pParent; ///< derivation
+ sal_uInt16 m_nCount; ///< number of items
+ sal_uInt16 m_nTotalCount; ///< number of WhichIDs, also size of m_ppItems array
+
+ // bitfield (better packaging if a bool needs to be added)
+ bool m_bItemsFixed : 1; ///< true if this is a SfxItemSetFixed object, so does not *own* m_ppItems
+
+ SfxPoolItem const** m_ppItems; ///< pointer to array of items, we allocate and free this unless m_bItemsFixed==true
+ WhichRangesContainer m_pWhichRanges; ///< array of Which Ranges
+
+ // Notification-Callback mechanism for SwAttrSet in SW, functionPtr for callback
+ std::function<void(const SfxPoolItem*, const SfxPoolItem*)> m_aCallback;
+
+protected:
+ // Notification-Callback mechanism for SwAttrSet in SW
+ void setCallback(const std::function<void(const SfxPoolItem*, const SfxPoolItem*)> &func) { m_aCallback = func; }
+ void clearCallback() { m_aCallback = nullptr; }
+
+ // container library interface support
+ // only for internal use (for now), thus protected
+ using const_iterator = SfxPoolItem const**;
+
+ const_iterator begin() const noexcept { return m_ppItems; }
+ const_iterator end() const noexcept { return begin() + m_nTotalCount; }
+
+ bool empty() const noexcept { return 0 == m_nTotalCount; }
+ sal_Int32 size() const noexcept { return m_nTotalCount; }
+ SfxPoolItem const* operator[](sal_Int32 idx) const noexcept
+ {
+ assert(idx >= 0 && idx < m_nTotalCount && "index out of range");
+ return m_ppItems[idx];
+ }
+
+friend class SfxAllItemSet;
+
+private:
+ SVL_DLLPRIVATE void RecreateRanges_Impl(const WhichRangesContainer& pNewRanges);
+
+public:
+ SfxPoolItem const** GetItems_Impl() const { return m_ppItems; }
+
+private:
+ const SfxItemSet& operator=(const SfxItemSet &) = delete;
+
+protected:
+ virtual const SfxPoolItem* PutImpl( const SfxPoolItem&, sal_uInt16 nWhich, bool bPassingOwnership );
+
+ /** special constructor for SfxAllItemSet */
+ enum class SfxAllItemSetFlag { Flag };
+ SfxItemSet( SfxItemPool&, SfxAllItemSetFlag );
+ /** special constructor for SfxItemSetFixed */
+ SfxItemSet( SfxItemPool&, WhichRangesContainer&& ranges, SfxPoolItem const ** ppItems, sal_uInt16 nTotalCount );
+
+public:
+ SfxItemSet( const SfxItemSet& );
+ SfxItemSet( SfxItemSet&& ) noexcept;
+ SfxItemSet( SfxItemPool& );
+ SfxItemSet( SfxItemPool&, WhichRangesContainer ranges );
+
+ SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhichStart, sal_uInt16 nWhichEnd )
+ : SfxItemSet(rPool, WhichRangesContainer(nWhichStart, nWhichEnd)) {}
+
+ template<sal_uInt16... WIDs>
+ SfxItemSet(SfxItemPool& pool, svl::Items_t<WIDs...> wids)
+ : SfxItemSet(pool, WhichRangesContainer(wids)) {}
+
+ virtual ~SfxItemSet();
+
+ virtual std::unique_ptr<SfxItemSet> Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
+ /** note that this only works if you know for sure that you are dealing with an SfxItemSet
+ and not one of it's subclasses. */
+ SfxItemSet CloneAsValue(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
+
+ // Get number of items
+ sal_uInt16 Count() const { return m_nCount; }
+ sal_uInt16 TotalCount() const { return m_nTotalCount; }
+
+ const SfxPoolItem& Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const;
+ template<class T>
+ const T& Get( TypedWhichId<T> nWhich, bool bSrchInParent = true ) const
+ {
+ return static_cast<const T&>(Get(sal_uInt16(nWhich), bSrchInParent));
+ }
+
+ /** This method eases accessing single Items in the SfxItemSet.
+
+ @param nId SlotId or the Item's WhichId
+ @param bSearchInParent also search in parent ItemSets
+ @returns 0 if the ItemSet does not contain an Item with the Id 'nWhich'
+ */
+ const SfxPoolItem* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const;
+
+ /// Templatized version of GetItem() to directly return the correct type.
+ template<class T> const T* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const
+ {
+ const SfxPoolItem* pItem = GetItem(nWhich, bSearchInParent);
+ const T* pCastedItem = dynamic_cast<const T*>(pItem);
+
+ assert(!pItem || pCastedItem); // if it exists, must have the correct type
+ return pCastedItem;
+ }
+ template<class T> const T* GetItem( TypedWhichId<T> nWhich, bool bSearchInParent = true ) const
+ {
+ return GetItem<T>(sal_uInt16(nWhich), bSearchInParent);
+ }
+
+
+ /// Templatized static version of GetItem() to directly return the correct type if the SfxItemSet is available.
+ template<class T> static const T* GetItem(const SfxItemSet* pItemSet, sal_uInt16 nWhich, bool bSearchInParent)
+ {
+ if (pItemSet)
+ return pItemSet->GetItem<T>(nWhich, bSearchInParent);
+
+ return nullptr;
+ }
+ template <class T>
+ static const T* GetItem(const SfxItemSet* pItemSet, TypedWhichId<T> nWhich,
+ bool bSearchInParent)
+ {
+ return GetItem<T>(pItemSet, static_cast<sal_uInt16>(nWhich), bSearchInParent);
+ }
+
+ sal_uInt16 GetWhichByOffset(sal_uInt16 nOffset) const;
+
+ SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent = true, const SfxPoolItem **ppItem = nullptr) const
+ {
+ // use local helper, start value for looped-through SfxItemState value is SfxItemState::UNKNOWN
+ return GetItemState_ForWhichID(SfxItemState::UNKNOWN, nWhich, bSrchInParent, ppItem);
+ }
+
+ template <class T> SfxItemState GetItemState(TypedWhichId<T> nWhich, bool bSrchInParent = true, const T **ppItem = nullptr ) const
+ {
+ // use local helper, start value for looped-through SfxItemState value is SfxItemState::UNKNOWN
+ return GetItemState_ForWhichID(SfxItemState::UNKNOWN, sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<SfxPoolItem const**>(ppItem));
+ }
+
+ /// Templatized version of GetItemState() to directly return the correct type.
+ template<class T>
+ const T * GetItemIfSet( TypedWhichId<T> nWhich,
+ bool bSrchInParent = true ) const
+ {
+ const SfxPoolItem * pItem = nullptr;
+ if (SfxItemState::SET == GetItemState_ForWhichID(SfxItemState::UNKNOWN, sal_uInt16(nWhich), bSrchInParent, &pItem))
+ return static_cast<const T*>(pItem);
+ return nullptr;
+ }
+
+ bool HasItem(sal_uInt16 nWhich, const SfxPoolItem** ppItem = nullptr) const;
+ template<class T>
+ bool HasItem(TypedWhichId<T> nWhich, const T** ppItem = nullptr) const
+ { return HasItem(sal_uInt16(nWhich), reinterpret_cast<const SfxPoolItem**>(ppItem)); }
+
+ void DisableItem(sal_uInt16 nWhich);
+ void InvalidateItem(sal_uInt16 nWhich)
+ { InvalidateItem_ForWhichID(nWhich); }
+ sal_uInt16 ClearItem( sal_uInt16 nWhich = 0);
+ void ClearInvalidItems();
+ void InvalidateAllItems(); // HACK(via nWhich = 0) ???
+
+ inline void SetParent( const SfxItemSet* pNew );
+
+ // add, delete items, work on items
+public:
+ const SfxPoolItem* Put( const SfxPoolItem& rItem, sal_uInt16 nWhich )
+ { return PutImpl(rItem, nWhich, /*bPassingOwnership*/false); }
+ const SfxPoolItem* Put( std::unique_ptr<SfxPoolItem> xItem, sal_uInt16 nWhich )
+ { return PutImpl(*xItem.release(), nWhich, /*bPassingOwnership*/true); }
+ const SfxPoolItem* Put( const SfxPoolItem& rItem )
+ { return Put(rItem, rItem.Which()); }
+ const SfxPoolItem* Put( std::unique_ptr<SfxPoolItem> xItem )
+ { auto nWhich = xItem->Which(); return Put(std::move(xItem), nWhich); }
+ bool Put( const SfxItemSet&,
+ bool bInvalidAsDefault = true );
+ void PutExtended( const SfxItemSet&,
+ SfxItemState eDontCareAs,
+ SfxItemState eDefaultAs );
+
+ bool Set( const SfxItemSet&, bool bDeep = true );
+
+ void Intersect( const SfxItemSet& rSet );
+ void MergeValues( const SfxItemSet& rSet );
+ void Differentiate( const SfxItemSet& rSet );
+ void MergeValue( const SfxPoolItem& rItem, bool bOverwriteDefaults = false );
+
+ SfxItemPool* GetPool() const { return m_pPool; }
+ const WhichRangesContainer & GetRanges() const { return m_pWhichRanges; }
+ void SetRanges( const WhichRangesContainer& );
+ void SetRanges( WhichRangesContainer&& );
+ void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
+ const SfxItemSet* GetParent() const { return m_pParent; }
+
+ bool operator==(const SfxItemSet &) const;
+
+ /** Compare possibly ignoring SfxItemPool pointer.
+
+ This can be used to compare the content of two SfxItemSet even if they
+ don't share the same pool. EditTextObject::Equals(...,false) uses this
+ which is needed in ScGlobal::EETextObjEqual() for
+ ScPageHFItem::operator==()
+
+ @param bComparePool
+ if <FALSE/> ignore SfxItemPool pointer,
+ if <TRUE/> compare also SfxItemPool pointer (identical to operator==())
+ */
+ bool Equals(const SfxItemSet &, bool bComparePool) const;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+private:
+ // split version(s) of ClearSingleItemImpl for input types WhichID and Offset
+ sal_uInt16 ClearSingleItem_ForWhichID( sal_uInt16 nWhich );
+ sal_uInt16 ClearSingleItem_ForOffset( sal_uInt16 nOffset );
+
+ // cleanup all Items, but do not reset/change m_ppItems array. That is
+ // responsibility of the caller & allows specific resets
+ sal_uInt16 ClearAllItemsImpl();
+
+ // Merge two given Item(entries)
+ void MergeItem_Impl(const SfxPoolItem **ppFnd1, const SfxPoolItem *pFnd2, bool bIgnoreDefaults);
+
+ // split version(s) of InvalidateItem for input types WhichID and Offset
+ void InvalidateItem_ForWhichID(sal_uInt16 nWhich);
+ void InvalidateItem_ForOffset(sal_uInt16 nOffset);
+
+ // split version(s) of GetItemStateImpl for input types WhichID and Offset
+ SfxItemState GetItemState_ForWhichID( SfxItemState eState, sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem) const;
+ SfxItemState GetItemState_ForOffset( sal_uInt16 nOffset, const SfxPoolItem **ppItem) const;
+};
+
+inline void SfxItemSet::SetParent( const SfxItemSet* pNew )
+{
+ m_pParent = pNew;
+}
+
+class SVL_DLLPUBLIC SfxAllItemSet final : public SfxItemSet
+
+// Handles all Ranges. Ranges are automatically modified by putting items.
+
+{
+public:
+ SfxAllItemSet( SfxItemPool &rPool );
+ SfxAllItemSet( const SfxItemSet & );
+ SfxAllItemSet( const SfxAllItemSet & );
+
+ virtual std::unique_ptr<SfxItemSet> Clone( bool bItems = true, SfxItemPool *pToPool = nullptr ) const override;
+private:
+ virtual const SfxPoolItem* PutImpl( const SfxPoolItem&, sal_uInt16 nWhich, bool bPassingOwnership ) override;
+};
+
+
+namespace svl::detail
+{
+/**
+ * Determines the number of sal_uInt16s in a container of pairs of
+ * sal_uInt16s, each representing a range of sal_uInt16s, and total capacity of the ranges.
+ */
+template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16... Rest>
+static constexpr sal_uInt16 CountRanges1()
+{
+ sal_uInt16 nCapacity = rangeSize(WID1, WID2);
+ if constexpr (sizeof...(Rest) > 0)
+ nCapacity += CountRanges1<Rest...>();
+ return nCapacity;
+}}
+
+// Allocate the items array inside the object, to reduce allocation cost.
+//
+template<sal_uInt16... WIDs>
+class SfxItemSetFixed : public SfxItemSet
+{
+public:
+ SfxItemSetFixed( SfxItemPool& rPool)
+ : SfxItemSet(rPool, WhichRangesContainer(svl::Items_t<WIDs...>{}), m_aItems, NITEMS) {}
+private:
+ static constexpr sal_uInt16 NITEMS = svl::detail::CountRanges1<WIDs...>();
+ const SfxPoolItem* m_aItems[NITEMS] = {};
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
new file mode 100644
index 0000000000..e780ed4751
--- /dev/null
+++ b/include/svl/languageoptions.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_LANGUAGEOPTIONS_HXX
+#define INCLUDED_SVL_LANGUAGEOPTIONS_HXX
+
+#include <svl/svldllapi.h>
+#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
+#include <i18nlangtag/lang.h>
+
+// class SvtLanguageOptions ----------------------------------------------------
+
+// these defines can be ORed
+// note these values DO NOT match the values in css::i18n::ScriptType
+enum class SvtScriptType : sal_uInt8
+{
+ NONE = 0x00,
+ LATIN = 0x01,
+ ASIAN = 0x02,
+ COMPLEX = 0x04,
+ UNKNOWN = 0x08 // (only used in SC) if type has not been determined yet
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvtScriptType> : is_typed_flags<SvtScriptType, 0x0f> {};
+}
+
+namespace SvtLanguageOptions
+{
+ // CJK options
+// SVL_DLLPUBLIC bool IsCJKFontEnabled() { m_pCJKOptions->IsCJKFontEnabled(); }
+// SVL_DLLPUBLIC bool IsVerticalTextEnabled() m_pCJKOptions->IsVerticalTextEnabled();
+// SVL_DLLPUBLIC bool IsAsianTypographyEnabled() m_pCJKOptions->IsAsianTypographyEnabled();
+// SVL_DLLPUBLIC bool IsJapaneseFindEnabled() m_pCJKOptions->IsJapaneseFindEnabled();
+// SVL_DLLPUBLIC void SetAll( bool _bSet ) m_pCJKOptions->SetAll( _bSet );
+// SVL_DLLPUBLIC bool IsAnyEnabled() m_pCJKOptions->IsAnyEnabled();
+
+ // CTL options
+ //SVL_DLLPUBLIC void SetCTLFontEnabled( bool _bEnabled ) m_pCTLOptions->SetCTLFontEnabled( _bEnabled );
+// SVL_DLLPUBLIC bool IsCTLFontEnabled() m_pCTLOptions->IsCTLFontEnabled();
+
+// SVL_DLLPUBLIC void SetCTLSequenceChecking( bool _bEnabled ) m_pCTLOptions->SetCTLSequenceChecking( _bEnabled );
+
+ //SVL_DLLPUBLIC void SetCTLSequenceCheckingRestricted( bool _bEnable ) m_pCTLOptions->SetCTLSequenceCheckingRestricted( _bEnable );
+
+// SVL_DLLPUBLIC void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable ) m_pCTLOptions->SetCTLSequenceCheckingTypeAndReplace( _bEnable );
+
+ // returns for a language the scripttype
+ SVL_DLLPUBLIC SvtScriptType GetScriptTypeOfLanguage( LanguageType nLang );
+
+ // convert from css::i18n::ScriptType constants to SvtScriptType
+ SVL_DLLPUBLIC SvtScriptType FromI18NToSvtScriptType( sal_Int16 nI18NType );
+
+ SVL_DLLPUBLIC sal_Int16 FromSvtScriptTypeToI18N( SvtScriptType nI18NType );
+
+ SVL_DLLPUBLIC sal_Int16 GetI18NScriptTypeOfLanguage( LanguageType nLang );
+
+};
+
+/** #i42730# Gives access to the Windows 16bit system locale
+ */
+namespace SvtSystemLanguageOptions
+{
+ bool isCJKKeyboardLayoutInstalled();
+};
+
+#endif // INCLUDED_SVL_LANGUAGEOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lckbitem.hxx b/include/svl/lckbitem.hxx
new file mode 100644
index 0000000000..5625a7aac0
--- /dev/null
+++ b/include/svl/lckbitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_LCKBITEM_HXX
+#define INCLUDED_SVL_LCKBITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/svldllapi.h>
+#include <tools/stream.hxx>
+
+class SVL_DLLPUBLIC SfxLockBytesItem final : public SfxPoolItem
+{
+ SvLockBytesRef _xVal;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxLockBytesItem();
+ virtual ~SfxLockBytesItem() override;
+
+ SfxLockBytesItem(SfxLockBytesItem const &) = default;
+ SfxLockBytesItem(SfxLockBytesItem &&) = default;
+ SfxLockBytesItem & operator =(SfxLockBytesItem const &) = delete; // due to SfxPoolItem
+ SfxLockBytesItem & operator =(SfxLockBytesItem &&) = delete; // due to SfxPoolItem
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxLockBytesItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ SvLockBytes* GetValue() const { return _xVal.get(); }
+
+ virtual bool PutValue ( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/legacyitem.hxx b/include/svl/legacyitem.hxx
new file mode 100644
index 0000000000..b2035aecaf
--- /dev/null
+++ b/include/svl/legacyitem.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_LEGACYITEM_HXX
+#define INCLUDED_SVL_LEGACYITEM_HXX
+
+#include <svl/svldllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// // svl
+// SfxBoolItem aLinebreak;
+// SfxInt32Item aRotateAngle; -> CntInt32Item
+//////////////////////////////////////////////////////////////////////////////
+
+class SvStream;
+class SfxBoolItem;
+class CntInt32Item;
+
+namespace legacy
+{
+ namespace SfxBool
+ {
+ sal_uInt16 SVL_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void SVL_DLLPUBLIC Create(SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SVL_DLLPUBLIC SvStream& Store(const SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+ namespace CntInt32
+ {
+ sal_uInt16 SVL_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion);
+ void SVL_DLLPUBLIC Create(CntInt32Item& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ SVL_DLLPUBLIC SvStream& Store(const CntInt32Item& rItem, SvStream& rStrm, sal_uInt16 nItemVersion);
+ }
+}
+
+#endif // INCLUDED_SVL_LEGACYITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/listener.hxx b/include/svl/listener.hxx
new file mode 100644
index 0000000000..e7c5896253
--- /dev/null
+++ b/include/svl/listener.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_LISTENER_HXX
+#define INCLUDED_SVL_LISTENER_HXX
+
+#include <svl/svldllapi.h>
+
+#include <o3tl/sorted_vector.hxx>
+
+class SvtBroadcaster;
+class SfxHint;
+
+class SVL_DLLPUBLIC SvtListener
+{
+ friend class SvtBroadcaster;
+ typedef o3tl::sorted_vector<SvtBroadcaster*> BroadcastersType;
+ BroadcastersType maBroadcasters;
+
+ const SvtListener& operator=(const SvtListener &) = delete;
+ // called from the SvtBroadcaster destructor
+ void BroadcasterDying( SvtBroadcaster& rBroadcaster );
+
+public:
+ class SVL_DLLPUBLIC QueryBase
+ {
+ sal_uInt16 mnId;
+ public:
+ QueryBase( sal_uInt16 nId ) : mnId(nId) {}
+ virtual ~QueryBase() {};
+
+ sal_uInt16 getId() const { return mnId; }
+ };
+
+ SvtListener() = default;
+ SvtListener( const SvtListener &r ) = default;
+ virtual ~SvtListener() COVERITY_NOEXCEPT_FALSE;
+
+ bool StartListening( SvtBroadcaster& rBroadcaster );
+ void EndListening( SvtBroadcaster& rBroadcaster );
+ void EndListeningAll();
+
+ /// Overwrites existing broadcasters with the ones from the specified listener
+ void CopyAllBroadcasters( const SvtListener& r );
+ bool HasBroadcaster() const { return !maBroadcasters.empty(); }
+
+ virtual void Notify( const SfxHint& rHint );
+ virtual void Query( QueryBase& rQuery ) const;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lngmisc.hxx b/include/svl/lngmisc.hxx
new file mode 100644
index 0000000000..eb7b7cbbe3
--- /dev/null
+++ b/include/svl/lngmisc.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_LNGMISC_HXX
+#define INCLUDED_SVL_LNGMISC_HXX
+
+#include <svl/svldllapi.h>
+
+#include <rtl/ustring.hxx>
+
+#define SVT_SOFT_HYPHEN u'\x00AD'
+#define SVT_HARD_HYPHEN u'\x2011'
+
+// the non-breaking space
+#define SVT_HARD_SPACE u'\x00A0'
+
+namespace linguistic
+{
+ inline bool IsHyphen(sal_Unicode cChar)
+ {
+ return cChar == SVT_SOFT_HYPHEN || cChar == SVT_HARD_HYPHEN;
+ }
+
+ inline bool IsControlChar(sal_Unicode cChar)
+ {
+ // TODO: why doesn't this include 0x7F DEL?
+ return cChar < u' ';
+ }
+
+ sal_Int32 GetNumControlChars( std::u16string_view rTxt );
+
+ SVL_DLLPUBLIC bool RemoveHyphens(OUString &rTxt);
+ SVL_DLLPUBLIC bool RemoveControlChars(OUString &rTxt);
+ SVL_DLLPUBLIC bool ReplaceControlChars(OUString &rTxt);
+ SVL_DLLPUBLIC OUString GetThesaurusReplaceText(const OUString &rText);
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lockfilecommon.hxx b/include/svl/lockfilecommon.hxx
new file mode 100644
index 0000000000..6a19681b6f
--- /dev/null
+++ b/include/svl/lockfilecommon.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_LOCKFILECOMMON_HXX
+#define INCLUDED_SVL_LOCKFILECOMMON_HXX
+
+#include <svl/svldllapi.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <tools/urlobj.hxx>
+#include <o3tl/enumarray.hxx>
+
+#include <mutex>
+#include <string_view>
+#include <vector>
+
+enum class LockFileComponent
+{
+ OOOUSERNAME, SYSUSERNAME, LOCALHOST, EDITTIME, USERURL, LAST=USERURL
+};
+
+typedef o3tl::enumarray<LockFileComponent,OUString> LockFileEntry;
+
+namespace svt {
+
+/// This is a general implementation that is used in document lock file implementation and in sharing control file implementation
+class SVL_DLLPUBLIC LockFileCommon
+{
+private:
+ OUString m_aURL;
+
+protected:
+ std::mutex m_aMutex;
+
+ /// This method generates the URL of the lock file based on the document URL and the specified prefix.
+ static OUString GenerateOwnLockFileURL(std::u16string_view aOrigURL, std::u16string_view aPrefix);
+
+public:
+ LockFileCommon(OUString aLockFileURL);
+ virtual ~LockFileCommon();
+
+ const OUString& GetURL() const;
+ void SetURL(const OUString& aURL);
+
+ static void ParseList( const css::uno::Sequence< sal_Int8 >& aBuffer, std::vector< LockFileEntry > &rOutput );
+ static LockFileEntry ParseEntry( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
+ static OUString ParseName( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
+ static OUString EscapeCharacters( const OUString& aSource );
+ static OUString GetOOOUserName();
+ static OUString GetCurrentLocalTime();
+ static LockFileEntry GenerateOwnEntry();
+
+ static INetURLObject ResolveLinks( const INetURLObject& aDocURL );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lstner.hxx b/include/svl/lstner.hxx
new file mode 100644
index 0000000000..f9a35f10a8
--- /dev/null
+++ b/include/svl/lstner.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_LSTNER_HXX
+#define INCLUDED_SVL_LSTNER_HXX
+
+#include <svl/svldllapi.h>
+#include <map>
+#include <memory>
+#include <vector>
+#ifdef DBG_UTIL
+#include <sal/backtrace.hxx>
+#endif
+
+class SfxBroadcaster;
+class SfxHint;
+
+//StartListening duplicate handling options
+//Prevent only adds the listener if it's not already added
+//Allow allows duplicate listeners
+//Unexpected, the default, is for the usual case where the
+//listener should only be added once and duplicates are
+//unexpected. In dbgutil mode this tracks where the original
+//listener was added from and reports the duplicate addition
+//as an error
+enum class DuplicateHandling { Unexpected, Prevent, Allow };
+
+class SVL_DLLPUBLIC SfxListener
+{
+ std::vector<SfxBroadcaster*> maBCs;
+#ifdef DBG_UTIL
+ std::map<SfxBroadcaster*, std::unique_ptr<sal::BacktraceState>>
+ maCallStacks;
+#endif
+
+private:
+ const SfxListener& operator=(const SfxListener &) = delete;
+
+public:
+
+ SfxListener() {}
+ SfxListener( const SfxListener &rCopy );
+ virtual ~SfxListener() COVERITY_NOEXCEPT_FALSE;
+
+ void StartListening(SfxBroadcaster& rBroadcaster, DuplicateHandling eDuplicateHanding = DuplicateHandling::Unexpected);
+ void EndListening( SfxBroadcaster& rBroadcaster, bool bRemoveAllDuplicates = false );
+ void EndListeningAll();
+ bool IsListening( SfxBroadcaster& rBroadcaster ) const;
+
+ sal_uInt16 GetBroadcasterCount() const;
+ SfxBroadcaster* GetBroadcasterJOE( sal_uInt16 nNo ) const;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ void RemoveBroadcaster_Impl( SfxBroadcaster& rBC );
+
+ /// Used to avoid cost of dynamic_cast in SdrViewIter::ImpFindView
+ virtual bool IsSdrView() const { return false; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/macitem.hxx b/include/svl/macitem.hxx
new file mode 100644
index 0000000000..1c2a4cf301
--- /dev/null
+++ b/include/svl/macitem.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_MACITEM_HXX
+#define INCLUDED_SVL_MACITEM_HXX
+
+// class SvxMacroItem ----------------------------------------------------
+
+#include <rtl/ustring.hxx>
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <map>
+#include <utility>
+
+class SvStream;
+enum class SvMacroItemId : sal_uInt16;
+
+inline constexpr OUString SVX_MACRO_LANGUAGE_JAVASCRIPT = u"JavaScript"_ustr;
+inline constexpr OUString SVX_MACRO_LANGUAGE_STARBASIC = u"StarBasic"_ustr;
+inline constexpr OUString SVX_MACRO_LANGUAGE_SF = u"Script"_ustr;
+
+enum ScriptType
+{
+ STARBASIC,
+ JAVASCRIPT,
+ EXTENDED_STYPE
+};
+
+class SVL_DLLPUBLIC SvxMacro
+{
+ OUString aMacName;
+ OUString aLibName;
+ ScriptType eType;
+
+public:
+
+ SvxMacro( OUString aMacName, const OUString &rLanguage);
+
+ SvxMacro( OUString aMacName, OUString aLibName,
+ ScriptType eType); // = STARBASIC removes
+
+ const OUString &GetLibName() const { return aLibName; }
+ const OUString &GetMacName() const { return aMacName; }
+ OUString GetLanguage()const;
+
+ ScriptType GetScriptType() const { return eType; }
+
+ bool HasMacro() const { return !aMacName.isEmpty(); }
+};
+
+inline SvxMacro::SvxMacro( OUString _aMacName, OUString _aLibName,
+ ScriptType eTyp )
+ : aMacName(std::move( _aMacName )), aLibName(std::move( _aLibName )), eType( eTyp )
+{}
+
+// Macro Table, destroys the pointers in the DTor!
+typedef std::map<SvMacroItemId, SvxMacro> SvxMacroTable;
+
+#define SVX_MACROTBL_VERSION31 0
+#define SVX_MACROTBL_VERSION40 1
+
+class SVL_DLLPUBLIC SvxMacroTableDtor
+{
+private:
+ SvxMacroTable aSvxMacroTable;
+public:
+ SvxMacroTableDtor() {}
+ SvxMacroTableDtor( const SvxMacroTableDtor &rCpy ) : aSvxMacroTable(rCpy.aSvxMacroTable) { }
+
+ SvxMacroTableDtor& operator=( const SvxMacroTableDtor &rCpy );
+ bool operator==( const SvxMacroTableDtor& rOther ) const;
+
+ void Read( SvStream & );
+ SvStream& Write( SvStream & ) const;
+
+ bool empty() const { return aSvxMacroTable.empty(); }
+
+ // returns NULL if no entry exists, or a pointer to the internal value
+ const SvxMacro* Get(SvMacroItemId nEvent) const;
+ // returns NULL if no entry exists, or a pointer to the internal value
+ SvxMacro* Get(SvMacroItemId nEvent);
+ // return true if the key exists
+ bool IsKeyValid(SvMacroItemId nEvent) const;
+ // This stores a copy of the rMacro parameter
+ SvxMacro& Insert(SvMacroItemId nEvent, const SvxMacro& rMacro);
+ // If the entry exists, remove it from the map and release it's storage
+ void Erase(SvMacroItemId nEvent);
+};
+
+
+/*
+This item describes a Macro table.
+*/
+
+class SVL_DLLPUBLIC SvxMacroItem final : public SfxPoolItem
+{
+public:
+ explicit inline SvxMacroItem ( const sal_uInt16 nId );
+
+ // "pure virtual methods" of SfxPoolItem
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual SvxMacroItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;}
+ void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; }
+
+ inline const SvxMacro& GetMacro( SvMacroItemId nEvent ) const;
+ inline bool HasMacro( SvMacroItemId nEvent ) const;
+ void SetMacro( SvMacroItemId nEvent, const SvxMacro& );
+
+private:
+ SvxMacroTableDtor aMacroTable;
+
+ SvxMacroItem( const SvxMacroItem& ) = default;
+};
+
+inline SvxMacroItem::SvxMacroItem( const sal_uInt16 nId )
+ : SfxPoolItem( nId )
+{}
+
+inline bool SvxMacroItem::HasMacro( SvMacroItemId nEvent ) const
+{
+ return aMacroTable.IsKeyValid( nEvent );
+}
+inline const SvxMacro& SvxMacroItem::GetMacro( SvMacroItemId nEvent ) const
+{
+ return *(aMacroTable.Get(nEvent));
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/memberid.h b/include/svl/memberid.h
new file mode 100644
index 0000000000..1853897138
--- /dev/null
+++ b/include/svl/memberid.h
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_MEMBERID_H
+#define INCLUDED_SVL_MEMBERID_H
+
+#define MID_X 1
+#define MID_Y 2
+#define MID_RECT_LEFT 3
+#define MID_RECT_TOP 4
+#define MID_WIDTH 5
+#define MID_HEIGHT 6
+#define MID_RECT_RIGHT 7
+
+// SvxSizeItem
+#define MID_SIZE_SIZE 0
+#define MID_SIZE_WIDTH 1
+#define MID_SIZE_HEIGHT 2
+
+// SvxSearchItem
+// XXX When changing the MID count here, also increment the corresponding
+// SvxSearchItem SFX_DECL_TYPE(n) value in include/sfx2/msg.hxx to match, and
+// add a member to struct SvxSearch in sfx2/sdi/sfxitems.sdi so that dependent
+// slot items get generated.
+#define MID_SEARCH_STYLEFAMILY 1
+#define MID_SEARCH_CELLTYPE 2
+#define MID_SEARCH_ROWDIRECTION 3
+#define MID_SEARCH_ALLTABLES 4
+#define MID_SEARCH_SEARCHFILTERED 5
+#define MID_SEARCH_BACKWARD 6
+#define MID_SEARCH_PATTERN 7
+#define MID_SEARCH_CONTENT 8
+#define MID_SEARCH_ASIANOPTIONS 9
+#define MID_SEARCH_ALGORITHMTYPE 10
+#define MID_SEARCH_FLAGS 11
+#define MID_SEARCH_SEARCHSTRING 12
+#define MID_SEARCH_REPLACESTRING 13
+#define MID_SEARCH_LOCALE 14
+#define MID_SEARCH_CHANGEDCHARS 15
+#define MID_SEARCH_DELETEDCHARS 16
+#define MID_SEARCH_INSERTEDCHARS 17
+#define MID_SEARCH_TRANSLITERATEFLAGS 18
+#define MID_SEARCH_COMMAND 19
+#define MID_SEARCH_STARTPOINTX 20
+#define MID_SEARCH_STARTPOINTY 21
+#define MID_SEARCH_SEARCHFORMATTED 22
+#define MID_SEARCH_ALGORITHMTYPE2 23
+
+// SfxDocumentInfoItem
+#define MID_DOCINFO_DESCRIPTION 0x13
+#define MID_DOCINFO_KEYWORDS 0x17
+#define MID_DOCINFO_SUBJECT 0x1b
+#define MID_DOCINFO_TITLE 0x1d
+#define MID_DOCINFO_AUTOLOADENABLED 0x2d
+#define MID_DOCINFO_AUTOLOADURL 0x2e
+#define MID_DOCINFO_AUTOLOADSECS 0x2f
+#define MID_DOCINFO_DEFAULTTARGET 0x30
+#define MID_DOCINFO_USEUSERDATA 0x31
+#define MID_DOCINFO_DELETEUSERDATA 0x32
+#define MID_DOCINFO_USETHUMBNAILSAVE 0x33
+#define MID_DOCINFO_CONTRIBUTOR 0x34
+#define MID_DOCINFO_COVERAGE 0x35
+#define MID_DOCINFO_IDENTIFIER 0x38
+#define MID_DOCINFO_PUBLISHER 0x3a
+#define MID_DOCINFO_RELATION 0x3b
+#define MID_DOCINFO_RIGHTS 0x3c
+#define MID_DOCINFO_SOURCE 0x3d
+#define MID_DOCINFO_TYPE 0x3e
+
+// only for FastPropertySet
+#define MID_TYPE 0x3f
+#define MID_VALUE 0x40
+#define MID_VALUESET 0x41
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/metitem.hxx b/include/svl/metitem.hxx
new file mode 100644
index 0000000000..30cf75b7f8
--- /dev/null
+++ b/include/svl/metitem.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_METITEM_HXX
+#define INCLUDED_SVL_METITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/intitem.hxx>
+
+class SVL_DLLPUBLIC SfxMetricItem: public SfxInt32Item
+{
+public:
+ explicit SfxMetricItem( sal_uInt16 nWhich, sal_Int32 nValue );
+
+ virtual void ScaleMetrics( tools::Long lMult, tools::Long lDiv ) override;
+ virtual bool HasMetrics() const override;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/msodocumentlockfile.hxx b/include/svl/msodocumentlockfile.hxx
new file mode 100644
index 0000000000..282f427b32
--- /dev/null
+++ b/include/svl/msodocumentlockfile.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_MSODOCUMENTLOCKFILE_HXX
+#define INCLUDED_SVL_MSODOCUMENTLOCKFILE_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/documentlockfile.hxx>
+
+#define MSO_WORD_LOCKFILE_SIZE 162
+#define MSO_EXCEL_AND_POWERPOINT_LOCKFILE_SIZE 165
+#define MSO_USERNAME_MAX_LENGTH 52
+
+namespace svt
+{
+/// Class implementing reading and writing MSO lockfiles.
+class SVL_DLLPUBLIC MSODocumentLockFile final : public GenDocumentLockFile
+{
+private:
+ enum class AppType
+ {
+ Word,
+ Excel,
+ PowerPoint
+ };
+ static AppType getAppType(std::u16string_view sOrigURL);
+ AppType m_eAppType;
+
+ virtual void
+ WriteEntryToStream(std::unique_lock<std::mutex>& rGuard, const LockFileEntry& aEntry,
+ const css::uno::Reference<css::io::XOutputStream>& xStream) override;
+
+ virtual css::uno::Reference<css::io::XInputStream>
+ OpenStream(std::unique_lock<std::mutex>& rGuard) override;
+
+ virtual LockFileEntry GetLockDataImpl(std::unique_lock<std::mutex>& rGuard) override;
+
+public:
+ MSODocumentLockFile(std::u16string_view aOrigURL);
+ virtual ~MSODocumentLockFile() override;
+
+ virtual void RemoveFile() override;
+
+ static bool IsMSOSupportedFileFormat(std::u16string_view aURL);
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svl/nfkeytab.hxx b/include/svl/nfkeytab.hxx
new file mode 100644
index 0000000000..3ab012f39c
--- /dev/null
+++ b/include/svl/nfkeytab.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_NFKEYTAB_HXX
+#define INCLUDED_SVL_NFKEYTAB_HXX
+
+#include <array>
+#include <rtl/ustring.hxx>
+
+//! For ImpSvNumberformatScan: first the short symbols, then the long symbols!
+//! e.g. first YY then YYYY
+//! The internal order is essential for the format code string scanner.
+//
+// This table is externally only to be used with method
+// OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable&, const LocaleDataWrapper& );
+// and method
+// void SvNumberFormatter::FillKeywordTable( NfKeywordTable&, LanguageType );
+enum NfKeywordIndex
+{
+ NF_KEY_NONE = 0,
+ NF_KEY_E, // exponential symbol
+ NF_KEY_AMPM, // AM/PM
+ NF_KEY_AP, // a/p
+ NF_KEY_MI, // minute (!)
+ NF_KEY_MMI, // minute 02 (!)
+ NF_KEY_M, // month (!)
+ NF_KEY_MM, // month 02 (!)
+ NF_KEY_MMM, // month short name
+ NF_KEY_MMMM, // month long name
+ NF_KEY_MMMMM, // month narrow name, first letter
+ NF_KEY_H, // hour
+ NF_KEY_HH, // hour 02
+ NF_KEY_S, // second
+ NF_KEY_SS, // second 02
+ NF_KEY_Q, // quarter
+ NF_KEY_QQ, // quarter 02
+ NF_KEY_D, // day of month
+ NF_KEY_DD, // day of month 02
+ NF_KEY_DDD, // day of week short
+ NF_KEY_DDDD, // day of week long
+ NF_KEY_YY, // year two digits
+ NF_KEY_YYYY, // year four digits
+ NF_KEY_NN, // day of week short
+ NF_KEY_NNN, // day of week long without separator, as of version 6, 10.10.97
+ NF_KEY_NNNN, // day of week long with separator
+ NF_KEY_AAA, // abbreviated day name from Japanese Xcl, same as DDD or NN English
+ NF_KEY_AAAA, // full day name from Japanese Xcl, same as DDDD or NNN English
+ NF_KEY_EC, // E non-gregorian calendar year without preceding 0
+ NF_KEY_EEC, // EE non-gregorian calendar year with preceding 0 (two digit)
+ NF_KEY_G, // abbreviated era name, latin characters M T S or H for Gengou calendar
+ NF_KEY_GG, // abbreviated era name
+ NF_KEY_GGG, // full era name
+ NF_KEY_R, // acts as EE (Xcl) => GR==GEE, GGR==GGEE, GGGR==GGGEE
+ NF_KEY_RR, // acts as GGGEE (Xcl)
+ NF_KEY_WW, // week of year, as of version 8, 19.06.98
+ NF_KEY_THAI_T, // Thai T modifier, speciality of Thai Excel, only used with Thai locale and converted to [NatNum1]
+ NF_KEY_CCC, // currency bank symbol (old version)
+ NF_KEY_BOOLEAN, // boolean
+ NF_KEY_GENERAL, // General / Standard
+ NF_KEY_LASTKEYWORD = NF_KEY_GENERAL,
+
+ // Reserved words translated and color names follow:
+ NF_KEY_TRUE, // boolean true
+ NF_KEY_FALSE, // boolean false
+ NF_KEY_COLOR, // color
+ NF_KEY_FIRSTCOLOR,
+ NF_KEY_BLACK = NF_KEY_FIRSTCOLOR, // you do know colors, don't you?
+ NF_KEY_BLUE,
+ NF_KEY_GREEN,
+ NF_KEY_CYAN,
+ NF_KEY_RED,
+ NF_KEY_MAGENTA,
+ NF_KEY_BROWN,
+ NF_KEY_GREY,
+ NF_KEY_YELLOW,
+ NF_KEY_WHITE,
+ NF_KEY_LASTCOLOR = NF_KEY_WHITE,
+
+ NF_KEYWORD_ENTRIES_COUNT
+};
+
+typedef ::std::array<OUString, NF_KEYWORD_ENTRIES_COUNT> NfKeywordTable;
+
+#endif // INCLUDED_SVL_NFKEYTAB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/nfsymbol.hxx b/include/svl/nfsymbol.hxx
new file mode 100644
index 0000000000..8a659857e0
--- /dev/null
+++ b/include/svl/nfsymbol.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_NFSYMBOL_HXX
+#define INCLUDED_SVL_NFSYMBOL_HXX
+
+/* ATTENTION! If new types arrive that had its content previously handled as
+ * SYMBOLTYPE_STRING, they have to be added at several places in zforscan.cxx
+ * and/or zformat.cxx, and in xmloff/source/style/xmlnumfe.cxx. Mostly these
+ * are places where already NF_SYMBOLTYPE_STRING together with
+ * NF_SYMBOLTYPE_CURRENCY or NF_SYMBOLTYPE_DATESEP are used in the same case of
+ * a switch respectively an if-condition.
+ */
+
+namespace svt {
+
+/// Number formatter's symbol types of a token, if not key words, which are >0
+enum NfSymbolType
+{
+ NF_SYMBOLTYPE_STRING = -1, // literal string in output
+ NF_SYMBOLTYPE_DEL = -2, // special character
+ NF_SYMBOLTYPE_BLANK = -3, // blank for '_'
+ NF_SYMBOLTYPE_STAR = -4, // *-character
+ NF_SYMBOLTYPE_DIGIT = -5, // digit place holder
+ NF_SYMBOLTYPE_DECSEP = -6, // decimal separator
+ NF_SYMBOLTYPE_THSEP = -7, // group AKA thousand separator
+ NF_SYMBOLTYPE_EXP = -8, // exponent E
+ NF_SYMBOLTYPE_FRAC = -9, // fraction /
+ NF_SYMBOLTYPE_EMPTY = -10, // deleted symbols
+ NF_SYMBOLTYPE_FRACBLANK = -11, // delimiter between integer and fraction
+ NF_SYMBOLTYPE_CURRENCY = -12, // currency symbol
+ NF_SYMBOLTYPE_CURRDEL = -13, // currency symbol delimiter [$]
+ NF_SYMBOLTYPE_CURREXT = -14, // currency symbol extension -xxx
+ NF_SYMBOLTYPE_CALENDAR = -15, // calendar ID
+ NF_SYMBOLTYPE_CALDEL = -16, // calendar delimiter [~]
+ NF_SYMBOLTYPE_DATESEP = -17, // date separator
+ NF_SYMBOLTYPE_TIMESEP = -18, // time separator
+ NF_SYMBOLTYPE_TIME100SECSEP = -19, // time 100th seconds separator
+ NF_SYMBOLTYPE_PERCENT = -20, // percent %
+ NF_SYMBOLTYPE_FRAC_FDIV = -21 // forced divisors
+};
+
+} // namespace svt
+
+#endif // INCLUDED_SVL_NFSYMBOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx
new file mode 100644
index 0000000000..0a374f3c33
--- /dev/null
+++ b/include/svl/numformat.hxx
@@ -0,0 +1,753 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/i18n/XNumberFormatCode.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <i18nlangtag/lang.h>
+#include <tools/link.hxx>
+#include <svl/nfkeytab.hxx>
+#include <svl/ondemand.hxx>
+#include <svl/zforlist.hxx>
+#include <unotools/charclass.hxx>
+
+#include <map>
+
+class Color;
+class ImpSvNumberformatScan;
+class ImpSvNumberInputScan;
+class SvNumberFormatterRegistry_Impl;
+class NfCurrencyTable;
+
+class SVL_DLLPUBLIC SvNumberFormatter
+{
+ friend class SvNumberFormatterRegistry_Impl;
+
+public:
+ /**
+ * We can't technically have an "infinite" value, so we use an arbitrary
+ * upper precision threshold to represent the "unlimited" precision.
+ */
+ static const sal_uInt16 UNLIMITED_PRECISION;
+
+ /**
+ * Precision suitable for numbers displayed in input bar, for instance
+ * Calc's formula input bar.
+ */
+ static const sal_uInt16 INPUTSTRING_PRECISION;
+
+ /// Preferred ctor with service manager and language/country enum
+ SvNumberFormatter(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ LanguageType eLang);
+
+ ~SvNumberFormatter();
+
+ /// Set CallBack to ColorTable
+ void SetColorLink(const Link<sal_uInt16, Color*>& rColorTableCallBack);
+ /// Do the CallBack to ColorTable
+ Color* GetUserDefColor(sal_uInt16 nIndex);
+
+ /// Change language/country, also input and format scanner
+ void ChangeIntl(LanguageType eLnge);
+ /// Change the reference null date
+ void ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear);
+ /// Change standard precision
+ void ChangeStandardPrec(short nPrec);
+ /// Set zero value suppression
+ void SetNoZero(bool bNZ);
+
+ /** The language with which the formatter was initialized (system setting),
+ NOT the current language after a ChangeIntl() */
+ LanguageType GetLanguage() const;
+
+ // Determine whether two format types are input compatible or not
+ static bool IsCompatible(SvNumFormatType eOldType, SvNumFormatType eNewType);
+
+ /** Get table of formats of a specific type of a locale. A format FIndex is
+ tested whether it has the type and locale requested, if it doesn't
+ match FIndex returns the default format for the type/locale. If no
+ specific format is to be selected FIndex may be initialized to 0. */
+ SvNumberFormatTable& GetEntryTable(SvNumFormatType eType, sal_uInt32& FIndex,
+ LanguageType eLnge);
+
+ /** Get table of formats of a specific type of a language/country.
+ FIndex returns the default format of that type.
+ If the language/country was never touched before new entries are generated */
+ SvNumberFormatTable& ChangeCL(SvNumFormatType eType, sal_uInt32& FIndex, LanguageType eLnge);
+
+ /** Get table of formats of the same type as FIndex; eType and rLnge are
+ set accordingly. An unknown format is set to Standard/General */
+ SvNumberFormatTable& GetFirstEntryTable(SvNumFormatType& eType, sal_uInt32& FIndex,
+ LanguageType& rLnge);
+
+ /// Delete an entry including the format it is referring to
+ void DeleteEntry(sal_uInt32 nKey);
+
+ /** Create new entry of a format code string for language/country.
+ @return
+ <TRUE/> if string new and ok and inserted.
+ <FALSE/> if string already exists or an unresolvable parse error
+ occurred, in which case nCheckPos is the error position within rString.
+ If the error occurs at position 0 or rString is empty nCheckPos
+ will be 1, so an error in the string is always indicated by
+ nCheckPos not being zero.
+ The content of the rString variable can be changed and corrected
+ by the method.
+ nType contains the type of the format.
+ nKey contains the index key of the format.
+ */
+ bool PutEntry(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType, sal_uInt32& nKey,
+ LanguageType eLnge = LANGUAGE_DONTKNOW, bool bReplaceBooleanEquivalent = true);
+
+ /** Same as <method>PutEntry</method> but the format code string is
+ considered to be of language/country eLnge and is converted to
+ language/country eNewLnge */
+ bool PutandConvertEntry(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType,
+ sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge,
+ bool bConvertDateOrder, bool bReplaceBooleanEquivalent = true);
+
+ /** Same as <method>PutandConvertEntry</method> but the format code string
+ is considered to be of the System language/country eLnge and is
+ converted to another System language/country eNewLnge. In this case
+ the automatic currency is converted too. */
+ bool PutandConvertEntrySystem(OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType,
+ sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge);
+
+ /** Similar to <method>PutEntry</method> and
+ <method>PutandConvertEntry</method> or
+ <method>PutandConvertEntrySystem</method>, the format code string
+ passed is considered to be of language/country eLnge. If
+ eLnge==LANGUAGE_SYSTEM the format code has to match eSysLnge, and if
+ eSysLnge is not the current application locale the format code is
+ converted to the current locale. Additionally, if the format code
+ represents an old "automatic" currency format, it is converted to the
+ new default currency format of the eLnge locale. The rString format
+ code passed as an argument may get adapted in case eLnge was used (or
+ is LANGUAGE_SYSTEM and eSysLnge is identical); in case it wasn't the
+ method works on a copy instead, otherwise the resulting string would
+ not match eSysLnge anymore.
+
+ <p> This method was introduced to handle the legacy currency formats of
+ the "autotbl.fmt" file used by Calc and Writer and convert them to
+ fixed currency codes of the actual currency. Note that in the case of
+ legacy currency formats no special attribution is converted, only the
+ default currency format of the locale is chosen, and that new fixed
+ currency codes are of course not converted to other currencies. The
+ method may also be used as a general method taking, converting and
+ inserting almost arbitrary format codes. To insert or use, for example,
+ the default currency format code matching the current locale, the
+ method could be called with<br/>
+
+ <code>
+ GetIndexPuttingAndConverting( "0 $", LANGUAGE_SYSTEM, LANGUAGE_ENGLISH_US, ...);
+ </code>
+
+ @return
+ The index key of the resulting number format. If the format code
+ was empty, could not be converted or has errors, the eLnge locale's
+ standard number format is chosen instead. The index key is
+ guaranteed to represent some valid number format. If
+ rNewInserted==false and rCheckPos>0 the format code has errors
+ and/or could not be converted.
+ */
+ sal_uInt32 GetIndexPuttingAndConverting(OUString& rString, LanguageType eLnge,
+ LanguageType eSysLnge, SvNumFormatType& rType,
+ bool& rNewInserted, sal_Int32& rCheckPos);
+
+ /** Create a format code string using format nIndex as a template and
+ applying other settings (passed from the dialog) */
+ OUString GenerateFormat(sal_uInt32 nIndex, LanguageType eLnge = LANGUAGE_DONTKNOW,
+ bool bThousand = false, bool IsRed = false, sal_uInt16 nPrecision = 0,
+ sal_uInt16 nLeadingCnt = 1);
+
+ /** Analyze an input string
+ @return
+ <TRUE/> if input is a number or is matching a format F_Index
+ F_Index is set to a matching format if number, the value is
+ returned in fOutNumber
+ <FALSE/> if input is not a number
+ */
+ bool IsNumberFormat(const OUString& sString, sal_uInt32& F_Index, double& fOutNumber,
+ SvNumInputOptions eInputOptions = SvNumInputOptions::NONE);
+
+ /// Format a number according to a format index, return string and color
+ void GetOutputString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& sOutString,
+ const Color** ppColor, bool bUseStarFormat = false);
+
+ /** Format a string according to a format index, return string and color.
+ Formats only if the format code is of type text or the 4th subcode
+ of a format code is specified, otherwise sOutString will be == "" */
+ void GetOutputString(const OUString& sString, sal_uInt32 nFIndex, OUString& sOutString,
+ const Color** ppColor, bool bUseStarFormat = false);
+
+ /** Format a number according to the standard default format matching
+ the given format index. rOutString will be the real cell string (e.g.
+ a number rounded by the cell format, which rounded value is used
+ in the filtering condition now), instead of the EditFormat string
+ (e.g a not rounded value, which is visible during editing).*/
+ void GetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, OUString& rOutString,
+ bool bFiltering = false, bool bForceSystemLocale = false);
+
+ /** Format a number according to a format code string to be scanned.
+ @return
+ <FALSE/> if format code contains an error
+ <TRUE/> else, in which case the string and color are returned.
+ */
+ bool GetPreviewString(const OUString& sFormatString, double fPreviewNumber,
+ OUString& sOutString, const Color** ppColor, LanguageType eLnge,
+ bool bUseStarFormat = false);
+
+ /** Same as <method>GetPreviewString</method> but the format code string
+ may be either language/country eLnge or en_US english US */
+ bool GetPreviewStringGuess(const OUString& sFormatString, double fPreviewNumber,
+ OUString& sOutString, const Color** ppColor,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Format a string according to a format code string to be scanned.
+ @return
+ <FALSE/> if format code contains an error
+ <TRUE/> else, in which case the string and color are returned.
+ */
+ bool GetPreviewString(const OUString& sFormatString, const OUString& sPreviewString,
+ OUString& sOutString, const Color** ppColor,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Test whether the format code string is already present in container
+ @return
+ NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index.
+ */
+ sal_uInt32 TestNewString(const OUString& sFormatString, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Whether format index nFIndex is of type text or not
+ bool IsTextFormat(sal_uInt32 nFIndex) const;
+
+ /// Whether format index nFIndex has NatNum12 modifier
+ bool IsNatNum12(sal_uInt32 nFIndex) const;
+
+ /// Get additional info of a format index, e.g. for dialog box
+ void GetFormatSpecialInfo(sal_uInt32 nFormat, bool& bThousand, bool& IsRed,
+ sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt);
+
+ /// Count of decimals
+ sal_uInt16 GetFormatPrecision(sal_uInt32 nFormat) const;
+
+ /// Count of integer digits
+ sal_uInt16 GetFormatIntegerDigits(sal_uInt32 nFormat) const;
+
+ /** Get additional info of a format code string, e.g. for dialog box.
+ Uses a temporary parse, if possible use only if format code is not
+ present in container yet, otherwise ineffective.
+ @return
+ 0 if format code string parsed without errors, otherwise error
+ position (like nCheckPos on <method>PutEntry</method>)
+ */
+ sal_uInt32 GetFormatSpecialInfo(const OUString&, bool& bThousand, bool& IsRed,
+ sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Get return string for Calc CELL() function, "G", "D1", ...
+ OUString GetCalcCellReturn(sal_uInt32 nFormat) const;
+
+ bool IsUserDefined(sal_uInt32 F_Index) const;
+
+ /// Check if format code string may be deleted by user
+ bool IsUserDefined(std::u16string_view sStr, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return the format index of the format code string for language/country,
+ or NUMBERFORMAT_ENTRY_NOT_FOUND */
+ sal_uInt32 GetEntryKey(std::u16string_view sStr, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Return the format for a format index
+ const SvNumberformat* GetEntry(sal_uInt32 nKey) const;
+
+ /// Obtain substituted GetFormatEntry(), i.e. system formats.
+ const SvNumberformat* GetSubstitutedEntry(sal_uInt32 nKey, sal_uInt32& o_rNewKey) const;
+
+ /// Return the format index of the standard default number format for language/country
+ sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Return the format index of the default format of a type for language/country
+ sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return the format index of the default format of a type for language/country.
+ Maybe not the default format but a special builtin format, e.g. for
+ NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
+ sal_uInt32 GetStandardFormat(sal_uInt32 nFIndex, SvNumFormatType eType, LanguageType eLnge);
+
+ /** Return the format index of the default format of a type for language/country.
+ Maybe not the default format but a special builtin format, e.g. for
+ NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */
+ sal_uInt32 GetStandardFormat(double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
+ LanguageType eLnge);
+
+ /// Whether nFIndex is a special builtin format
+ bool IsSpecialStandardFormat(sal_uInt32 nFIndex, LanguageType eLnge);
+
+ /** Return a time format that best matches fNumber. */
+ sal_uInt32 GetTimeFormat(double fNumber, LanguageType eLnge, bool bForceDuration);
+
+ /** Return a format and type that best matches the value of fNumber if
+ fNumber is assumed to be a date, time or datetime value, but unknown
+ which. Originally introduced for Chart databrowser editor, probably
+ should not be used otherwise. */
+ sal_uInt32 GuessDateTimeFormat(SvNumFormatType& rType, double fNumber, LanguageType eLnge);
+
+ /** Return the corresponding edit format of a format.
+
+ nFIndex, eType and pFormat (if not nullptr) are assumed to match each
+ other / be of one format. The locale to use is obtained from pFormat,
+ if nullptr then LANGUAGE_SYSTEM is used. This can be overridden by
+ specifying eForLocale other than LANGUAGE_DONTKNOW.
+ */
+ sal_uInt32 GetEditFormat(double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
+ SvNumberformat const* pFormat,
+ LanguageType eForLocale = LANGUAGE_DONTKNOW);
+
+ /// Return the reference date
+ const Date& GetNullDate() const;
+ /// Return the standard decimal precision
+ sal_uInt16 GetStandardPrec() const;
+ /// Return whether zero suppression is switched on
+ bool GetNoZero() const;
+ /** Get the type of a format (or css::util::NumberFormat::UNDEFINED if no entry),
+ but with css::util::NumberFormat::DEFINED masked out */
+ SvNumFormatType GetType(sal_uInt32 nFIndex) const;
+
+ /// As the name says
+ void ClearMergeTable();
+ /// Merge in all new entries from rNewTable and return a table of resulting new format indices
+ SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable);
+
+ /// Whether a merge table is present or not
+ bool HasMergeFormatTable() const;
+ /// Return the new format index for an old format index, if a merge table exists
+ sal_uInt32 GetMergeFormatIndex(sal_uInt32 nOldFmt) const;
+
+ /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32
+ entries merge table to ::std::map with old index key and new index key.
+ @ATTENTION! Also clears the old table using ClearMergeTable() */
+ SvNumberFormatterMergeMap ConvertMergeTableToMap();
+
+ /** Return the format index of a builtin format for a specific language/country.
+ If nFormat is not a builtin format nFormat is returned. */
+ sal_uInt32 GetFormatForLanguageIfBuiltIn(sal_uInt32 nFormat,
+ LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return the format index for a builtin format of a specific language
+ @see NfIndexTableOffset
+ */
+ sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return enum index of a format index of a builtin format,
+ NF_INDEX_TABLE_ENTRIES if it's not a builtin format.
+ @see NfIndexTableOffset
+ */
+ NfIndexTableOffset GetIndexTableOffset(sal_uInt32 nFormat) const;
+
+ /** Set evaluation type and order of input date strings
+ @see NfEvalDateFormat
+ */
+ void SetEvalDateFormat(NfEvalDateFormat eEDF);
+ NfEvalDateFormat GetEvalDateFormat() const;
+
+ /** Set TwoDigitYearStart, how the input string scanner handles a two digit year.
+ Default from VCL: 1930, 30-99 19xx, 00-29 20xx
+
+ <p> Historically (prior to src513e) it was a two digit number determining
+ until which number the string scanner recognizes a year to be 20xx,
+ default <= 29 is used by SFX/OfaMiscCfg.
+ The name Year2000 is kept although the actual functionality is now a
+ TwoDigitYearStart which might be in any century.
+ */
+ void SetYear2000(sal_uInt16 nVal);
+ sal_uInt16 GetYear2000() const;
+ static sal_uInt16 GetYear2000Default();
+
+ sal_uInt16 ExpandTwoDigitYear(sal_uInt16 nYear) const;
+ static sal_uInt16 ExpandTwoDigitYear(sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart);
+
+ /// Return the decimal separator matching the locale of the given format
+ OUString GetFormatDecimalSep(sal_uInt32 nFormat) const;
+
+ /// Return the decimal separator matching the given locale / LanguageType.
+ OUString GetLangDecimalSep(LanguageType nLang) const;
+
+ static void resetTheCurrencyTable();
+
+ /// Return a NfCurrencyTable with pointers to <type>NfCurrencyEntry</type> entries
+ static const NfCurrencyTable& GetTheCurrencyTable();
+
+ /** Searches, according to the default locale currency, an entry of the
+ CurrencyTable which is <bold>not</bold> the first (LANGUAGE_SYSTEM) entry.
+ @return
+ <NULL/> if not found
+ else pointer to NfCurrencyEntry
+ */
+ static const NfCurrencyEntry* MatchSystemCurrency();
+
+ /** Return a NfCurrencyEntry matching a language/country.
+ If language/country is LANGUAGE_SYSTEM a <method>MatchSystemCurrency</method>
+ call is tried to get an entry. If that fails or the corresponding
+ language/country is not present the entry for LANGUAGE_SYSTEM is returned.
+ */
+ static const NfCurrencyEntry& GetCurrencyEntry(LanguageType);
+
+ /** Return a NfCurrencyEntry pointer matching a language/country
+ and currency abbreviation (AKA banking symbol).
+ This method is meant for the configuration of the default currency.
+ @return
+ <NULL/> if not found
+ else pointer to NfCurrencyEntry
+ */
+ static const NfCurrencyEntry* GetCurrencyEntry(std::u16string_view rAbbrev, LanguageType eLang);
+
+ /** Return a NfCurrencyEntry pointer matching the symbol
+ combination of a LegacyOnly currency. Note that this means only that
+ the currency matching both symbols was once used in the Office, but is
+ not offered in dialogs anymore. It doesn't even mean that the currency
+ symbol combination is valid, since the reason for removing it may have
+ been just that. #i61657#
+ @return
+ A matching entry, or else <NULL/>.
+ */
+ static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry(std::u16string_view rSymbol,
+ std::u16string_view rAbbrev);
+
+ /** Set the default system currency. The combination of abbreviation and
+ language must match an existent element of theCurrencyTable. If not,
+ the SYSTEM (current locale) entry becomes the default.
+ This method is meant for the configuration of the default currency.
+ */
+ static void SetDefaultSystemCurrency(std::u16string_view rAbbrev, LanguageType eLang);
+
+ /** Get all standard formats for a specific currency, formats are
+ appended to the NfWSStringsDtor list.
+ @param bBank
+ <TRUE/>: generate only format strings with currency abbreviation
+ <FALSE/>: mixed format strings
+ @return
+ position of default format
+ */
+ sal_uInt16 GetCurrencyFormatStrings(NfWSStringsDtor&, const NfCurrencyEntry&, bool bBank) const;
+
+ /** Whether nFormat is of type css::util::NumberFormat::CURRENCY and the format code
+ contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn].
+ If ppEntry is not NULL and exactly one entry is found, a [$xxx-nnn] is
+ returned, even if the format code only contains [$xxx] !
+ */
+ bool GetNewCurrencySymbolString(sal_uInt32 nFormat, OUString& rSymbol,
+ const NfCurrencyEntry** ppEntry, bool* pBank = nullptr) const;
+
+ /** Look up the corresponding NfCurrencyEntry matching
+ rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly
+ a rExtension (being yyy of [$xxx-yyy]) or a given language/country
+ value. Tries to match a rSymbol with rExtension first, then with
+ eFormatLanguage, then rSymbol only. This is because a currency entry
+ might have been constructed using I18N locale data where a used locale
+ of a currency format code must not necessarily match the locale of
+ the locale data itself, e.g. [$HK$-40C] (being "zh_HK" locale) in
+ zh_CN locale data. Here the rExtension would have the value 0x40c but
+ eFormatLanguage of the number format would have the value of zh_CN
+ locale, the value with which the corresponding CurrencyEntry is
+ constructed.
+
+ @param bFoundBank
+ Only used for output.
+ If the return value is not <NULL/> this value is set to <TRUE/> if
+ the matching entry was found by comparing rSymbol against the
+ CurrencyAbbreviation (AKA BankSymbol).
+ If the return value is <NULL/> the value of bFoundBank is undefined.
+ @param rSymbol
+ Currency symbol, preferably obtained of a format by a call to
+ <method>SvNumberformat::GetNewCurrencySymbol()</method>
+ @param rExtension
+ Currency extension, preferably obtained of a format by a call to
+ <method>SvNumberformat::GetNewCurrencySymbol()</method>
+ @param eFormatLanguage
+ The language/country value of the format of which rSymbol and
+ rExtension are obtained (<method>SvNumberformat::GetLanguage()</method>).
+ @param bOnlyStringLanguage
+ If <TRUE/> only entries with language/country of rExtension are
+ checked, no match on eFormatLanguage. If rExtension is empty all
+ entries are checked.
+ @return
+ The matching entry if unique (in which case bFoundBank is set),
+ else <NULL/>.
+ */
+ static const NfCurrencyEntry* GetCurrencyEntry(bool& bFoundBank, std::u16string_view rSymbol,
+ std::u16string_view rExtension,
+ LanguageType eFormatLanguage,
+ bool bOnlyStringLanguage = false);
+
+ /// Get compatibility ("automatic" old style) currency from I18N locale data
+ void GetCompatibilityCurrency(OUString& rSymbol, OUString& rAbbrev) const;
+
+ /// Fill rList with the language/country codes that have been allocated
+ void GetUsedLanguages(std::vector<LanguageType>& rList);
+
+ /// Fill a NfKeywordIndex table with keywords of a language/country
+ void FillKeywordTable(NfKeywordTable& rKeywords, LanguageType eLang);
+
+ /** Fill a NfKeywordIndex table with keywords usable in Excel export with
+ GetFormatStringForExcel() or SvNumberformat::GetMappedFormatstring() */
+ void FillKeywordTableForExcel(NfKeywordTable& rKeywords);
+
+ /** Return a format code string suitable for Excel export.
+
+ @param rTempFormatter
+ SvNumberFormatter to use if a non-en-US format code needs to be
+ converted and put, should not be the same formatter to not
+ pollute the entries of this one here.
+ */
+ OUString GetFormatStringForExcel(sal_uInt32 nKey, const NfKeywordTable& rKeywords,
+ SvNumberFormatter& rTempFormatter) const;
+
+ /** Return a keyword for a language/country and NfKeywordIndex
+ for XML import, to generate number format strings. */
+ OUString GetKeyword(LanguageType eLnge, sal_uInt16 nIndex);
+
+ /** Return the GENERAL keyword in proper case ("General") for a
+ language/country, used in XML import */
+ OUString GetStandardName(LanguageType eLnge);
+
+ /** Check if a specific locale has supported locale data. */
+ static bool IsLocaleInstalled(LanguageType eLang);
+
+ /** Obtain NfKeywordTable used with a format, possibly localized.
+
+ XXX NOTE: the content (actual keywords) is only valid as long as the
+ locale context of the associated ImpSvNumberformatScan instance does
+ not change to a locale with different keywords, which may happen
+ anytime with a call (implicit or explicit) to
+ SvNumberFormatter::ChangeIntl(). If needed longer, copy-create another
+ NfKeywordTable instance or copy individual elements.
+
+ If the format specified with nKey does not exist, the content of the
+ NfKeywordTable matches the locale with which the SvNumberFormatter
+ instance was created and initialized.
+
+ This function preliminary exists for unit tests and otherwise is
+ pretty much useless.
+ */
+ const NfKeywordTable& GetKeywords(sal_uInt32 nKey);
+
+ /** Access for unit tests. */
+ const NfKeywordTable& GetEnglishKeywords() const;
+
+ /** Access for unit tests. */
+ const std::vector<Color>& GetStandardColors() const;
+
+ /** Access for unit tests. */
+ size_t GetMaxDefaultColors() const;
+
+ struct InputScannerPrivateAccess
+ {
+ friend class ImpSvNumberInputScan;
+
+ private:
+ InputScannerPrivateAccess() {}
+ };
+ /** Access for input scanner to temporarily (!) switch locales. */
+ OnDemandLocaleDataWrapper& GetOnDemandLocaleDataWrapper(const InputScannerPrivateAccess&)
+ {
+ return xLocaleData;
+ }
+
+private:
+ mutable ::osl::Mutex m_aMutex;
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ LanguageTag maLanguageTag;
+ std::map<sal_uInt32, std::unique_ptr<SvNumberformat>>
+ aFTable; // Table of format keys to format entries
+ typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap;
+ DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys
+ std::unique_ptr<SvNumberFormatTable> pFormatTable; // For the UI dialog
+ std::unique_ptr<SvNumberFormatterIndexTable>
+ pMergeTable; // List of indices for merging two formatters
+ OnDemandCharClass xCharClass; // CharacterClassification
+ OnDemandLocaleDataWrapper xLocaleData; // LocaleData switched between SYSTEM, ENGLISH and other
+ OnDemandTransliterationWrapper xTransliteration; // Transliteration loaded on demand
+ OnDemandCalendarWrapper xCalendar; // Calendar loaded on demand
+ OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand
+ std::unique_ptr<ImpSvNumberInputScan> pStringScanner; // Input string scanner
+ std::unique_ptr<ImpSvNumberformatScan> pFormatScanner; // Format code string scanner
+ Link<sal_uInt16, Color*> aColorLink; // User defined color table CallBack
+ sal_uInt32 MaxCLOffset; // Max language/country offset used
+ sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale
+ LanguageType IniLnge; // Initialized setting language/country
+ LanguageType ActLnge; // Current setting language/country
+ NfEvalDateFormat eEvalDateFormat; // DateFormat evaluation
+ bool bNoZero; // Zero value suppression
+
+ // cached locale data items needed almost any time
+ OUString aDecimalSep;
+ OUString aDecimalSepAlt;
+ OUString aThousandSep;
+ OUString aDateSep;
+
+ SVL_DLLPRIVATE static volatile bool bCurrencyTableInitialized;
+ SVL_DLLPRIVATE static sal_uInt16 nSystemCurrencyPosition;
+ SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry;
+
+ // get the registry, create one if none exists
+ SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry();
+
+ // called by ctors
+ SVL_DLLPRIVATE void ImpConstruct(LanguageType eLang);
+
+ // Generate builtin formats provided by i18n behind CLOffset,
+ // if bNoAdditionalFormats==false also generate additional i18n formats.
+ SVL_DLLPRIVATE void ImpGenerateFormats(sal_uInt32 CLOffset, bool bNoAdditionalFormats);
+
+ // Generate additional formats provided by i18n
+ SVL_DLLPRIVATE void ImpGenerateAdditionalFormats(
+ sal_uInt32 CLOffset,
+ css::uno::Reference<css::i18n::XNumberFormatCode> const& rNumberFormatCode,
+ bool bAfterChangingSystemCL);
+
+ SVL_DLLPRIVATE SvNumberformat* ImpInsertFormat(const css::i18n::NumberFormatCode& rCode,
+ sal_uInt32 nPos,
+ bool bAfterChangingSystemCL = false,
+ sal_Int16 nOrgIndex = 0);
+
+ // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country
+ SVL_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const;
+
+ // Test whether format code already exists, then return index key,
+ // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
+ SVL_DLLPRIVATE sal_uInt32 ImpIsEntry(std::u16string_view rString, sal_uInt32 CLOffset,
+ LanguageType eLnge);
+
+ // Create builtin formats for language/country if necessary, return CLOffset
+ SVL_DLLPRIVATE sal_uInt32 ImpGenerateCL(LanguageType eLnge);
+
+ // Create theCurrencyTable with all <type>NfCurrencyEntry</type>
+ SVL_DLLPRIVATE static void ImpInitCurrencyTable();
+
+ // Return the format index of the currency format of the system locale.
+ // Format is created if not already present.
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat();
+
+ // Return the format index of the currency format of the current locale.
+ // Format is created if not already present.
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat();
+
+ // Return the default format for a given type and current locale.
+ // May ONLY be called from within GetStandardFormat().
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat(SvNumFormatType nType);
+
+ // Return the index in a sequence of format codes matching an enum of
+ // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't
+ // contain any format code elements a default element is created and inserted.
+ SVL_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex(
+ css::uno::Sequence<css::i18n::NumberFormatCode>& rSeq, const NfIndexTableOffset nTabOff);
+
+ // Adjust a sequence of format codes to contain only one (THE) default
+ // instead of multiple defaults for short/medium/long types.
+ // If there is no medium but a short and a long default the long is taken.
+ // Non-PRODUCT version may check locale data for matching defaults in one
+ // FormatElement group.
+ SVL_DLLPRIVATE void ImpAdjustFormatCodeDefault(css::i18n::NumberFormatCode* pFormatArr,
+ sal_Int32 nCount);
+
+ // Obtain the format entry for a given key index.
+ SVL_DLLPRIVATE SvNumberformat* GetFormatEntry(sal_uInt32 nKey);
+ SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry(sal_uInt32 nKey) const;
+
+ // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
+ static bool ImpLookupCurrencyEntryLoopBody(const NfCurrencyEntry*& pFoundEntry,
+ bool& bFoundBank, const NfCurrencyEntry* pData,
+ sal_uInt16 nPos, std::u16string_view rSymbol);
+
+ // link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method>
+ DECL_DLLPRIVATE_STATIC_LINK(SvNumberFormatter, CurrencyChangeLink, LinkParamNone*, void);
+
+ // return position of a special character
+ sal_Int32 ImpPosToken(const OUStringBuffer& sFormat, sal_Unicode token,
+ sal_Int32 nStartPos = 0) const;
+
+ // Substitute a format during GetFormatEntry(), i.e. system formats.
+ SvNumberformat* ImpSubstituteEntry(SvNumberformat* pFormat, sal_uInt32* o_pRealKey = nullptr);
+
+ // own mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
+ static ::osl::Mutex& GetGlobalMutex();
+ ::osl::Mutex& GetInstanceMutex() const { return m_aMutex; }
+
+public:
+ // called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes
+ void ResetDefaultSystemCurrency();
+
+ // Called by SvNumberFormatterRegistry_Impl::Notify if the system locale's
+ // date acceptance patterns change.
+ void InvalidateDateAcceptancePatterns();
+
+ // Replace the SYSTEM language/country format codes. Called upon change of
+ // the user configurable locale.
+ // Old compatibility codes are replaced, user defined are converted, and
+ // new format codes are appended.
+ void ReplaceSystemCL(LanguageType eOldLanguage);
+
+ const css::uno::Reference<css::uno::XComponentContext>& GetComponentContext() const;
+
+ //! The following method is not to be used from outside but must be
+ //! public for the InputScanner.
+ // return the current FormatScanner
+ const ImpSvNumberformatScan* GetFormatScanner() const;
+
+ //! The following methods are not to be used from outside but must be
+ //! public for the InputScanner and FormatScanner.
+
+ // return current (!) Locale
+ const LanguageTag& GetLanguageTag() const;
+
+ // return corresponding Transliteration wrapper
+ const ::utl::TransliterationWrapper* GetTransliteration() const;
+
+ // return the corresponding CharacterClassification wrapper
+ const CharClass* GetCharClass() const;
+
+ // return the corresponding LocaleData wrapper
+ const LocaleDataWrapper* GetLocaleData() const;
+
+ // return the corresponding Calendar wrapper
+ CalendarWrapper* GetCalendar() const;
+
+ // return the corresponding NativeNumberSupplier wrapper
+ const NativeNumberWrapper* GetNatNum() const;
+
+ // cached locale data items
+
+ // return the corresponding decimal separator
+ const OUString& GetNumDecimalSep() const;
+
+ // return the corresponding decimal separator alternative
+ const OUString& GetNumDecimalSepAlt() const;
+
+ // return the corresponding group (AKA thousand) separator
+ const OUString& GetNumThousandSep() const;
+
+ // return the corresponding date separator
+ const OUString& GetDateSep() const;
+
+ // checks for decimal separator and optional alternative
+ bool IsDecimalSep(std::u16string_view rStr) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/numuno.hxx b/include/svl/numuno.hxx
new file mode 100644
index 0000000000..c7c0419418
--- /dev/null
+++ b/include/svl/numuno.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_NUMUNO_HXX
+#define INCLUDED_SVL_NUMUNO_HXX
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <memory>
+
+class SvNumberFormatter;
+class SvNumFmtSuppl_Impl;
+
+namespace comphelper
+{
+ class SharedMutex;
+}
+
+
+/**
+ * Factory for XNumberFormats objects.
+ * Implements XAggregation because it is aggregated to ScModelObj
+ */
+class SVL_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2<
+ css::util::XNumberFormatsSupplier,
+ css::lang::XUnoTunnel>
+{
+private:
+ std::unique_ptr<SvNumFmtSuppl_Impl> pImpl;
+
+public:
+ SvNumberFormatsSupplierObj();
+ SvNumberFormatsSupplierObj(SvNumberFormatter* pForm);
+ virtual ~SvNumberFormatsSupplierObj() override;
+
+ void SetNumberFormatter(SvNumberFormatter* pNew);
+ SvNumberFormatter* GetNumberFormatter() const;
+
+ // XNumberFormatsSupplier
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL
+ getNumberFormatSettings() override;
+ virtual css::uno::Reference< css::util::XNumberFormats > SAL_CALL
+ getNumberFormats() override;
+
+ // XUnoTunnel
+ UNO3_GETIMPLEMENTATION_DECL(SvNumberFormatsSupplierObj)
+
+ ::comphelper::SharedMutex& getSharedMutex() const;
+};
+
+#endif // INCLUDED_SVL_NUMUNO_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx
new file mode 100644
index 0000000000..4a0a91b182
--- /dev/null
+++ b/include/svl/ondemand.hxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <i18nlangtag/lang.h>
+#include <i18nutil/transliteration.hxx>
+#include <unotools/syslocale.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/calendarwrapper.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <unotools/nativenumberwrapper.hxx>
+#include <unotools/charclass.hxx>
+#include <optional>
+
+/*
+ On demand instantiation and initialization of several i18n wrappers,
+ helping the number formatter to not perform worse than it already does.
+ */
+
+/** @short
+ Switch between LANGUAGE_SYSTEM and LANGUAGE_ENGLISH_US and any other
+ LocaleDataWrapper.
+ SvNumberformatter uses it upon switching locales.
+
+ @descr
+ Avoids reloading and analysing of locale data again and again.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called before
+ accessing any locale data. The passed parameters Locale and LanguageType
+ must match each other.
+ */
+
+class OnDemandLocaleDataWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ SvtSysLocale aSysLocale;
+ LanguageType eCurrentLanguage;
+ LanguageType eLastAnyLanguage;
+ std::optional<LocaleDataWrapper> moEnglish;
+ std::optional<LocaleDataWrapper> moAny;
+ int nCurrent; // 0 == system, 1 == english, 2 == any
+ bool bInitialized;
+
+public:
+ OnDemandLocaleDataWrapper()
+ : eLastAnyLanguage(LANGUAGE_DONTKNOW)
+ , nCurrent(0)
+ , bInitialized(false)
+ {
+ eCurrentLanguage = LANGUAGE_SYSTEM;
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const LanguageTag& rLanguageTag)
+ {
+ m_xContext = rxContext;
+ changeLocale(rLanguageTag);
+ bInitialized = true;
+ }
+
+ void changeLocale(const LanguageTag& rLanguageTag)
+ {
+ LanguageType eLang = rLanguageTag.getLanguageType(false);
+ if (eLang == LANGUAGE_SYSTEM)
+ nCurrent = 0;
+ else if (eLang == LANGUAGE_ENGLISH_US)
+ {
+ if (!moEnglish)
+ moEnglish.emplace(m_xContext, rLanguageTag);
+ nCurrent = 1;
+ }
+ else
+ {
+ if (!moAny)
+ {
+ moAny.emplace(m_xContext, rLanguageTag);
+ eLastAnyLanguage = eLang;
+ }
+ else if (eLastAnyLanguage != eLang)
+ {
+ moAny.emplace(m_xContext, rLanguageTag);
+ eLastAnyLanguage = eLang;
+ }
+ nCurrent = 2;
+ }
+ eCurrentLanguage = eLang;
+ }
+
+ LanguageType getCurrentLanguage() const { return eCurrentLanguage; }
+
+ const LocaleDataWrapper* get() const
+ {
+ switch (nCurrent)
+ {
+ case 0:
+ return &aSysLocale.GetLocaleData();
+ case 1:
+ return &*moEnglish;
+ case 2:
+ return &*moAny;
+ default:
+ assert(false);
+ return nullptr;
+ }
+ }
+ const LocaleDataWrapper* operator->() const { return get(); }
+ const LocaleDataWrapper& operator*() const { return *get(); }
+};
+
+/** Load a calendar only if it's needed. Keep calendar for "en-US" locale
+ separately, as there can be alternation between locale dependent and
+ locale independent formats.
+ SvNumberformatter uses it upon switching locales.
+
+ @ATTENTION If the default ctor is used the init() method MUST be called
+ before accessing the calendar.
+ */
+class OnDemandCalendarWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ css::lang::Locale aEnglishLocale;
+ css::lang::Locale aLocale;
+ mutable css::lang::Locale aLastAnyLocale;
+ mutable std::optional<CalendarWrapper> moEnglish;
+ mutable std::optional<CalendarWrapper> moAny;
+
+public:
+ OnDemandCalendarWrapper()
+ {
+ LanguageTag aEnglishLanguageTag(LANGUAGE_ENGLISH_US);
+ aEnglishLocale = aEnglishLanguageTag.getLocale();
+ aLastAnyLocale = aEnglishLocale;
+ }
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ const css::lang::Locale& rLocale)
+ {
+ m_xContext = rxContext;
+ changeLocale(rLocale);
+ moEnglish.reset();
+ moAny.reset();
+ }
+
+ void changeLocale(const css::lang::Locale& rLocale) { aLocale = rLocale; }
+
+ CalendarWrapper* get() const
+ {
+ CalendarWrapper* pPtr;
+ if (aLocale == aEnglishLocale)
+ {
+ if (!moEnglish)
+ {
+ moEnglish.emplace(m_xContext);
+ moEnglish->loadDefaultCalendar(aEnglishLocale);
+ }
+ pPtr = &*moEnglish;
+ }
+ else
+ {
+ if (!moAny)
+ {
+ moAny.emplace(m_xContext);
+ moAny->loadDefaultCalendar(aLocale);
+ aLastAnyLocale = aLocale;
+ }
+ else if (aLocale != aLastAnyLocale)
+ {
+ moAny->loadDefaultCalendar(aLocale);
+ aLastAnyLocale = aLocale;
+ }
+ pPtr = &*moAny;
+ }
+ return pPtr;
+ }
+};
+
+/** Load a transliteration only if it's needed.
+ SvNumberformatter uses it upon switching locales.
+ @ATTENTION If the default ctor is used the init() method MUST be called
+ before accessing the transliteration.
+ */
+class OnDemandTransliterationWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ LanguageType eLanguage;
+ TransliterationFlags nType;
+ mutable std::optional<::utl::TransliterationWrapper> moTransliterate;
+ mutable bool bValid;
+ bool bInitialized;
+
+public:
+ OnDemandTransliterationWrapper()
+ : eLanguage(LANGUAGE_SYSTEM)
+ , nType(TransliterationFlags::NONE)
+ , bValid(false)
+ , bInitialized(false)
+ {
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext, LanguageType eLang)
+ {
+ m_xContext = rxContext;
+ nType = TransliterationFlags::IGNORE_CASE;
+ changeLocale(eLang);
+ moTransliterate.reset();
+ bInitialized = true;
+ }
+
+ void changeLocale(LanguageType eLang)
+ {
+ bValid = false;
+ eLanguage = eLang;
+ }
+
+ const ::utl::TransliterationWrapper* get() const
+ {
+ if (!bValid)
+ {
+ if (!moTransliterate)
+ moTransliterate.emplace(m_xContext, nType);
+ moTransliterate->loadModuleIfNeeded(eLanguage);
+ bValid = true;
+ }
+ return &*moTransliterate;
+ }
+
+ const ::utl::TransliterationWrapper* operator->() const { return get(); }
+};
+
+/** Load a native number service wrapper only if it's needed.
+ SvNumberformatter uses it.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called
+ before accessing the native number supplier.
+ */
+class OnDemandNativeNumberWrapper
+{
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ mutable std::optional<NativeNumberWrapper> moNativeNumber;
+
+public:
+ OnDemandNativeNumberWrapper() {}
+
+ void init(const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+ {
+ m_xContext = rxContext;
+ moNativeNumber.reset();
+ }
+
+ NativeNumberWrapper* get() const
+ {
+ if (!moNativeNumber)
+ moNativeNumber.emplace(m_xContext);
+ return &*moNativeNumber;
+ }
+};
+
+/** @short
+ SvNumberformatter uses it upon switching locales.
+
+ @descr
+ Avoids reloading and analysing of locale data again and again.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called before
+ accessing any locale data.
+ */
+
+class OnDemandCharClass
+{
+ std::optional<CharClass> moCharClass1;
+ std::optional<CharClass> moCharClass2;
+ int nCurrent; // -1 == uninitialised, 0 == class1, 1 == class2
+
+public:
+ OnDemandCharClass()
+ : nCurrent(-1)
+ {
+ }
+
+ void changeLocale(const css::uno::Reference<css::uno::XComponentContext>& xContext,
+ const LanguageTag& rLanguageTag)
+ {
+ // check for existing match
+ if (moCharClass1 && moCharClass1->getLanguageTag() == rLanguageTag)
+ {
+ nCurrent = 0;
+ return;
+ }
+ if (moCharClass2 && moCharClass2->getLanguageTag() == rLanguageTag)
+ {
+ nCurrent = 1;
+ return;
+ }
+ // no match - update one the current entries
+ if (nCurrent == -1 || nCurrent == 1)
+ {
+ moCharClass1.emplace(xContext, rLanguageTag);
+ nCurrent = 0;
+ }
+ else
+ {
+ moCharClass2.emplace(xContext, rLanguageTag);
+ nCurrent = 1;
+ }
+ }
+
+ const CharClass* get() const
+ {
+ switch (nCurrent)
+ {
+ case 0:
+ return &*moCharClass1;
+ case 1:
+ return &*moCharClass2;
+ default:
+ assert(false);
+ return nullptr;
+ }
+ }
+ const CharClass* operator->() const { return get(); }
+ const CharClass& operator*() const { return *get(); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/outstrm.hxx b/include/svl/outstrm.hxx
new file mode 100644
index 0000000000..f85b26515d
--- /dev/null
+++ b/include/svl/outstrm.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_OUTSTRM_HXX
+#define INCLUDED_SVL_OUTSTRM_HXX
+
+#include <svl/svldllapi.h>
+#include <com/sun/star/uno/Reference.h>
+#include <tools/stream.hxx>
+
+namespace com::sun::star::io
+{
+class XOutputStream;
+}
+
+class SVL_DLLPUBLIC SvOutputStream final : public SvStream
+{
+ css::uno::Reference<css::io::XOutputStream> m_xStream;
+
+ SVL_DLLPRIVATE virtual std::size_t GetData(void*, std::size_t) override;
+
+ SVL_DLLPRIVATE virtual std::size_t PutData(void const* pData, std::size_t nSize) override;
+
+ SVL_DLLPRIVATE virtual sal_uInt64 SeekPos(sal_uInt64) override;
+
+ SVL_DLLPRIVATE virtual void FlushData() override;
+
+ SVL_DLLPRIVATE virtual void SetSize(sal_uInt64) override;
+
+public:
+ SvOutputStream(css::uno::Reference<css::io::XOutputStream> xTheStream);
+
+ virtual ~SvOutputStream() override;
+};
+
+#endif // INCLUDED_SVL_OUTSTRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ownlist.hxx b/include/svl/ownlist.hxx
new file mode 100644
index 0000000000..cd93e6436a
--- /dev/null
+++ b/include/svl/ownlist.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_OWNLIST_HXX
+#define INCLUDED_SVL_OWNLIST_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::uno { template <typename > class Sequence; }
+
+class SvCommand
+/*
+ Contains a string that defines the command and another string for the
+ command arguments. If such a command were given in the command line,
+ it would look like this: command = argument
+*/
+{
+ OUString aCommand;
+ OUString aArgument;
+public:
+ SvCommand( const OUString & rCommand, const OUString & rArg )
+ {
+ aCommand = rCommand;
+ aArgument = rArg;
+ }
+ const OUString & GetCommand() const { return aCommand; }
+ const OUString & GetArgument() const { return aArgument; }
+};
+
+class SVL_DLLPUBLIC SvCommandList
+/*
+ The list contains objects of type SvCommand.
+ If an object is inserted, it is copied and inserted at the end
+ of the list.
+ */
+{
+private:
+ ::std::vector< SvCommand > aCommandList;
+
+public:
+ void Append( const OUString & rCommand, const OUString & rArg );
+
+ void FillFromSequence( const css::uno::Sequence < css::beans::PropertyValue >& );
+ void FillSequence( css::uno::Sequence < css::beans::PropertyValue >& ) const;
+
+ size_t size() const { return aCommandList.size(); }
+
+ SvCommand const & operator[]( size_t i) {
+ return aCommandList[ i ];
+ }
+
+};
+
+#endif // INCLUDED_SVL_OWNLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/pickerhistoryaccess.hxx b/include/svl/pickerhistoryaccess.hxx
new file mode 100644
index 0000000000..7e855f17af
--- /dev/null
+++ b/include/svl/pickerhistoryaccess.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_PICKERHISTORYACCESS_HXX
+#define INCLUDED_SVL_PICKERHISTORYACCESS_HXX
+
+#include <svl/svldllapi.h>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+
+namespace svt
+{
+
+
+ SVL_DLLPUBLIC void addFolderPicker(
+ const css::uno::Reference< css::uno::XInterface >& _rxPicker );
+
+ SVL_DLLPUBLIC void addFilePicker(
+ const css::uno::Reference< css::uno::XInterface >& _rxPicker );
+
+
+} // namespace svt
+
+
+#endif // INCLUDED_SVL_PICKERHISTORYACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
new file mode 100644
index 0000000000..af993096e6
--- /dev/null
+++ b/include/svl/poolitem.hxx
@@ -0,0 +1,317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_POOLITEM_HXX
+#define INCLUDED_SVL_POOLITEM_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+#include <vector>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <svl/hint.hxx>
+#include <svl/svldllapi.h>
+#include <svl/typedwhich.hxx>
+#include <tools/mapunit.hxx>
+#include <tools/long.hxx>
+#include <boost/property_tree/ptree_fwd.hpp>
+
+class IntlWrapper;
+
+#define SFX_ITEMS_OLD_MAXREF 0xffef
+#define SFX_ITEMS_MAXREF 0xfffffffe
+
+#define CONVERT_TWIPS 0x80 // Uno conversion for measurement (for MemberId)
+
+// warning, if there is no boolean inside the any this will always return the value false
+inline bool Any2Bool( const css::uno::Any&rValue )
+{
+ bool bValue = false;
+ if( !(rValue >>= bValue) )
+ {
+ sal_Int32 nNum = 0;
+ if( rValue >>= nNum )
+ bValue = nNum != 0;
+ }
+
+ return bValue;
+}
+
+/*
+ * The values of this enum describe the degree of textual
+ * representation of an item after calling the virtual
+ * method <SfxPoolItem::GetPresentation()const>.
+ */
+enum class SfxItemPresentation
+{
+ Nameless,
+ Complete
+};
+
+/**
+ * These values have to match the values in the
+ * css::frame::status::ItemState IDL
+ * to be found at offapi/com/sun/star/frame/status/ItemState.idl
+*/
+enum class SfxItemState {
+
+ /** Specifies an unknown state. */
+ UNKNOWN = 0,
+
+ /** Specifies that the property is currently disabled. */
+ DISABLED = 0x0001,
+
+ /** Specifies that the property is currently in a don't care state.
+ * <br/>
+ * This is normally used if a selection provides more than one state
+ * for a property at the same time.
+ */
+ DONTCARE = 0x0010,
+
+ /** Specifies that the property is currently in a default state. */
+ DEFAULT = 0x0020,
+
+ /** The property has been explicitly set to a given value hence we know
+ * we are not taking the default value.
+ * <br/>
+ * For example, you may want to get the font color and it might either
+ * be the default one or one that has been explicitly set.
+ */
+ SET = 0x0040
+};
+
+#ifdef DBG_UTIL
+SVL_DLLPUBLIC size_t getAllocatedSfxPoolItemCount();
+SVL_DLLPUBLIC size_t getUsedSfxPoolItemCount();
+SVL_DLLPUBLIC void listAllocatedSfxPoolItems();
+#endif
+
+class SfxItemPool;
+class SfxItemSet;
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+class SVL_DLLPUBLIC SfxPoolItem
+{
+ friend class SfxItemPool;
+ friend class SfxItemDisruptor_Impl;
+ friend class SfxItemSet;
+
+ // allow ItemSetTooling to access
+ friend SfxPoolItem const* implCreateItemEntry(SfxItemPool&, SfxPoolItem const*, sal_uInt16, bool);
+ friend void implCleanupItemEntry(SfxItemPool&, SfxPoolItem const*);
+
+ mutable sal_uInt32 m_nRefCount;
+ sal_uInt16 m_nWhich;
+
+#ifdef DBG_UTIL
+ // for debugging add a serial number, will be set in the constructor
+ // and count up from zero. If you have a deterministic error case and
+ // see the Item involved in the debugger you can use that number in
+ // the next run to see where that Item gets constructed and how it is
+ // involved/ processed
+ sal_uInt32 m_nSerialNumber;
+#endif
+
+ // bitfield for flags (instead of SfxItemKind)
+ bool m_bIsVoidItem : 1; // bit 0
+ bool m_bStaticDefault : 1; // bit 1
+ bool m_bPoolDefault : 1; // bit 2
+ bool m_bRegisteredAtPool : 1; // bit 3
+ bool m_bExceptionalSCItem : 1; // bit 4
+ bool m_bIsSetItem : 1; // bit 5
+
+protected:
+#ifdef DBG_UTIL
+ // this flag will make debugging item stuff much simpler
+ bool m_bDeleted : 1; // bit 6
+#endif
+
+private:
+ inline void SetRefCount(sal_uInt32 n)
+ {
+ m_nRefCount = n;
+ m_bStaticDefault = m_bPoolDefault = false;
+ }
+
+protected:
+ void setIsVoidItem() { m_bIsVoidItem = true; }
+ void setStaticDefault() { m_bStaticDefault = true; }
+ void setPoolDefault() { m_bPoolDefault = true; }
+ void setRegisteredAtPool(bool bNew) { m_bRegisteredAtPool = bNew; }
+ void setExceptionalSCItem() { m_bExceptionalSCItem = true; }
+ void setIsSetItem() { m_bIsSetItem = true; }
+
+public:
+ inline void AddRef(sal_uInt32 n = 1) const
+ {
+ assert(m_nRefCount <= SFX_ITEMS_MAXREF && "AddRef with non-Pool-Item");
+ assert(n <= SFX_ITEMS_MAXREF - m_nRefCount && "AddRef: refcount overflow");
+ m_nRefCount += n;
+ }
+
+#ifdef DBG_UTIL
+ sal_uInt32 getSerialNumber() const { return m_nSerialNumber; }
+#endif
+
+ bool isVoidItem() const { return m_bIsVoidItem; }
+ bool isStaticDefault() const { return m_bStaticDefault; }
+ bool isPoolDefault() const { return m_bPoolDefault; }
+ bool isRegisteredAtPool() const { return m_bRegisteredAtPool; }
+ bool isExceptionalSCItem() const { return m_bExceptionalSCItem; }
+ bool isSetItem() const { return m_bIsSetItem; }
+
+ // version that allows nullptrs
+ static bool areSame(const SfxPoolItem* pItem1, const SfxPoolItem* pItem2);
+
+ // if you have the items (not nullptrs) use this version
+ static bool areSame(const SfxPoolItem& rItem1, const SfxPoolItem& rItem2);
+
+private:
+ inline sal_uInt32 ReleaseRef(sal_uInt32 n = 1) const
+ {
+ assert(m_nRefCount <= SFX_ITEMS_MAXREF && "ReleaseRef with non-Pool-Item");
+ assert(n <= m_nRefCount);
+ m_nRefCount -= n;
+ return m_nRefCount;
+ }
+
+protected:
+ explicit SfxPoolItem( sal_uInt16 nWhich = 0 );
+ SfxPoolItem( const SfxPoolItem& rCopy)
+ : SfxPoolItem(rCopy.m_nWhich) {}
+
+public:
+ virtual ~SfxPoolItem();
+
+ void SetWhich( sal_uInt16 nId )
+ {
+ // can only change the Which before we are in a set
+ assert(m_nRefCount==0);
+ m_nWhich = nId;
+ }
+ sal_uInt16 Which() const { return m_nWhich; }
+ // StaticWhichCast asserts if the TypedWhichId is not matching its type, otherwise it returns a reference.
+ // You can use StaticWhichCast when you are sure about the type at compile time -- like a static_cast.
+ template<class T> T& StaticWhichCast(TypedWhichId<T> nId)
+ {
+ (void)nId;
+ assert(nId == m_nWhich);
+ assert(dynamic_cast<T*>(this));
+ return *static_cast<T*>(this);
+ }
+ template<class T> const T& StaticWhichCast(TypedWhichId<T> nId) const
+ {
+ (void)nId;
+ assert(nId == m_nWhich);
+ assert(dynamic_cast<const T*>(this));
+ return *static_cast<const T*>(this);
+ }
+ // DynamicWhichCast returns nullptr if the TypedWhichId is not matching its type, otherwise it returns a typed pointer.
+ // it asserts if the TypedWhichId matches its Which, but not the RTTI type.
+ // You can use DynamicWhichCast when you are not sure about the type at compile time -- like a dynamic_cast.
+ template<class T> T* DynamicWhichCast(TypedWhichId<T> nId)
+ {
+ if(m_nWhich != nId)
+ return nullptr;
+ assert(dynamic_cast<T*>(this));
+ return static_cast<T*>(this);
+ }
+ template<class T> const T* DynamicWhichCast(TypedWhichId<T> nId) const
+ {
+ if(m_nWhich != nId)
+ return nullptr;
+ assert(dynamic_cast<const T*>(this));
+ return static_cast<const T*>(this);
+ }
+ virtual bool operator==( const SfxPoolItem& ) const = 0;
+ bool operator!=( const SfxPoolItem& rItem ) const
+ { return !(*this == rItem); }
+
+ /** @return true if it has a valid string representation */
+ virtual bool GetPresentation( SfxItemPresentation ePresentation,
+ MapUnit eCoreMetric,
+ MapUnit ePresentationMetric,
+ OUString &rText,
+ const IntlWrapper& rIntlWrapper ) const;
+
+ virtual void ScaleMetrics( tools::Long lMult, tools::Long lDiv );
+ virtual bool HasMetrics() const;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const = 0;
+ // clone and call SetWhich
+ std::unique_ptr<SfxPoolItem> CloneSetWhich( sal_uInt16 nNewWhich ) const;
+ template<class T> std::unique_ptr<T> CloneSetWhich( TypedWhichId<T> nId ) const
+ {
+ return std::unique_ptr<T>(static_cast<T*>(CloneSetWhich(sal_uInt16(nId)).release()));
+ }
+
+ sal_uInt32 GetRefCount() const { return m_nRefCount; }
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+ virtual boost::property_tree::ptree dumpAsJSON() const;
+
+private:
+ SfxPoolItem& operator=( const SfxPoolItem& ) = delete;
+};
+
+
+
+inline bool IsPoolDefaultItem(const SfxPoolItem *pItem )
+{
+ return pItem && pItem->isPoolDefault();
+}
+
+inline bool IsStaticDefaultItem(const SfxPoolItem *pItem )
+{
+ return pItem && pItem->isStaticDefault();
+}
+
+inline bool IsDefaultItem( const SfxPoolItem *pItem )
+{
+ return pItem && (pItem->isPoolDefault() || pItem->isStaticDefault());
+}
+
+inline bool IsPooledItem( const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetRefCount() > 0 && pItem->GetRefCount() <= SFX_ITEMS_MAXREF;
+}
+
+SVL_DLLPUBLIC extern SfxPoolItem const * const INVALID_POOL_ITEM;
+
+inline bool IsInvalidItem(const SfxPoolItem *pItem)
+{
+ return pItem == INVALID_POOL_ITEM;
+}
+
+SVL_DLLPUBLIC bool areSfxPoolItemPtrsEqual(const SfxPoolItem* pItem1, const SfxPoolItem* pItem2);
+
+class SVL_DLLPUBLIC SfxPoolItemHint final : public SfxHint
+{
+ SfxPoolItem* pObj;
+public:
+ explicit SfxPoolItemHint( SfxPoolItem* Object ) : pObj(Object) {}
+ SfxPoolItem* GetObject() const { return pObj; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ptitem.hxx b/include/svl/ptitem.hxx
new file mode 100644
index 0000000000..2ceb394106
--- /dev/null
+++ b/include/svl/ptitem.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_PTITEM_HXX
+#define INCLUDED_SVL_PTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <tools/gen.hxx>
+#include <tools/debug.hxx>
+
+class SvStream;
+
+class SVL_DLLPUBLIC SfxPointItem final : public SfxPoolItem
+{
+ Point aVal;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxPointItem();
+ SfxPointItem( sal_uInt16 nWhich, const Point& rVal );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+
+ virtual SfxPointItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const Point& GetValue() const { return aVal; }
+ void SetValue( const Point& rNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ aVal = rNewVal;
+ }
+
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx
new file mode 100644
index 0000000000..26c2acd37b
--- /dev/null
+++ b/include/svl/rectitem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_RECTITEM_HXX
+#define INCLUDED_SVL_RECTITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+class SVL_DLLPUBLIC SfxRectangleItem final : public SfxPoolItem
+{
+ tools::Rectangle maVal;
+
+public:
+ static SfxPoolItem* CreateDefault();
+ SfxRectangleItem();
+ SfxRectangleItem( sal_uInt16 nWhich, const tools::Rectangle& rVal );
+
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual SfxRectangleItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ const tools::Rectangle& GetValue() const { return maVal; }
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/rngitem.hxx b/include/svl/rngitem.hxx
new file mode 100644
index 0000000000..7e8caf9374
--- /dev/null
+++ b/include/svl/rngitem.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_RNGITEM_HXX
+#define INCLUDED_SVL_RNGITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+
+class SVL_DLLPUBLIC SfxRangeItem final : public SfxPoolItem
+{
+private:
+ sal_uInt16 nFrom;
+ sal_uInt16 nTo;
+public:
+ SfxRangeItem( sal_uInt16 nWID, sal_uInt16 nFrom, sal_uInt16 nTo );
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual SfxRangeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/setitem.hxx b/include/svl/setitem.hxx
new file mode 100644
index 0000000000..69ebea4b1d
--- /dev/null
+++ b/include/svl/setitem.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <svl/poolitem.hxx>
+#include <svl/itemset.hxx>
+
+class SVL_DLLPUBLIC SfxSetItem : public SfxPoolItem
+{
+ SfxItemSet maSet;
+
+ SfxSetItem& operator=(const SfxSetItem&) = delete;
+
+public:
+ SfxSetItem(sal_uInt16 nWhich, SfxItemSet&& pSet);
+ SfxSetItem(sal_uInt16 nWhich, const SfxItemSet& rSet);
+ SfxSetItem(const SfxSetItem&, SfxItemPool* pPool = nullptr);
+
+ virtual bool operator==(const SfxPoolItem&) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric,
+ MapUnit ePresMetric, OUString& rText,
+ const IntlWrapper&) const override;
+
+ // create a copy of itself
+ virtual SfxSetItem* Clone(SfxItemPool* pPool = nullptr) const override = 0;
+
+ const SfxItemSet& GetItemSet() const { return maSet; }
+ SfxItemSet& GetItemSet() { return maSet; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sharecontrolfile.hxx b/include/svl/sharecontrolfile.hxx
new file mode 100644
index 0000000000..a7b9ac1db2
--- /dev/null
+++ b/include/svl/sharecontrolfile.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_SHARECONTROLFILE_HXX
+#define INCLUDED_SVL_SHARECONTROLFILE_HXX
+
+#include <svl/svldllapi.h>
+
+#include <svl/lockfilecommon.hxx>
+#include <vector>
+
+namespace com::sun::star::io { class XInputStream; }
+namespace com::sun::star::io { class XOutputStream; }
+namespace com::sun::star::io { class XSeekable; }
+namespace com::sun::star::io { class XStream; }
+namespace com::sun::star::io { class XTruncate; }
+
+namespace svt {
+
+class SVL_DLLPUBLIC ShareControlFile final : public LockFileCommon
+{
+ css::uno::Reference< css::io::XStream > m_xStream;
+ css::uno::Reference< css::io::XInputStream > m_xInputStream;
+ css::uno::Reference< css::io::XOutputStream > m_xOutputStream;
+ css::uno::Reference< css::io::XSeekable > m_xSeekable;
+ css::uno::Reference< css::io::XTruncate > m_xTruncate;
+
+ std::vector< LockFileEntry > m_aUsersData;
+
+ void Close();
+ bool IsValid() const
+ {
+ return ( m_xStream.is() && m_xInputStream.is() && m_xOutputStream.is() && m_xSeekable.is() && m_xTruncate.is() );
+ }
+
+public:
+
+ // The constructor will throw exception in case the stream can not be opened
+ ShareControlFile( std::u16string_view aOrigURL );
+ virtual ~ShareControlFile() override;
+
+ std::vector< LockFileEntry > GetUsersData();
+ void SetUsersDataAndStore( std::unique_lock<std::mutex>& rGuard, std::vector< LockFileEntry >&& aUserNames );
+ LockFileEntry InsertOwnEntry();
+ bool HasOwnEntry();
+ void RemoveEntry( const LockFileEntry& aOptionalSpecification );
+ void RemoveEntry();
+ void RemoveFile();
+private:
+ void RemoveFileImpl(std::unique_lock<std::mutex>& rGuard);
+ std::vector< LockFileEntry > GetUsersDataImpl(std::unique_lock<std::mutex>& rGuard);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx
new file mode 100644
index 0000000000..09261dd5ad
--- /dev/null
+++ b/include/svl/sharedstring.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_SHAREDSTRING_HXX
+#define INCLUDED_SVL_SHAREDSTRING_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+
+#include <utility>
+
+namespace svl {
+
+class SVL_DLLPUBLIC SharedString
+{
+ rtl_uString* mpData = nullptr;
+ rtl_uString* mpDataIgnoreCase = nullptr;
+public:
+
+ static const SharedString & getEmptyString();
+ static const OUString EMPTY_STRING;
+
+ SharedString() = default;
+ SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase );
+ explicit SharedString( const OUString& rStr );
+ SharedString( const SharedString& r );
+ SharedString(SharedString&& r) noexcept;
+ ~SharedString();
+
+ SharedString& operator= ( const SharedString& r );
+ SharedString& operator=(SharedString&& r) noexcept;
+
+ bool operator== ( const SharedString& r ) const;
+ bool operator!= ( const SharedString& r ) const;
+
+ const OUString & getString() const;
+ const OUString & getIgnoreCaseString() const;
+
+ rtl_uString* getData();
+ const rtl_uString* getData() const;
+
+ rtl_uString* getDataIgnoreCase();
+ const rtl_uString* getDataIgnoreCase() const;
+
+ bool isValid() const;
+ bool isEmpty() const;
+
+ sal_Int32 getLength() const;
+};
+
+inline SharedString::SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase ) :
+ mpData(pData), mpDataIgnoreCase(pDataIgnoreCase)
+{
+ if (mpData)
+ rtl_uString_acquire(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_acquire(mpDataIgnoreCase);
+}
+
+inline SharedString::SharedString( const OUString& rStr ) : mpData(rStr.pData)
+{
+ rtl_uString_acquire(mpData);
+}
+
+inline SharedString::SharedString( const SharedString& r ) : mpData(r.mpData), mpDataIgnoreCase(r.mpDataIgnoreCase)
+{
+ if (mpData)
+ rtl_uString_acquire(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_acquire(mpDataIgnoreCase);
+}
+
+inline SharedString::SharedString(SharedString&& r) noexcept
+ : mpData(std::exchange(r.mpData, nullptr))
+ , mpDataIgnoreCase(std::exchange(r.mpDataIgnoreCase, nullptr))
+{
+}
+
+inline SharedString::~SharedString()
+{
+ if (mpData)
+ rtl_uString_release(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_release(mpDataIgnoreCase);
+}
+
+inline SharedString& SharedString::operator=(SharedString&& r) noexcept
+{
+ // Having this inline helps Calc's mdds::multi_type_vector to do some operations
+ // much faster.
+ if (mpData)
+ rtl_uString_release(mpData);
+ if (mpDataIgnoreCase)
+ rtl_uString_release(mpDataIgnoreCase);
+
+ mpData = std::exchange(r.mpData, nullptr);
+ mpDataIgnoreCase = std::exchange(r.mpDataIgnoreCase, nullptr);
+
+ return *this;
+}
+
+inline bool SharedString::operator!= ( const SharedString& r ) const
+{
+ return !operator== (r);
+}
+
+inline const OUString & SharedString::getString() const
+{
+ return mpData ? OUString::unacquired(&mpData) : EMPTY_STRING;
+}
+
+inline const OUString & SharedString::getIgnoreCaseString() const
+{
+ return mpDataIgnoreCase ? OUString::unacquired(&mpDataIgnoreCase) : EMPTY_STRING;
+}
+
+inline rtl_uString* SharedString::getData()
+{
+ return mpData;
+}
+
+inline const rtl_uString* SharedString::getData() const
+{
+ return mpData;
+}
+
+inline rtl_uString* SharedString::getDataIgnoreCase()
+{
+ return mpDataIgnoreCase;
+}
+
+inline const rtl_uString* SharedString::getDataIgnoreCase() const
+{
+ return mpDataIgnoreCase;
+}
+
+inline bool SharedString::isValid() const
+{
+ return mpData != nullptr;
+}
+
+inline bool SharedString::isEmpty() const
+{
+ return mpData == nullptr || mpData->length == 0;
+}
+
+inline sal_Int32 SharedString::getLength() const
+{
+ return mpData ? mpData->length : 0;
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx
new file mode 100644
index 0000000000..6880fec2a1
--- /dev/null
+++ b/include/svl/sharedstringpool.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_SHAREDSTRINGPOOL_HXX
+#define INCLUDED_SVL_SHAREDSTRINGPOOL_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <memory>
+
+class CharClass;
+
+namespace svl
+{
+class SharedString;
+
+/**
+ * Storage for pool of shared strings. It also provides mapping from
+ * original-cased strings to upper-cased strings for case insensitive
+ * operations.
+ */
+class SVL_DLLPUBLIC SharedStringPool
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+ SharedStringPool(const SharedStringPool&) = delete;
+ SharedStringPool& operator=(const SharedStringPool&) = delete;
+
+public:
+ SharedStringPool(const CharClass& rCharClass);
+ ~SharedStringPool();
+
+ /**
+ * Intern a string object into the shared string pool.
+ *
+ * @param rStr string object to intern.
+ *
+ * @return a pointer to the string object stored inside the pool, or NULL
+ * if the insertion fails.
+ */
+ SharedString intern(const OUString& rStr);
+
+ /**
+ * Go through all string objects in the pool, and clear those that are no
+ * longer used outside of the pool.
+ */
+ void purge();
+
+ // For unit tests. Note that an "empty" pool may contain some internal items,
+ // such as SharedString::getEmptyString().
+ size_t getCount() const;
+ size_t getCountIgnoreCase() const;
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sigstruct.hxx b/include/svl/sigstruct.hxx
new file mode 100644
index 0000000000..20cb0ebd2d
--- /dev/null
+++ b/include/svl/sigstruct.hxx
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_XMLSECURITY_INC_SIGSTRUCT_HXX
+#define INCLUDED_XMLSECURITY_INC_SIGSTRUCT_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/crypto/SecurityOperationStatus.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <set>
+#include <vector>
+
+namespace com::sun::star::graphic { class XGraphic; }
+
+/*
+ * type of reference
+ */
+enum class SignatureReferenceType
+{
+ SAMEDOCUMENT = 1,
+ BINARYSTREAM = 2,
+ XMLSTREAM = 3
+};
+
+struct SignatureReferenceInformation
+{
+ SignatureReferenceType nType;
+ OUString ouURI;
+ // For ODF: XAdES digests (SHA256) or the old SHA1, from css::xml::crypto::DigestID
+ sal_Int32 nDigestID;
+ OUString ouDigestValue;
+ /// Type of the reference: a URI (newer idSignedProperties references) or empty.
+ OUString ouType;
+
+ SignatureReferenceInformation() :
+ nType(SignatureReferenceType::SAMEDOCUMENT),
+ ouURI(""),
+ nDigestID(css::xml::crypto::DigestID::SHA1),
+ ouDigestValue("")
+ {
+ }
+
+ SignatureReferenceInformation( SignatureReferenceType type, sal_Int32 digestID, const OUString& uri, const OUString& rType ) :
+ SignatureReferenceInformation()
+ {
+ nType = type;
+ nDigestID = digestID;
+ ouURI = uri;
+ ouType = rType;
+ }
+};
+
+typedef ::std::vector< SignatureReferenceInformation > SignatureReferenceInformations;
+
+namespace svl::crypto
+{
+/// Specifies the algorithm used for signature generation and validation.
+enum class SignatureMethodAlgorithm
+{
+ RSA,
+ ECDSA
+};
+}
+
+
+struct SignatureInformation
+{
+ sal_Int32 nSecurityId;
+ css::xml::crypto::SecurityOperationStatus nStatus;
+ SignatureReferenceInformations vSignatureReferenceInfors;
+ struct X509CertInfo
+ {
+ OUString X509IssuerName;
+ OUString X509SerialNumber;
+ OUString X509Certificate;
+ /// OOXML certificate SHA-256 digest, empty for ODF except when doing XAdES signature.
+ OUString CertDigest;
+ /// The certificate owner (aka subject).
+ OUString X509Subject;
+ };
+ typedef std::vector<X509CertInfo> X509Data;
+ // note: at parse time, it's unknown which one is the signing certificate;
+ // ImplVerifySignatures() figures it out and puts it at the back
+ std::vector<X509Data> X509Datas;
+
+ X509CertInfo const* GetSigningCertificate() const
+ {
+ if (X509Datas.empty())
+ {
+ return nullptr;
+ }
+ assert(!X509Datas.back().empty());
+ return & X509Datas.back().back();
+ }
+
+ OUString ouGpgKeyID;
+ OUString ouGpgCertificate;
+ OUString ouGpgOwner;
+
+ OUString ouSignatureValue;
+ css::util::DateTime stDateTime;
+
+ // XAdES EncapsulatedX509Certificate values
+ std::set<OUString> maEncapsulatedX509Certificates;
+
+ OUString ouSignatureId;
+ // signature may contain multiple time stamps - check they're consistent
+ bool hasInconsistentSigningTime = false;
+ //We also keep the date and time as string. This is done when this
+ //structure is created as a result of a XML signature being read.
+ //When then a signature is added or another removed, then the original
+ //XML signatures are written again (unless they have been removed).
+ //If the date time string is converted into the DateTime structure
+ //then information can be lost because it only holds a fractional
+ //of a second with an accuracy of one hundredth of second.
+ //If the string contains
+ //milliseconds (because the document was created by an application other than OOo)
+ //and the converted time is written back, then the string looks different
+ //and the signature is broken.
+ OUString ouDateTime;
+ /// The Id attribute of the <SignatureProperty> element that contains the <dc:date>.
+ OUString ouDateTimePropertyId;
+ /// Characters of the <dc:description> element inside the signature.
+ OUString ouDescription;
+ /// The Id attribute of the <SignatureProperty> element that contains the <dc:description>.
+ OUString ouDescriptionPropertyId;
+ /// Valid and invalid signature line images
+ css::uno::Reference<css::graphic::XGraphic> aValidSignatureImage;
+ css::uno::Reference<css::graphic::XGraphic> aInvalidSignatureImage;
+ /// Signature Line Id, used to map signatures to their respective signature line images.
+ OUString ouSignatureLineId;
+ /// A full OOXML signature for unchanged roundtrip, empty for ODF.
+ css::uno::Sequence<sal_Int8> aSignatureBytes;
+ /// For PDF: digest format, from css::xml::crypto::DigestID
+ sal_Int32 nDigestID;
+ /// For PDF: has id-aa-signingCertificateV2 as a signed attribute.
+ bool bHasSigningCertificate;
+ /// For PDF: the byte range doesn't cover the whole document.
+ bool bPartialDocumentSignature;
+
+ svl::crypto::SignatureMethodAlgorithm eAlgorithmID;
+
+ SignatureInformation( sal_Int32 nId )
+ {
+ nSecurityId = nId;
+ nStatus = css::xml::crypto::SecurityOperationStatus_UNKNOWN;
+ nDigestID = 0;
+ bHasSigningCertificate = false;
+ bPartialDocumentSignature = false;
+ eAlgorithmID = svl::crypto::SignatureMethodAlgorithm::RSA;
+ }
+};
+
+typedef ::std::vector< SignatureInformation > SignatureInformations;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/slstitm.hxx b/include/svl/slstitm.hxx
new file mode 100644
index 0000000000..48e5581498
--- /dev/null
+++ b/include/svl/slstitm.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_SLSTITM_HXX
+#define INCLUDED_SVL_SLSTITM_HXX
+
+#include <vector>
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <memory>
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+class SVL_DLLPUBLIC SfxStringListItem final : public SfxPoolItem
+{
+ std::shared_ptr<std::vector<OUString>> mpList;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SfxStringListItem();
+ SfxStringListItem( sal_uInt16 nWhich, const std::vector<OUString> *pList=nullptr );
+ virtual ~SfxStringListItem() override;
+
+ SfxStringListItem(SfxStringListItem const &) = default;
+ SfxStringListItem(SfxStringListItem &&) = default;
+ SfxStringListItem & operator =(SfxStringListItem const &) = delete; // due to SfxPoolItem
+ SfxStringListItem & operator =(SfxStringListItem &&) = delete; // due to SfxPoolItem
+
+ std::vector<OUString>& GetList();
+
+ const std::vector<OUString>& GetList() const;
+
+ // String-Separator: \n
+ void SetString( const OUString& );
+ OUString GetString();
+
+ void SetStringList( const css::uno::Sequence< OUString >& rList );
+ void GetStringList( css::uno::Sequence< OUString >& rList ) const;
+
+ virtual bool operator==( const SfxPoolItem& ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& ) const override;
+ virtual SfxStringListItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+
+ virtual bool PutValue ( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
new file mode 100644
index 0000000000..f1ec1a4568
--- /dev/null
+++ b/include/svl/solar.hrc
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_SOLAR_HRC
+#define INCLUDED_SVL_SOLAR_HRC
+
+// defines ------------------------------------------------------------------
+
+#define OWN_ATTR_VALUE_START 3900
+#define OWN_ATTR_VALUE_END 4008
+
+#define RID_LIB_START 10000
+#define RID_LIB_END 19999
+
+#define RID_SVX_START (RID_LIB_START)
+// RID_SVX_END (RID_LIB_START+499)
+
+#define RID_OFA_START (RID_LIB_START+6900)
+// RID_OFA_END (RID_LIB_START+7399)
+
+// do *NOT* add more ranges here, RID_LIB_END is (RID_LIB_START + 10000)
+
+#define RID_APP_START 20000
+// RID_APP_END 31999
+
+#define RID_SW_START (20000)
+// RID_SW_END (25999)
+
+// free: 26000-28199
+
+// Help-Ids --------------------------------------------------------------
+
+#define HID_START 32768
+
+#define HID_SC_START (HID_START+25000)
+// HID_SC_END (HID_START+26999)
+
+#define HID_SD_START (HID_START+27000)
+// HID_SD_END (HID_START+27999)
+
+// Slot Ids
+
+#define SID_SFX_START 5000
+// SID_SFX_END 8999
+#define SID_DOCKWIN_START 9800
+// SID_DOCKWIN_END 9999
+
+#define SID_LIB_START 10000
+// SID_LIB_END 19999
+// free: 20000-29999
+#define SID_OBJ_START 30000
+
+#define SID_SW_START 20000
+// SID_SW_END 25999
+#define SID_SC_START 26000
+// SID_SC_END 26999
+#define SID_SD_START 27000
+// SID_SD_END 27999
+
+#define SID_SMA_START (SID_OBJ_START + 256)
+// SID_SMA_END (SID_OBJ_START + 511)
+#define SID_BASICIDE_START (SID_OBJ_START + 768)
+// SID_BASICIDE_END (SID_BASICIDE_START + 255)
+
+#define SID_SVX_START SID_LIB_START // 10000
+#define SID_SVX_END (SID_SVX_START + 1499)
+#define SID_EDIT_START (SID_SVX_END + 1) // 11500
+#define SID_EDIT_END (SID_EDIT_START + 499)
+#define SID_OPTIONS_START (SID_EDIT_END + 1) // 12000
+#define SID_OPTIONS_END (SID_OPTIONS_START + 100)
+#define SID_SBA_START (SID_OPTIONS_END + 1) // 12101
+#define SID_SBA_END (SID_SBA_START + 149)
+#define SID_DBACCESS_START (SID_SBA_END + 1) // 12251
+#define SID_DBACCESS_END (SID_DBACCESS_START + 200)
+#define SID_RPTUI_START (SID_DBACCESS_END + 1) // 12452
+// SID_RPTUI_END (SID_RPTUI_START + 199)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/srchdefs.hxx b/include/svl/srchdefs.hxx
new file mode 100644
index 0000000000..d77341c36f
--- /dev/null
+++ b/include/svl/srchdefs.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_SRCHDEFS_HXX
+#define INCLUDED_SVL_SRCHDEFS_HXX
+
+#include <o3tl/typed_flags_set.hxx>
+
+enum class SearchOptionFlags
+{
+ NONE = 0x0000,
+ SEARCH = 0x0001,
+ SEARCHALL = 0x0002, // named to this way to avoid conflict with macro on Windows.
+ REPLACE = 0x0004,
+ REPLACE_ALL = 0x0008,
+ WHOLE_WORDS = 0x0010,
+ BACKWARDS = 0x0020,
+ REG_EXP = 0x0040,
+ EXACT = 0x0080,
+ SELECTION = 0x0100,
+ FAMILIES = 0x0200,
+ FORMAT = 0x0400,
+ SIMILARITY = 0x0800,
+ WILDCARD = 0x1000,
+ ALL = 0x1fff
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SearchOptionFlags> : is_typed_flags<SearchOptionFlags, 0x1fff> {};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
new file mode 100644
index 0000000000..c51d2d752e
--- /dev/null
+++ b/include/svl/srchitem.hxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_SRCHITEM_HXX
+#define INCLUDED_SVL_SRCHITEM_HXX
+
+#include <sal/config.h>
+#include <svl/svldllapi.h>
+#include <com/sun/star/util/SearchAlgorithms2.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <i18nutil/transliteration.hxx>
+#include <i18nutil/searchopt.hxx>
+#include <unotools/configitem.hxx>
+#include <svl/style.hxx>
+#include <svl/poolitem.hxx>
+
+// defines ---------------------------------------------------------------
+
+// commands
+enum class SvxSearchCmd
+{
+ FIND = 0,
+ FIND_ALL = 1,
+ REPLACE = 2,
+ REPLACE_ALL = 3,
+};
+
+// search flags
+enum class SvxSearchCellType
+{
+ FORMULA = 0,
+ VALUE = 1,
+ NOTE = 2,
+};
+
+enum class SvxSearchApp
+{
+ WRITER = 0,
+ CALC = 1,
+ DRAW = 2,
+};
+
+// class SvxSearchItem ---------------------------------------------------
+
+class SVL_DLLPUBLIC SvxSearchItem final :
+ public SfxPoolItem,
+ public utl::ConfigItem
+{
+ i18nutil::SearchOptions2 m_aSearchOpt;
+
+ SfxStyleFamily m_eFamily; // style family
+
+ SvxSearchCmd m_nCommand; // command (Search, Search all, Replace, Replace all)
+
+ // Calc-specific
+ SvxSearchCellType m_nCellType; // Search in Formulas/Values/Notes
+ SvxSearchApp m_nAppFlag; // application which the dialog is for
+ bool m_bRowDirection; // search direction: row-wise/column-wise
+ bool m_bAllTables; // search in all sheets
+ bool m_bSearchFiltered; // search filtered cells.
+ bool m_bSearchFormatted; // search formatted display strings
+
+ // Writer-specific
+ bool m_bNotes;
+
+ bool m_bBackward; // search backwards
+ bool m_bPattern; // search for styles
+ bool m_bContent; // search in content
+ bool m_bAsianOptions; // use asian options?
+
+ // Start search at this point (absolute twips).
+ sal_Int32 m_nStartPointX;
+ sal_Int32 m_nStartPointY;
+
+ virtual void ImplCommit() override;
+
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SvxSearchItem( const sal_uInt16 nId );
+ SvxSearchItem( const SvxSearchItem& rItem );
+ virtual ~SvxSearchItem() override;
+
+ virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+ virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+ virtual bool operator == ( const SfxPoolItem& ) const override;
+ virtual SvxSearchItem* Clone( SfxItemPool *pPool = nullptr ) const override;
+ virtual bool GetPresentation( SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText, const IntlWrapper& ) const override;
+
+ // ConfigItem
+ virtual void Notify( const css::uno::Sequence< OUString > &rPropertyNames ) override;
+
+ bool equalsIgnoring(const SvxSearchItem& rSItem, bool bIgnoreReplace,
+ bool bIgnoreCommand) const;
+
+ SvxSearchCmd GetCommand() const { return m_nCommand; }
+ void SetCommand(SvxSearchCmd nNewCommand) { m_nCommand = nNewCommand; }
+
+ inline const OUString& GetSearchString() const;
+ inline void SetSearchString(const OUString& rNewString);
+
+ inline const OUString& GetReplaceString() const;
+ inline void SetReplaceString(const OUString& rNewString);
+
+ inline bool GetWordOnly() const;
+ void SetWordOnly(bool bNewWordOnly);
+
+ inline bool GetExact() const;
+ void SetExact(bool bNewExact);
+
+ bool GetBackward() const { return m_bBackward; }
+ void SetBackward(bool bNewBackward) { m_bBackward = bNewBackward; }
+
+ inline bool GetSelection() const;
+ void SetSelection(bool bNewSelection);
+
+ inline bool GetRegExp() const;
+ void SetRegExp( bool bVal );
+
+ inline bool GetWildcard() const;
+ void SetWildcard( bool bVal );
+
+ inline sal_Int32 GetWildcardEscapeCharacter() const;
+ inline void SetWildcardEscapeCharacter(sal_Int32 val);
+
+ bool GetPattern() const { return m_bPattern; }
+ void SetPattern(bool bNewPattern) { m_bPattern = bNewPattern; }
+
+ SfxStyleFamily GetFamily() const { return m_eFamily; }
+ void SetFamily( SfxStyleFamily eNewFamily )
+ { m_eFamily = eNewFamily; }
+
+ bool GetRowDirection() const { return m_bRowDirection; }
+ void SetRowDirection(bool bNewRowDirection) { m_bRowDirection = bNewRowDirection; }
+
+ bool IsAllTables() const { return m_bAllTables; }
+ void SetAllTables(bool bNew) { m_bAllTables = bNew; }
+
+ bool IsSearchFiltered() const { return m_bSearchFiltered; }
+ void SetSearchFiltered(bool b) { m_bSearchFiltered = b; }
+
+ bool IsSearchFormatted() const { return m_bSearchFormatted; }
+ void SetSearchFormatted(bool b) { m_bSearchFormatted = b; }
+
+ SvxSearchCellType GetCellType() const { return m_nCellType; }
+ void SetCellType(SvxSearchCellType nNewCellType) { m_nCellType = nNewCellType; }
+
+ bool GetNotes() const { return m_bNotes; }
+ void SetNotes(bool bNew) { m_bNotes = bNew; }
+
+ SvxSearchApp GetAppFlag() const { return m_nAppFlag; }
+ void SetAppFlag(SvxSearchApp nNewAppFlag) { m_nAppFlag = nNewAppFlag; }
+
+ inline bool IsLevenshtein() const;
+ void SetLevenshtein( bool bVal );
+
+ inline bool IsLEVRelaxed() const;
+ void SetLEVRelaxed(bool bSet);
+
+ inline sal_uInt16 GetLEVOther() const;
+ inline void SetLEVOther(sal_uInt16 nSet);
+
+ inline sal_uInt16 GetLEVShorter() const;
+ inline void SetLEVShorter(sal_uInt16 nSet);
+
+ inline sal_uInt16 GetLEVLonger() const;
+ inline void SetLEVLonger(sal_uInt16 nSet);
+
+ inline const i18nutil::SearchOptions2 &
+ GetSearchOptions() const;
+ inline void SetSearchOptions( const i18nutil::SearchOptions2 &rOpt );
+
+ inline TransliterationFlags
+ GetTransliterationFlags() const;
+ void SetTransliterationFlags( TransliterationFlags nFlags );
+
+ inline bool IsMatchFullHalfWidthForms() const;
+ void SetMatchFullHalfWidthForms( bool bVal );
+
+ bool IsUseAsianOptions() const { return m_bAsianOptions; }
+ void SetUseAsianOptions( bool bVal ) { m_bAsianOptions = bVal; }
+
+ sal_Int32 GetStartPointX() const;
+ sal_Int32 GetStartPointY() const;
+ /// Either x or y start point is set.
+ bool HasStartPoint() const;
+};
+
+const OUString& SvxSearchItem::GetSearchString() const
+{
+ return m_aSearchOpt.searchString;
+}
+
+void SvxSearchItem::SetSearchString(const OUString& rNewString)
+{
+ m_aSearchOpt.searchString = rNewString;
+}
+
+const OUString& SvxSearchItem::GetReplaceString() const
+{
+ return m_aSearchOpt.replaceString;
+}
+
+void SvxSearchItem::SetReplaceString(const OUString& rNewString)
+{
+ m_aSearchOpt.replaceString = rNewString;
+}
+
+bool SvxSearchItem::GetWordOnly() const
+{
+ return 0 != (m_aSearchOpt.searchFlag &
+ css::util::SearchFlags::NORM_WORD_ONLY);
+}
+
+bool SvxSearchItem::GetExact() const
+{
+ return !(m_aSearchOpt.transliterateFlags & TransliterationFlags::IGNORE_CASE);
+}
+
+bool SvxSearchItem::GetSelection() const
+{
+ return 0 != (m_aSearchOpt.searchFlag & css::util::SearchFlags::REG_NOT_BEGINOFLINE);
+}
+
+bool SvxSearchItem::GetRegExp() const
+{
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::REGEXP ;
+}
+
+bool SvxSearchItem::GetWildcard() const
+{
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::WILDCARD ;
+}
+
+sal_Int32 SvxSearchItem::GetWildcardEscapeCharacter() const
+{
+ return m_aSearchOpt.WildcardEscapeCharacter;
+}
+
+void SvxSearchItem::SetWildcardEscapeCharacter(sal_Int32 val)
+{
+ m_aSearchOpt.WildcardEscapeCharacter = val;
+}
+
+bool SvxSearchItem::IsLEVRelaxed() const
+{
+ return 0 != (m_aSearchOpt.searchFlag & css::util::SearchFlags::LEV_RELAXED);
+}
+
+sal_uInt16 SvxSearchItem::GetLEVOther() const
+{
+ return static_cast<sal_Int16>(m_aSearchOpt.changedChars);
+}
+
+void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
+{
+ m_aSearchOpt.changedChars = nVal;
+}
+
+sal_uInt16 SvxSearchItem::GetLEVShorter() const
+{
+ return static_cast<sal_Int16>(m_aSearchOpt.insertedChars);
+}
+
+void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
+{
+ m_aSearchOpt.insertedChars = nVal;
+}
+
+sal_uInt16 SvxSearchItem::GetLEVLonger() const
+{
+ return static_cast<sal_Int16>(m_aSearchOpt.deletedChars);
+}
+
+void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
+{
+ m_aSearchOpt.deletedChars = nVal;
+}
+
+bool SvxSearchItem::IsLevenshtein() const
+{
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::APPROXIMATE;
+}
+
+const i18nutil::SearchOptions2 & SvxSearchItem::GetSearchOptions() const
+{
+ return m_aSearchOpt;
+}
+
+void SvxSearchItem::SetSearchOptions( const i18nutil::SearchOptions2 &rOpt )
+{
+ m_aSearchOpt = rOpt;
+}
+
+TransliterationFlags SvxSearchItem::GetTransliterationFlags() const
+{
+ return m_aSearchOpt.transliterateFlags;
+}
+
+bool SvxSearchItem::IsMatchFullHalfWidthForms() const
+{
+ return bool(m_aSearchOpt.transliterateFlags & TransliterationFlags::IGNORE_WIDTH);
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stritem.hxx b/include/svl/stritem.hxx
new file mode 100644
index 0000000000..fe3695f794
--- /dev/null
+++ b/include/svl/stritem.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_STRITEM_HXX
+#define INCLUDED_SVL_STRITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/custritm.hxx>
+
+
+class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ SfxStringItem(sal_uInt16 which = 0): CntUnencodedStringItem(which) {}
+
+ SfxStringItem(sal_uInt16 which, const OUString & rValue):
+ CntUnencodedStringItem(which, rValue) {}
+
+ virtual SfxStringItem* Clone(SfxItemPool * = nullptr) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+};
+
+#endif // INCLUDED_SVL_STRITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
new file mode 100644
index 0000000000..fc12dc0be7
--- /dev/null
+++ b/include/svl/style.hxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_STYLE_HXX
+#define INCLUDED_SVL_STYLE_HXX
+
+#include <config_options.h>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <rtl/ref.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <svl/svldllapi.h>
+#include <svl/hint.hxx>
+#include <svl/lstner.hxx>
+#include <svl/SfxBroadcaster.hxx>
+#include <svl/stylesheetuser.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <tools/mapunit.hxx>
+#include <tools/solar.h>
+
+#include <memory>
+#include <optional>
+
+// This is used as a flags enum in sw/, but only there,
+// so I don't pull in o3tl::typed_flags here
+enum class SfxStyleFamily {
+ None = 0x00,
+ Char = 0x01,
+ Para = 0x02,
+ Frame = 0x04,
+ Page = 0x08,
+ Pseudo = 0x10,
+ Table = 0x20,
+ Cell = 0x40,
+ All = 0x7fff
+};
+
+enum class SfxStyleSearchBits {
+ // sc/calc styles
+ ScStandard = 0x0001,
+
+ // sw/writer styles
+ SwText = 0x0001,
+ SwChapter = 0x0002,
+ SwList = 0x0004,
+ SwIndex = 0x0008,
+ SwExtra = 0x0010,
+ SwHtml = 0x0020,
+ SwCondColl = 0x0040,
+
+ Auto = 0x0000, ///< automatic: flags from application
+ Hidden = 0x0200, ///< hidden styles (search mask)
+ ReadOnly = 0x2000, ///< readonly styles (search mask)
+ Used = 0x4000, ///< used styles (search mask)
+ UserDefined = 0x8000, ///< user defined styles (search mask)
+ AllVisible = 0xe07f, ///< all visible styles
+ All = 0xe27f, ///< all styles
+};
+namespace o3tl {
+ template<> struct typed_flags<SfxStyleSearchBits> : is_typed_flags<SfxStyleSearchBits, 0xe27f> {};
+}
+
+
+class SfxItemSet;
+class SfxItemPool;
+class SfxStyleSheetBasePool;
+class SvStream;
+
+namespace svl { class IndexedStyleSheets; }
+/*
+Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase
+must broadcast this using <SfxStyleSheetBasePool::GetBroadcaster()> broadcasts.
+The class <SfxStyleSheetHint> is used for this, it contains an Action-Id and a
+pointer to the <SfxStyleSheetBase>. The actions are:
+
+#define SfxHintId::StyleSheetCreated // style is created
+#define SfxHintId::StyleSheetModified // style is modified
+#define SfxHintId::StyleSheetChanged // style is replaced
+#define SfxHintId::StyleSheetErased // style is deleted
+
+The following methods already broadcast themself
+
+SfxSimpleHint(SfxHintId::Dying) from:
+ SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
+
+SfxStyleSheetHint( SfxHintId::StyleSheetCreated, *p ) from:
+ SfxStyleSheetBasePool::Make( const String& rName,
+ SfxStyleFamily eFam, sal_uInt16 mask)
+
+SfxStyleSheetHint( SfxHintId::StyleSheetChanged, *pNew ) from:
+ SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet )
+
+SfxStyleSheetHint( SfxHintId::StyleSheetErased, *p ) from:
+ SfxStyleSheetBasePool::Erase( SfxStyleSheetBase* p )
+ SfxStyleSheetBasePool::Clear()
+*/
+
+class SVL_DLLPUBLIC SfxStyleSheetBase : public cppu::WeakImplHelper<>
+{
+private:
+ friend class SfxStyleSheetBasePool;
+
+protected:
+ SfxStyleSheetBasePool* m_pPool; // related pool
+ SfxStyleFamily nFamily;
+
+ OUString aName, aParent, aFollow;
+ OUString aHelpFile; // name of the help file
+ SfxItemSet* pSet; // ItemSet
+ SfxStyleSearchBits nMask; // Flags
+
+ sal_uLong nHelpId; // help ID
+
+ bool bMySet; // sal_True: delete Set in dtor
+ bool bHidden;
+
+ SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, SfxStyleSearchBits mask );
+ SfxStyleSheetBase( const SfxStyleSheetBase& );
+ virtual ~SfxStyleSheetBase() override;
+
+public:
+
+ // returns the internal name of this style
+ const OUString& GetName() const;
+
+ // sets the internal name of this style.
+ //
+ // If the name of a style is changed, then the styles container needs to be
+ // reindexed (see IndexedStyleSheets). If you set bReindexNow to false to
+ // defer that indexing, then you must call the Reindex manually on the
+ // SfxStyleSheetBasePool parent.
+ virtual bool SetName(const OUString& rNewName, bool bReindexNow = true);
+
+ virtual const OUString& GetParent() const;
+ virtual bool SetParent( const OUString& );
+ virtual const OUString& GetFollow() const;
+ virtual bool SetFollow( const OUString& );
+ virtual bool HasFollowSupport() const; // Default true
+ virtual bool HasParentSupport() const; // Default true
+ virtual bool HasClearParentSupport() const; // Default false
+ virtual bool IsUsed() const; // Default true
+ virtual OUString GetDescription( MapUnit eMetric );
+
+ virtual OUString GetUsedBy() { return OUString(); }
+
+ SfxStyleSheetBasePool* GetPool() { return m_pPool; }
+ SfxStyleFamily GetFamily() const { return nFamily; }
+ SfxStyleSearchBits GetMask() const { return nMask; }
+ void SetMask( SfxStyleSearchBits mask) { nMask = mask; }
+ bool IsUserDefined() const
+ { return bool( nMask & SfxStyleSearchBits::UserDefined); }
+
+ virtual bool IsHidden() const { return bHidden; }
+ virtual void SetHidden( bool bValue );
+
+ virtual sal_uLong GetHelpId( OUString& rFile );
+ virtual void SetHelpId( const OUString& r, sal_uLong nId );
+
+ virtual SfxItemSet& GetItemSet();
+ /// Due to writer's usual lack of sanity this is a separate function for
+ /// preview only; it shall not create the style in case it does not exist.
+ /// If the style has parents, it is _not_ required that the returned item
+ /// set has parents (i.e. use it for display purposes only).
+ virtual std::optional<SfxItemSet> GetItemSetForPreview();
+
+ /// Fix for expensive dynamic_cast
+ virtual bool isScStyleSheet() const { return false; }
+};
+
+/* Class to iterate and search on a SfxStyleSheetBasePool */
+class SVL_DLLPUBLIC SfxStyleSheetIterator
+{
+public:
+ /** Constructor.
+ * The iterator will only iterate over style sheets which have the family \p eFam
+ */
+ SfxStyleSheetIterator(const SfxStyleSheetBasePool *pBase,
+ SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All );
+ SfxStyleSearchBits GetSearchMask() const;
+ SfxStyleFamily GetSearchFamily() const;
+ virtual sal_Int32 Count();
+ virtual SfxStyleSheetBase *operator[](sal_Int32 nIdx);
+ virtual SfxStyleSheetBase* First();
+ virtual SfxStyleSheetBase* Next();
+ virtual SfxStyleSheetBase* Find(const OUString& rStr);
+ virtual ~SfxStyleSheetIterator();
+
+ bool SearchUsed() const { return bSearchUsed; }
+
+protected:
+
+ const SfxStyleSheetBasePool* pBasePool;
+ SfxStyleFamily nSearchFamily;
+ SfxStyleSearchBits nMask;
+
+
+private:
+ SVL_DLLPRIVATE bool IsTrivialSearch() const;
+
+ SfxStyleSheetBase* pCurrentStyle;
+ sal_Int32 mnCurrentPosition;
+ bool bSearchUsed;
+
+friend class SfxStyleSheetBasePool;
+};
+
+class SfxStyleSheetBasePool_Impl;
+
+class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public cppu::WeakImplHelper<>
+{
+friend class SfxStyleSheetIterator;
+friend class SfxStyleSheetBase;
+
+ std::unique_ptr<SfxStyleSheetBasePool_Impl> pImpl;
+
+ SfxStyleSheetIterator& GetIterator_Impl(SfxStyleFamily eFamily, SfxStyleSearchBits eMask);
+protected:
+ SfxStyleSheetIterator* GetCachedIterator();
+
+ SfxItemPool& rPool;
+
+ void ChangeParent(std::u16string_view rOld, const OUString& rNew, SfxStyleFamily eFamily, bool bVirtual = true);
+ virtual rtl::Reference<SfxStyleSheetBase> Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits );
+ virtual rtl::Reference<SfxStyleSheetBase> Create( const SfxStyleSheetBase& );
+
+ virtual ~SfxStyleSheetBasePool() override;
+
+ void StoreStyleSheet(const rtl::Reference< SfxStyleSheetBase >&);
+
+ /** Obtain the indexed style sheets.
+ */
+ const svl::IndexedStyleSheets&
+ GetIndexedStyleSheets() const;
+ SfxStyleSheetBase* GetStyleSheetByPositionInIndex(unsigned pos);
+
+public:
+ SfxStyleSheetBasePool( SfxItemPool& );
+ SfxStyleSheetBasePool( const SfxStyleSheetBasePool& );
+
+ SfxItemPool& GetPool() { return rPool;}
+ const SfxItemPool& GetPool() const { return rPool;}
+
+ virtual std::unique_ptr<SfxStyleSheetIterator> CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask = SfxStyleSearchBits::All);
+
+ virtual SfxStyleSheetBase& Make(const OUString&,
+ SfxStyleFamily eFam,
+ SfxStyleSearchBits nMask = SfxStyleSearchBits::All);
+
+ virtual void Remove( SfxStyleSheetBase* );
+ void Insert( SfxStyleSheetBase* );
+
+ void Clear();
+
+ SfxStyleSheetBasePool& operator=( const SfxStyleSheetBasePool& );
+ SfxStyleSheetBasePool& operator+=( const SfxStyleSheetBasePool& );
+
+ SfxStyleSheetBase* First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask = SfxStyleSearchBits::All);
+ SfxStyleSheetBase* Next();
+ virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All );
+
+ void Reindex();
+ /** Add a style sheet.
+ * Not an actual public function. Do not call it from non-subclasses.
+ */
+ void Add( const SfxStyleSheetBase& );
+};
+
+class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase,
+ public SfxListener, public SfxBroadcaster, public svl::StyleSheetUser
+{
+public:
+
+ SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, SfxStyleSearchBits );
+ SfxStyleSheet( const SfxStyleSheet& );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+
+ virtual bool isUsedByModel() const override;
+
+ virtual bool SetParent( const OUString& ) override;
+
+protected:
+ virtual ~SfxStyleSheet() override;
+};
+
+class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool
+{
+protected:
+ using SfxStyleSheetBasePool::Create;
+ virtual rtl::Reference<SfxStyleSheetBase> Create(const OUString&, SfxStyleFamily, SfxStyleSearchBits mask) override;
+
+public:
+ SfxStyleSheetPool( SfxItemPool const& );
+};
+
+
+class SVL_DLLPUBLIC SfxStyleSheetPoolHint final : public SfxHint
+{
+public:
+ SfxStyleSheetPoolHint() {}
+};
+
+
+class SVL_DLLPUBLIC SfxStyleSheetHint: public SfxHint
+{
+ SfxStyleSheetBase* pStyleSh;
+public:
+ SfxStyleSheetHint( SfxHintId, SfxStyleSheetBase& );
+ SfxStyleSheetBase* GetStyleSheet() const
+ { return pStyleSh; }
+};
+
+class UNLESS_MERGELIBS(SVL_DLLPUBLIC) SfxStyleSheetModifiedHint final : public SfxStyleSheetHint
+{
+ OUString aName;
+
+public:
+ SfxStyleSheetModifiedHint( OUString aOld,
+ SfxStyleSheetBase& );
+ const OUString& GetOldName() const { return aName; }
+};
+
+class SVL_DLLPUBLIC SfxUnoStyleSheet : public cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle>
+{
+public:
+ SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask );
+
+ static SfxUnoStyleSheet* getUnoStyleSheet( const css::uno::Reference< css::style::XStyle >& xStyle );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stylepool.hxx b/include/svl/stylepool.hxx
new file mode 100644
index 0000000000..0a22cb1f70
--- /dev/null
+++ b/include/svl/stylepool.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_STYLEPOOL_HXX
+#define INCLUDED_SVL_STYLEPOOL_HXX
+
+#include <memory>
+#include <rtl/ustring.hxx>
+#include <svl/itemset.hxx>
+
+class StylePoolImpl;
+class IStylePoolIteratorAccess;
+
+class SVL_DLLPUBLIC StylePool final
+{
+private:
+ std::unique_ptr<StylePoolImpl> pImpl;
+public:
+ explicit StylePool( SfxItemSet const * pIgnorableItems = nullptr );
+
+ /** Insert a SfxItemSet into the style pool.
+
+ The pool makes a copy of the provided SfxItemSet.
+
+ @param SfxItemSet
+ the SfxItemSet to insert
+
+ @param pParentName
+ Name of the parent of rSet. If set, createIterator() can be more deterministic by iterating
+ over item sets ordered by parent names.
+
+ @return a shared pointer to the SfxItemSet
+ */
+ std::shared_ptr<SfxItemSet> insertItemSet( const SfxItemSet& rSet, const OUString* pParentName = nullptr );
+
+ /** Create an iterator
+
+ The iterator walks through the StylePool
+ OD 2008-03-07 #i86923#
+ introduce optional parameter to control, if unused SfxItemsSet are skipped or not
+ introduce optional parameter to control, if ignorable items are skipped or not
+
+ @attention every change, e.g. destruction, of the StylePool could cause undefined effects.
+
+ @param bSkipUnusedItemSets
+ input parameter - boolean, indicating if unused SfxItemSets are skipped or not
+
+ @param bSkipIgnorableItems
+ input parameter - boolean, indicating if ignorable items are skipped or not
+
+ @postcond the iterator "points before the first" SfxItemSet of the pool.
+ The first StylePoolIterator::getNext() call will deliver the first SfxItemSet.
+ */
+ std::unique_ptr<IStylePoolIteratorAccess> createIterator( const bool bSkipUnusedItemSets = false,
+ const bool bSkipIgnorableItems = false );
+
+ ~StylePool();
+
+ static OUString nameOf( const std::shared_ptr<SfxItemSet>& pSet );
+};
+
+class SVL_DLLPUBLIC IStylePoolIteratorAccess
+{
+public:
+ /** Delivers a shared pointer to the next SfxItemSet of the pool
+ If there is no more SfxItemSet, the delivered share_pointer is empty.
+ */
+ virtual std::shared_ptr<SfxItemSet> getNext() = 0;
+ virtual ~IStylePoolIteratorAccess() {};
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stylesheetuser.hxx b/include/svl/stylesheetuser.hxx
new file mode 100644
index 0000000000..24d23a94bd
--- /dev/null
+++ b/include/svl/stylesheetuser.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_STYLESHEETUSER_HXX
+#define INCLUDED_SVL_STYLESHEETUSER_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+namespace svl
+{
+/** Test whether object that uses a stylesheet is used itself.
+
+ This interface should be implemented by all classes that use
+ a SfxStyleSheet (and listen on it). It can be queried by the stylesheet
+ to determine if it is really used.
+ */
+class SAL_DLLPUBLIC_RTTI SAL_LOPLUGIN_ANNOTATE("crosscast") StyleSheetUser
+{
+public:
+ /** Test whether this object is used.
+
+ @return true, if the object is used, false otherwise
+ */
+ virtual bool isUsedByModel() const = 0;
+
+protected:
+ ~StyleSheetUser() {}
+};
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx
new file mode 100644
index 0000000000..e8b808ea11
--- /dev/null
+++ b/include/svl/svdde.hxx
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_SVDDE_HXX
+#define INCLUDED_SVL_SVDDE_HXX
+
+#include <sal/config.h>
+
+#include <svl/svldllapi.h>
+#include <sot/formats.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/solar.h>
+#include <tools/link.hxx>
+#include <tools/long.hxx>
+#include <memory>
+#include <vector>
+
+class DdeString;
+class DdeConnection;
+class DdeTopic;
+class DdeService;
+struct DdeDataImp;
+struct DdeImp;
+struct DdeItemImpData;
+struct Conversation;
+
+typedef ::std::vector< DdeService* > DdeServices;
+
+
+class SVL_DLLPUBLIC DdeData
+{
+ friend class DdeInternal;
+ friend class DdeService;
+ friend class DdeConnection;
+ friend class DdeTransaction;
+ std::unique_ptr<DdeDataImp> xImp;
+
+ SVL_DLLPRIVATE void Lock();
+
+ void SetFormat( SotClipboardFormatId nFmt );
+
+public:
+ DdeData();
+ DdeData(SAL_UNUSED_PARAMETER const void*, SAL_UNUSED_PARAMETER tools::Long, SAL_UNUSED_PARAMETER SotClipboardFormatId = SotClipboardFormatId::STRING);
+ DdeData(SAL_UNUSED_PARAMETER const OUString&);
+ DdeData(const DdeData&);
+ DdeData(DdeData&&) noexcept;
+ ~DdeData();
+
+ void const * getData() const;
+ tools::Long getSize() const;
+
+ SotClipboardFormatId GetFormat() const;
+
+ DdeData& operator=(const DdeData&);
+ DdeData& operator=(DdeData&&) noexcept;
+
+ static sal_uInt32 GetExternalFormat(SotClipboardFormatId nFmt);
+ static SotClipboardFormatId GetInternalFormat(sal_uLong nFmt);
+};
+
+
+class SVL_DLLPUBLIC DdeTransaction
+{
+public:
+ void Data( const DdeData* );
+ void Done( bool bDataValid );
+protected:
+ DdeConnection& rDde;
+ DdeData aDdeData;
+ DdeString* pName;
+ short nType;
+ sal_IntPtr nId;
+ sal_IntPtr nTime;
+ Link<const DdeData*,void> aData;
+ Link<bool,void> aDone;
+ bool bBusy;
+
+ DdeTransaction( DdeConnection&, SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER tools::Long = 0 );
+
+public:
+ virtual ~DdeTransaction();
+
+ bool IsBusy() const { return bBusy; }
+ OUString GetName() const;
+
+ void Execute();
+
+ void SetDataHdl( const Link<const DdeData*,void>& rLink ) { aData = rLink; }
+ const Link<const DdeData*,void>& GetDataHdl() const { return aData; }
+
+ void SetDoneHdl( const Link<bool,void>& rLink ) { aDone = rLink; }
+ const Link<bool,void>& GetDoneHdl() const { return aDone; }
+
+ void SetFormat( SotClipboardFormatId nFmt ) { aDdeData.SetFormat( nFmt ); }
+ SotClipboardFormatId GetFormat() const { return aDdeData.GetFormat(); }
+
+ tools::Long GetError() const;
+
+private:
+ friend class DdeInternal;
+ friend class DdeConnection;
+
+ DdeTransaction( const DdeTransaction& ) = delete;
+ const DdeTransaction& operator= ( const DdeTransaction& ) = delete;
+
+};
+
+
+class SVL_DLLPUBLIC DdeLink : public DdeTransaction
+{
+ Link<void*,void> aNotify;
+
+public:
+ DdeLink( DdeConnection&, const OUString&, tools::Long = 0 );
+ virtual ~DdeLink() override;
+
+ void SetNotifyHdl( const Link<void*,void>& rLink ) { aNotify = rLink; }
+ const Link<void*,void>& GetNotifyHdl() const { return aNotify; }
+ void Notify();
+};
+
+
+class SVL_DLLPUBLIC DdeHotLink : public DdeLink
+{
+public:
+ DdeHotLink( DdeConnection&, const OUString& );
+};
+
+
+class SVL_DLLPUBLIC DdeRequest : public DdeTransaction
+{
+public:
+ DdeRequest( DdeConnection&, const OUString&, tools::Long = 0 );
+};
+
+
+class SVL_DLLPUBLIC DdePoke : public DdeTransaction
+{
+public:
+ DdePoke( DdeConnection&, const OUString&, SAL_UNUSED_PARAMETER const DdeData&, tools::Long = 0 );
+};
+
+
+class SVL_DLLPUBLIC DdeExecute : public DdeTransaction
+{
+public:
+ DdeExecute( DdeConnection&, const OUString&, tools::Long = 0 );
+};
+
+
+class SVL_DLLPUBLIC DdeConnection
+{
+ friend class DdeInternal;
+ friend class DdeTransaction;
+ std::vector<DdeTransaction*> aTransactions;
+ DdeString* pService;
+ DdeString* pTopic;
+ std::unique_ptr<DdeImp> pImp;
+
+public:
+ DdeConnection( SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER const OUString& );
+ ~DdeConnection();
+
+ tools::Long GetError() const;
+
+ static const std::vector<DdeConnection*>& GetConnections();
+
+ bool IsConnected();
+
+ OUString GetServiceName() const;
+ OUString GetTopicName() const;
+
+private:
+ DdeConnection( const DdeConnection& ) = delete;
+ const DdeConnection& operator= ( const DdeConnection& ) = delete;
+};
+
+
+class SVL_DLLPUBLIC DdeItem
+{
+ friend class DdeInternal;
+ friend class DdeTopic;
+ DdeString* pName;
+ DdeTopic* pMyTopic;
+ std::vector<DdeItemImpData>* pImpData;
+
+protected:
+ sal_uInt8 nType;
+
+public:
+ DdeItem( const sal_Unicode* );
+ DdeItem( SAL_UNUSED_PARAMETER const OUString& );
+ DdeItem( const DdeItem& );
+ virtual ~DdeItem();
+
+ OUString GetName() const;
+ short GetLinks();
+ void NotifyClient();
+};
+
+
+class SVL_DLLPUBLIC DdeGetPutItem : public DdeItem
+{
+public:
+ DdeGetPutItem( const sal_Unicode* p );
+ DdeGetPutItem( const OUString& rStr );
+ DdeGetPutItem( const DdeItem& rItem );
+
+ virtual DdeData* Get( SotClipboardFormatId );
+ virtual bool Put( const DdeData* );
+ virtual void AdviseLoop( bool ); // Start / Stop AdviseLoop
+};
+
+
+class SVL_DLLPUBLIC DdeTopic
+{
+
+public:
+ virtual DdeData* Get(SotClipboardFormatId);
+ virtual bool Put( const DdeData* );
+ virtual bool Execute( const OUString* );
+ // Eventually create a new item. return 0 -> Item creation failed
+ virtual bool MakeItem( const OUString& rItem );
+
+ // A Warm-/Hot-Link is created. Return true if successful
+ virtual bool StartAdviseLoop();
+
+private:
+ friend class DdeInternal;
+ friend class DdeService;
+ friend class DdeItem;
+
+private:
+ DdeString* pName;
+ OUString aItem;
+ std::vector<DdeItem*> aItems;
+
+public:
+ DdeTopic( SAL_UNUSED_PARAMETER const OUString& );
+ virtual ~DdeTopic();
+
+ OUString GetName() const;
+
+ void NotifyClient( const OUString& );
+ bool IsSystemTopic();
+
+ void InsertItem( DdeItem* ); // For own superclasses
+ DdeItem* AddItem( const DdeItem& ); // Will be cloned
+ void RemoveItem( const DdeItem& );
+ const OUString& GetCurItem() const { return aItem; }
+ const std::vector<DdeItem*>& GetItems() const { return aItems; }
+
+private:
+ DdeTopic( const DdeTopic& ) = delete;
+ const DdeTopic& operator= ( const DdeTopic& ) = delete;
+};
+
+
+class SVL_DLLPUBLIC DdeService
+{
+ friend class DdeInternal;
+
+protected:
+ OUString Topics();
+ OUString Formats();
+ OUString SysItems();
+ OUString Status();
+
+ const DdeTopic* GetSysTopic() const { return pSysTopic; }
+private:
+ std::vector<DdeTopic*> aTopics;
+ std::vector< sal_uInt32 > aFormats;
+ DdeTopic* pSysTopic;
+ DdeString* pName;
+ std::vector<std::unique_ptr<Conversation>>
+ m_vConv;
+ short nStatus;
+
+ SVL_DLLPRIVATE bool HasCbFormat( sal_uInt32 );
+
+public:
+ DdeService( SAL_UNUSED_PARAMETER const OUString& );
+ virtual ~DdeService();
+
+ DdeService( const DdeService& ) = delete;
+ DdeService& operator= ( const DdeService& ) = delete;
+
+ OUString GetName() const;
+ short GetError() const { return nStatus; }
+
+ static DdeServices& GetServices();
+ std::vector<DdeTopic*>& GetTopics() { return aTopics; }
+
+ void AddTopic( const DdeTopic& );
+ void RemoveTopic( const DdeTopic& );
+
+ void AddFormat(SotClipboardFormatId);
+ void RemoveFormat(SotClipboardFormatId);
+ bool HasFormat(SotClipboardFormatId);
+};
+
+
+inline tools::Long DdeTransaction::GetError() const
+{
+ return rDde.GetError();
+}
+#endif // INCLUDED_SVL_SVDDE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svl.hrc b/include/svl/svl.hrc
new file mode 100644
index 0000000000..d4210e9076
--- /dev/null
+++ b/include/svl/svl.hrc
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_SVL_HRC
+#define INCLUDED_SVL_SVL_HRC
+
+#define NC_(Context, String) TranslateId(Context, u8##String)
+
+// Internet Media Type Presentations
+
+#define STR_SVT_MIMETYPE_CNT_FSYSBOX NC_("STR_SVT_MIMETYPE_CNT_FSYSBOX", "Workplace")
+#define STR_FILECTRL_BUTTONTEXT NC_("STR_FILECTRL_BUTTONTEXT", "Browse...")
+
+// tdf#145919 localizable strings to be shared in vcl and cui modules
+#define GRTSTR_PASSED NC_("GRTSTR_PASSED", "PASSED")
+#define GRTSTR_QUIRKY NC_("GRTSTR_QUIRKY", "QUIRKY")
+#define GRTSTR_FAILED NC_("GRTSTR_FAILED", "FAILED")
+#define GRTSTR_SKIPPED NC_("GRTSTR_SKIPPED", "SKIPPED")
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svldllapi.h b/include/svl/svldllapi.h
new file mode 100644
index 0000000000..31402a7b19
--- /dev/null
+++ b/include/svl/svldllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_SVLDLLAPI_H
+#define INCLUDED_SVL_SVLDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(SVL_DLLIMPLEMENTATION)
+#define SVL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif // INCLUDED_SVL_SVLDLLAPI_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svlresid.hxx b/include/svl/svlresid.hxx
new file mode 100644
index 0000000000..5b57aa2c0c
--- /dev/null
+++ b/include/svl/svlresid.hxx
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SVL_SVTRESID_HXX
+#define INCLUDED_SVL_SVTRESID_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+
+SVL_DLLPUBLIC OUString SvlResId(TranslateId sContextAndId);
+
+#endif // INCLUDED_SVL_SVTRESID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/typedwhich.hxx b/include/svl/typedwhich.hxx
new file mode 100644
index 0000000000..e96ad8228d
--- /dev/null
+++ b/include/svl/typedwhich.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+#ifndef INCLUDED_SVL_TYPEDWHICH_HXX
+#define INCLUDED_SVL_TYPEDWHICH_HXX
+
+#include <sal/config.h>
+#include <sal/types.h>
+#include <type_traits>
+
+/**
+ * A very thin wrapper around the sal_uInt16 WhichId whose purpose is mostly to carry type information,
+ * so that we Put() and Get() the right subclasses of SfxPoolItem for each WhichId.
+ */
+template <class T> class TypedWhichId final
+{
+public:
+ explicit constexpr TypedWhichId(sal_uInt16 nWhich)
+ : mnWhich(nWhich)
+ {
+ }
+
+ /** Up-casting conversion constructor
+ */
+ template <class derived_type>
+ constexpr TypedWhichId(TypedWhichId<derived_type> other,
+ std::enable_if_t<std::is_base_of_v<T, derived_type>, int> = 0)
+ : mnWhich(sal_uInt16(other))
+ {
+ }
+
+ constexpr operator sal_uInt16() const { return mnWhich; }
+
+private:
+ sal_uInt16 mnWhich;
+};
+
+template <class T> constexpr bool operator==(TypedWhichId<T> const& lhs, TypedWhichId<T> rhs)
+{
+ return sal_uInt16(lhs) == sal_uInt16(rhs);
+}
+template <class T> constexpr bool operator!=(TypedWhichId<T> const& lhs, TypedWhichId<T> rhs)
+{
+ return sal_uInt16(lhs) != sal_uInt16(rhs);
+}
+template <class T> constexpr bool operator==(sal_uInt16 lhs, TypedWhichId<T> const& rhs)
+{
+ return lhs == sal_uInt16(rhs);
+}
+template <class T> constexpr bool operator!=(sal_uInt16 lhs, TypedWhichId<T> const& rhs)
+{
+ return lhs != sal_uInt16(rhs);
+}
+template <class T> constexpr bool operator==(TypedWhichId<T> const& lhs, sal_uInt16 rhs)
+{
+ return sal_uInt16(lhs) == rhs;
+}
+template <class T> constexpr bool operator!=(TypedWhichId<T> const& lhs, sal_uInt16 rhs)
+{
+ return sal_uInt16(lhs) != rhs;
+}
+
+#endif // INCLUDED_SVL_TYPEDWHICH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
new file mode 100644
index 0000000000..a7d1e47537
--- /dev/null
+++ b/include/svl/undo.hxx
@@ -0,0 +1,344 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_UNDO_HXX
+#define INCLUDED_SVL_UNDO_HXX
+
+#include <svl/svldllapi.h>
+#include <rtl/ustring.hxx>
+#include <tools/datetime.hxx>
+#include <o3tl/strong_int.hxx>
+
+#include <memory>
+#include <vector>
+
+typedef o3tl::strong_int<sal_Int32, struct ViewShellIdTag> ViewShellId;
+typedef o3tl::strong_int<int, struct ViewShellDocIdTag> ViewShellDocId;
+
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+class SVL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") SfxRepeatTarget
+{
+public:
+ virtual ~SfxRepeatTarget() = 0;
+};
+
+
+class SVL_DLLPUBLIC SfxUndoContext
+{
+public:
+ /**
+ * Don't undo the top undo action, but an earlier one. It's the caller's responsibility to
+ * ensure that the earlier undo action is independent from the following ones.
+ */
+ virtual size_t GetUndoOffset() { return 0; }
+
+ virtual ~SfxUndoContext() = 0;
+};
+
+
+class SVL_DLLPUBLIC SfxUndoAction
+{
+public:
+ SfxUndoAction();
+ virtual ~SfxUndoAction() COVERITY_NOEXCEPT_FALSE;
+
+ virtual void Undo();
+ virtual void UndoWithContext( SfxUndoContext& i_context );
+ virtual void Redo();
+ virtual void RedoWithContext( SfxUndoContext& i_context );
+ virtual void Repeat(SfxRepeatTarget&);
+ virtual bool CanRepeat(SfxRepeatTarget&) const;
+
+ virtual bool Merge( SfxUndoAction *pNextAction );
+
+ virtual OUString GetComment() const;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const;
+ /// ID of the view shell that created this undo action.
+ virtual ViewShellId GetViewShellId() const;
+ /// Timestamp when this undo item was created.
+ const DateTime& GetDateTime() const;
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+private:
+ SfxUndoAction( const SfxUndoAction& ) = delete;
+ SfxUndoAction& operator=( const SfxUndoAction& ) = delete;
+
+ DateTime m_aDateTime;
+};
+
+
+/// is a mark on the Undo stack
+typedef sal_Int32 UndoStackMark;
+#define MARK_INVALID ::std::numeric_limits< UndoStackMark >::max()
+
+struct MarkedUndoAction
+{
+ std::unique_ptr<SfxUndoAction> pAction;
+ ::std::vector< UndoStackMark > aMarks;
+
+ MarkedUndoAction(std::unique_ptr<SfxUndoAction> p) : pAction(std::move(p)) {}
+};
+
+/** do not make use of these implementation details, unless you
+ really really have to! */
+struct SVL_DLLPUBLIC SfxUndoArray
+{
+ std::vector<MarkedUndoAction> maUndoActions;
+ size_t nMaxUndoActions;
+ size_t nCurUndoAction;
+ SfxUndoArray *pFatherUndoArray;
+
+ SfxUndoArray(size_t nMax=0) :
+ nMaxUndoActions(nMax), nCurUndoAction(0), pFatherUndoArray(nullptr) {}
+ virtual ~SfxUndoArray();
+
+ SfxUndoArray& operator=( SfxUndoArray const & ) = delete; // MSVC2017 workaround
+ SfxUndoArray( SfxUndoArray const & ) = delete; // MSVC2017 workaround
+
+ SfxUndoAction* GetUndoAction(size_t idx) { return maUndoActions[idx].pAction.get(); }
+ std::unique_ptr<SfxUndoAction> Remove(int idx);
+ void Remove( size_t i_pos, size_t i_count );
+ void Insert( std::unique_ptr<SfxUndoAction> i_action, size_t i_pos );
+};
+
+
+/** do not make use of these implementation details, unless you
+ really really have to! */
+class SVL_DLLPUBLIC SfxListUndoAction final : public SfxUndoAction, public SfxUndoArray
+
+/* [Explanation]
+
+ UndoAction to composite multiple Undos in one UndoAction.
+ These actions are used by SfxUndomanager. With < SfxUndoManager::EnterListAction >
+ you can go one composite level down and with < SfxUndoManager::LeaveListAction > up again.
+ Redo and Undo work element wise on SfxListUndoActions.
+*/
+{
+ struct Impl;
+ std::unique_ptr<Impl> mpImpl;
+
+public:
+
+ SfxListUndoAction(
+ const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId, SfxUndoArray *pFather );
+ virtual ~SfxListUndoAction() override;
+
+ virtual void Undo() override;
+ virtual void UndoWithContext( SfxUndoContext& i_context ) override;
+ virtual void Redo() override;
+ virtual void RedoWithContext( SfxUndoContext& i_context ) override;
+ virtual void Repeat(SfxRepeatTarget&) override;
+ virtual bool CanRepeat(SfxRepeatTarget&) const override;
+
+ virtual bool Merge( SfxUndoAction *pNextAction ) override;
+
+ virtual OUString GetComment() const override;
+ /// See SfxUndoAction::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const override;
+ sal_uInt16 GetId() const;
+
+ void SetComment(const OUString& rComment);
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+
+/** is a callback interface for notifications about state changes of an SfxUndoManager
+*/
+class SAL_NO_VTABLE SfxUndoListener
+{
+public:
+ virtual void actionUndone( const OUString& i_actionComment ) = 0;
+ virtual void actionRedone( const OUString& i_actionComment ) = 0;
+ virtual void undoActionAdded( const OUString& i_actionComment ) = 0;
+ virtual void cleared() = 0;
+ virtual void clearedRedo() = 0;
+ virtual void resetAll() = 0;
+ virtual void listActionEntered( const OUString& i_comment ) = 0;
+ virtual void listActionLeft( const OUString& i_comment ) = 0;
+ virtual void listActionCancelled() = 0;
+
+protected:
+ ~SfxUndoListener() {}
+};
+
+
+namespace svl::undo::impl
+{
+ class UndoManagerGuard;
+ class LockGuard;
+}
+
+struct SfxUndoManager_Data;
+class SVL_DLLPUBLIC SfxUndoManager
+{
+ std::unique_ptr< SfxUndoManager_Data >
+ m_xData;
+public:
+ static bool const CurrentLevel = true;
+ static bool const TopLevel = false;
+
+ SfxUndoManager( size_t nMaxUndoActionCount = 20 );
+ virtual ~SfxUndoManager();
+
+ void SetMaxUndoActionCount( size_t nMaxUndoActionCount );
+ size_t GetMaxUndoActionCount() const;
+ virtual void AddUndoAction( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerg=false );
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ OUString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ SfxUndoAction* GetUndoAction( size_t nNo=0 ) const;
+ /// Get info about all undo actions (comment, view shell id, etc.)
+ OUString GetUndoActionsInfo() const;
+ virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ OUString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ SfxUndoAction* GetRedoAction(size_t nNo = 0) const;
+ /// Get info about all redo actions (comment, view shell id, etc.)
+ OUString GetRedoActionsInfo() const;
+ virtual bool Undo();
+ virtual bool Redo();
+ /** Clears both the Redo and the Undo stack.
+ Will assert and bail out when called while within a list action (<member>IsInListAction</member>).
+ */
+ virtual void Clear();
+ /** Clears the Redo stack.
+ Will assert and bail out when called while within a list action (<member>IsInListAction</member>).
+ */
+ virtual void ClearRedo();
+ /** leaves any possible open list action (<member>IsInListAction</member>), and clears both the Undo and the
+ Redo stack.
+
+ Effectively, calling this method is equivalent to <code>while ( IsInListAction() ) LeaveListAction();</code>,
+ followed by <code>Clear()</code>. The only difference to this calling sequence is that Reset is an
+ atomic operation, also resulting in only one notification.
+ */
+ void Reset();
+ /** determines whether an Undo or Redo is currently running
+ */
+ bool IsDoing() const;
+ size_t GetRepeatActionCount() const;
+ OUString GetRepeatActionComment( SfxRepeatTarget &rTarget) const;
+ bool Repeat( SfxRepeatTarget &rTarget );
+ bool CanRepeat( SfxRepeatTarget &rTarget ) const;
+ virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId);
+ /** Leaves the list action entered with EnterListAction
+ @return the number of the sub actions in the list which has just been left. Note that in case no such
+ actions exist, the list action does not contribute to the Undo stack, but is silently removed.
+ */
+ size_t LeaveListAction();
+
+ /** Leaves the list action entered with EnterListAction, and forcefully merges the previous
+ action on the stack into the newly created list action.
+
+ Say you have an Undo action A on the stack, then call EnterListAction, followed by one or more calls to
+ AddUndoAction, followed by a call to LeaveAndMergeListAction. In opposite to LeaveListAction, your Undo
+ stack will now still contain one undo action: the newly created list action, whose first child is the
+ original A, whose other children are those you added via AddUndoAction, and whose comment is the same as
+ the comment of A.
+
+ Effectively, this means that all actions added between EnterListAction and LeaveAndMergeListAction are
+ hidden from the user.
+
+ @return the number of the sub actions in the list which has just been left. Note that in case no such
+ actions exist, the list action does not contribute to the Undo stack, but is silently removed.
+ */
+ size_t LeaveAndMergeListAction();
+ /// determines whether we're within a ListAction context, i.e. a LeaveListAction/LeaveAndMergeListAction call is pending
+ bool IsInListAction() const;
+ /// Determines how many nested list actions are currently open
+ size_t GetListActionDepth() const;
+ /** Clears the redo stack and removes the top undo action */
+ void RemoveLastUndoAction();
+ /** enables (true) or disables (false) recording of undo actions
+
+ If undo actions are added while undo is disabled, they are deleted.
+ Disabling undo does not clear the current undo buffer!
+
+ Multiple calls to <code>EnableUndo</code> are not cumulative. That is, calling <code>EnableUndo( false )</code>
+ twice, and then calling <code>EnableUndo( true )</code> means that Undo is enable afterwards.
+ */
+ void EnableUndo( bool bEnable );
+ /// returns true if undo is currently enabled.
+ /// This returns false if undo was disabled using EnableUndo( false ) and
+ /// also during the runtime of the Undo() and Redo() methods.
+ bool IsUndoEnabled() const;
+ /// Adds a new listener to be notified about changes in the UndoManager's state
+ void AddUndoListener( SfxUndoListener& i_listener );
+ void RemoveUndoListener( SfxUndoListener& i_listener );
+ bool IsEmptyActions() const;
+
+
+ /** marks the current top-level element of the Undo stack, and returns a unique ID for it
+ */
+ UndoStackMark MarkTopUndoAction();
+
+ /** removes a mark given by its ID.
+ After the call, the mark ID is invalid.
+ */
+ void RemoveMark( UndoStackMark const i_mark );
+
+ /** determines whether the top action on the Undo stack has a given mark
+ */
+ bool HasTopUndoActionMark( UndoStackMark const i_mark );
+
+ /** removes the oldest Undo actions from the stack
+ */
+ void RemoveOldestUndoAction();
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+protected:
+ bool UndoWithContext( SfxUndoContext& i_context );
+ bool RedoWithContext( SfxUndoContext& i_context );
+
+ void ImplClearRedo_NoLock( bool const i_currentLevel );
+
+ /** clears all undo actions on the current level, plus all undo actions on superordinate levels,
+ as soon as those levels are reached.
+
+ If no list action is active currently, i.e. we're on the top level already, this method is equivalent to
+ ->Clear.
+
+ Otherwise, the Undo actions on the current level are removed. Upon leaving the current list action, all
+ undo actions on the then-current level are removed, too. This is continued until the top level is reached.
+ */
+ void ClearAllLevels();
+ virtual void EmptyActionsChanged();
+
+private:
+ size_t ImplLeaveListAction( const bool i_merge, ::svl::undo::impl::UndoManagerGuard& i_guard );
+ bool ImplAddUndoAction_NoNotify( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerge, bool bClearRedo, ::svl::undo::impl::UndoManagerGuard& i_guard );
+ void ImplClearRedo( ::svl::undo::impl::UndoManagerGuard& i_guard, bool const i_currentLevel );
+ void ImplClearUndo( ::svl::undo::impl::UndoManagerGuard& i_guard );
+ void ImplClearCurrentLevel_NoNotify( ::svl::undo::impl::UndoManagerGuard& i_guard );
+ size_t ImplGetRedoActionCount_Lock( bool const i_currentLevel = CurrentLevel ) const;
+ bool ImplIsUndoEnabled_Lock() const;
+ bool ImplIsInListAction_Lock() const;
+ void ImplEnableUndo_Lock( bool const i_enable );
+
+ bool ImplUndo( SfxUndoContext* i_contextOrNull );
+ bool ImplRedo( SfxUndoContext* i_contextOrNull );
+ void ImplCheckEmptyActions();
+ inline bool ImplIsEmptyActions() const;
+
+ friend class ::svl::undo::impl::LockGuard;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urihelper.hxx b/include/svl/urihelper.hxx
new file mode 100644
index 0000000000..68843c17a8
--- /dev/null
+++ b/include/svl/urihelper.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_URIHELPER_HXX
+#define INCLUDED_SVL_URIHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/textenc.h>
+#include <svl/svldllapi.h>
+#include <tools/link.hxx>
+#include <tools/urlobj.hxx>
+
+namespace com::sun::star {
+ namespace uno { class XComponentContext; }
+ namespace uri { class XUriReference; }
+}
+
+class CharClass;
+
+namespace URIHelper {
+
+/**
+ @ATT
+ Calling this function with defaulted arguments rMaybeFileHdl = Link() and
+ bCheckFileExists = true often leads to results that are not intended:
+ Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is
+ relative, and rTheRelURIRef could also be smart-parsed as a non-file URL
+ (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"),
+ then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists =
+ true returns the non-file URL interpretation. To avoid this, either pass
+ some non-null rMaybeFileHdl if you want to check generated file URLs for
+ existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false
+ if you want to generate file URLs without checking for their existence.
+*/
+SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
+ OUString const & rTheRelURIRef,
+ Link<OUString *, bool> const & rMaybeFileHdl = Link<OUString *, bool>(),
+ bool bCheckFileExists = true,
+ bool bIgnoreFragment = false,
+ INetURLObject::EncodeMechanism eEncodeMechanism = INetURLObject::EncodeMechanism::WasEncoded,
+ INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ FSysStyle eStyle = FSysStyle::Detect);
+
+SVL_DLLPUBLIC void SetMaybeFileHdl(Link<OUString *, bool> const & rTheMaybeFileHdl);
+
+SVL_DLLPUBLIC Link<OUString *, bool> const & GetMaybeFileHdl();
+
+/**
+ Converts a URI reference to a relative one, ignoring certain differences (for
+ example, treating file URLs for case-ignoring file systems
+ case-insensitively).
+
+ @param context a component context; must not be null
+
+ @param baseUriReference a base URI reference
+
+ @param uriReference a URI reference
+
+ @return a URI reference representing the given uriReference relative to the
+ given baseUriReference; if the given baseUriReference is not an absolute,
+ hierarchical URI reference, or the given uriReference is not a valid URI
+ reference, null is returned
+
+ @exception std::bad_alloc if an out-of-memory condition occurs
+
+ @exception css::uno::RuntimeException if any error occurs
+ */
+SVL_DLLPUBLIC css::uno::Reference< css::uri::XUriReference >
+normalizedMakeRelative(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ OUString const & baseUriReference,
+ OUString const & uriReference);
+
+/**
+ A variant of normalizedMakeRelative with a simplified interface.
+
+ Internally calls normalizedMakeRelative with the default component context.
+
+ @param baseUriReference a base URI reference, passed to
+ normalizedMakeRelative
+
+ @param uriReference a URI reference, passed to normalizedMakeRelative
+
+ @return if the XUriReference returned by normalizedMakeRelative is empty,
+ uriReference is returned unmodified; otherwise, the result of calling
+ XUriReference::getUriReference on the XUriReference returned by
+ normalizedMakeRelative is returned
+
+ @exception std::bad_alloc if an out-of-memory condition occurs
+
+ @exception css::uno::RuntimeException if any error occurs
+
+ @deprecated
+ No code should rely on the default component context.
+*/
+SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative( OUString const & baseUriReference,
+ OUString const & uriReference);
+
+SVL_DLLPUBLIC OUString FindFirstURLInText(OUString const & rText,
+ sal_Int32 & rBegin,
+ sal_Int32 & rEnd,
+ CharClass const & rCharClass,
+ INetURLObject::EncodeMechanism eMechanism = INetURLObject::EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+SVL_DLLPUBLIC OUString FindFirstDOIInText(OUString const & rText,
+ sal_Int32 & rBegin,
+ sal_Int32 & rEnd,
+ CharClass const & rCharClass);
+
+/** Remove any password component from both absolute and relative URLs.
+
+ @ATT The current implementation will not remove a password from a
+ relative URL that has an authority component (e.g., the password is not
+ removed from the relative ftp URL <//user:password@domain/path>). But
+ since our functions to translate between absolute and relative URLs never
+ produce relative URLs with authority components, this is no real problem.
+
+ @ATT For relative URLs (or anything not recognized as an absolute URI),
+ the current implementation will return the input unmodified, not applying
+ any translations implied by the encode/decode parameters.
+
+ @param rURI An absolute or relative URI reference.
+
+ @param eEncodeMechanism See the general discussion for INetURLObject set-
+ methods.
+
+ @param eDecodeMechanism See the general discussion for INetURLObject get-
+ methods.
+
+ @param eCharset See the general discussion for INetURLObject get- and
+ set-methods.
+
+ @return The input URI with any password component removed.
+ */
+SVL_DLLPUBLIC OUString removePassword(OUString const & rURI,
+ INetURLObject::EncodeMechanism eEncodeMechanism,
+ INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DecodeMechanism::ToIUri,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+/** Resolve a URL's host component domain name in IDNA syntax to plain DNS
+ syntax.
+
+ For details, see RFC 5890 "Internationalized Domain Names for Applications
+ (IDNA): Definitions and Document Framework."
+
+ @param: url An arbitrary string, should be a URI.
+
+ @return If the input matches the syntax of a hierarchical URL, and it has
+ a host component that matches the IDNA2008 domain name syntax, and that
+ domain name contains any U-labels, return a version of the input URL with
+ the host component resolved to plain DNS syntax. Otherwise, return the
+ input unchanged.
+*/
+SVL_DLLPUBLIC OUString resolveIdnaHost(OUString const & url);
+
+}
+
+#endif // INCLUDED_SVL_URIHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urlbmk.hxx b/include/svl/urlbmk.hxx
new file mode 100644
index 0000000000..e2a090806d
--- /dev/null
+++ b/include/svl/urlbmk.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_URLBMK_HXX
+#define INCLUDED_SVL_URLBMK_HXX
+
+#include <rtl/ustring.hxx>
+#include <utility>
+
+
+/**
+ * This class represents a bookmark that consists of a URL and
+ * a corresponding description text.
+ *
+ * There is an own clipboard format and helper methods to copy
+ * to and from clipboard and DragServer.
+ */
+class INetBookmark
+{
+ OUString aUrl;
+ OUString aDescr;
+
+public:
+ INetBookmark( OUString _aUrl, OUString _aDescr )
+ : aUrl(std::move( _aUrl )), aDescr(std::move( _aDescr ))
+ {}
+ INetBookmark()
+ {}
+
+ const OUString& GetURL() const { return aUrl; }
+ const OUString& GetDescription() const { return aDescr; }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx
new file mode 100644
index 0000000000..4ae5cdd550
--- /dev/null
+++ b/include/svl/visitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_VISITEM_HXX
+#define INCLUDED_SVL_VISITEM_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/frame/status/Visibility.hpp>
+
+class SVL_DLLPUBLIC SfxVisibilityItem final : public SfxPoolItem
+{
+ css::frame::status::Visibility m_nValue;
+
+public:
+
+ explicit SfxVisibilityItem(sal_uInt16 which, bool bVisible):
+ SfxPoolItem(which)
+ {
+ m_nValue.bVisible = bVisible;
+ }
+
+ virtual bool operator ==(const SfxPoolItem & rItem) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit,
+ OUString & rText,
+ const IntlWrapper&)
+ const override;
+
+ virtual bool QueryValue( css::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const override;
+
+ virtual bool PutValue( const css::uno::Any& rVal,
+ sal_uInt8 nMemberId ) override;
+
+ virtual SfxVisibilityItem* Clone(SfxItemPool * = nullptr) const override;
+
+ bool GetValue() const { return m_nValue.bVisible; }
+};
+
+#endif // INCLUDED_SVL_VISITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/voiditem.hxx b/include/svl/voiditem.hxx
new file mode 100644
index 0000000000..911c691470
--- /dev/null
+++ b/include/svl/voiditem.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_SVL_VOIDITEM_HXX
+#define INCLUDED_SVL_VOIDITEM_HXX
+
+#include <svl/poolitem.hxx>
+
+class SVL_DLLPUBLIC SfxVoidItem final : public SfxPoolItem
+{
+public:
+ static SfxPoolItem* CreateDefault();
+
+ explicit SfxVoidItem(sal_uInt16 nWhich);
+ SfxVoidItem(const SfxVoidItem& rCopy);
+ SfxVoidItem(SfxVoidItem&& rOrig);
+ virtual ~SfxVoidItem() override;
+
+ SfxVoidItem& operator=(SfxVoidItem const&) = delete; // due to SfxPoolItem
+ SfxVoidItem& operator=(SfxVoidItem&&) = delete; // due to SfxPoolItem
+
+ virtual bool operator==(const SfxPoolItem&) const override;
+
+ virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric,
+ MapUnit ePresMetric, OUString& rText,
+ const IntlWrapper&) const override;
+ virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
+ // create a copy of itself
+ virtual SfxVoidItem* Clone(SfxItemPool* pPool = nullptr) const override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/whichranges.hxx b/include/svl/whichranges.hxx
new file mode 100644
index 0000000000..37a3d34e56
--- /dev/null
+++ b/include/svl/whichranges.hxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+#pragma once
+
+#include <sal/config.h>
+#include <sal/types.h>
+#include <svl/svldllapi.h>
+#include <array>
+#include <memory>
+#include <cassert>
+
+typedef std::pair<sal_uInt16, sal_uInt16> WhichPair;
+
+namespace svl
+{
+namespace detail
+{
+constexpr bool validRange(sal_uInt16 wid1, sal_uInt16 wid2) { return wid1 != 0 && wid1 <= wid2; }
+
+constexpr bool validGap(sal_uInt16 wid1, sal_uInt16 wid2) { return wid2 > wid1; }
+
+template <sal_uInt16 WID1, sal_uInt16 WID2> constexpr bool validRanges()
+{
+ return validRange(WID1, WID2);
+}
+
+template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16 WID3, sal_uInt16... WIDs>
+constexpr bool validRanges()
+{
+ return validRange(WID1, WID2) && validGap(WID2, WID3) && validRanges<WID3, WIDs...>();
+}
+
+// The calculations in rangeSize cannot overflow, assuming
+// std::size_t is no smaller than sal_uInt16:
+constexpr std::size_t rangeSize(sal_uInt16 wid1, sal_uInt16 wid2)
+{
+ assert(validRange(wid1, wid2));
+ return wid2 - wid1 + 1;
+}
+}
+
+template <sal_uInt16... WIDs> struct Items_t
+{
+ using Array = std::array<WhichPair, sizeof...(WIDs) / 2>;
+ template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16... Rest>
+ static constexpr void fill(typename Array::iterator it)
+ {
+ it->first = WID1;
+ it->second = WID2;
+ if constexpr (sizeof...(Rest) > 0)
+ fill<Rest...>(++it);
+ }
+ static constexpr Array make()
+ {
+ assert(svl::detail::validRanges<WIDs...>());
+ Array a{};
+ fill<WIDs...>(a.begin());
+ return a;
+ }
+ // This is passed to WhichRangesContainer so we can avoid needing to malloc()
+ // for compile-time data.
+ static constexpr Array value = make();
+};
+
+template <sal_uInt16... WIDs> inline static constexpr auto Items = Items_t<WIDs...>{};
+}
+
+#define INVALID_WHICHPAIR_OFFSET (sal_uInt16(0xffff))
+
+/**
+ * Most of the time, the which ranges we point at are a compile-time literal.
+ * So we take advantage of that, and avoid the cost of allocating our own array and copying into it.
+ */
+struct SVL_DLLPUBLIC WhichRangesContainer
+{
+ using const_iterator = WhichPair const*;
+
+ WhichPair const* m_pairs = nullptr;
+ sal_Int32 m_size = 0;
+ /** if true, we allocated and need to delete the pairs, if not, we are pointing
+ * at a global const literal */
+ bool m_bOwnRanges = false;
+
+ // variables for buffering the last used WhichPair to allow fast answers
+ // in getOffsetFromWhich
+ mutable sal_uInt16 m_aLastWhichPairOffset = INVALID_WHICHPAIR_OFFSET;
+ mutable sal_uInt16 m_aLastWhichPairFirst = 0;
+ mutable sal_uInt16 m_aLastWhichPairSecond = 0;
+
+ WhichRangesContainer() = default;
+
+ WhichRangesContainer(std::unique_ptr<WhichPair[]> wids, sal_Int32 nSize)
+ : m_pairs(wids.release())
+ , m_size(nSize)
+ , m_bOwnRanges(true)
+ , m_aLastWhichPairOffset(INVALID_WHICHPAIR_OFFSET)
+ , m_aLastWhichPairFirst(0)
+ , m_aLastWhichPairSecond(0)
+ {
+ }
+ template <sal_uInt16... WIDs>
+ WhichRangesContainer(svl::Items_t<WIDs...>)
+ : m_pairs(svl::Items_t<WIDs...>::value.data())
+ , m_size(svl::Items_t<WIDs...>::value.size())
+ , m_bOwnRanges(false)
+ , m_aLastWhichPairOffset(INVALID_WHICHPAIR_OFFSET)
+ , m_aLastWhichPairFirst(0)
+ , m_aLastWhichPairSecond(0)
+ {
+ }
+ WhichRangesContainer(const WhichPair* wids, sal_Int32 nSize);
+ WhichRangesContainer(sal_uInt16 nWhichStart, sal_uInt16 nWhichEnd);
+ WhichRangesContainer(WhichRangesContainer const& other) { operator=(other); }
+ WhichRangesContainer(WhichRangesContainer&& other);
+ ~WhichRangesContainer();
+
+ WhichRangesContainer& operator=(WhichRangesContainer&& other);
+ WhichRangesContainer& operator=(WhichRangesContainer const& other);
+
+ bool operator==(WhichRangesContainer const& other) const;
+ const_iterator begin() const noexcept { return m_pairs; }
+ const_iterator end() const noexcept { return begin() + size(); }
+ bool empty() const noexcept { return m_size == 0; }
+ sal_Int32 size() const noexcept { return m_size; }
+ WhichPair const& operator[](sal_Int32 idx) const noexcept
+ {
+ assert(idx >= 0 && idx < size() && "index out of range");
+ return m_pairs[idx];
+ }
+ void reset();
+
+ // calculate and return the offset inside the fixed SfxPoolItem
+ // array of SfxItemPool
+ sal_uInt16 getOffsetFromWhich(sal_uInt16 nWhich) const;
+
+ // extract the WhichID for given offset
+ sal_uInt16 getWhichFromOffset(sal_uInt16 nOffset) const;
+
+ // Adds a range to which ranges, keeping the ranges in valid state (sorted, non-overlapping)
+ SAL_WARN_UNUSED_RESULT WhichRangesContainer MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/svl/whiter.hxx b/include/svl/whiter.hxx
new file mode 100644
index 0000000000..155d02d7f3
--- /dev/null
+++ b/include/svl/whiter.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#pragma once
+
+#include <svl/svldllapi.h>
+#include <svl/whichranges.hxx>
+
+class SfxItemSet;
+class SfxPoolItem;
+enum class SfxItemState;
+
+/**
+ * Iterates over the which ids and the pool items arrays together (which are stored in parallel arrays).
+ * Primarily so that we can call GetItemSet on the SfxItemSet and pass in a hint, which avoids
+ * searching the array the SfxItemSet, which speeds up GetItemState greatly.
+ */
+class SVL_DLLPUBLIC SfxWhichIter
+{
+ const SfxItemSet& m_rItemSet;
+ const WhichPair* m_pCurrentWhichPair;
+ sal_uInt16 m_nOffsetFromStartOfCurrentWhichPair;
+ /// Offset into m_ppItems array in SfxItemSet
+ sal_uInt16 m_nItemsOffset;
+
+public:
+ SfxWhichIter(const SfxItemSet& rSet);
+
+ sal_uInt16 GetCurWhich() const;
+ sal_uInt16 NextWhich();
+ sal_uInt16 FirstWhich();
+ SfxItemState GetItemState(bool bSrchInParent = true,
+ const SfxPoolItem** ppItem = nullptr) const;
+ void ClearItem();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
new file mode 100644
index 0000000000..f9edfdf783
--- /dev/null
+++ b/include/svl/zforlist.hxx
@@ -0,0 +1,381 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_ZFORLIST_HXX
+#define INCLUDED_SVL_ZFORLIST_HXX
+
+#include <config_options.h>
+#include <svl/svldllapi.h>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <unotools/localedatawrapper.hxx>
+
+#include <map>
+#include <unordered_map>
+
+namespace com::sun::star::i18n { struct Currency; }
+
+class SvNumberformat;
+
+#define SV_COUNTRY_LANGUAGE_OFFSET 10000 // Max count of formats per country/language
+#define SV_MAX_COUNT_STANDARD_FORMATS 100 // Max count of builtin default formats per CL
+
+constexpr size_t NF_MAX_FORMAT_SYMBOLS = 100;
+
+/// The built-in @ Text format, offset within a locale, key in the locale the
+/// number formatter was constructed with.
+constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT = SV_MAX_COUNT_STANDARD_FORMATS;
+
+constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND = 0xffffffff; /// MAX_ULONG
+
+enum class SvNumFormatType : sal_Int16
+{
+ /** selects all number formats.
+ */
+ ALL = css::util::NumberFormat::ALL, // 0
+ /** selects only user-defined number formats.
+ */
+ DEFINED = css::util::NumberFormat::DEFINED, // 1
+ /** selects date formats.
+ */
+ DATE = css::util::NumberFormat::DATE, // 2
+ /** selects time formats.
+ */
+ TIME = css::util::NumberFormat::TIME, // 4
+ /** selects currency formats.
+ */
+ CURRENCY = css::util::NumberFormat::CURRENCY, // 8
+ /** selects decimal number formats.
+ */
+ NUMBER = css::util::NumberFormat::NUMBER, // 16
+ /** selects scientific number formats.
+ */
+ SCIENTIFIC = css::util::NumberFormat::SCIENTIFIC, // 32
+ /** selects number formats for fractions.
+ */
+ FRACTION = css::util::NumberFormat::FRACTION, // 64
+ /** selects percentage number formats.
+ */
+ PERCENT = css::util::NumberFormat::PERCENT, // 128
+ /** selects text number formats.
+ */
+ TEXT = css::util::NumberFormat::TEXT, // 256
+ /** selects number formats which contain date and time.
+ */
+ DATETIME = DATE | TIME, // 6
+ /** selects boolean number formats.
+ */
+ LOGICAL = css::util::NumberFormat::LOGICAL, // 1024
+ /** is used as a return value if no format exists.
+ */
+ UNDEFINED = css::util::NumberFormat::UNDEFINED, // 2048
+ /** @internal is used to flag an empty sub format.
+ @since LibreOffice 5.1
+ */
+ EMPTY = css::util::NumberFormat::EMPTY, // 4096
+ /** @internal selects a time duration format.
+ 8192 + TIME (4)
+ @since LibreOffice 6.2
+ */
+ DURATION = css::util::NumberFormat::DURATION, // 8196
+};
+namespace o3tl {
+ template<> struct typed_flags<SvNumFormatType> : is_typed_flags<SvNumFormatType, 0x3dff> {};
+}
+
+/** enum values for <method>SvNumberFormatter::GetFormatIndex</method>
+
+ <p>
+ Builtin standard formats, order should be also the arrangement in the
+ dialog list box representation.</p>
+
+ <p>
+ Date specials:<ul>
+ <li>SYSTEM: As set in System Regional Settings.
+ <li>SYS: short/long defined, order and separators from System Regional Settings.
+ <li>DEF: short/long and order defined, separators from System Regional Settings.
+ <li>DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require.
+ <li>all other: hard coded
+ </ul>
+
+ Do NOT insert any new values!
+ The values here correspond with those in offapi/com/sun/star/i18n/NumberFormatIndex.idl
+ You may append values though after NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS.
+ */
+enum NfIndexTableOffset
+{
+ NF_NUMERIC_START = 0,
+
+ NF_NUMBER_START = NF_NUMERIC_START,
+ NF_NUMBER_STANDARD = NF_NUMBER_START, // Standard/General
+ NF_NUMBER_INT, // 0
+ NF_NUMBER_DEC2, // 0.00
+ NF_NUMBER_1000INT, // #,##0
+ NF_NUMBER_1000DEC2, // #,##0.00
+ NF_NUMBER_SYSTEM, // #,##0.00 or whatever is set in System Regional Settings
+ NF_NUMBER_END = NF_NUMBER_SYSTEM,
+
+ NF_SCIENTIFIC_START,
+ NF_SCIENTIFIC_000E000 = NF_SCIENTIFIC_START, // 0.00E+000
+ NF_SCIENTIFIC_000E00, // 0.00E+00
+ NF_SCIENTIFIC_END = NF_SCIENTIFIC_000E00,
+
+ NF_PERCENT_START,
+ NF_PERCENT_INT = NF_PERCENT_START, // 0%
+ NF_PERCENT_DEC2, // 0.00%
+ NF_PERCENT_END = NF_PERCENT_DEC2,
+
+ NF_FRACTION_START,
+ NF_FRACTION_1D = NF_FRACTION_START, // # ?/?
+ NF_FRACTION_2D, // # ??/??
+ NF_FRACTION_END = NF_FRACTION_2D,
+
+ NF_NUMERIC_END = NF_FRACTION_END,
+
+ NF_CURRENCY_START,
+ NF_CURRENCY_1000INT = NF_CURRENCY_START,// #,##0 DM
+ NF_CURRENCY_1000DEC2, // #,##0.00 DM
+ NF_CURRENCY_1000INT_RED, // #,##0 DM negative in red
+ NF_CURRENCY_1000DEC2_RED, // #,##0.00 DM negative in red
+ NF_CURRENCY_1000DEC2_CCC, // #,##0.00 DEM currency abbreviation
+ NF_CURRENCY_1000DEC2_DASHED, // #,##0.-- DM
+ NF_CURRENCY_END = NF_CURRENCY_1000DEC2_DASHED,
+
+ NF_DATE_START,
+ NF_DATE_SYSTEM_SHORT = NF_DATE_START, // 08.10.97
+ NF_DATE_SYSTEM_LONG, // Wednesday, 8. October 1997
+ NF_DATE_SYS_DDMMYY, // 08.10.97
+ NF_DATE_SYS_DDMMYYYY, // 08.10.1997 THE edit format, formatindex="21"
+ NF_DATE_SYS_DMMMYY, // 8. Oct 97
+ NF_DATE_SYS_DMMMYYYY, // 8. Oct 1997
+ NF_DATE_DIN_DMMMYYYY, // 8. Oct. 1997 DIN
+ NF_DATE_SYS_DMMMMYYYY, // 8. October 1997
+ NF_DATE_DIN_DMMMMYYYY, // 8. October 1997 DIN
+ NF_DATE_SYS_NNDMMMYY, // Wed, 8. Okt 97
+ NF_DATE_DEF_NNDDMMMYY, // Wed 08.Okt 97
+ NF_DATE_SYS_NNDMMMMYYYY, // Wed, 8. Oktober 1997
+ NF_DATE_SYS_NNNNDMMMMYYYY, // Wednesday, 8. Oktober 1997
+ NF_DATE_DIN_MMDD, // 10-08 DIN
+ NF_DATE_DIN_YYMMDD, // 97-10-08 DIN
+ NF_DATE_DIN_YYYYMMDD, // 1997-10-08 DIN
+ NF_DATE_ISO_YYYYMMDD = NF_DATE_DIN_YYYYMMDD, // 1997-10-08 ISO clarify with name, formatindex="33"
+ NF_DATE_SYS_MMYY, // 10.97
+ NF_DATE_SYS_DDMMM, // 08.Oct
+ NF_DATE_MMMM, // October
+ NF_DATE_QQJJ, // 4. Quarter 97
+ NF_DATE_WW, // week of year
+ NF_DATE_END = NF_DATE_WW,
+
+ NF_TIME_START,
+ NF_TIME_HHMM = NF_TIME_START, // HH:MM
+ NF_TIME_HHMMSS, // HH:MM:SS
+ NF_TIME_HHMMAMPM, // HH:MM AM/PM
+ NF_TIME_HHMMSSAMPM, // HH:MM:SS AM/PM
+ NF_TIME_HH_MMSS, // [HH]:MM:SS formatindex="43"
+ NF_TIME_MMSS00, // MM:SS,00 formatindex="44"
+ NF_TIME_HH_MMSS00, // [HH]:MM:SS,00 formatindex="45"
+ NF_TIME_END = NF_TIME_HH_MMSS00,
+
+ NF_DATETIME_START,
+ NF_DATETIME_SYSTEM_SHORT_HHMM = NF_DATETIME_START, // 08.10.97 01:23
+ NF_DATETIME_SYS_DDMMYYYY_HHMMSS, // 08.10.1997 01:23:45 THE edit format, formatindex="47"
+ NF_DATETIME_END = NF_DATETIME_SYS_DDMMYYYY_HHMMSS,
+
+ NF_BOOLEAN, // BOOLEAN
+ NF_TEXT, // @
+
+ NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // == 50, old number of predefined entries, i18npool locale data additions start after this
+
+ // From here on are values of new predefined and built-in formats that are
+ // not in the original NumberFormatIndex.idl
+
+ // XXX Values appended here must also get a corresponding entry in
+ // svl/source/numbers/zforlist.cxx indexTable[] in the same order.
+
+ // XXX The dialog's number format shell assumes start/end spans
+ // (NF_..._START and NF_..._END above) to fill its categories with builtin
+ // formats, make new formats known to svx/source/items/numfmtsh.cxx
+ // SvxNumberFormatShell::FillEListWithStd_Impl(), otherwise they will not
+ // be listed at all. Yes that is ugly.
+ // DATETIME formats need to be added to
+ // SvxNumberFormatShell::FillEListWithDateTime_Impl().
+
+ // New predefined format added to i18npool locale data.
+ NF_DATETIME_SYS_DDMMYYYY_HHMM = NF_INDEX_TABLE_LOCALE_DATA_DEFAULTS, // 08.10.1997 01:23 formatindex="50"
+
+ // No i18npool defined locale data between here and NF_INDEX_TABLE_ENTRIES.
+ NF_INDEX_TABLE_RESERVED_START,
+
+ NF_FRACTION_3D = NF_INDEX_TABLE_RESERVED_START, // # ???/???
+ NF_FRACTION_2, // # ?/2
+ NF_FRACTION_4, // # ?/4
+ NF_FRACTION_8, // # ?/8
+ NF_FRACTION_16, // # ??/16
+ NF_FRACTION_10, // # ??/10
+ NF_FRACTION_100, // # ??/100
+
+ NF_DATETIME_ISO_YYYYMMDD_HHMMSS, // 1997-10-08 01:23:45 ISO (with blank instead of T)
+ NF_DATETIME_ISO_YYYYMMDD_HHMMSS000, // 1997-10-08 01:23:45.678 not quite ISO with locale's separator
+ NF_DATETIME_ISO_YYYYMMDDTHHMMSS, // 1997-10-08T01:23:45 ISO
+ NF_DATETIME_ISO_YYYYMMDDTHHMMSS000, // 1997-10-08T01:23:45,678 ISO with milliseconds and ',' or '.'
+
+ // XXX When adding values here, follow the comment above about
+ // svx/source/items/numfmtsh.cxx
+
+ NF_INDEX_TABLE_ENTRIES // == 62, reserved to not be used in i18npool locale data.
+
+ // XXX Adding values above may increment the reserved area that can't be
+ // used by i18npool's locale data FormatCode definitions, see the
+ // description at i18npool/source/localedata/data/locale.dtd for ELEMENT
+ // FormatCode what the current convention's value is. In that case, the
+ // used formatIndex values in i18npool/source/localedata/data/*.xml will
+ // have to be adjusted.
+ // Overlapping the area will bail out with a check in
+ // SvNumberFormatter::ImpInsertFormat() in debug builds.
+};
+
+
+// #45717# IsNumberFormat( "98-10-24", 30, x ), YMD Format set with DMY
+// International settings doesn't recognize the string as a date.
+/** enum values for <method>SvNumberFormatter::SetEvalDateFormat</method>
+
+ <p>How <method>ImpSvNumberInputScan::GetDateRef</method> shall take the
+ DateFormat order (YMD,DMY,MDY) into account, if called from IsNumberFormat
+ with a date format to match against.
+ */
+enum NfEvalDateFormat
+{
+ /** DateFormat only from International, default. */
+ NF_EVALDATEFORMAT_INTL,
+
+ /** DateFormat only from date format passed to function (if any).
+ If no date format is passed then the DateFormat is taken from International. */
+ NF_EVALDATEFORMAT_FORMAT,
+
+ /** First try the DateFormat from International. If it doesn't match a
+ valid date try the DateFormat from the date format passed. */
+ NF_EVALDATEFORMAT_INTL_FORMAT,
+
+ /** First try the DateFormat from the date format passed. If it doesn't
+ match a valid date try the DateFormat from International. */
+ NF_EVALDATEFORMAT_FORMAT_INTL
+};
+
+
+/// This table is std::map because it needs to preserve insertion order,
+/// because the formats are roughly ordered from most to least common, and some
+/// parts of the UI want to show them in that order.
+typedef std::map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
+typedef std::unordered_map<sal_uInt16, sal_uInt32> SvNumberFormatterIndexTable;
+typedef std::unordered_map< sal_uInt32, sal_uInt32> SvNumberFormatterMergeMap;
+
+
+/** Language/country dependent currency entries
+ */
+class UNLESS_MERGELIBS(SVL_DLLPUBLIC) NfCurrencyEntry final
+{
+ OUString aSymbol; /// currency symbol
+ OUString aBankSymbol; /// currency abbreviation
+ LanguageType eLanguage; /// language/country value
+ sal_uInt16 nPositiveFormat; /// position of symbol
+ sal_uInt16 nNegativeFormat; /// position of symbol and type and position of negative sign
+ sal_uInt16 nDigits; /// count of decimal digits
+ sal_Unicode cZeroChar; /// which character is used for zeros as last decimal digits
+
+private:
+
+ // nDecimalFormat := 0, 1, 2
+ // #,##0 or #,##0.00 or #,##0.-- is returned
+ SVL_DLLPRIVATE OUString Impl_BuildFormatStringNumChars( const LocaleDataWrapper&, sal_uInt16 nDecimalFormat) const;
+
+public:
+
+ NfCurrencyEntry( const LocaleDataWrapper& rLocaleData,
+ LanguageType eLang );
+ NfCurrencyEntry( const css::i18n::Currency & rCurr,
+ const LocaleDataWrapper& rLocaleData,
+ LanguageType eLang );
+
+ /// Symbols and language identical
+ bool operator==( const NfCurrencyEntry& r ) const;
+
+ const OUString& GetSymbol() const { return aSymbol; }
+ const OUString& GetBankSymbol() const { return aBankSymbol; }
+ LanguageType GetLanguage() const { return eLanguage; }
+ sal_uInt16 GetPositiveFormat() const { return nPositiveFormat; }
+ sal_uInt16 GetNegativeFormat() const { return nNegativeFormat; }
+ sal_uInt16 GetDigits() const { return nDigits; }
+
+ /** Only to resolve system locale for currency list. */
+ void SetLanguage( LanguageType nLang ) { eLanguage = nLang; }
+
+ /** [$DM-407] (bBank==false) or [$DEM] (bBank==true)
+ is returned. If bBank==false and
+ bWithoutExtension==true only [$DM] */
+ OUString BuildSymbolString(bool bBank, bool bWithoutExtension = false) const;
+
+ /** #,##0.00 [$DM-407] is returned, separators
+ from rLoc, incl. minus sign but without [RED] */
+ OUString BuildPositiveFormatString(bool bBank, const LocaleDataWrapper&,
+ sal_uInt16 nDecimalFormat = 1) const;
+ OUString BuildNegativeFormatString(bool bBank, const LocaleDataWrapper&,
+ sal_uInt16 nDecimalFormat = 1) const;
+
+ /** [$DM-407] (or [$DEM] if bBank==true)
+ is appended/prepended to rStr, incl. minus sign */
+ void CompletePositiveFormatString(OUStringBuffer& rStr, bool bBank,
+ sal_uInt16 nPosiFormat) const;
+ void CompleteNegativeFormatString(OUStringBuffer& rStr, bool bBank,
+ sal_uInt16 nNegaFormat) const;
+
+ /// rSymStr is appended/prepended to rStr, incl. minus sign
+ static void CompletePositiveFormatString(OUStringBuffer& rStr,
+ std::u16string_view rSymStr, sal_uInt16 nPosiFormat);
+ static void CompleteNegativeFormatString(OUStringBuffer& rStr,
+ std::u16string_view rSymStr, sal_uInt16 nNegaFormat);
+
+ /** Representation of a currency (symbol position and
+ negative sign) in other locales */
+ static sal_uInt16 GetEffectivePositiveFormat( sal_uInt16 nIntlFormat,
+ sal_uInt16 nCurrFormat, bool bBank );
+ static sal_uInt16 GetEffectiveNegativeFormat( sal_uInt16 nIntlFormat,
+ sal_uInt16 nCurrFormat, bool bBank );
+
+ /// General Unicode Euro symbol
+ static sal_Unicode GetEuroSymbol() { return u'\x20AC'; }
+};
+
+typedef std::vector< OUString > NfWSStringsDtor;
+
+/** Input options to be used with IsNumberFormat() */
+enum class SvNumInputOptions : sal_uInt16
+{
+ NONE = 0,
+ LAX_TIME = 1 ///< allow input of minutes or seconds >59
+};
+namespace o3tl {
+ template<> struct typed_flags<SvNumInputOptions> : is_typed_flags<SvNumInputOptions, 0x0001> {};
+}
+
+
+#endif // INCLUDED_SVL_ZFORLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
new file mode 100644
index 0000000000..1fa52c3384
--- /dev/null
+++ b/include/svl/zformat.hxx
@@ -0,0 +1,763 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+#ifndef INCLUDED_SVL_ZFORMAT_HXX
+#define INCLUDED_SVL_ZFORMAT_HXX
+
+#include <svl/svldllapi.h>
+#include <svl/zforlist.hxx>
+#include <svl/nfkeytab.hxx>
+#include <vector>
+
+namespace utl {
+ class DigitGroupingIterator;
+}
+
+namespace com::sun::star::i18n { struct NativeNumberXmlAttributes2; }
+
+class Color;
+
+class ImpSvNumberformatScan; // format code string scanner
+class ImpSvNumberInputScan; // input string scanner
+class SvNumberFormatter;
+
+enum SvNumberformatLimitOps
+{
+ NUMBERFORMAT_OP_NO = 0, // Undefined, no OP
+ NUMBERFORMAT_OP_EQ = 1, // Operator =
+ NUMBERFORMAT_OP_NE = 2, // Operator <>
+ NUMBERFORMAT_OP_LT = 3, // Operator <
+ NUMBERFORMAT_OP_LE = 4, // Operator <=
+ NUMBERFORMAT_OP_GT = 5, // Operator >
+ NUMBERFORMAT_OP_GE = 6 // Operator >=
+};
+
+struct ImpSvNumberformatInfo // Struct for FormatInfo
+{
+ std::vector<OUString> sStrArray; // Array of symbols
+ std::vector<short> nTypeArray; // Array of infos
+ sal_uInt16 nThousand; // Count of group separator sequences
+ sal_uInt16 nCntPre; // Count of digits before decimal point
+ sal_uInt16 nCntPost; // Count of digits after decimal point
+ sal_uInt16 nCntExp; // Count of exponent digits, or AM/PM
+ SvNumFormatType eScannedType; // Type determined by scan
+ bool bThousand; // Has group (AKA thousand) separator
+
+ void Copy( const ImpSvNumberformatInfo& rNumFor, sal_uInt16 nCount );
+};
+
+// NativeNumber, represent numbers using CJK or other digits if nNum>0,
+// eLang specifies the Locale to use.
+class SvNumberNatNum
+{
+ OUString sParams; // For [NatNum12 ordinal-number]-like syntax
+ LanguageType eLang;
+ sal_uInt8 nNum;
+ bool bDBNum :1; // DBNum, to be converted to NatNum
+ bool bDate :1; // Used in date? (needed for DBNum/NatNum mapping)
+ bool bSet :1; // If set, since NatNum0 is possible
+
+public:
+
+ static sal_uInt8 MapDBNumToNatNum( sal_uInt8 nDBNum, LanguageType eLang, bool bDate );
+ static sal_uInt8 MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLang, bool bDate );
+
+ SvNumberNatNum() : eLang( LANGUAGE_DONTKNOW ), nNum(0),
+ bDBNum(false), bDate(false), bSet(false) {}
+ bool IsComplete() const { return bSet && eLang != LANGUAGE_DONTKNOW; }
+ sal_uInt8 GetNatNum() const { return bDBNum ? MapDBNumToNatNum( nNum, eLang, bDate ) : nNum; }
+ sal_uInt8 GetDBNum() const { return bDBNum ? nNum : MapNatNumToDBNum( nNum, eLang, bDate ); }
+ LanguageType GetLang() const { return eLang; }
+ void SetLang( LanguageType e ) { eLang = e; }
+ void SetNum( sal_uInt8 nNumber, bool bDBNumber )
+ {
+ nNum = nNumber;
+ bDBNum = bDBNumber;
+ bSet = true;
+ }
+ bool IsSet() const { return bSet; }
+ void SetDate( bool bDateP ) { bDate = bDateP; }
+ void SetParams(const OUString& s) { sParams = s; }
+ OUString const & GetParams() const { return sParams; }
+};
+
+class CharClass;
+
+class ImpSvNumFor // One of four subformats of the format code string
+{
+public:
+ ImpSvNumFor(); // Ctor without filling the Info
+ ~ImpSvNumFor();
+
+ void Enlarge(sal_uInt16 nCount); // Init of arrays to the right size
+
+ // if pSc is set, it is used to get the Color pointer
+ void Copy( const ImpSvNumFor& rNumFor, const ImpSvNumberformatScan* pSc );
+
+ // Access to Info; call Enlarge before!
+ ImpSvNumberformatInfo& Info() { return aI;}
+ const ImpSvNumberformatInfo& Info() const { return aI; }
+
+ // Get count of substrings (symbols)
+ sal_uInt16 GetCount() const { return nStringsCnt;}
+
+ const Color* GetColor() const { return pColor; }
+ void SetColor(const Color* pCol, OUString const& rName)
+ { pColor = pCol; sColorName = rName; }
+ const OUString& GetColorName() const { return sColorName; }
+
+ // new SYMBOLTYPE_CURRENCY in subformat?
+ bool HasNewCurrency() const;
+ bool GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const;
+
+ // [NatNum1], [NatNum2], ...
+ void SetNatNumNum( sal_uInt8 nNum, bool bDBNum ) { aNatNum.SetNum( nNum, bDBNum ); }
+ void SetNatNumLang( LanguageType eLang ) { aNatNum.SetLang( eLang ); }
+ void SetNatNumDate( bool bDate ) { aNatNum.SetDate( bDate ); }
+ void SetNatNumParams(const OUString& sParams) { aNatNum.SetParams(sParams); }
+ const SvNumberNatNum& GetNatNum() const { return aNatNum; }
+
+private:
+ ImpSvNumberformatInfo aI; // helper struct for remaining information
+ OUString sColorName; // color name
+ const Color* pColor; // pointer to color of subformat
+ sal_uInt16 nStringsCnt; // count of symbols
+ SvNumberNatNum aNatNum; // DoubleByteNumber
+
+};
+
+class SVL_DLLPUBLIC SvNumberformat
+{
+ struct SAL_DLLPRIVATE LocaleType
+ {
+ enum class Substitute : sal_uInt8
+ {
+ NONE,
+ TIME,
+ LONGDATE
+ };
+
+ LanguageType meLanguage;
+ LanguageType meLanguageWithoutLocaleData;
+ Substitute meSubstitute;
+ sal_uInt8 mnNumeralShape;
+ sal_uInt8 mnCalendarType;
+
+ OUString generateCode() const;
+
+ LocaleType();
+ LocaleType(sal_uInt32 nRawCode);
+
+ bool isPlainLocale() const;
+ };
+
+public:
+ // Normal ctor
+ SvNumberformat( OUString& rString,
+ ImpSvNumberformatScan* pSc,
+ ImpSvNumberInputScan* pISc,
+ sal_Int32& nCheckPos,
+ LanguageType& eLan,
+ bool bReplaceBooleanEquivalent = true );
+
+ // Copy ctor
+ SvNumberformat( SvNumberformat const & rFormat );
+
+ // Copy ctor with exchange of format code string scanner (used in merge)
+ SvNumberformat( SvNumberformat const & rFormat, ImpSvNumberformatScan& rSc );
+
+ ~SvNumberformat();
+
+ /// Get type of format, may include css::util::NumberFormat::DEFINED bit
+ SvNumFormatType GetType() const { return eType; }
+
+ /// Get type of format, does not include css::util::NumberFormat::DEFINED
+ SvNumFormatType GetMaskedType() const { return eType & ~SvNumFormatType::DEFINED; }
+
+ void SetType(SvNumFormatType eSetType) { eType = eSetType; }
+ // Standard means the I18N defined standard format of this type
+ void SetStandard() { bStandard = true; }
+ bool IsStandard() const { return bStandard; }
+
+ // If this format is an additional built-in format defined by i18n.
+ void SetAdditionalBuiltin() { bAdditionalBuiltin = true; }
+ bool IsAdditionalBuiltin() const { return bAdditionalBuiltin; }
+
+ LanguageType GetLanguage() const { return maLocale.meLanguage;}
+
+ /** If the format is a placeholder and needs to be substituted. */
+ bool IsSubstituted() const
+ {
+ return maLocale.meSubstitute != LocaleType::Substitute::NONE;
+ }
+
+ /** If the format is a placeholder for the system time format and needs to
+ be substituted during formatting time.
+ */
+ bool IsSystemTimeFormat() const
+ {
+ return maLocale.meSubstitute == LocaleType::Substitute::TIME && maLocale.meLanguage == LANGUAGE_SYSTEM;
+ }
+
+ /** If the format is a placeholder for the system long date format and needs
+ to be substituted during formatting time.
+ */
+ bool IsSystemLongDateFormat() const
+ {
+ return maLocale.meSubstitute == LocaleType::Substitute::LONGDATE && maLocale.meLanguage == LANGUAGE_SYSTEM;
+ }
+
+ /** If the format is a MM:SS or [MM]:SS format, or MM:[SS] (sic!) or even
+ MM:SS.00 or [MM]:SS.00 or MM:[SS].00
+ */
+ bool IsMinuteSecondFormat() const;
+
+ const OUString& GetFormatstring() const { return sFormatstring; }
+
+ // Build a format string of application defined keywords
+ OUString GetMappedFormatstring( const NfKeywordTable& rKeywords,
+ const LocaleDataWrapper& rLoc,
+ LanguageType nOriginalLang = LANGUAGE_DONTKNOW,
+ bool bSystemLanguage = false ) const;
+
+ void SetStarFormatSupport( bool b ) { bStarFlag = b; }
+
+ /**
+ * Get output string from a numeric value that fits the number of
+ * characters specified.
+ */
+ bool GetOutputString( double fNumber, sal_uInt16 nCharCount, OUString& rOutString ) const;
+
+ bool GetOutputString( double fNumber, OUString& OutString, const Color** ppColor );
+ void GetOutputString( std::u16string_view sString, OUString& OutString, const Color** ppColor );
+
+ // True if type text
+ bool IsTextFormat() const { return bool(eType & SvNumFormatType::TEXT); }
+ // True if 4th subformat present
+ bool HasTextFormat() const
+ {
+ return (NumFor[3].GetCount() > 0) ||
+ (NumFor[3].Info().eScannedType == SvNumFormatType::TEXT);
+ }
+
+ void GetFormatSpecialInfo(bool& bThousand,
+ bool& IsRed,
+ sal_uInt16& nPrecision,
+ sal_uInt16& nLeadingCnt) const;
+
+ /// Get index of subformat (0..3) according to conditions and fNumber value
+ sal_uInt16 GetSubformatIndex( double fNumber ) const;
+
+ /// Count of decimal precision
+ sal_uInt16 GetFormatPrecision( sal_uInt16 nIx = 0 ) const
+ { return NumFor[nIx].Info().nCntPost; }
+
+ /// Count of integer digits
+ sal_uInt16 GetFormatIntegerDigits( sal_uInt16 nIx = 0 ) const
+ { return NumFor[nIx].Info().nCntPre; }
+
+ /** Count of hidden integer digits with thousands divisor:
+ formats like "0," to show only thousands.
+
+ Works only with SvNumFormatType::NUMBER and SvNumFormatType::CURRENCY,
+ returns 0 otherwise.
+
+ Returns SvNumberFormatter::UNLIMITED_PRECISION for formats that contain
+ the General keyword.
+ */
+ sal_uInt16 GetThousandDivisorPrecision( sal_uInt16 nIx = 0 ) const;
+
+ //! Read/write access on a special sal_uInt16 component, may only be used on the
+ //! standard format 0, 10000, ... and only by the number formatter!
+ struct FormatterPrivateAccess { friend SvNumberFormatter; private: FormatterPrivateAccess() {} };
+ sal_uInt16 GetLastInsertKey( const FormatterPrivateAccess& ) const
+ { return NumFor[0].Info().nThousand; }
+ void SetLastInsertKey( sal_uInt16 nKey, const FormatterPrivateAccess& )
+ { NumFor[0].Info().nThousand = nKey; }
+
+ //! Only onLoad: convert from stored to current system language/country
+ void ConvertLanguage( SvNumberFormatter& rConverter,
+ LanguageType eConvertFrom, LanguageType eConvertTo );
+
+ // Substring of a subformat code nNumFor (0..3)
+ // nPos == 0xFFFF => last substring
+ // bString==true: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY
+ const OUString* GetNumForString( sal_uInt16 nNumFor, sal_uInt16 nPos,
+ bool bString = false ) const;
+
+ // Subtype of a subformat code nNumFor (0..3)
+ // nPos == 0xFFFF => last substring
+ short GetNumForType( sal_uInt16 nNumFor, sal_uInt16 nPos ) const;
+
+ OUString GetPercentString( sal_uInt16 nNumFor = 0 ) const;
+
+ OUString GetDenominatorString( sal_uInt16 nNumFor ) const;
+ OUString GetNumeratorString( sal_uInt16 nNumFor ) const;
+ OUString GetIntegerFractionDelimiterString( sal_uInt16 nNumFor ) const;
+ /// Round fNumber to its fraction representation
+ double GetRoundFractionValue ( double fNumber ) const;
+
+ /// Create a format string for time with a new precision
+ OUString GetFormatStringForTimePrecision( int nPrecision ) const;
+
+
+ /** If the count of string elements (substrings, ignoring [modifiers] and
+ so on) in a subformat code nNumFor (0..3) is equal to the given number.
+ Used by ImpSvNumberInputScan::IsNumberFormatMain() to detect a matched
+ format. */
+ bool IsNumForStringElementCountEqual( sal_uInt16 nNumFor, sal_uInt16 nAllCount,
+ sal_uInt16 nNumCount ) const
+ {
+ if ( nNumFor < 4 )
+ {
+ // First try a simple approach. Note that this is called only
+ // if all MidStrings did match so far, to verify that all
+ // strings of the format were matched and not just the starting
+ // sequence, so we don't have to check if GetCount() includes
+ // [modifiers] or anything else if both counts are equal.
+ sal_uInt16 nCnt = NumFor[nNumFor].GetCount();
+ if ( nAllCount == nCnt )
+ return true;
+ if ( nAllCount < nCnt ) // check ignoring [modifiers] and so on
+ return ImpGetNumForStringElementCount( nNumFor ) ==
+ (nAllCount - nNumCount);
+ }
+ return false;
+ }
+ /** Get the count of numbers among string elements **/
+ sal_uInt16 GetNumForNumberElementCount( sal_uInt16 nNumFor ) const;
+
+ /** Get the scanned type of the specified subformat. */
+ SvNumFormatType GetNumForInfoScannedType( sal_uInt16 nNumFor ) const
+ {
+ return (nNumFor < 4) ? NumFor[nNumFor].Info().eScannedType : SvNumFormatType::UNDEFINED;
+ }
+
+ // Whether the second subformat code is really for negative numbers
+ // or another limit set.
+ bool IsSecondSubformatRealNegative() const
+ {
+ return fLimit1 == 0.0 && fLimit2 == 0.0 &&
+ ( (eOp1 == NUMBERFORMAT_OP_GE && eOp2 == NUMBERFORMAT_OP_NO) ||
+ (eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT) ||
+ (eOp1 == NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO) );
+ }
+
+ // Whether the first subformat code is really for negative numbers
+ // or another limit set.
+ bool IsFirstSubformatRealNegative() const
+ {
+ return fLimit1 == 0.0 && fLimit2 == 0.0 &&
+ ((eOp1 == NUMBERFORMAT_OP_LT &&
+ (eOp2 == NUMBERFORMAT_OP_GT || eOp2 == NUMBERFORMAT_OP_EQ ||
+ eOp2 == NUMBERFORMAT_OP_GE || eOp2 == NUMBERFORMAT_OP_NO)) ||
+ (eOp1 == NUMBERFORMAT_OP_LE &&
+ (eOp2 == NUMBERFORMAT_OP_NO || eOp2 == NUMBERFORMAT_OP_GT)));
+ }
+
+ // Whether the negative format is without a sign or not
+ bool IsNegativeWithoutSign() const;
+
+ bool IsNegativeInBracket() const;
+
+ bool HasPositiveBracketPlaceholder() const;
+
+ // Whether a new SYMBOLTYPE_CURRENCY is contained in the format
+ bool HasNewCurrency() const;
+
+ // strip [$-yyy] from all [$xxx-yyy] leaving only xxx's,
+ static OUString StripNewCurrencyDelimiters( const OUString& rStr );
+
+ // If a new SYMBOLTYPE_CURRENCY is contained if the format is of type
+ // css::util::NumberFormat::CURRENCY, and if so the symbol xxx and the extension nnn
+ // of [$xxx-nnn] are returned
+ bool GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const;
+
+ static bool HasStringNegativeSign( const OUString& rStr );
+
+ /**
+ Whether a character at position nPos is somewhere between two matching
+ cQuote or not.
+ If nPos points to a cQuote, a true is returned on an opening cQuote,
+ a false is returned on a closing cQuote.
+ A cQuote between quotes may be escaped by a cEscIn, a cQuote outside of
+ quotes may be escaped by a cEscOut.
+ The default '\0' results in no escapement possible.
+ Defaults are set right according to the "unlogic" of the Numberformatter
+ */
+ static bool IsInQuote( const OUString& rString, sal_Int32 nPos,
+ sal_Unicode cQuote = '"',
+ sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' );
+
+ /**
+ Return the position of a matching closing cQuote if the character at
+ position nPos is between two matching cQuote, otherwise return -1.
+ If nPos points to an opening cQuote the position of the matching
+ closing cQuote is returned.
+ If nPos points to a closing cQuote nPos is returned.
+ If nPos points into a part which starts with an opening cQuote but has
+ no closing cQuote, rString.Len() is returned.
+ Uses <method>IsInQuote</method> internally, so you don't have to call
+ that prior to a call of this method.
+ */
+ static sal_Int32 GetQuoteEnd( const OUString& rString, sal_Int32 nPos,
+ sal_Unicode cQuote = '"',
+ sal_Unicode cEscIn = '\0' );
+
+ void SetComment( const OUString& rStr )
+ { sComment = rStr; }
+ const OUString& GetComment() const { return sComment; }
+
+ /** Insert the number of blanks into the string that is needed to simulate
+ the width of character c for underscore formats */
+ static sal_Int32 InsertBlanks( OUString& r, sal_Int32 nPos, sal_Unicode c )
+ {
+ sal_Int32 result;
+ OUStringBuffer sBuff(r);
+
+ result = InsertBlanks(sBuff, nPos, c);
+ r = sBuff.makeStringAndClear();
+
+ return result;
+ }
+
+ /** Insert the number of blanks into the string that is needed to simulate
+ the width of character c for underscore formats */
+ static sal_Int32 InsertBlanks( OUStringBuffer& r, sal_Int32 nPos, sal_Unicode c );
+
+ /// One of YMD,DMY,MDY if date format
+ DateOrder GetDateOrder() const;
+
+ /** A coded value of the exact YMD combination used, if date format.
+ For example: YYYY-MM-DD => ('Y' << 16) | ('M' << 8) | 'D'
+ or: MM/YY => ('M' << 8) | 'Y' */
+ sal_uInt32 GetExactDateOrder() const;
+
+ // used in XML export
+ void GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1,
+ SvNumberformatLimitOps& rOper2, double& rVal2 ) const;
+ const Color* GetColor( sal_uInt16 nNumFor ) const;
+ void GetNumForInfo( sal_uInt16 nNumFor, SvNumFormatType& rScannedType,
+ bool& bThousand, sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt ) const;
+
+ // rAttr.Number not empty if NatNum attributes are to be stored
+ void GetNatNumXml(
+ css::i18n::NativeNumberXmlAttributes2& rAttr,
+ sal_uInt16 nNumFor ) const;
+ /** Return empty string if no NatNum modifier or invalid nNumFor
+ otherwise return "[NatNum1]" or "[NatNum12 ...]" */
+ OUString GetNatNumModifierString( sal_uInt16 nNumFor = 0 ) const;
+
+ /** Switches to the first non-"gregorian" calendar, but only if the current
+ calendar is "gregorian"; original calendar name and date/time returned,
+ but only if calendar switched and rOrgCalendar was empty. */
+ void SwitchToOtherCalendar( OUString& rOrgCalendar, double& fOrgDateTime ) const;
+
+ /** Switches to the "gregorian" calendar, but only if the current calendar
+ is non-"gregorian" and rOrgCalendar is not empty. Thus a preceding
+ ImpSwitchToOtherCalendar() call should have been placed prior to
+ calling this method. */
+ void SwitchToGregorianCalendar( std::u16string_view rOrgCalendar, double fOrgDateTime ) const;
+
+#ifdef THE_FUTURE
+ /** Switches to the first specified calendar, if any, in subformat nNumFor
+ (0..3). Original calendar name and date/time returned, but only if
+ calendar switched and rOrgCalendar was empty.
+
+ @return
+ <TRUE/> if a calendar was specified and switched to,
+ <FALSE/> else.
+ */
+ bool SwitchToSpecifiedCalendar( OUString& rOrgCalendar, double& fOrgDateTime,
+ sal_uInt16 nNumFor ) const
+ {
+ if ( nNumFor < 4 )
+ return ImpSwitchToSpecifiedCalendar( rOrgCalendar,
+ fOrgDateTime, NumFor[nNumFor] );
+ return false;
+ }
+#endif
+
+ /// Whether it's a (YY)YY-M(M)-D(D) format.
+ bool IsIso8601( sal_uInt16 nNumFor ) const
+ {
+ if ( nNumFor < 4 )
+ return ImpIsIso8601( NumFor[nNumFor]);
+ return false;
+ }
+
+private:
+ ImpSvNumFor NumFor[4]; // Array for the 4 subformats
+ OUString sFormatstring; // The format code string
+ OUString sComment; // Comment, since number formatter version 6
+ double fLimit1; // Value for first condition
+ double fLimit2; // Value for second condition
+ ImpSvNumberformatScan& rScan; // Format code scanner
+ LocaleType maLocale; // Language/country of the format, numeral shape and calendar type from Excel.
+ SvNumberformatLimitOps eOp1; // Operator for first condition
+ SvNumberformatLimitOps eOp2; // Operator for second condition
+ SvNumFormatType eType; // Type of format
+ bool bAdditionalBuiltin; // If this is an additional built-in format defined by i18n
+ bool bStarFlag; // Take *n format as ESC n
+ bool bStandard; // If this is a default standard format
+ bool bIsUsed; // Flag as used for storing
+
+ SVL_DLLPRIVATE sal_uInt16 ImpGetNumForStringElementCount( sal_uInt16 nNumFor ) const;
+
+ SVL_DLLPRIVATE bool ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const;
+
+#ifdef THE_FUTURE
+ SVL_DLLPRIVATE bool ImpSwitchToSpecifiedCalendar( OUString& rOrgCalendar,
+ double& fOrgDateTime,
+ const ImpSvNumFor& rNumFor ) const;
+#endif
+
+ /** Whether to use possessive genitive case month name, or partitive case
+ month name, instead of nominative name (noun).
+
+ @param io_nState
+ 0: execute check <br>
+ set to 1 if nominative case is returned, <br>
+ set to 2 if genitive case is returned, <br>
+ set to 3 if partitive case is returned <br>
+ 1: don't execute check, return nominative case <br>
+ 2: don't execute check, return genitive case <br>
+ 3: don't execute check, return partitive case <br>
+
+ @param eCodeType
+ a NfKeywordIndex, must designate a month type code
+
+ @returns one of css::i18n::CalendarDisplayCode values
+ according to eCodeType and the check executed (or passed).
+ */
+ SVL_DLLPRIVATE static sal_Int32 ImpUseMonthCase( int & io_nState, const ImpSvNumFor& rNumFor, NfKeywordIndex eCodeType );
+
+ /// Whether it's a (YY)YY-M(M)-D(D) format.
+ SVL_DLLPRIVATE bool ImpIsIso8601( const ImpSvNumFor& rNumFor ) const;
+
+ const CharClass& rChrCls() const;
+ const LocaleDataWrapper& rLoc() const;
+ CalendarWrapper& GetCal() const;
+ const SvNumberFormatter& GetFormatter() const;
+
+ // divide in substrings and color conditions
+ SVL_DLLPRIVATE short ImpNextSymbol( OUStringBuffer& rString,
+ sal_Int32& nPos,
+ OUString& sSymbol ) const;
+
+ // read string until ']' and strip blanks (after condition)
+ SVL_DLLPRIVATE static sal_Int32 ImpGetNumber( OUStringBuffer& rString,
+ sal_Int32& nPos,
+ OUString& sSymbol );
+
+ /**
+ * Parse the content of '[$-xxx] or '[$-xxxxxxxx]' and extract the locale
+ * type from it. Given the string, start parsing at position specified by
+ * nPos, and store the end position with nPos when the parsing is
+ * complete. The nPos should point to the '$' before the parsing, and to
+ * the closing bracket after the parsing. When the content is [$-xxx],
+ * the xxx part represents the language type (aka LCID) in hex numerals.
+ * When the content is [$-xxxxxxxx] the last 4 digits represent the LCID
+ * (again in hex), the next 2 digits represent the calendar type, and the
+ * 2 highest digits (if exists) is the numeral shape.
+ *
+ * @reference
+ * http://office.microsoft.com/en-us/excel-help/creating-international-number-formats-HA001034635.aspx
+ *
+ * @param rString input string
+ * @param nPos position (see above).
+ *
+ * @return struct containing numeral shape, calendar type, and LCID that
+ * specifies language type. See i18nlangtag/lang.h for a complete
+ * list of language types. These numbers also correspond with the
+ * numbers used by Microsoft Office.
+ */
+ SVL_DLLPRIVATE static LocaleType ImpGetLocaleType( std::u16string_view rString, sal_Int32& nPos );
+
+ /** Obtain calendar and numerals from a LocaleType that was parsed from a
+ LCID with ImpGetLocaleType().
+
+ Inserts a NatNum modifier to rString at nPos if needed as determined
+ from the numeral code.
+
+ @ATTENTION: may modify <member>maLocale</member> to make it follow
+ aTmpLocale, in which case also nLang is adapted.
+
+ @returns a string with the calendar if one was determined from the
+ calendar code, else an empty string. The calendar string needs to be
+ inserted at a proper position to rString after all bracketed prefixes.
+ */
+ SVL_DLLPRIVATE OUString ImpObtainCalendarAndNumerals( OUStringBuffer & rString,
+ sal_Int32 nPos,
+ LanguageType & nLang,
+ const LocaleType & aTmpLocale );
+
+ // standard number output
+ SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, OUString& OutString ) const;
+ SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, OUStringBuffer& OutString ) const;
+ SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, OUString& rOutString, sal_uInt16 nPrecision ) const;
+ // numbers in input line
+ SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, OUString& OutString ) const;
+
+ // check subcondition
+ // OP undefined => -1
+ // else 0 or 1
+ SVL_DLLPRIVATE static short ImpCheckCondition(double fNumber,
+ double fLimit,
+ SvNumberformatLimitOps eOp);
+
+ // Helper function for number strings
+ // append string symbols, insert leading 0 or ' ', or ...
+ SVL_DLLPRIVATE bool ImpNumberFill( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32& k,
+ sal_uInt16& j,
+ sal_uInt16 nIx,
+ short eSymbolType,
+ bool bInsertRightBlank = false );
+
+ // Helper function to fill in the integer part and the group (AKA thousand) separators
+ SVL_DLLPRIVATE bool ImpNumberFillWithThousands( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32 k,
+ sal_uInt16 j,
+ sal_uInt16 nIx,
+ sal_Int32 nDigCnt,
+ bool bAddDecSep = true );
+
+ // Helper function to fill in the group (AKA thousand) separators
+ // or to skip additional digits
+ SVL_DLLPRIVATE void ImpDigitFill( OUStringBuffer& sStr,
+ sal_Int32 nStart,
+ sal_Int32& k,
+ sal_uInt16 nIx,
+ sal_Int32 & nDigitCount,
+ utl::DigitGroupingIterator & );
+
+ SVL_DLLPRIVATE bool ImpDecimalFill( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32 nDecPos,
+ sal_uInt16 j,
+ sal_uInt16 nIx,
+ bool bInteger );
+
+ /** Calculate each element of fraction:
+ * integer part, numerator part, denominator part
+ * @param fNumber value to be represented as fraction. Will contain absolute fractional part
+ * @param nIx subformat number 0..3
+ * @param fIntPart integral part of fraction
+ * @param nFrac numerator of fraction
+ * @param nDic denominator of fraction
+ */
+ SVL_DLLPRIVATE void ImpGetFractionElements( double& fNumber,
+ sal_uInt16 nIx,
+ double& fIntPart,
+ sal_Int64& nFrac,
+ sal_Int64& nDiv ) const;
+ SVL_DLLPRIVATE bool ImpGetFractionOutput(double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString);
+ SVL_DLLPRIVATE bool ImpGetScientificOutput(double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString);
+
+ SVL_DLLPRIVATE bool ImpGetDateOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+ SVL_DLLPRIVATE bool ImpGetTimeOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+ SVL_DLLPRIVATE bool ImpGetDateTimeOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ // Switches to the "gregorian" calendar if the current calendar is
+ // non-"gregorian" and the era is a "Dummy" era of a calendar which doesn't
+ // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and
+ // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was
+ // empty the previous calendar name and date/time are returned.
+ SVL_DLLPRIVATE bool ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, double& fOrgDateTime );
+
+ // Append a "G" short era string of the given calendar. In the case of a
+ // Gengou calendar this is a one character abbreviation, for other
+ // calendars the XExtendedCalendar::getDisplayString() method is called.
+ SVL_DLLPRIVATE static void ImpAppendEraG( OUStringBuffer& OutStringBuffer, const CalendarWrapper& rCal,
+ sal_Int16 nNatNum );
+
+ SVL_DLLPRIVATE bool ImpGetLogicalOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ SVL_DLLPRIVATE bool ImpGetNumberOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ SVL_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat );
+
+ // normal digits or other digits, depending on ImpSvNumFor.aNatNum,
+ // [NatNum1], [NatNum2], ...
+ SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int64 nVal,
+ sal_uInt16 nMinDigits ) const;
+
+ OUString ImpIntToString( sal_uInt16 nIx, sal_Int64 nVal, sal_uInt16 nMinDigits = 0 ) const
+ {
+ const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum();
+ if ( nMinDigits || rNum.IsComplete() )
+ {
+ return ImpGetNatNumString( rNum, nVal, nMinDigits );
+ }
+ return OUString::number(nVal);
+ }
+
+ // Obtain the string of the fraction of second, without leading "0.",
+ // rounded to nFractionDecimals (or nFractionDecimals+1 if
+ // bAddOneRoundingDecimal==true but then truncated at nFractionDecimals,
+ // for use with the result of tools::Time::GetClock()) with the length of
+ // nFractionDecimals, unless nMinimumInputLineDecimals>0 is given for input
+ // line string where extra trailing "0" are discarded.
+ SVL_DLLPRIVATE sal_uInt16 ImpGetFractionOfSecondString( OUStringBuffer& rBuf, double fFractionOfSecond,
+ int nFractionDecimals, bool bAddOneRoundingDecimal, sal_uInt16 nIx, sal_uInt16 nMinimumInputLineDecimals );
+
+ // transliterate according to NativeNumber
+ SVL_DLLPRIVATE OUString impTransliterateImpl(const OUString& rStr, const SvNumberNatNum& rNum) const;
+ SVL_DLLPRIVATE void impTransliterateImpl(OUStringBuffer& rStr, const SvNumberNatNum& rNum) const;
+ SVL_DLLPRIVATE OUString impTransliterateImpl(const OUString& rStr, const SvNumberNatNum& rNum, sal_uInt16 nDateKey) const;
+
+ OUString impTransliterate(const OUString& rStr, const SvNumberNatNum& rNum) const
+ {
+ return rNum.IsComplete() ? impTransliterateImpl(rStr, rNum) : rStr;
+ }
+
+ SVL_DLLPRIVATE void impTransliterate(OUStringBuffer& rStr, const SvNumberNatNum& rNum) const
+ {
+ if(rNum.IsComplete())
+ {
+ impTransliterateImpl(rStr, rNum);
+ }
+ }
+
+ OUString impTransliterate(const OUString& rStr, const SvNumberNatNum& rNum, sal_uInt16 nDateKey) const
+ {
+ return rNum.IsComplete() ? impTransliterateImpl(rStr, rNum, nDateKey) : rStr;
+ }
+
+};
+
+#endif // INCLUDED_SVL_ZFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */