diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-07-24 19:01:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-25 08:23:54 +0200 |
commit | 84f4f7f99f92c0ecec0dd9d754fdfa8c652a7ec0 (patch) | |
tree | b81bdf68955de076e4ece1003803d40ff34c9e41 /include | |
parent | e192e1542a84b26cb0685860b84339019021de96 (diff) |
simplify SvFontSubst
in the process, needed to expose some functionality in ConfigManager
and ConfigItem, to avoid repeating code
Change-Id: Ic0256a010070a79cd649dfd11267bec2f77e5221
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119470
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/fontsubstconfig.hxx | 33 | ||||
-rw-r--r-- | include/unotools/configitem.hxx | 35 | ||||
-rw-r--r-- | include/unotools/configmgr.hxx | 4 |
3 files changed, 41 insertions, 31 deletions
diff --git a/include/svtools/fontsubstconfig.hxx b/include/svtools/fontsubstconfig.hxx index 8399203dfb8f..06097cf3b78b 100644 --- a/include/svtools/fontsubstconfig.hxx +++ b/include/svtools/fontsubstconfig.hxx @@ -19,11 +19,8 @@ #pragma once #include <svtools/svtdllapi.h> -#include <unotools/configitem.hxx> -#include <memory> - -struct SvtFontSubstConfig_Impl; - +#include <rtl/ustring.hxx> +#include <vector> struct SubstitutionStruct { @@ -33,28 +30,12 @@ struct SubstitutionStruct bool bReplaceOnScreenOnly; }; -class SVT_DLLPUBLIC SvtFontSubstConfig final : public utl::ConfigItem +namespace svtools { -private: - bool bIsEnabled; - std::unique_ptr<SvtFontSubstConfig_Impl> pImpl; - - virtual void ImplCommit() override; - -public: - SvtFontSubstConfig(); - virtual ~SvtFontSubstConfig() override; - - virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override; - - bool IsEnabled() const {return bIsEnabled;} - void Enable(bool bSet) {bIsEnabled = bSet; SetModified();} - - sal_Int32 SubstitutionCount() const; - void ClearSubstitutions(); - const SubstitutionStruct* GetSubstitution(sal_Int32 nPos); - void AddSubstitution(const SubstitutionStruct& rToAdd); - void Apply(); + SVT_DLLPUBLIC bool IsFontSubstitutionsEnabled(); + SVT_DLLPUBLIC std::vector<SubstitutionStruct> GetFontSubstitutions(); + SVT_DLLPUBLIC void SetFontSubstitutions(bool bIsEnabled, std::vector<SubstitutionStruct> const &); + SVT_DLLPUBLIC void ApplyFontSubstitutionsToVcl(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotools/configitem.hxx b/include/unotools/configitem.hxx index e14aaf0f2418..20612d401ab8 100644 --- a/include/unotools/configitem.hxx +++ b/include/unotools/configitem.hxx @@ -93,13 +93,14 @@ namespace utl // LOCALE VALUE // "de" "Mein Name" // "en-US" "my name" - void impl_packLocalizedProperties ( const css::uno::Sequence< OUString >& lInNames , + static void impl_packLocalizedProperties ( const css::uno::Sequence< OUString >& lInNames , const css::uno::Sequence< css::uno::Any >& lInValues , css::uno::Sequence< css::uno::Any >& lOutValues ); - void impl_unpackLocalizedProperties ( const css::uno::Sequence< OUString >& lInNames , - const css::uno::Sequence< css::uno::Any >& lInValues , - css::uno::Sequence< OUString >& lOutNames , - css::uno::Sequence< css::uno::Any >& lOutValues ); + static void impl_unpackLocalizedProperties ( + const css::uno::Sequence< OUString >& lInNames , + const css::uno::Sequence< css::uno::Any >& lInValues , + css::uno::Sequence< OUString >& lOutNames , + css::uno::Sequence< css::uno::Any >& lOutValues); css::uno::Reference< css::container::XHierarchicalNameAccess> GetTree(); @@ -178,6 +179,30 @@ namespace utl void Commit(); ConfigItemMode GetMode() const { return m_nMode;} + + //returns all members of a node in a specific format + static css::uno::Sequence< OUString > GetNodeNames( + css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess, + const OUString& rNode, ConfigNameFormat eFormat); + static css::uno::Sequence< css::uno::Any> GetProperties( + css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess, + const css::uno::Sequence< OUString >& rNames, + bool bAllLocales); + static bool PutProperties( + css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess, + const css::uno::Sequence< OUString >& rNames, + const css::uno::Sequence< css::uno::Any>& rValues, + bool bAllLocales); + // remove all members of a set + static bool ClearNodeSet( + css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess, + const OUString& rNode); + // remove, change or add members of a set + static bool ReplaceSetProperties( + css::uno::Reference<css::container::XHierarchicalNameAccess> const & xHierarchyAccess, + const OUString& rNode, + const css::uno::Sequence< css::beans::PropertyValue >& rValues, + bool bAllLocales); }; }//namespace utl #endif // INCLUDED_UNOTOOLS_CONFIGITEM_HXX diff --git a/include/unotools/configmgr.hxx b/include/unotools/configmgr.hxx index a4d46cb8e19e..e8d42a28fd7e 100644 --- a/include/unotools/configmgr.hxx +++ b/include/unotools/configmgr.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> +#include <string_view> #include <vector> #include <com/sun/star/uno/Reference.hxx> @@ -62,6 +63,9 @@ public: SAL_DLLPRIVATE static css::uno::Reference< css::container::XHierarchicalNameAccess> acquireTree(utl::ConfigItem const & item); + static css::uno::Reference< css::container::XHierarchicalNameAccess> + acquireTree(std::u16string_view rSubTreeName); + SAL_DLLPRIVATE ConfigManager(); SAL_DLLPRIVATE ~ConfigManager(); |