diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-22 16:39:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-04 06:38:03 +0000 |
commit | 5676ced82539d9e40bde6196d2aa3b2e4c7b3fdb (patch) | |
tree | db860b2365f8cb0e2fab4772e80e4e38d4d89b37 | |
parent | 1a1d1a86e9129ec3885610b641179b30f9bf5e79 (diff) |
make UNO enums scoped for internal LO code
this modifies codemaker so that, for an UNO enum, we generate code
that effectively looks like:
#ifdef LIBO_INTERNAL_ONLY && HAVE_CX11_CONSTEXPR
enum class XXX {
ONE = 1
};
constexpr auto ONE = XXX_ONE;
#else
...the old normal way..
#endif
which means that for LO internal code, the enums are scoped.
The "constexpr auto" trick acts like an alias so we don't have to
use scoped naming everywhere.
Change-Id: I3054ecb230e8666ce98b4a9cb87b384df5f64fb4
Reviewed-on: https://gerrit.libreoffice.org/34546
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
27 files changed, 717 insertions, 777 deletions
diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx index 4f1840c54e43..a4279e3a98dd 100644 --- a/codemaker/source/commoncpp/commoncpp.cxx +++ b/codemaker/source/commoncpp/commoncpp.cxx @@ -63,7 +63,6 @@ OString scopedCppName(OString const & type, bool ns_alias) return s; } - OString translateUnoToCppType( codemaker::UnoType::Sort sort, OUString const & nucleus) { diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 659061a8fd34..a657389d6a4d 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -46,9 +46,11 @@ #include "dumputils.hxx" #include "includes.hxx" -namespace { +namespace +{ -bool isBootstrapType(OUString const & name) { +bool isBootstrapType(OUString const & name) +{ static char const * const names[] = { "com.sun.star.beans.Property", "com.sun.star.beans.PropertyAttribute", @@ -136,8 +138,9 @@ bool isBootstrapType(OUString const & name) { "com.sun.star.uno.XReference", "com.sun.star.uno.XUnloadingPreference", "com.sun.star.uno.XWeak", - "com.sun.star.util.XMacroExpander" }; - // cf. cppuhelper/unotypes/Makefile UNOTYPES (plus missing dependencies) + "com.sun.star.util.XMacroExpander" + }; + // cf. cppuhelper/unotypes/Makefile UNOTYPES (plus missing dependencies) for (std::size_t i = 0; i < SAL_N_ELEMENTS(names); ++i) { if (name.equalsAscii(names[i])) { return true; @@ -146,7 +149,8 @@ bool isBootstrapType(OUString const & name) { return false; } -class CppuType { +class CppuType +{ public: CppuType( OUString const & name, rtl::Reference< TypeManager > const & typeMgr); @@ -166,8 +170,9 @@ public: codemaker::GeneratedTypeSet & generated, CppuOptions const & options); virtual void dumpHdlFile( - FileStream & out, codemaker::cppumaker::Includes & includes) - { dumpHFileContent(out, includes); } + FileStream & out, codemaker::cppumaker::Includes & includes) { + dumpHFileContent(out, includes); + } virtual void dumpHppFile(FileStream& o, codemaker::cppumaker::Includes & includes) = 0; @@ -177,16 +182,18 @@ public: virtual void dumpLightGetCppuType(FileStream & out); - virtual void dumpNormalGetCppuType(FileStream &) - { assert(false); } // this cannot happen + virtual void dumpNormalGetCppuType(FileStream &) { + assert(false); // this cannot happen + } - virtual void dumpComprehensiveGetCppuType(FileStream &) - { assert(false); } // this cannot happen + virtual void dumpComprehensiveGetCppuType(FileStream &) { + assert(false); // this cannot happen + } void dumpType( FileStream & out, OUString const & name, bool isConst = false, bool isRef = false, bool native = false, bool cppuUnoType = false) - const; + const; OUString getTypeClass(OUString const & name, bool cStyle = false); @@ -199,8 +206,10 @@ public: void dec(sal_Int32 num=4); OUString indent() const; protected: - virtual sal_uInt32 checkInheritedMemberCount() const - { assert(false); return 0; } // this cannot happen + virtual sal_uInt32 checkInheritedMemberCount() const { + assert(false); // this cannot happen + return 0; + } bool passByReference(OUString const & name) const; @@ -213,8 +222,9 @@ protected: codemaker::cpp::IdentifierTranslationMode isGlobal() const; - virtual void dumpDeclaration(FileStream &) - { assert(false); } // this cannot happen + virtual void dumpDeclaration(FileStream &) { + assert(false); // this cannot happen + } virtual void dumpFiles(OUString const & uri, CppuOptions const & options); @@ -259,7 +269,7 @@ protected: private: void addGetCppuTypeIncludes(codemaker::cppumaker::Includes & includes) - const; + const; }; CppuType::CppuType( @@ -275,11 +285,10 @@ CppuType::CppuType( {} void CppuType::addGetCppuTypeIncludes(codemaker::cppumaker::Includes & includes) - const +const { if (name_ == "com.sun.star.uno.XInterface" - || name_ == "com.sun.star.uno.Exception") - { + || name_ == "com.sun.star.uno.Exception") { includes.addType(); includes.addCppuUnotypeHxx(); includes.addSalTypesH(); @@ -294,7 +303,8 @@ void CppuType::addGetCppuTypeIncludes(codemaker::cppumaker::Includes & includes) } } -void CppuType::dumpFiles(OUString const & uri, CppuOptions const & options) { +void CppuType::dumpFiles(OUString const & uri, CppuOptions const & options) +{ dumpFile(uri, name_, false, options); dumpFile(uri, name_, true, options); } @@ -323,9 +333,13 @@ void CppuType::addComprehensiveGetCppuTypeIncludes( includes.addCppuUnotypeHxx(); } -bool CppuType::isPolymorphic() const { return false; } +bool CppuType::isPolymorphic() const +{ + return false; +} -void CppuType::dumpGetCppuTypePreamble(FileStream & out) { +void CppuType::dumpGetCppuTypePreamble(FileStream & out) +{ if (isPolymorphic()) { out << "namespace cppu {\n\n"; dumpTemplateHead(out); @@ -348,7 +362,8 @@ void CppuType::dumpGetCppuTypePreamble(FileStream & out) { inc(); } -void CppuType::dumpGetCppuTypePostamble(FileStream & out) { +void CppuType::dumpGetCppuTypePostamble(FileStream & out) +{ dec(); if (isPolymorphic()) { out << indent() << "}\n\nprivate:\n" @@ -377,7 +392,8 @@ void CppuType::dumpGetCppuTypePostamble(FileStream & out) { out << indent() << "}\n"; } -void CppuType::dump(CppuOptions const & options) { +void CppuType::dump(CppuOptions const & options) +{ if (isBootstrapType(name_)) { m_cppuTypeDynamic = false; } else { @@ -434,7 +450,7 @@ bool CppuType::dumpFile( } out.close(); return makeValidTypeFile( - u2b(fileUri), u2b(tmpUri), exists && options.isValid("-Gc")); + u2b(fileUri), u2b(tmpUri), exists && options.isValid("-Gc")); } void CppuType::dumpDependedTypes( @@ -443,8 +459,7 @@ void CppuType::dumpDependedTypes( if (!options.isValid("-nD")) { codemaker::cppumaker::Dependencies::Map const & map = m_dependencies.getMap(); - for (const auto& entry : map) - { + for (const auto& entry : map) { produce(entry.first, m_typeMgr, generated, options); } } @@ -461,25 +476,23 @@ OUString CppuType::dumpHeaderDefine( } void CppuType::addDefaultHIncludes(codemaker::cppumaker::Includes & includes) - const +const { //TODO: Only include what is really needed includes.addCppuMacrosHxx(); if (m_typeMgr->getSort(name_) - == codemaker::UnoType::Sort::Interface) - { + == codemaker::UnoType::Sort::Interface) { includes.addReference(); } } void CppuType::addDefaultHxxIncludes(codemaker::cppumaker::Includes & includes) - const +const { //TODO: Only include what is really needed includes.addType(); if (m_typeMgr->getSort(name_) - == codemaker::UnoType::Sort::Interface) - { + == codemaker::UnoType::Sort::Interface) { includes.addReference(); } } @@ -517,6 +530,7 @@ void CppuType::dumpInitializer( << (dynamic_cast< unoidl::EnumTypeEntity * >(ent.get())-> getMembers()[0].name); break; + break; case codemaker::UnoType::Sort::String: case codemaker::UnoType::Sort::Type: case codemaker::UnoType::Sort::Any: @@ -541,8 +555,8 @@ void CppuType::dumpHFileContent( dumpHeaderDefine(out, "HDL"); out << "\n"; includes.dump(out, nullptr, false); - // 'exceptions = false' would be wrong for services/singletons, but - // those don't dump .hdl files anyway + // 'exceptions = false' would be wrong for services/singletons, but + // those don't dump .hdl files anyway out << ("\nnamespace com { namespace sun { namespace star { namespace uno" " { class Type; } } } }\n\n"); if (codemaker::cppumaker::dumpNamespaceOpen(out, name_, false)) { @@ -551,8 +565,7 @@ void CppuType::dumpHFileContent( dumpDeclaration(out); if (!(name_ == "com.sun.star.uno.XInterface" || name_ == "com.sun.star.uno.Exception" - || isPolymorphic())) - { + || isPolymorphic())) { out << "\n" << indent() << ("inline ::css::uno::Type const &" " cppu_detail_getUnoType(SAL_UNUSED_PARAMETER "); @@ -570,7 +583,8 @@ void CppuType::dumpHFileContent( out << " *);\n\n#endif\n"; } -void CppuType::dumpGetCppuType(FileStream & out) { +void CppuType::dumpGetCppuType(FileStream & out) +{ if (name_ == "com.sun.star.uno.XInterface") { out << indent() << ("SAL_DEPRECATED(\"use cppu::UnoType\") inline ::css::uno::Type const & SAL_CALL" @@ -604,7 +618,8 @@ void CppuType::dumpGetCppuType(FileStream & out) { } } -void CppuType::dumpLightGetCppuType(FileStream & out) { +void CppuType::dumpLightGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << "static typelib_TypeDescriptionReference * the_type = 0;\n" @@ -619,112 +634,115 @@ void CppuType::dumpLightGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -codemaker::cpp::IdentifierTranslationMode CppuType::isGlobal() const { +codemaker::cpp::IdentifierTranslationMode CppuType::isGlobal() const +{ return name_.indexOf('.') == -1 - ? codemaker::cpp::IdentifierTranslationMode::Global : codemaker::cpp::IdentifierTranslationMode::NonGlobal; + ? codemaker::cpp::IdentifierTranslationMode::Global : codemaker::cpp::IdentifierTranslationMode::NonGlobal; } sal_uInt32 CppuType::getInheritedMemberCount() { - if (m_inheritedMemberCount == 0) - { + if (m_inheritedMemberCount == 0) { m_inheritedMemberCount = checkInheritedMemberCount(); } return m_inheritedMemberCount; } -OUString CppuType::getTypeClass(OUString const & name, bool cStyle) { +OUString CppuType::getTypeClass(OUString const & name, bool cStyle) +{ rtl::Reference< unoidl::Entity > ent; switch (m_typeMgr->getSort(name, &ent)) { case codemaker::UnoType::Sort::Void: return cStyle - ? OUString("typelib_TypeClass_VOID") - : OUString("::css::uno::TypeClass_VOID"); + ? OUString("typelib_TypeClass_VOID") + : OUString("::css::uno::TypeClass_VOID"); case codemaker::UnoType::Sort::Boolean: return cStyle - ? OUString("typelib_TypeClass_BOOLEAN") - : OUString("::css::uno::TypeClass_BOOLEAN"); + ? OUString("typelib_TypeClass_BOOLEAN") + : OUString("::css::uno::TypeClass_BOOLEAN"); case codemaker::UnoType::Sort::Byte: return cStyle - ? OUString("typelib_TypeClass_BYTE") - : OUString("::css::uno::TypeClass_BYTE"); + ? OUString("typelib_TypeClass_BYTE") + : OUString("::css::uno::TypeClass_BYTE"); case codemaker::UnoType::Sort::Short: return cStyle - ? OUString("typelib_TypeClass_SHORT") - : OUString("::css::uno::TypeClass_SHORT"); + ? OUString("typelib_TypeClass_SHORT") + : OUString("::css::uno::TypeClass_SHORT"); case codemaker::UnoType::Sort::UnsignedShort: return cStyle - ? OUString("typelib_TypeClass_UNSIGNED_SHORT") - : OUString("::css::uno::TypeClass_UNSIGNED_SHORT"); + ? OUString("typelib_TypeClass_UNSIGNED_SHORT") + : OUString("::css::uno::TypeClass_UNSIGNED_SHORT"); case codemaker::UnoType::Sort::Long: return cStyle - ? OUString("typelib_TypeClass_LONG") - : OUString("::css::uno::TypeClass_LONG"); + ? OUString("typelib_TypeClass_LONG") + : OUString("::css::uno::TypeClass_LONG"); case codemaker::UnoType::Sort::UnsignedLong: return cStyle - ? OUString("typelib_TypeClass_UNSIGNED_LONG") - : OUString("::css::uno::TypeClass_UNSIGNED_LONG"); + ? OUString("typelib_TypeClass_UNSIGNED_LONG") + : OUString("::css::uno::TypeClass_UNSIGNED_LONG"); case codemaker::UnoType::Sort::Hyper: return cStyle - ? OUString("typelib_TypeClass_HYPER") - : OUString("::css::uno::TypeClass_HYPER"); + ? OUString("typelib_TypeClass_HYPER") + : OUString("::css::uno::TypeClass_HYPER"); case codemaker::UnoType::Sort::UnsignedHyper: return cStyle - ? OUString("typelib_TypeClass_UNSIGNED_HYPER") - : OUString("::css::uno::TypeClass_UNSIGNED_HYPER"); + ? OUString("typelib_TypeClass_UNSIGNED_HYPER") + : OUString("::css::uno::TypeClass_UNSIGNED_HYPER"); case codemaker::UnoType::Sort::Float: return cStyle - ? OUString("typelib_TypeClass_FLOAT") - : OUString("::css::uno::TypeClass_FLOAT"); + ? OUString("typelib_TypeClass_FLOAT") + : OUString("::css::uno::TypeClass_FLOAT"); case codemaker::UnoType::Sort::Double: return cStyle - ? OUString("typelib_TypeClass_DOUBLE") - : OUString("::css::uno::TypeClass_DOUBLE"); + ? OUString("typelib_TypeClass_DOUBLE") + : OUString("::css::uno::TypeClass_DOUBLE"); case codemaker::UnoType::Sort::Char: return cStyle - ? OUString("typelib_TypeClass_CHAR") - : OUString("::css::uno::TypeClass_CHAR"); + ? OUString("typelib_TypeClass_CHAR") + : OUString("::css::uno::TypeClass_CHAR"); case codemaker::UnoType::Sort::String: return cStyle - ? OUString("typelib_TypeClass_STRING") - : OUString("::css::uno::TypeClass_STRING"); + ? OUString("typelib_TypeClass_STRING") + : OUString("::css::uno::TypeClass_STRING"); case codemaker::UnoType::Sort::Type: return cStyle - ? OUString("typelib_TypeClass_TYPE") - : OUString("::css::uno::TypeClass_TYPE"); + ? OUString("typelib_TypeClass_TYPE") + : OUString("::css::uno::TypeClass_TYPE"); case codemaker::UnoType::Sort::Any: return cStyle - ? OUString("typelib_TypeClass_ANY") - : OUString("::css::uno::TypeClass_ANY"); + ? OUString("typelib_TypeClass_ANY") + : OUString("::css::uno::TypeClass_ANY"); case codemaker::UnoType::Sort::Sequence: return cStyle - ? OUString("typelib_TypeClass_SEQUENCE") - : OUString("::css::uno::TypeClass_SEQUENCE"); + ? OUString("typelib_TypeClass_SEQUENCE") + : OUString("::css::uno::TypeClass_SEQUENCE"); case codemaker::UnoType::Sort::Enum: return cStyle - ? OUString("typelib_TypeClass_ENUM") - : OUString("::css::uno::TypeClass_ENUM"); + ? OUString("typelib_TypeClass_ENUM") + : OUString("::css::uno::TypeClass_ENUM"); case codemaker::UnoType::Sort::PlainStruct: case codemaker::UnoType::Sort::PolymorphicStructTemplate: case codemaker::UnoType::Sort::InstantiatedPolymorphicStruct: return cStyle - ? OUString("typelib_TypeClass_STRUCT") - : OUString("::css::uno::TypeClass_STRUCT"); + ? OUString("typelib_TypeClass_STRUCT") + : OUString("::css::uno::TypeClass_STRUCT"); case codemaker::UnoType::Sort::Exception: return cStyle - ? OUString("typelib_TypeClass_EXCEPTION") - : OUString("::css::uno::TypeClass_EXCEPTION"); + ? OUString("typelib_TypeClass_EXCEPTION") + : OUString("::css::uno::TypeClass_EXCEPTION"); case codemaker::UnoType::Sort::Interface: return cStyle - ? OUString("typelib_TypeClass_INTERFACE") - : OUString("::css::uno::TypeClass_INTERFACE"); + ? OUString("typelib_TypeClass_INTERFACE") + : OUString("::css::uno::TypeClass_INTERFACE"); case codemaker::UnoType::Sort::Typedef: return getTypeClass( - dynamic_cast<unoidl::TypedefEntity&>(*ent.get()).getType(), - cStyle); + dynamic_cast<unoidl::TypedefEntity&>(*ent.get()).getType(), + cStyle); default: - for (;;) { std::abort(); } + for (;;) { + std::abort(); + } } } @@ -801,8 +819,7 @@ void CppuType::dumpType( if (!args.empty()) { out << "< "; for (std::vector< OString >::iterator i(args.begin()); - i != args.end(); ++i) - { + i != args.end(); ++i) { if (i != args.begin()) { out << ", "; } @@ -839,7 +856,7 @@ void CppuType::dumpCppuGetType( OUString nucleus; sal_Int32 rank; codemaker::UnoType::Sort sort = m_typeMgr->decompose( - name, true, &nucleus, &rank, nullptr, nullptr); + name, true, &nucleus, &rank, nullptr, nullptr); switch (rank == 0 ? sort : codemaker::UnoType::Sort::Sequence) { case codemaker::UnoType::Sort::Void: case codemaker::UnoType::Sort::Boolean: @@ -879,7 +896,8 @@ void CppuType::dumpCppuGetType( } } -bool CppuType::passByReference(OUString const & name) const { +bool CppuType::passByReference(OUString const & name) const +{ switch (m_typeMgr->getSort(resolveOuterTypedefs(name))) { case codemaker::UnoType::Sort::Boolean: case codemaker::UnoType::Sort::Byte: @@ -909,10 +927,12 @@ bool CppuType::passByReference(OUString const & name) const { } } -bool CppuType::canBeWarnUnused(OUString const & name) const { +bool CppuType::canBeWarnUnused(OUString const & name) const +{ return canBeWarnUnused(name, 0); } -bool CppuType::canBeWarnUnused(OUString const & name, int depth) const { +bool CppuType::canBeWarnUnused(OUString const & name, int depth) const +{ // prevent infinite recursion and blowing the stack if (depth > 10) return false; @@ -933,23 +953,20 @@ bool CppuType::canBeWarnUnused(OUString const & name, int depth) const { case codemaker::UnoType::Sort::String: case codemaker::UnoType::Sort::Type: return true; - case codemaker::UnoType::Sort::PlainStruct: - { + case codemaker::UnoType::Sort::PlainStruct: { rtl::Reference< unoidl::Entity > ent; m_typeMgr->getSort(aResolvedName, &ent); rtl::Reference< unoidl::PlainStructTypeEntity > ent2( dynamic_cast< unoidl::PlainStructTypeEntity * >(ent.get())); if (!ent2->getDirectBase().isEmpty() && !canBeWarnUnused(ent2->getDirectBase(), depth+1)) return false; - for ( const unoidl::PlainStructTypeEntity::Member& rMember : ent2->getDirectMembers()) - { + for ( const unoidl::PlainStructTypeEntity::Member& rMember : ent2->getDirectMembers()) { if (!canBeWarnUnused(rMember.type, depth+1)) return false; } return true; } - case codemaker::UnoType::Sort::Sequence: - { + case codemaker::UnoType::Sort::Sequence: { OUString aInnerType = aResolvedName.copy(2); return canBeWarnUnused(aInnerType, depth+1); } @@ -964,7 +981,8 @@ bool CppuType::canBeWarnUnused(OUString const & name, int depth) const { } } -OUString CppuType::resolveOuterTypedefs(OUString const & name) const { +OUString CppuType::resolveOuterTypedefs(OUString const & name) const +{ for (OUString n(name);;) { rtl::Reference< unoidl::Entity > ent; if (m_typeMgr->getSort(n, &ent) != codemaker::UnoType::Sort::Typedef) { @@ -974,7 +992,8 @@ OUString CppuType::resolveOuterTypedefs(OUString const & name) const { } } -OUString CppuType::resolveAllTypedefs(OUString const & name) const { +OUString CppuType::resolveAllTypedefs(OUString const & name) const +{ sal_Int32 k1; OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k1))); for (;;) { @@ -984,10 +1003,10 @@ OUString CppuType::resolveAllTypedefs(OUString const & name) const { } sal_Int32 k2; n = b2u( - codemaker::UnoType::decompose( - u2b(dynamic_cast<unoidl::TypedefEntity&>(*ent.get()). - getType()), - &k2)); + codemaker::UnoType::decompose( + u2b(dynamic_cast<unoidl::TypedefEntity&>(*ent.get()). + getType()), + &k2)); k1 += k2; //TODO: overflow } OUStringBuffer b; @@ -1008,7 +1027,8 @@ void CppuType::dec(sal_Int32 num) m_indentLength = std::max< sal_Int32 >(m_indentLength - num, 0); } -OUString CppuType::indent() const { +OUString CppuType::indent() const +{ OUStringBuffer buf(m_indentLength); for (sal_Int32 i = 0; i != m_indentLength; ++i) { buf.append(' '); @@ -1016,9 +1036,9 @@ OUString CppuType::indent() const { return buf.makeStringAndClear(); } -bool isDeprecated(std::vector< OUString > const & annotations) { - for (const OUString& r : annotations) - { +bool isDeprecated(std::vector< OUString > const & annotations) +{ + for (const OUString& r : annotations) { if (r == "deprecated") { return true; } @@ -1026,22 +1046,28 @@ bool isDeprecated(std::vector< OUString > const & annotations) { return false; } -void dumpDeprecation(FileStream & out, bool deprecated) { +void dumpDeprecation(FileStream & out, bool deprecated) +{ if (deprecated) { out << "SAL_DEPRECATED_INTERNAL(\"marked @deprecated in UNOIDL\") "; } } -class BaseOffset { +class BaseOffset +{ public: BaseOffset( rtl::Reference< TypeManager > const & manager, rtl::Reference< unoidl::InterfaceTypeEntity > const & entity): - manager_(manager), offset_(0) { calculateBases(entity); } + manager_(manager), offset_(0) { + calculateBases(entity); + } BaseOffset(const BaseOffset&) = delete; const BaseOffset& operator=(const BaseOffset&) = delete; - sal_Int32 get() const { return offset_; } + sal_Int32 get() const { + return offset_; + } private: void calculateBases( @@ -1056,8 +1082,7 @@ void BaseOffset::calculateBases( rtl::Reference< unoidl::InterfaceTypeEntity > const & entity) { assert(entity.is()); - for (const unoidl::AnnotatedReference& ar : entity->getDirectMandatoryBases()) - { + for (const unoidl::AnnotatedReference& ar : entity->getDirectMandatoryBases()) { if (set_.insert(ar.name).second) { rtl::Reference< unoidl::Entity > ent; codemaker::UnoType::Sort sort = manager_->getSort(ar.name, &ent); @@ -1071,12 +1096,13 @@ void BaseOffset::calculateBases( assert(ent2.is()); calculateBases(ent2); offset_ += ent2->getDirectAttributes().size() - + ent2->getDirectMethods().size(); //TODO: overflow + + ent2->getDirectMethods().size(); //TODO: overflow } } } -class InterfaceType: public CppuType { +class InterfaceType: public CppuType +{ public: InterfaceType( rtl::Reference< unoidl::InterfaceTypeEntity > const & entity, @@ -1100,8 +1126,9 @@ private: virtual void addComprehensiveGetCppuTypeIncludes( codemaker::cppumaker::Includes & includes) const override; - virtual sal_uInt32 checkInheritedMemberCount() const override - { return BaseOffset(m_typeMgr, entity_).get(); } + virtual sal_uInt32 checkInheritedMemberCount() const override { + return BaseOffset(m_typeMgr, entity_).get(); + } void dumpExceptionTypeName( FileStream & out, OUString const & prefix, sal_uInt32 index, @@ -1124,12 +1151,12 @@ InterfaceType::InterfaceType( assert(entity.is()); } -void InterfaceType::dumpDeclaration(FileStream & out) { +void InterfaceType::dumpDeclaration(FileStream & out) +{ out << "\nclass SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI " << id_; for (std::vector< unoidl::AnnotatedReference >::const_iterator i( entity_->getDirectMandatoryBases().begin()); - i != entity_->getDirectMandatoryBases().end(); ++i) - { + i != entity_->getDirectMandatoryBases().end(); ++i) { out << (i == entity_->getDirectMandatoryBases().begin() ? " :" : ",") << " public " << codemaker::cpp::scopedCppName(u2b(i->name)); } @@ -1170,12 +1197,12 @@ void InterfaceType::dumpHppFile( out << "}\n\n#endif // "<< headerDefine << "\n"; } -void InterfaceType::dumpAttributes(FileStream & out) { +void InterfaceType::dumpAttributes(FileStream & out) +{ if (!entity_->getDirectAttributes().empty()) { out << "\n" << indent() << "// Attributes\n"; } - for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) - { + for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) { bool depr = m_isDeprecated || isDeprecated(attr.annotations); out << indent(); dumpDeprecation(out, depr); @@ -1193,12 +1220,12 @@ void InterfaceType::dumpAttributes(FileStream & out) { } } -void InterfaceType::dumpMethods(FileStream & out) { +void InterfaceType::dumpMethods(FileStream & out) +{ if (!entity_->getDirectMethods().empty()) { out << "\n" << indent() << "// Methods\n"; } - for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) - { + for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) { out << indent(); dumpDeprecation(out, m_isDeprecated || isDeprecated(method.annotations)); out << "virtual "; @@ -1207,15 +1234,13 @@ void InterfaceType::dumpMethods(FileStream & out) { if (!method.parameters.empty()) { out << " "; for (std::vector< unoidl::InterfaceTypeEntity::Method::Parameter >:: - const_iterator j(method.parameters.begin()); - j != method.parameters.end();) - { + const_iterator j(method.parameters.begin()); + j != method.parameters.end();) { bool isConst; bool isRef; if (j->direction == (unoidl::InterfaceTypeEntity::Method::Parameter:: - DIRECTION_IN)) - { + DIRECTION_IN)) { isConst = passByReference(j->type); isRef = isConst; } else { @@ -1235,7 +1260,8 @@ void InterfaceType::dumpMethods(FileStream & out) { } } -void InterfaceType::dumpNormalGetCppuType(FileStream & out) { +void InterfaceType::dumpNormalGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << "static typelib_TypeDescriptionReference * the_type = 0;\n" @@ -1245,16 +1271,14 @@ void InterfaceType::dumpNormalGetCppuType(FileStream & out) { entity_->getDirectMandatoryBases().size()); if (bases == 1 && (entity_->getDirectMandatoryBases()[0].name - == "com.sun.star.uno.XInterface")) - { + == "com.sun.star.uno.XInterface")) { bases = 0; } if (bases != 0) { out << indent() << "typelib_TypeDescriptionReference * aSuperTypes[" << entity_->getDirectMandatoryBases().size() << "];\n"; std::vector< unoidl::AnnotatedReference >::size_type n = 0; - for (const unoidl::AnnotatedReference& ar : entity_->getDirectMandatoryBases()) - { + for (const unoidl::AnnotatedReference& ar : entity_->getDirectMandatoryBases()) { out << indent() << "aSuperTypes[" << n++ << "] = ::cppu::UnoType< "; dumpType(out, ar.name, true, false, false, true); out << " >::get().getTypeLibType();\n"; @@ -1270,7 +1294,8 @@ void InterfaceType::dumpNormalGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) { +void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) +{ codemaker::cppumaker::dumpNamespaceOpen(out, name_, false); OUString staticTypeClass("the" + id_ + "Type"); out << " namespace detail {\n\n" << indent() << "struct " << staticTypeClass @@ -1286,14 +1311,13 @@ void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) { out << indent() << "typelib_TypeDescriptionReference * aSuperTypes[" << entity_->getDirectMandatoryBases().size() << "];\n"; std::vector< unoidl::AnnotatedReference >::size_type n = 0; - for (const unoidl::AnnotatedReference& ar : entity_->getDirectMandatoryBases()) - { + for (const unoidl::AnnotatedReference& ar : entity_->getDirectMandatoryBases()) { out << indent() << "aSuperTypes[" << n++ << "] = ::cppu::UnoType< "; dumpType(out, ar.name, false, false, false, true); out << " >::get().getTypeLibType();\n"; } std::size_t count = entity_->getDirectAttributes().size() - + entity_->getDirectMethods().size(); //TODO: overflow + + entity_->getDirectMethods().size(); //TODO: overflow if (count != 0) { out << indent() << "typelib_TypeDescriptionReference * pMembers[" << count << "] = { "; @@ -1318,7 +1342,7 @@ void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) { dec(); out << indent() << ("typelib_typedescription_register( (typelib_TypeDescription**)&pTD" - " );\n"); + " );\n"); for (std::size_t i = 0; i != count; ++i) { out << indent() << "typelib_typedescriptionreference_release( pMembers[" << i << "] );\n"; @@ -1372,8 +1396,7 @@ void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) { void InterfaceType::dumpCppuAttributeRefs(FileStream & out, sal_uInt32 & index) { std::vector< unoidl::InterfaceTypeEntity::Attribute >::size_type n = 0; - for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) - { + for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) { out << indent() << "::rtl::OUString sAttributeName" << n << "( \"" << name_ << "::" << attr.name << "\" );\n" << indent() << "typelib_typedescriptionreference_new( &pMembers[" << index++ @@ -1387,10 +1410,10 @@ void InterfaceType::dumpCppuAttributeRefs(FileStream & out, sal_uInt32 & index) } } -void InterfaceType::dumpCppuMethodRefs(FileStream & out, sal_uInt32 & index) { +void InterfaceType::dumpCppuMethodRefs(FileStream & out, sal_uInt32 & index) +{ std::vector< unoidl::InterfaceTypeEntity::Method >::size_type n = 0; - for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) - { + for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) { out << indent() << "::rtl::OUString sMethodName" << n << "( \"" << name_ << "::" << method.name << "\" );\n" << indent() << "typelib_typedescriptionreference_new( &pMembers[" << index++ @@ -1415,13 +1438,13 @@ void InterfaceType::addComprehensiveGetCppuTypeIncludes( includes.add("com.sun.star.uno.RuntimeException"); } -void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) { +void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) +{ if (!entity_->getDirectAttributes().empty()) { out << "\n" << indent() << "typelib_InterfaceAttributeTypeDescription * pAttribute = 0;\n"; std::vector< unoidl::InterfaceTypeEntity::Attribute >::size_type n = 0; - for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) - { + for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) { OUString type(resolveAllTypedefs(attr.type)); out << indent() << "{\n"; inc(); @@ -1430,9 +1453,9 @@ void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) { << "::rtl::OUString sAttributeName" << n << "( \"" << name_ << "::" << attr.name << "\" );\n"; sal_Int32 getExcn = dumpExceptionTypeNames( - out, "get", attr.getExceptions, false); + out, "get", attr.getExceptions, false); sal_Int32 setExcn = dumpExceptionTypeNames( - out, "set", attr.setExceptions, false); + out, "set", attr.setExceptions, false); out << indent() << ("typelib_typedescription_newExtendedInterfaceAttribute(" " &pAttribute,\n"); @@ -1459,13 +1482,13 @@ void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) { } } -void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) { +void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) +{ if (!entity_->getDirectMethods().empty()) { out << "\n" << indent() << "typelib_InterfaceMethodTypeDescription * pMethod = 0;\n"; std::vector< unoidl::InterfaceTypeEntity::Method >::size_type n = 0; - for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) - { + for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) { OUString returnType(resolveAllTypedefs(method.returnType)); out << indent() << "{\n"; inc(); @@ -1474,9 +1497,8 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) { << method.parameters.size() << "];\n"; } std::vector< unoidl::InterfaceTypeEntity::Method::Parameter >:: - size_type m = 0; - for (const unoidl::InterfaceTypeEntity::Method::Parameter& param : method.parameters) - { + size_type m = 0; + for (const unoidl::InterfaceTypeEntity::Method::Parameter& param : method.parameters) { OUString type(resolveAllTypedefs(param.type)); out << indent() << "::rtl::OUString sParamName" << m << "( \"" << param.name << "\" );\n" << indent() @@ -1501,8 +1523,8 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) { ++m; } sal_Int32 excn = dumpExceptionTypeNames( - out, "", method.exceptions, - method.name != "acquire" && method.name != "release"); + out, "", method.exceptions, + method.name != "acquire" && method.name != "release"); out << indent() << "::rtl::OUString sReturnType" << n << "( \"" << returnType << "\" );\n" << indent() << "::rtl::OUString sMethodName" << n << "( \"" << name_ << "::" @@ -1535,19 +1557,16 @@ void InterfaceType::dumpAttributesCppuDecl( FileStream & out, std::set< OUString > * seen) { assert(seen != nullptr); - for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) - { + for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes()) { if (seen->insert(attr.type).second) { dumpCppuGetType(out, attr.type); } - for (const OUString& exc : attr.getExceptions) - { + for (const OUString& exc : attr.getExceptions) { if (seen->insert(exc).second) { dumpCppuGetType(out, exc); } } - for (const OUString& exc : attr.setExceptions) - { + for (const OUString& exc : attr.setExceptions) { if (seen->insert(exc).second) { dumpCppuGetType(out, exc); } @@ -1559,10 +1578,8 @@ void InterfaceType::dumpMethodsCppuDecl( FileStream & out, std::set< OUString > * seen) { assert(seen != nullptr); - for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) - { - for (const OUString& ex : method.exceptions) - { + for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) { + for (const OUString& ex : method.exceptions) { if (seen->insert(ex).second) { dumpCppuGetType(out, ex); } @@ -1583,8 +1600,7 @@ sal_Int32 InterfaceType::dumpExceptionTypeNames( std::vector< OUString > const & exceptions, bool runtimeException) { sal_Int32 count = 0; - for (const OUString& ex : exceptions) - { + for (const OUString& ex : exceptions) { if (ex != "com.sun.star.uno.RuntimeException") { dumpExceptionTypeName(out, prefix, count++, ex); } @@ -1604,15 +1620,19 @@ sal_Int32 InterfaceType::dumpExceptionTypeNames( return count; } -class ConstantGroup: public CppuType { +class ConstantGroup: public CppuType +{ public: ConstantGroup( rtl::Reference< unoidl::ConstantGroupEntity > const & entity, OUString const & name, rtl::Reference< TypeManager > const & typeMgr): - CppuType(name, typeMgr), entity_(entity) - { assert(entity.is()); } + CppuType(name, typeMgr), entity_(entity) { + assert(entity.is()); + } - bool hasConstants() const { return !entity_->getMembers().empty(); } + bool hasConstants() const { + return !entity_->getMembers().empty(); + } private: virtual void dumpHdlFile( @@ -1655,9 +1675,9 @@ void ConstantGroup::dumpHppFile( out << "\n#endif // "<< headerDefine << "\n"; } -void ConstantGroup::dumpDeclaration(FileStream & out) { - for (const unoidl::ConstantGroupEntity::Member& member : entity_->getMembers()) - { +void ConstantGroup::dumpDeclaration(FileStream & out) +{ + for (const unoidl::ConstantGroupEntity::Member& member : entity_->getMembers()) { out << "static const "; switch (member.value.type) { case unoidl::ConstantValue::TYPE_BOOLEAN: @@ -1744,24 +1764,28 @@ void ConstantGroup::dumpDeclaration(FileStream & out) { } } -void dumpTypeParameterName(FileStream & out, OUString const & name) { +void dumpTypeParameterName(FileStream & out, OUString const & name) +{ // Prefix all type parameters with "typeparam_" to avoid problems when a // struct member has the same name as a type parameter, as in // struct<T> { T T; }; out << "typeparam_" << name; } -class PlainStructType: public CppuType { +class PlainStructType: public CppuType +{ public: PlainStructType( rtl::Reference< unoidl::PlainStructTypeEntity > const & entity, OUString const & name, rtl::Reference< TypeManager > const & typeMgr): - CppuType(name, typeMgr), entity_(entity) - { assert(entity.is()); } + CppuType(name, typeMgr), entity_(entity) { + assert(entity.is()); + } private: - virtual sal_uInt32 checkInheritedMemberCount() const override - { return getTotalMemberCount(entity_->getDirectBase()); } + virtual sal_uInt32 checkInheritedMemberCount() const override { + return getTotalMemberCount(entity_->getDirectBase()); + } virtual void dumpDeclaration(FileStream& o) override; @@ -1790,7 +1814,8 @@ private: rtl::Reference< unoidl::PlainStructTypeEntity > entity_; }; -void PlainStructType::dumpDeclaration(FileStream & out) { +void PlainStructType::dumpDeclaration(FileStream & out) +{ out << "\n#ifdef SAL_W32\n# pragma pack(push, 8)\n#endif\n\n" << indent(); out << "struct SAL_DLLPUBLIC_RTTI "; if (canBeWarnUnused(name_)) @@ -1806,8 +1831,7 @@ void PlainStructType::dumpDeclaration(FileStream & out) { if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) { out << "\n" << indent() << "inline " << id_ << "("; bool bFirst = !dumpBaseMembers(out, base, true); - for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) { if (!bFirst) { out << ", "; } @@ -1820,16 +1844,14 @@ void PlainStructType::dumpDeclaration(FileStream & out) { if (!entity_->getDirectMembers().empty()) { out << "\n"; for (std::vector< unoidl::PlainStructTypeEntity::Member >:: - const_iterator i(entity_->getDirectMembers().begin()); - i != entity_->getDirectMembers().end(); ++i) - { + const_iterator i(entity_->getDirectMembers().begin()); + i != entity_->getDirectMembers().end(); ++i) { out << indent(); dumpType(out, i->type); out << " " << i->name; if (i == entity_->getDirectMembers().begin() && !base.isEmpty() && i->type != "hyper" && i->type != "unsigned hyper" - && i->type != "double") - { + && i->type != "double") { out << " CPPU_GCC3_ALIGN(" << codemaker::cpp::scopedCppName(u2b(base)) << ")"; } @@ -1859,8 +1881,7 @@ void PlainStructType::dumpHppFile( << "()\n"; bFirst = false; } - for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) { out << indent() << (bFirst ? ":" : ",") << " " << member.name; dumpInitializer(out, false, member.type); out << "\n"; @@ -1872,8 +1893,7 @@ void PlainStructType::dumpHppFile( out << "inline " << id_; out << "::" << id_ << "("; bFirst = !dumpBaseMembers(out, base, true); - for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) { if (!bFirst) { out << ", "; } @@ -1891,8 +1911,7 @@ void PlainStructType::dumpHppFile( out << ")\n"; bFirst = false; } - for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) { out << indent() << (bFirst ? ":" : ",") << " " << member.name << "(" << member.name << "_)\n"; bFirst = false; @@ -1911,8 +1930,7 @@ void PlainStructType::dumpHppFile( << ">(the_lhs), static_cast< " << codemaker::cpp::scopedCppName(u2b(base)) << ">(the_rhs) )\n"; bFirst = false; } - for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) { if (!bFirst) out << "\n" << indent() << indent() << "&& "; out << "the_lhs." << member.name << " == the_rhs." << member.name; @@ -1935,7 +1953,8 @@ void PlainStructType::dumpHppFile( out << "\n#endif // "<< headerDefine << "\n"; } -void PlainStructType::dumpLightGetCppuType(FileStream & out) { +void PlainStructType::dumpLightGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << ("//TODO: On certain platforms with weak memory models, the" @@ -1953,7 +1972,8 @@ void PlainStructType::dumpLightGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void PlainStructType::dumpNormalGetCppuType(FileStream & out) { +void PlainStructType::dumpNormalGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << ("//TODO: On certain platforms with weak memory models, the" @@ -1968,8 +1988,7 @@ void PlainStructType::dumpNormalGetCppuType(FileStream & out) { inc(); for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i( entity_->getDirectMembers().begin()); - i != entity_->getDirectMembers().end();) - { + i != entity_->getDirectMembers().end();) { out << indent() << "::cppu::UnoType< "; dumpType(out, i->type, false, false, false, true); ++i; @@ -1993,7 +2012,8 @@ void PlainStructType::dumpNormalGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) { +void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) +{ OUString staticTypeClass("the" + id_ + "Type"); codemaker::cppumaker::dumpNamespaceOpen(out, name_, false); out << " namespace detail {\n\n" << indent() << "struct " @@ -2007,13 +2027,11 @@ void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) { out << indent() << "::rtl::OUString the_name( \"" << name_ << "\" );\n"; std::map< OUString, sal_uInt32 > types; std::vector< unoidl::PlainStructTypeEntity::Member >::size_type n = 0; - for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers()) { if (types.insert( std::map< OUString, sal_uInt32 >::value_type( member.type, static_cast< sal_uInt32 >(types.size()))). - second) - { + second) { dumpCppuGetType(out, member.type, &name_); // For typedefs, use the resolved type name, as there will be no // information available about the typedef itself at runtime (the @@ -2032,8 +2050,7 @@ void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) { n = 0; for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i( entity_->getDirectMembers().begin()); - i != entity_->getDirectMembers().end();) - { + i != entity_->getDirectMembers().end();) { out << indent() << "{ { " << getTypeClass(i->type, true) << ", the_tname" << types.find(i->type)->second << ".pData, the_name" << n++ << ".pData }, false }"; @@ -2086,8 +2103,7 @@ bool PlainStructType::dumpBaseMembers( return false; } hasMember = dumpBaseMembers(out, ent2->getDirectBase(), withType); - for (const unoidl::PlainStructTypeEntity::Member& member : ent2->getDirectMembers()) - { + for (const unoidl::PlainStructTypeEntity::Member& member : ent2->getDirectMembers()) { if (hasMember) { out << ", "; } @@ -2135,7 +2151,8 @@ void PlainStructType::addComprehensiveGetCppuTypeIncludes( includes.addTypelibTypedescriptionH(); } -sal_uInt32 PlainStructType::getTotalMemberCount(OUString const & base) const { +sal_uInt32 PlainStructType::getTotalMemberCount(OUString const & base) const +{ if (base.isEmpty()) { return 0; } @@ -2152,17 +2169,19 @@ sal_uInt32 PlainStructType::getTotalMemberCount(OUString const & base) const { return 0; } return getTotalMemberCount(ent2->getDirectBase()) - + ent2->getDirectMembers().size(); //TODO: overflow + + ent2->getDirectMembers().size(); //TODO: overflow } -class PolyStructType: public CppuType { +class PolyStructType: public CppuType +{ public: PolyStructType( rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > const & - entity, + entity, OUString const & name, rtl::Reference< TypeManager > const & typeMgr): - CppuType(name, typeMgr), entity_(entity) - { assert(entity.is()); } + CppuType(name, typeMgr), entity_(entity) { + assert(entity.is()); + } private: virtual void dumpDeclaration(FileStream& o) override; @@ -2184,7 +2203,9 @@ private: virtual void addComprehensiveGetCppuTypeIncludes( codemaker::cppumaker::Includes & includes) const override; - virtual bool isPolymorphic() const override { return true; } + virtual bool isPolymorphic() const override { + return true; + } virtual void dumpTemplateHead(FileStream & out) const override; @@ -2193,7 +2214,8 @@ private: rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > entity_; }; -void PolyStructType::dumpDeclaration(FileStream & out) { +void PolyStructType::dumpDeclaration(FileStream & out) +{ out << "\n#ifdef SAL_W32\n# pragma pack(push, 8)\n#endif\n\n" << indent(); dumpTemplateHead(out); out << "struct SAL_DLLPUBLIC_RTTI " << id_ << " {\n"; @@ -2202,10 +2224,9 @@ void PolyStructType::dumpDeclaration(FileStream & out) { if (!entity_->getMembers().empty()) { out << "\n" << indent() << "inline " << id_ << "("; for (std::vector< - unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end(); ++i) - { + unoidl::PolymorphicStructTypeTemplateEntity::Member >:: + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end(); ++i) { if (i != entity_->getMembers().begin()) { out << ", "; } @@ -2220,8 +2241,7 @@ void PolyStructType::dumpDeclaration(FileStream & out) { out << ");\n\n"; // print the member fields for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : - entity_->getMembers()) - { + entity_->getMembers()) { out << indent(); if (member.parameterized) { dumpTypeParameterName(out, member.type); @@ -2253,9 +2273,8 @@ void PolyStructType::dumpHppFile( out << "::" << id_ << "()\n"; inc(); for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end(); ++i) - { + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end(); ++i) { out << indent() << (i == entity_->getMembers().begin() ? ":" : ",") << " " << i->name; dumpInitializer(out, i->parameterized, i->type); @@ -2270,10 +2289,9 @@ void PolyStructType::dumpHppFile( dumpTemplateParameters(out); out << "::" << id_ << "("; for (std::vector< - unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end(); ++i) - { + unoidl::PolymorphicStructTypeTemplateEntity::Member >:: + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end(); ++i) { if (i != entity_->getMembers().begin()) { out << ", "; } @@ -2288,10 +2306,9 @@ void PolyStructType::dumpHppFile( out << ")\n"; inc(); for (std::vector< - unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end(); ++i) - { + unoidl::PolymorphicStructTypeTemplateEntity::Member >:: + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end(); ++i) { out << indent() << (i == entity_->getMembers().begin() ? ":" : ",") << " " << i->name << "(" << i->name << "_)\n"; } @@ -2303,10 +2320,9 @@ void PolyStructType::dumpHppFile( dumpTemplateParameters(out); out << "\n" << indent() << "make_" << id_ << "("; for (std::vector< - unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end(); ++i) - { + unoidl::PolymorphicStructTypeTemplateEntity::Member >:: + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end(); ++i) { if (i != entity_->getMembers().begin()) { out << ", "; } @@ -2324,10 +2340,9 @@ void PolyStructType::dumpHppFile( dumpTemplateParameters(out); out << "("; for (std::vector< - unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end(); ++i) - { + unoidl::PolymorphicStructTypeTemplateEntity::Member >:: + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end(); ++i) { if (i != entity_->getMembers().begin()) { out << ", "; } @@ -2348,8 +2363,7 @@ void PolyStructType::dumpHppFile( inc(); out << indent() << "return "; bool bFirst = true; - for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity_->getMembers()) - { + for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity_->getMembers()) { if (!bFirst) out << "\n" << indent() << indent() << "&& "; out << "the_lhs." << member.name << " == the_rhs." << member.name; @@ -2377,7 +2391,8 @@ void PolyStructType::dumpHppFile( out << "\n#endif // "<< headerDefine << "\n"; } -void PolyStructType::dumpLightGetCppuType(FileStream & out) { +void PolyStructType::dumpLightGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << ("//TODO: On certain platforms with weak memory models, the" @@ -2391,8 +2406,7 @@ void PolyStructType::dumpLightGetCppuType(FileStream & out) { << "<\");\n"; for (std::vector< OUString >::const_iterator i( entity_->getTypeParameters().begin()); - i != entity_->getTypeParameters().end();) - { + i != entity_->getTypeParameters().end();) { out << indent() << ("the_buffer.append(::rtl::OUStringToOString(" "::cppu::getTypeFavourChar(static_cast< "); @@ -2412,7 +2426,8 @@ void PolyStructType::dumpLightGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void PolyStructType::dumpNormalGetCppuType(FileStream & out) { +void PolyStructType::dumpNormalGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << ("//TODO: On certain platforms with weak memory models, the" @@ -2426,8 +2441,7 @@ void PolyStructType::dumpNormalGetCppuType(FileStream & out) { << "<\");\n"; for (std::vector< OUString >::const_iterator i( entity_->getTypeParameters().begin()); - i != entity_->getTypeParameters().end();) - { + i != entity_->getTypeParameters().end();) { out << indent() << ("the_buffer.append(::rtl::OUStringToOString(" "::cppu::getTypeFavourChar(static_cast< "); @@ -2442,9 +2456,8 @@ void PolyStructType::dumpNormalGetCppuType(FileStream & out) { << "::typelib_TypeDescriptionReference * the_members[] = {\n"; inc(); for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end();) - { + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end();) { out << indent(); if (i->parameterized) { out << "::cppu::getTypeFavourChar(static_cast< "; @@ -2462,9 +2475,8 @@ void PolyStructType::dumpNormalGetCppuType(FileStream & out) { dec(); out << indent() << "static ::sal_Bool const the_parameterizedTypes[] = { "; for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end(); ++i) - { + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end(); ++i) { if (i != entity_->getMembers().begin()) { out << ", "; } @@ -2482,7 +2494,8 @@ void PolyStructType::dumpNormalGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) { +void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) +{ out << "namespace cppu { namespace detail {\n\n" << indent(); dumpTemplateHead(out); OUString staticTypeClass("the" + id_ + "Type"); @@ -2499,8 +2512,7 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) { << "the_buffer.append(\"" << name_ << "<\");\n"; for (std::vector< OUString >::const_iterator i( entity_->getTypeParameters().begin()); - i != entity_->getTypeParameters().end();) - { + i != entity_->getTypeParameters().end();) { out << indent() << "the_buffer.append(::cppu::getTypeFavourChar(static_cast< "; dumpTypeParameterName(out, *i); @@ -2518,15 +2530,13 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) { std::map< OUString, sal_uInt32 > parameters; std::map< OUString, sal_uInt32 > types; std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - size_type n = 0; - for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity_->getMembers()) - { + size_type n = 0; + for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity_->getMembers()) { if (member.parameterized) { if (parameters.insert( std::map< OUString, sal_uInt32 >::value_type( member.type, static_cast< sal_uInt32 >(parameters.size()))). - second) - { + second) { sal_uInt32 k = static_cast< sal_uInt32 >(parameters.size() - 1); out << indent() << "::css::uno::Type const & the_ptype" << k @@ -2542,8 +2552,7 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) { } else if (types.insert( std::map< OUString, sal_uInt32 >::value_type( member.type, static_cast< sal_uInt32 >(types.size()))). - second) - { + second) { dumpCppuGetType(out, member.type, &name_); // For typedefs, use the resolved type name, as there will be no // information available about the typedef itself at runtime (the @@ -2561,9 +2570,8 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) { inc(); n = 0; for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >:: - const_iterator i(entity_->getMembers().begin()); - i != entity_->getMembers().end();) - { + const_iterator i(entity_->getMembers().begin()); + i != entity_->getMembers().end();) { out << indent() << "{ { "; if (i->parameterized) { sal_uInt32 k = parameters.find(i->type)->second; @@ -2639,12 +2647,12 @@ void PolyStructType::addComprehensiveGetCppuTypeIncludes( includes.addRtlUstrbufHxx(); } -void PolyStructType::dumpTemplateHead(FileStream & out) const { +void PolyStructType::dumpTemplateHead(FileStream & out) const +{ out << "template< "; for (std::vector< OUString >::const_iterator i( entity_->getTypeParameters().begin()); - i != entity_->getTypeParameters().end(); ++i) - { + i != entity_->getTypeParameters().end(); ++i) { if (i != entity_->getTypeParameters().begin()) { out << ", "; } @@ -2654,12 +2662,12 @@ void PolyStructType::dumpTemplateHead(FileStream & out) const { out << " > "; } -void PolyStructType::dumpTemplateParameters(FileStream & out) const { +void PolyStructType::dumpTemplateParameters(FileStream & out) const +{ out << "< "; for (std::vector< OUString >::const_iterator i( entity_->getTypeParameters().begin()); - i != entity_->getTypeParameters().end(); ++i) - { + i != entity_->getTypeParameters().end(); ++i) { if (i != entity_->getTypeParameters().begin()) { out << ", "; } @@ -2668,7 +2676,8 @@ void PolyStructType::dumpTemplateParameters(FileStream & out) const { out << " >"; } -OUString typeToIdentifier(OUString const & name) { +OUString typeToIdentifier(OUString const & name) +{ sal_Int32 k; OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k))); OUStringBuffer b; @@ -2684,13 +2693,15 @@ OUString typeToIdentifier(OUString const & name) { return b.makeStringAndClear(); } -class ExceptionType: public CppuType { +class ExceptionType: public CppuType +{ public: ExceptionType( rtl::Reference< unoidl::ExceptionTypeEntity > const & entity, OUString const & name, rtl::Reference< TypeManager > const & typeMgr): - CppuType(name, typeMgr), entity_(entity) - { assert(entity.is()); } + CppuType(name, typeMgr), entity_(entity) { + assert(entity.is()); + } private: virtual void dumpHppFile( @@ -2705,8 +2716,9 @@ private: virtual void dumpComprehensiveGetCppuType(FileStream & out) override; - virtual sal_uInt32 checkInheritedMemberCount() const override - { return getTotalMemberCount(entity_->getDirectBase()); } + virtual sal_uInt32 checkInheritedMemberCount() const override { + return getTotalMemberCount(entity_->getDirectBase()); + } virtual void dumpDeclaration(FileStream & out) override; @@ -2746,8 +2758,7 @@ void ExceptionType::dumpHppFile( << "()\n"; bFirst = false; } - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { out << indent() << (bFirst ? ":" : ",") << " "; out << member.name; dumpInitializer(out, false, member.type); @@ -2768,8 +2779,7 @@ void ExceptionType::dumpHppFile( if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) { out << indent() << "inline " << id_ << "::" << id_ << "("; bFirst = !dumpBaseMembers(out, base, true, false); - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { if (!bFirst) { out << ", "; } @@ -2787,8 +2797,7 @@ void ExceptionType::dumpHppFile( out << ")\n"; bFirst = false; } - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { out << indent() << (bFirst ? ":" : ",") << " " << member.name << "(" << member.name << "_)\n"; bFirst = false; @@ -2813,8 +2822,7 @@ void ExceptionType::dumpHppFile( << "(the_other)"; bFirst = false; } - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { out << (bFirst ? ":" : ",") << " " << member.name << "(the_other." << member.name << ")"; bFirst = false; @@ -2830,8 +2838,7 @@ void ExceptionType::dumpHppFile( out << indent() << codemaker::cpp::scopedCppName(u2b(base)) << "::operator =(the_other);\n"; } - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { out << indent() << member.name << " = the_other." << member.name << ";\n"; } out << indent() << "return *this;\n"; @@ -2845,7 +2852,8 @@ void ExceptionType::dumpHppFile( out << "\n#endif // "<< headerDefine << "\n"; } -void ExceptionType::dumpLightGetCppuType(FileStream & out) { +void ExceptionType::dumpLightGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << "static typelib_TypeDescriptionReference * the_type = 0;\n" @@ -2860,7 +2868,8 @@ void ExceptionType::dumpLightGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void ExceptionType::dumpNormalGetCppuType(FileStream & out) { +void ExceptionType::dumpNormalGetCppuType(FileStream & out) +{ dumpGetCppuTypePreamble(out); out << indent() << "static typelib_TypeDescriptionReference * the_type = 0;\n" @@ -2884,8 +2893,7 @@ void ExceptionType::dumpNormalGetCppuType(FileStream & out) { << entity_->getDirectMembers().size() << "];\n"; std::set< OUString > seen; std::vector< unoidl::ExceptionTypeEntity::Member >::size_type n = 0; - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { OUString type(resolveAllTypedefs(member.type)); OUString modType(typeToIdentifier(type)); if (seen.insert(type).second) { @@ -2920,7 +2928,8 @@ void ExceptionType::dumpNormalGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void ExceptionType::dumpComprehensiveGetCppuType(FileStream & out) { +void ExceptionType::dumpComprehensiveGetCppuType(FileStream & out) +{ codemaker::cppumaker::dumpNamespaceOpen(out, name_, false); out << " namespace detail {\n\n"; OUString staticTypeClass("the" + id_ + "Type"); @@ -2943,8 +2952,7 @@ void ExceptionType::dumpComprehensiveGetCppuType(FileStream & out) { out << " >::get();\n"; } std::set< OUString > seen; - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { if (seen.insert(member.type).second) { dumpCppuGetType(out, member.type); } @@ -2953,8 +2961,7 @@ void ExceptionType::dumpComprehensiveGetCppuType(FileStream & out) { out << "\n" << indent() << "typelib_CompoundMember_Init aMembers[" << entity_->getDirectMembers().size() << "];\n"; std::vector< unoidl::ExceptionTypeEntity::Member >::size_type n = 0; - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { OUString type(resolveAllTypedefs(member.type)); out << indent() << "::rtl::OUString sMemberType" << n << "( \"" << type << "\" );\n" << indent() @@ -2995,7 +3002,8 @@ void ExceptionType::dumpComprehensiveGetCppuType(FileStream & out) { dumpGetCppuTypePostamble(out); } -void ExceptionType::dumpDeclaration(FileStream & out) { +void ExceptionType::dumpDeclaration(FileStream & out) +{ out << "\nclass CPPU_GCC_DLLPUBLIC_EXPORT " << id_; OUString base(entity_->getDirectBase()); if (!base.isEmpty()) { @@ -3009,8 +3017,7 @@ void ExceptionType::dumpDeclaration(FileStream & out) { out << indent() << "inline CPPU_GCC_DLLPRIVATE " << id_ << "("; bool eligibleForDefaults = entity_->getDirectMembers().empty(); bool bFirst = !dumpBaseMembers(out, base, true, eligibleForDefaults); - for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers()) { if (!bFirst) { out << ", "; } @@ -3027,15 +3034,13 @@ void ExceptionType::dumpDeclaration(FileStream & out) { << " & operator =(" << id_ << " const &);\n#endif\n\n"; for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i( entity_->getDirectMembers().begin()); - i != entity_->getDirectMembers().end(); ++i) - { + i != entity_->getDirectMembers().end(); ++i) { out << indent(); dumpType(out, i->type); out << " " << i->name; if (i == entity_->getDirectMembers().begin() && !base.isEmpty() && i->type != "hyper" && i->type != "unsigned hyper" - && i->type != "double") - { + && i->type != "double") { out << " CPPU_GCC3_ALIGN( " << codemaker::cpp::scopedCppName(u2b(base)) << " )"; } @@ -3063,10 +3068,9 @@ bool ExceptionType::dumpBaseMembers( return false; } hasMember = dumpBaseMembers( out, ent2->getDirectBase(), withType, - eligibleForDefaults && ent2->getDirectMembers().empty() ); + eligibleForDefaults && ent2->getDirectMembers().empty() ); int memberCount = 0; - for (const unoidl::ExceptionTypeEntity::Member& member : ent2->getDirectMembers()) - { + for (const unoidl::ExceptionTypeEntity::Member& member : ent2->getDirectMembers()) { if (hasMember) { out << ", "; } @@ -3079,10 +3083,10 @@ bool ExceptionType::dumpBaseMembers( // constructors, since most of the time we don't pass a Context object in to the exception // throw sites. if (eligibleForDefaults - && base == "com.sun.star.uno.Exception" - && memberCount == 1 - && member.name == "Context" - && member.type == "com.sun.star.uno.XInterface") { + && base == "com.sun.star.uno.Exception" + && memberCount == 1 + && member.name == "Context" + && member.type == "com.sun.star.uno.XInterface") { out << " = ::css::uno::Reference< ::css::uno::XInterface >()"; } hasMember = true; @@ -3092,7 +3096,8 @@ bool ExceptionType::dumpBaseMembers( return hasMember; } -sal_uInt32 ExceptionType::getTotalMemberCount(OUString const & base) const { +sal_uInt32 ExceptionType::getTotalMemberCount(OUString const & base) const +{ if (base.isEmpty()) { return 0; } @@ -3105,16 +3110,18 @@ sal_uInt32 ExceptionType::getTotalMemberCount(OUString const & base) const { unoidl::ExceptionTypeEntity& ent2( dynamic_cast< unoidl::ExceptionTypeEntity&>(*ent.get())); return getTotalMemberCount(ent2.getDirectBase()) - + ent2.getDirectMembers().size(); //TODO: overflow + + ent2.getDirectMembers().size(); //TODO: overflow } -class EnumType: public CppuType { +class EnumType: public CppuType +{ public: EnumType( rtl::Reference< unoidl::EnumTypeEntity > const & entity, OUString const & name, rtl::Reference< TypeManager > const & typeMgr): - CppuType(name, typeMgr), entity_(entity) - { assert(entity.is()); } + CppuType(name, typeMgr), entity_(entity) { + assert(entity.is()); + } private: virtual void dumpDeclaration(FileStream& o) override; @@ -3139,11 +3146,14 @@ void EnumType::addComprehensiveGetCppuTypeIncludes( void EnumType::dumpDeclaration(FileStream& o) { + o << "\n#if defined LIBO_INTERNAL_ONLY\n"; + o << "\nenum class SAL_DLLPUBLIC_RTTI " << id_ << "\n{\n"; + o << "\n#else\n"; o << "\nenum SAL_DLLPUBLIC_RTTI " << id_ << "\n{\n"; + o << "\n#endif\n"; inc(); - for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) - { + for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) { o << indent() << id_ << "_" << u2b(member.name) << " = " << member.value << ",\n"; } @@ -3152,6 +3162,16 @@ void EnumType::dumpDeclaration(FileStream& o) dec(); o << "};\n\n"; + + // use constexpr to create a kind of type-alias so we don't have to modify existing code + o << "#if defined LIBO_INTERNAL_ONLY\n"; + for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) { + o << "constexpr auto " << id_ << "_" << u2b(member.name) + << " = " + << id_ << "::" << id_ << "_" << u2b(member.name) + << ";\n"; + } + o << "#endif\n"; } void EnumType::dumpHppFile( @@ -3218,8 +3238,7 @@ void EnumType::dumpComprehensiveGetCppuType(FileStream& o) o << indent() << "rtl_uString* enumValueNames[" << entity_->getMembers().size() << "];\n"; std::vector< unoidl::EnumTypeEntity::Member >::size_type n = 0; - for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) - { + for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) { o << indent() << "::rtl::OUString sEnumValue" << n << "( \"" << u2b(member.name) << "\" );\n"; o << indent() << "enumValueNames[" << n << "] = sEnumValue" << n @@ -3230,8 +3249,7 @@ void EnumType::dumpComprehensiveGetCppuType(FileStream& o) o << "\n" << indent() << "sal_Int32 enumValues[" << entity_->getMembers().size() << "];\n"; n = 0; - for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) - { + for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers()) { o << indent() << "enumValues[" << n++ << "] = " << member.value << ";\n"; } @@ -3270,13 +3288,15 @@ void EnumType::dumpComprehensiveGetCppuType(FileStream& o) dumpGetCppuTypePostamble(o); } -class Typedef: public CppuType { +class Typedef: public CppuType +{ public: Typedef( rtl::Reference< unoidl::TypedefEntity > const & entity, OUString const & name, rtl::Reference< TypeManager > const & typeMgr): - CppuType(name, typeMgr), entity_(entity) - { assert(entity.is()); } + CppuType(name, typeMgr), entity_(entity) { + assert(entity.is()); + } private: virtual void dumpDeclaration(FileStream& o) override; @@ -3331,25 +3351,28 @@ void Typedef::dumpHppFile( o << "\n#endif // "<< headerDefine << "\n"; } -class ConstructiveType: public CppuType { +class ConstructiveType: public CppuType +{ public: ConstructiveType( OUString const & name, rtl::Reference< TypeManager > const & manager): CppuType(name, manager) {} private: - virtual void dumpHdlFile(FileStream &, codemaker::cppumaker::Includes &) override - { assert(false); } // this cannot happen + virtual void dumpHdlFile(FileStream &, codemaker::cppumaker::Includes &) override { + assert(false); // this cannot happen + } - virtual void dumpFiles(OUString const & uri, CppuOptions const & options) override - { dumpFile(uri, name_, true, options); } + virtual void dumpFiles(OUString const & uri, CppuOptions const & options) override { + dumpFile(uri, name_, true, options); + } }; bool hasRestParameter( unoidl::SingleInterfaceBasedServiceEntity::Constructor const & constructor) { return !constructor.parameters.empty() - && constructor.parameters.back().rest; + && constructor.parameters.back().rest; } void includeExceptions( @@ -3359,21 +3382,22 @@ void includeExceptions( if (node->present) { includes.add(node->name); } else { - for (std::unique_ptr<codemaker::ExceptionTreeNode> const & pChild : node->children) - { + for (std::unique_ptr<codemaker::ExceptionTreeNode> const & pChild : node->children) { includeExceptions(includes, pChild.get()); } } } -class ServiceType: public ConstructiveType { +class ServiceType: public ConstructiveType +{ public: ServiceType( rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > const & - entity, + entity, OUString const & name, rtl::Reference< TypeManager > const & manager): - ConstructiveType(name, manager), entity_(entity) - { assert(entity.is()); } + ConstructiveType(name, manager), entity_(entity) { + assert(entity.is()); + } private: virtual void dumpHppFile( @@ -3405,8 +3429,7 @@ void ServiceType::dumpHppFile( includes.addRtlUstringHxx(); includes.add("com.sun.star.uno.DeploymentException"); includes.add("com.sun.star.uno.XComponentContext"); - for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : entity_->getConstructors()) - { + for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : entity_->getConstructors()) { if (cons.defaultConstructor) { includes.add("com.sun.star.uno.Exception"); includes.add("com.sun.star.uno.RuntimeException"); @@ -3415,21 +3438,18 @@ void ServiceType::dumpHppFile( includes.addAny(); includes.addSequence(); for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param : - cons.parameters) - { + cons.parameters) { if (m_typeMgr->getSort( b2u(codemaker::UnoType::decompose( u2b(param.type)))) - == codemaker::UnoType::Sort::Char) - { + == codemaker::UnoType::Sort::Char) { includes.addCppuUnotypeHxx(); break; } } } codemaker::ExceptionTree tree; - for (const OUString& ex : cons.exceptions) - { + for (const OUString& ex : cons.exceptions) { tree.add(u2b(ex), m_typeMgr); } if (!tree.getRoot().present) { @@ -3458,7 +3478,7 @@ void ServiceType::dumpHppFile( << "\nextern \"C\" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_" << name_.replaceAll(".", "_dot_") << "(::css::uno::XComponentContext *, ::css::uno::Sequence< " - "::css::uno::Any > const &);\n#endif\n"; + "::css::uno::Any > const &);\n#endif\n"; } o << "\n"; if (codemaker::cppumaker::dumpNamespaceOpen(o, name_, false)) { @@ -3471,8 +3491,7 @@ void ServiceType::dumpHppFile( OString scopedBaseName(codemaker::cpp::scopedCppName(baseName)); o << "public:\n"; for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : - entity_->getConstructors()) - { + entity_->getConstructors()) { if (cons.defaultConstructor) { o << indent() << "static ::css::uno::Reference< " << scopedBaseName << " > " @@ -3541,8 +3560,7 @@ void ServiceType::dumpHppFile( " the_context"); bool rest = hasRestParameter(cons); for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param : - cons.parameters) - { + cons.parameters) { o << ", "; OUStringBuffer buf; if (param.rest) { @@ -3564,11 +3582,10 @@ void ServiceType::dumpHppFile( << ("::css::uno::Sequence< ::css::uno::Any > the_arguments(") << cons.parameters.size() << ");\n"; std::vector< - unoidl::SingleInterfaceBasedServiceEntity::Constructor:: - Parameter >::size_type n = 0; + unoidl::SingleInterfaceBasedServiceEntity::Constructor:: + Parameter >::size_type n = 0; for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& j : - cons.parameters) - { + cons.parameters) { o << indent() << "the_arguments[" << n++ << "] "; OString param( codemaker::cpp::translateUnoToCppIdentifier( @@ -3580,8 +3597,7 @@ void ServiceType::dumpHppFile( } else if (m_typeMgr->getSort( b2u(codemaker::UnoType::decompose( u2b(j.type), &rank))) - == codemaker::UnoType::Sort::Char) - { + == codemaker::UnoType::Sort::Char) { o << "= ::css::uno::Any(&" << param << ", ::cppu::UnoType< "; for (sal_Int32 k = 0; k < rank; ++k) { @@ -3601,8 +3617,7 @@ void ServiceType::dumpHppFile( o << indent() << "::css::uno::Reference< " << scopedBaseName << " > the_instance;\n"; codemaker::ExceptionTree tree; - for (const OUString& ex : cons.exceptions) - { + for (const OUString& ex : cons.exceptions) { tree.add(u2b(ex), m_typeMgr); } if (!tree.getRoot().present) { @@ -3624,8 +3639,8 @@ void ServiceType::dumpHppFile( << ")(the_context.get(), "; if (rest) { o << codemaker::cpp::translateUnoToCppIdentifier( - u2b(cons.parameters.back().name), "param", - codemaker::cpp::IdentifierTranslationMode::NonGlobal); + u2b(cons.parameters.back().name), "param", + codemaker::cpp::IdentifierTranslationMode::NonGlobal); } else if (cons.parameters.empty()) { o << "::css::uno::Sequence< ::css::uno::Any >()"; } else { @@ -3651,8 +3666,8 @@ void ServiceType::dumpHppFile( << name_ << "\", "; if (rest) { o << codemaker::cpp::translateUnoToCppIdentifier( - u2b(cons.parameters.back().name), "param", - codemaker::cpp::IdentifierTranslationMode::NonGlobal); + u2b(cons.parameters.back().name), "param", + codemaker::cpp::IdentifierTranslationMode::NonGlobal); } else if (cons.parameters.empty()) { o << ("::css::uno::Sequence< ::css::uno::Any >()"); } else { @@ -3713,20 +3728,21 @@ void ServiceType::dumpCatchClauses( out << indent() << "throw;\n"; dec(); } else { - for (std::unique_ptr<codemaker::ExceptionTreeNode> const & pChild : node->children) - { + for (std::unique_ptr<codemaker::ExceptionTreeNode> const & pChild : node->children) { dumpCatchClauses(out, pChild.get()); } } } -class SingletonType: public ConstructiveType { +class SingletonType: public ConstructiveType +{ public: SingletonType( rtl::Reference< unoidl::InterfaceBasedSingletonEntity > const & entity, OUString const & name, rtl::Reference< TypeManager > const & manager): - ConstructiveType(name, manager), entity_(entity) - { assert(entity.is()); } + ConstructiveType(name, manager), entity_(entity) { + assert(entity.is()); + } private: virtual void dumpHppFile( @@ -3766,7 +3782,7 @@ void SingletonType::dumpHppFile( << "\nextern \"C\" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_" << name_.replaceAll(".", "_dot_") << "(::css::uno::XComponentContext *, ::css::uno::Sequence< " - "::css::uno::Any > const &);\n#endif\n"; + "::css::uno::Any > const &);\n#endif\n"; o << "\n"; if (codemaker::cppumaker::dumpNamespaceOpen(o, name_, false)) { o << "\n"; @@ -3797,9 +3813,9 @@ void SingletonType::dumpHppFile( << name_.replaceAll(".", "_dot_") << (")(the_context.get(), ::css::uno::Sequence<" " ::css::uno::Any >())), ::SAL_NO_ACQUIRE)," - " ::css::uno::UNO_QUERY);\n#else\n") + " ::css::uno::UNO_QUERY);\n#else\n") << indent() << ("the_context->getValueByName(" - "::rtl::OUString( \"/singletons/") + "::rtl::OUString( \"/singletons/") << name_ << "\" )) >>= instance;\n#endif\n" << indent() << "if (!instance.is()) {\n"; inc(); @@ -3841,106 +3857,96 @@ void produce( rtl::Reference< unoidl::Entity > ent; rtl::Reference< unoidl::MapCursor > cur; switch (manager->getSort(name, &ent, &cur)) { - case codemaker::UnoType::Sort::Module: - { - OUString prefix; - if (!name.isEmpty()) { - prefix = name + "."; - } - for (;;) { - OUString mem; - if (!cur->getNext(&mem).is()) { - break; - } - produce(prefix + mem, manager, generated, options); - } - break; - } - case codemaker::UnoType::Sort::Enum: - { - EnumType t( - dynamic_cast< unoidl::EnumTypeEntity * >(ent.get()), name, - manager); - t.dump(options); - t.dumpDependedTypes(generated, options); - break; - } - case codemaker::UnoType::Sort::PlainStruct: - { - PlainStructType t( - dynamic_cast< unoidl::PlainStructTypeEntity * >(ent.get()), - name, manager); - t.dump(options); - t.dumpDependedTypes(generated, options); - break; - } - case codemaker::UnoType::Sort::PolymorphicStructTemplate: - { - PolyStructType t( - dynamic_cast< unoidl::PolymorphicStructTypeTemplateEntity * >( - ent.get()), - name, manager); - t.dump(options); - t.dumpDependedTypes(generated, options); - break; - } - case codemaker::UnoType::Sort::Exception: - { - ExceptionType t( - dynamic_cast< unoidl::ExceptionTypeEntity * >(ent.get()), name, - manager); - t.dump(options); - t.dumpDependedTypes(generated, options); - break; - } - case codemaker::UnoType::Sort::Interface: - { - InterfaceType t( - dynamic_cast< unoidl::InterfaceTypeEntity * >(ent.get()), name, - manager); - t.dump(options); - t.dumpDependedTypes(generated, options); - break; - } - case codemaker::UnoType::Sort::Typedef: - { - Typedef t( - dynamic_cast< unoidl::TypedefEntity * >(ent.get()), name, - manager); - t.dump(options); - t.dumpDependedTypes(generated, options); - break; - } - case codemaker::UnoType::Sort::ConstantGroup: - { - ConstantGroup t( - dynamic_cast< unoidl::ConstantGroupEntity * >(ent.get()), name, - manager); - if (t.hasConstants()) { - t.dump(options); + case codemaker::UnoType::Sort::Module: { + OUString prefix; + if (!name.isEmpty()) { + prefix = name + "."; + } + for (;;) { + OUString mem; + if (!cur->getNext(&mem).is()) { + break; } - break; + produce(prefix + mem, manager, generated, options); } - case codemaker::UnoType::Sort::SingleInterfaceBasedService: - { - ServiceType t( - dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * >( - ent.get()), - name, manager); - t.dump(options); - t.dumpDependedTypes(generated, options); - break; - } - case codemaker::UnoType::Sort::InterfaceBasedSingleton: - { - SingletonType t( - dynamic_cast< unoidl::InterfaceBasedSingletonEntity * >( - ent.get()), - name, manager); + break; + } + case codemaker::UnoType::Sort::Enum: { + EnumType t( + dynamic_cast< unoidl::EnumTypeEntity * >(ent.get()), name, + manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } + case codemaker::UnoType::Sort::PlainStruct: { + PlainStructType t( + dynamic_cast< unoidl::PlainStructTypeEntity * >(ent.get()), + name, manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } + case codemaker::UnoType::Sort::PolymorphicStructTemplate: { + PolyStructType t( + dynamic_cast< unoidl::PolymorphicStructTypeTemplateEntity * >( + ent.get()), + name, manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } + case codemaker::UnoType::Sort::Exception: { + ExceptionType t( + dynamic_cast< unoidl::ExceptionTypeEntity * >(ent.get()), name, + manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } + case codemaker::UnoType::Sort::Interface: { + InterfaceType t( + dynamic_cast< unoidl::InterfaceTypeEntity * >(ent.get()), name, + manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } + case codemaker::UnoType::Sort::Typedef: { + Typedef t( + dynamic_cast< unoidl::TypedefEntity * >(ent.get()), name, + manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } + case codemaker::UnoType::Sort::ConstantGroup: { + ConstantGroup t( + dynamic_cast< unoidl::ConstantGroupEntity * >(ent.get()), name, + manager); + if (t.hasConstants()) { t.dump(options); - t.dumpDependedTypes(generated, options); - break; } + break; + } + case codemaker::UnoType::Sort::SingleInterfaceBasedService: { + ServiceType t( + dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * >( + ent.get()), + name, manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } + case codemaker::UnoType::Sort::InterfaceBasedSingleton: { + SingletonType t( + dynamic_cast< unoidl::InterfaceBasedSingletonEntity * >( + ent.get()), + name, manager); + t.dump(options); + t.dumpDependedTypes(generated, options); + break; + } case codemaker::UnoType::Sort::AccumulationBasedService: case codemaker::UnoType::Sort::ServiceBasedSingleton: break; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx index a363aa2d40c9..a82aa90e545f 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx @@ -92,7 +92,7 @@ namespace OUString const & lcl_guessProfileRoot( MozillaProductType _product ) { - size_t productIndex = _product - 1; + size_t productIndex = (int)_product - 1; static OUString s_productDirectories[NB_PRODUCTS]; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx index 3e0432adda7d..05d47378764d 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx @@ -70,7 +70,7 @@ namespace connectivity //Thunderbird and firefox profiles are saved in profiles.ini void ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; OUString regDir = getRegistryDir(product); @@ -145,7 +145,7 @@ namespace connectivity OUString ProfileAccess::getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; if (rProduct.mProfileList.empty() || rProduct.mProfileList.find(profileName) == rProduct.mProfileList.end()) { @@ -158,13 +158,13 @@ namespace connectivity ::sal_Int32 ProfileAccess::getProfileCount( css::mozilla::MozillaProductType product) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; return static_cast< ::sal_Int32 >(rProduct.mProfileList.size()); } ::sal_Int32 ProfileAccess::getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; list.realloc(static_cast<sal_Int32>(rProduct.mProfileList.size())); sal_Int32 i=0; @@ -182,7 +182,7 @@ namespace connectivity OUString ProfileAccess::getDefaultProfile( css::mozilla::MozillaProductType product ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; if (!rProduct.mCurrentProfileName.isEmpty()) { @@ -206,7 +206,7 @@ namespace connectivity bool ProfileAccess::getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; if (rProduct.mProfileList.empty() || rProduct.mProfileList.find(profileName) == rProduct.mProfileList.end()) { diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 3ab8d1d621d5..b6e021116326 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -1151,52 +1151,52 @@ bool implSetObject( const Reference< XParameters >& _rxParameters, bool bSuccessfullyReRouted = true; switch (_rValue.getValueTypeClass()) { - case typelib_TypeClass_HYPER: + case css::uno::TypeClass_HYPER: { sal_Int64 nValue = 0; _rxParameters->setLong( _nColumnIndex, nValue ); } break; - case typelib_TypeClass_VOID: + case css::uno::TypeClass_VOID: _rxParameters->setNull(_nColumnIndex,css::sdbc::DataType::VARCHAR); break; - case typelib_TypeClass_STRING: + case css::uno::TypeClass_STRING: _rxParameters->setString(_nColumnIndex, *o3tl::forceAccess<OUString>(_rValue)); break; - case typelib_TypeClass_BOOLEAN: + case css::uno::TypeClass_BOOLEAN: _rxParameters->setBoolean(_nColumnIndex, *o3tl::forceAccess<bool>(_rValue)); break; - case typelib_TypeClass_BYTE: + case css::uno::TypeClass_BYTE: _rxParameters->setByte(_nColumnIndex, *o3tl::forceAccess<sal_Int8>(_rValue)); break; - case typelib_TypeClass_UNSIGNED_SHORT: - case typelib_TypeClass_SHORT: + case css::uno::TypeClass_UNSIGNED_SHORT: + case css::uno::TypeClass_SHORT: _rxParameters->setShort(_nColumnIndex, *o3tl::forceAccess<sal_Int16>(_rValue)); break; - case typelib_TypeClass_CHAR: + case css::uno::TypeClass_CHAR: _rxParameters->setString(_nColumnIndex, OUString(*o3tl::forceAccess<sal_Unicode>(_rValue))); break; - case typelib_TypeClass_UNSIGNED_LONG: - case typelib_TypeClass_LONG: + case css::uno::TypeClass_UNSIGNED_LONG: + case css::uno::TypeClass_LONG: _rxParameters->setInt(_nColumnIndex, *o3tl::forceAccess<sal_Int32>(_rValue)); break; - case typelib_TypeClass_FLOAT: + case css::uno::TypeClass_FLOAT: _rxParameters->setFloat(_nColumnIndex, *o3tl::forceAccess<float>(_rValue)); break; - case typelib_TypeClass_DOUBLE: + case css::uno::TypeClass_DOUBLE: _rxParameters->setDouble(_nColumnIndex, *o3tl::forceAccess<double>(_rValue)); break; - case typelib_TypeClass_SEQUENCE: + case css::uno::TypeClass_SEQUENCE: if (auto s = o3tl::tryAccess<Sequence< sal_Int8 >>(_rValue)) { _rxParameters->setBytes(_nColumnIndex, *s); @@ -1204,7 +1204,7 @@ bool implSetObject( const Reference< XParameters >& _rxParameters, else bSuccessfullyReRouted = false; break; - case typelib_TypeClass_STRUCT: + case css::uno::TypeClass_STRUCT: if (auto s1 = o3tl::tryAccess<css::util::DateTime>(_rValue)) _rxParameters->setTimestamp(_nColumnIndex, *s1); else if (auto s2 = o3tl::tryAccess<css::util::Date>(_rValue)) @@ -1215,7 +1215,7 @@ bool implSetObject( const Reference< XParameters >& _rxParameters, bSuccessfullyReRouted = false; break; - case typelib_TypeClass_INTERFACE: + case css::uno::TypeClass_INTERFACE: { Reference< css::io::XInputStream > xStream; if (_rValue >>= xStream) diff --git a/cppu/qa/cppumaker/test_cppumaker.cxx b/cppu/qa/cppumaker/test_cppumaker.cxx index 580cb0b8c271..65db58e4b1e8 100644 --- a/cppu/qa/cppumaker/test_cppumaker.cxx +++ b/cppu/qa/cppumaker/test_cppumaker.cxx @@ -441,18 +441,15 @@ void Test::testBigStruct() { CPPUNIT_ASSERT_EQUAL(guard.p->m10, 0.0); CPPUNIT_ASSERT_EQUAL(guard.p->m11, static_cast< sal_Unicode >(0)); CPPUNIT_ASSERT_EQUAL(guard.p->m12.getLength(), static_cast< sal_Int32 >(0)); - CPPUNIT_ASSERT_EQUAL( - +guard.p->m13.getTypeClass(), +css::uno::TypeClass_VOID); + CPPUNIT_ASSERT_EQUAL((sal_Int32)guard.p->m13.getTypeClass(), (sal_Int32)css::uno::TypeClass_VOID); CPPUNIT_ASSERT_EQUAL(guard.p->m14.hasValue(), false); CPPUNIT_ASSERT_EQUAL(guard.p->m15.getLength(), static_cast< sal_Int32 >(0)); - CPPUNIT_ASSERT_EQUAL( - +guard.p->m16, +test::codemaker::cppumaker::HelperEnum_ZERO); + CPPUNIT_ASSERT_EQUAL((int)guard.p->m16, (int)test::codemaker::cppumaker::HelperEnum_ZERO); CPPUNIT_ASSERT_EQUAL(guard.p->m17.m1, sal_False); CPPUNIT_ASSERT_EQUAL(guard.p->m17.m2.is(), false); CPPUNIT_ASSERT_EQUAL(guard.p->m18.is(), false); CPPUNIT_ASSERT_EQUAL(guard.p->m19, static_cast< sal_Int8 >(0)); - CPPUNIT_ASSERT_EQUAL( - +guard.p->m20, +test::codemaker::cppumaker::HelperEnum_ZERO); + CPPUNIT_ASSERT_EQUAL((sal_Int32)guard.p->m20, (sal_Int32)test::codemaker::cppumaker::HelperEnum_ZERO); CPPUNIT_ASSERT_EQUAL(guard.p->m21.getLength(), static_cast< sal_Int32 >(0)); CPPUNIT_ASSERT_EQUAL(guard.p->m22.getLength(), static_cast< sal_Int32 >(0)); CPPUNIT_ASSERT_EQUAL(guard.p->m23.getLength(), static_cast< sal_Int32 >(0)); diff --git a/cppu/qa/test_unotype.cxx b/cppu/qa/test_unotype.cxx index 47274580c329..6269ff2cfa86 100644 --- a/cppu/qa/test_unotype.cxx +++ b/cppu/qa/test_unotype.cxx @@ -53,8 +53,15 @@ operator <<(std::basic_ostream<charT, traits> & stream, Type const & type) { return stream << type.getTypeName(); } +std::ostream& operator<< (std::ostream& aStream, const css::uno::TypeClass& aTypeClass) +{ + aStream << (sal_Int32)aTypeClass; + return aStream; +} + } } } } + namespace { struct DerivedStruct1: css::lang::EventObject {}; @@ -111,67 +118,67 @@ void Test::testUnoType() { css::uno::Type t; t = cppu::UnoType<cppu::UnoVoidType>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_VOID, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_VOID, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("void"), t.getTypeName()); CPPUNIT_ASSERT(bool(cppu::UnoType<void>::get() == t)); t = cppu::UnoType<bool>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BOOLEAN, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_BOOLEAN, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("boolean"), t.getTypeName()); CPPUNIT_ASSERT(bool(cppu::UnoType<sal_Bool>::get() == t)); t = cppu::UnoType<sal_Int8>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BYTE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_BYTE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("byte"), t.getTypeName()); t = cppu::UnoType<sal_Int16>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SHORT, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SHORT, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("short"), t.getTypeName()); t = cppu::UnoType<cppu::UnoUnsignedShortType>::get(); CPPUNIT_ASSERT_EQUAL( - +css::uno::TypeClass_UNSIGNED_SHORT, +t.getTypeClass()); + css::uno::TypeClass_UNSIGNED_SHORT, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("unsigned short"), t.getTypeName()); t = cppu::UnoType<sal_Int32>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_LONG, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_LONG, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("long"), t.getTypeName()); t = cppu::UnoType<sal_uInt32>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_UNSIGNED_LONG, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_UNSIGNED_LONG, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("unsigned long"), t.getTypeName()); t = cppu::UnoType<sal_Int64>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_HYPER, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_HYPER, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("hyper"), t.getTypeName()); t = cppu::UnoType<sal_uInt64>::get(); CPPUNIT_ASSERT_EQUAL( - +css::uno::TypeClass_UNSIGNED_HYPER, +t.getTypeClass()); + css::uno::TypeClass_UNSIGNED_HYPER, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("unsigned hyper"), t.getTypeName()); t = cppu::UnoType<float>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_FLOAT, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_FLOAT, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("float"), t.getTypeName()); t = cppu::UnoType<double>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_DOUBLE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_DOUBLE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("double"), t.getTypeName()); t = cppu::UnoType<cppu::UnoCharType>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_CHAR, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_CHAR, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("char"), t.getTypeName()); t = cppu::UnoType<OUString>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRING, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRING, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("string"), t.getTypeName()); t = cppu::UnoType<css::uno::Type>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_TYPE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_TYPE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("type"), t.getTypeName()); t = cppu::UnoType<css::uno::Any>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ANY, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_ANY, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("any"), t.getTypeName()); t = cppu::UnoType<cppu::UnoSequenceType<sal_Int8>>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("[]byte"), t.getTypeName()); CPPUNIT_ASSERT(bool(cppu::UnoType<css::uno::Sequence<sal_Int8>>::get() == t)); t = cppu::UnoType<cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("[]unsigned short"), t.getTypeName()); t = cppu::UnoType<cppu::UnoSequenceType<cppu::UnoCharType>>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("[]char"), t.getTypeName()); t = cppu::UnoType< cppu::UnoSequenceType<cppu::UnoSequenceType<sal_Int8>>>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("[][]byte"), t.getTypeName()); CPPUNIT_ASSERT_EQUAL( cppu::UnoType<css::uno::Sequence<css::uno::Sequence<sal_Int8>>>::get(), @@ -179,42 +186,42 @@ void Test::testUnoType() { t = cppu::UnoType< cppu::UnoSequenceType< cppu::UnoSequenceType<cppu::UnoUnsignedShortType>>>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("[][]unsigned short"), t.getTypeName()); t = cppu::UnoType< cppu::UnoSequenceType<cppu::UnoSequenceType<cppu::UnoCharType>>>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL(OUString("[][]char"), t.getTypeName()); t = cppu::UnoType<css::uno::TypeClass>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ENUM, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_ENUM, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.uno.TypeClass"), t.getTypeName()); t = cppu::UnoType<css::lang::EventObject>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.lang.EventObject"), t.getTypeName()); CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedStruct1>::get(), t); t = cppu::UnoType<css::beans::PropertyChangeEvent>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.beans.PropertyChangeEvent"), t.getTypeName()); CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedStruct2>::get(), t); t = cppu::UnoType<css::beans::Optional<sal_Int8>>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.beans.Optional<byte>"), t.getTypeName()); t = cppu::UnoType<css::uno::Exception>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_EXCEPTION, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.uno.Exception"), t.getTypeName()); CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedException1>::get(), t); t = cppu::UnoType<css::uno::RuntimeException>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_EXCEPTION, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.uno.RuntimeException"), t.getTypeName()); CPPUNIT_ASSERT_EQUAL(cppu::UnoType<DerivedException2>::get(), t); t = cppu::UnoType<css::uno::XInterface>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_INTERFACE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.uno.XInterface"), t.getTypeName()); CPPUNIT_ASSERT_EQUAL( @@ -223,7 +230,7 @@ void Test::testUnoType() { CPPUNIT_ASSERT_EQUAL( cppu::UnoType<css::uno::Reference<DerivedInterface1>>::get(), t); t = cppu::UnoType<css::uno::XComponentContext>::get(); - CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE, +t.getTypeClass()); + CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_INTERFACE, t.getTypeClass()); CPPUNIT_ASSERT_EQUAL( OUString("com.sun.star.uno.XComponentContext"), t.getTypeName()); CPPUNIT_ASSERT_EQUAL( diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 2b767a7c2b47..d895fa4952bd 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -37,12 +37,21 @@ #include <comphelper/string.hxx> #include <comphelper/scopeguard.hxx> #include <cairo.h> +#include <ostream> #include <lib/init.hxx> using namespace com::sun::star; using namespace desktop; +namespace com { namespace sun { namespace star { namespace text { +std::ostream& operator<<(std::ostream& os, css::text::TextContentAnchorType const & n) +{ + os << (sal_Int32)n; + return os; +} +} } } }; + class DesktopLOKTest : public UnoApiTest { public: diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx index a491cb8457b4..012a5aa3ec60 100644 --- a/desktop/source/lib/lokinteractionhandler.cxx +++ b/desktop/source/lib/lokinteractionhandler.cxx @@ -147,7 +147,7 @@ bool LOKInteractionHandler::handleIOException(const css::uno::Sequence<css::uno: if (!(rRequest >>= aIoException)) return false; - static ErrCode const aErrorCode[ucb::IOErrorCode_WRONG_VERSION + 1] = + static ErrCode const aErrorCode[(int)ucb::IOErrorCode_WRONG_VERSION + 1] = { ERRCODE_IO_ABORT, ERRCODE_IO_ACCESSDENIED, @@ -187,7 +187,7 @@ bool LOKInteractionHandler::handleIOException(const css::uno::Sequence<css::uno: ERRCODE_IO_WRONGVERSION, }; - postError(aIoException.Classification, "io", aErrorCode[aIoException.Code], ""); + postError(aIoException.Classification, "io", aErrorCode[(int)aIoException.Code], ""); selectApproved(rContinuations); return true; diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 0593d8839492..6db571daa953 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2549,15 +2549,16 @@ namespace pcr // Auslesen des ListSourceTypes Any aListSourceType( m_xComponent->getPropertyValue( PROPERTY_LISTSOURCETYPE ) ); - sal_Int32 nListSourceType = ListSourceType_VALUELIST; + sal_Int32 nListSourceType = (sal_Int32)ListSourceType_VALUELIST; ::cppu::enum2int( nListSourceType, aListSourceType ); + ListSourceType eListSourceType = (ListSourceType)nListSourceType; _out_rDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( PROPERTY_ID_LISTSOURCE ); _out_rDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( PROPERTY_ID_LISTSOURCE ) ); // Enums setzen - switch( nListSourceType ) + switch( eListSourceType ) { case ListSourceType_VALUELIST: _out_rDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::StringListField, false ); @@ -2570,7 +2571,7 @@ namespace pcr std::vector< OUString > aListEntries; if ( impl_ensureRowsetConnection_nothrow() ) { - if ( nListSourceType == ListSourceType_QUERY ) + if ( eListSourceType == ListSourceType_QUERY ) impl_fillQueryNames_throw( aListEntries ); else impl_fillTableNames_throw( aListEntries ); @@ -2583,6 +2584,7 @@ namespace pcr impl_ensureRowsetConnection_nothrow(); _out_rDescriptor.HasPrimaryButton = m_xRowSetConnection.is(); break; + default: break; } } @@ -3115,7 +3117,7 @@ namespace pcr bool ValueListCommandUI::getEscapeProcessing() const { - enum ListSourceType eType( ListSourceType_SQL ); + ListSourceType eType = ListSourceType_SQL; OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eType ); OSL_ENSURE( ( eType == ListSourceType_SQL ) || ( eType == ListSourceType_SQLPASSTHROUGH ), "ValueListCommandUI::getEscapeProcessing: unexpected list source type!" ); diff --git a/extensions/source/propctrlr/pushbuttonnavigation.cxx b/extensions/source/propctrlr/pushbuttonnavigation.cxx index e4c75605fdfb..d0424d1df37c 100644 --- a/extensions/source/propctrlr/pushbuttonnavigation.cxx +++ b/extensions/source/propctrlr/pushbuttonnavigation.cxx @@ -18,7 +18,6 @@ */ #include "pushbuttonnavigation.hxx" -#include <com/sun/star/form/FormButtonType.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include "formstrings.hxx" #include <comphelper/extract.hxx> @@ -97,14 +96,14 @@ namespace pcr } - sal_Int32 PushButtonNavigation::implGetCurrentButtonType() const + FormButtonType PushButtonNavigation::implGetCurrentButtonType() const { - sal_Int32 nButtonType = FormButtonType_PUSH; + sal_Int32 nButtonType = (sal_Int32)FormButtonType_PUSH; if ( !m_xControlModel.is() ) - return nButtonType; + return (FormButtonType)nButtonType; OSL_VERIFY( ::cppu::enum2int( nButtonType, m_xControlModel->getPropertyValue( PROPERTY_BUTTONTYPE ) ) ); - if ( nButtonType == FormButtonType_URL ) + if ( nButtonType == (sal_Int32)FormButtonType_URL ) { // there's a chance that this is a "virtual" button type // (which are realized by special URLs) @@ -116,7 +115,7 @@ namespace pcr // it actually *is* a virtual button type nButtonType = s_nFirstVirtualButtonType + nNavigationURLIndex; } - return nButtonType; + return (FormButtonType)nButtonType; } @@ -145,7 +144,7 @@ namespace pcr try { - sal_Int32 nButtonType = FormButtonType_PUSH; + sal_Int32 nButtonType = (sal_Int32)FormButtonType_PUSH; OSL_VERIFY( ::cppu::enum2int( nButtonType, _rValue ) ); OUString sTargetURL; @@ -155,7 +154,7 @@ namespace pcr const sal_Char* pURL = lcl_getNavigationURL( nButtonType - s_nFirstVirtualButtonType ); sTargetURL = OUString::createFromAscii( pURL ); - nButtonType = FormButtonType_URL; + nButtonType = (sal_Int32)FormButtonType_URL; } m_xControlModel->setPropertyValue( PROPERTY_BUTTONTYPE, makeAny( static_cast< FormButtonType >( nButtonType ) ) ); @@ -182,10 +181,10 @@ namespace pcr eState = xStateAccess->getPropertyState( PROPERTY_BUTTONTYPE ); if ( eState == PropertyState_DIRECT_VALUE ) { - sal_Int32 nRealButtonType = FormButtonType_PUSH; + sal_Int32 nRealButtonType = (sal_Int32)FormButtonType_PUSH; OSL_VERIFY( ::cppu::enum2int( nRealButtonType, m_xControlModel->getPropertyValue( PROPERTY_BUTTONTYPE ) ) ); // perhaps it's one of the virtual button types? - if ( FormButtonType_URL == nRealButtonType ) + if ( (sal_Int32)FormButtonType_URL == nRealButtonType ) { // yes, it is -> rely on the state of the URL property eState = xStateAccess->getPropertyState( PROPERTY_TARGET_URL ); @@ -213,8 +212,8 @@ namespace pcr aReturn = m_xControlModel->getPropertyValue( PROPERTY_TARGET_URL ); if ( m_bIsPushButton ) { - sal_Int32 nCurrentButtonType = implGetCurrentButtonType(); - bool bIsVirtualButtonType = nCurrentButtonType >= s_nFirstVirtualButtonType; + FormButtonType nCurrentButtonType = implGetCurrentButtonType(); + bool bIsVirtualButtonType = nCurrentButtonType >= (FormButtonType)s_nFirstVirtualButtonType; if ( bIsVirtualButtonType ) { // pretend (to the user) that there's no URL set - since @@ -271,7 +270,7 @@ namespace pcr bool PushButtonNavigation::currentButtonTypeIsOpenURL() const { - sal_Int32 nButtonType( FormButtonType_PUSH ); + FormButtonType nButtonType( FormButtonType_PUSH ); try { nButtonType = implGetCurrentButtonType(); diff --git a/extensions/source/propctrlr/pushbuttonnavigation.hxx b/extensions/source/propctrlr/pushbuttonnavigation.hxx index 6a8ee54248bd..2ee906b0c406 100644 --- a/extensions/source/propctrlr/pushbuttonnavigation.hxx +++ b/extensions/source/propctrlr/pushbuttonnavigation.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/form/FormButtonType.hpp> namespace pcr @@ -89,7 +90,7 @@ namespace pcr bool hasNonEmptyCurrentTargetURL() const; private: - sal_Int32 implGetCurrentButtonType() const; + css::form::FormButtonType implGetCurrentButtonType() const; }; diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 87daad96ae83..ce47bfccd440 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -405,7 +405,7 @@ void EscherPropertyContainer::CreateGradientProperties( bWriteFillTo = true; } break; - case css::awt::GradientStyle_MAKE_FIXED_SIZE : break; + case css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE : break; } AddOpt( ESCHER_Prop_fillType, nFillType ); AddOpt( ESCHER_Prop_fillAngle, nAngle ); diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 31c21943d974..0687c2a3b73d 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -1725,11 +1725,11 @@ bool SVGFilter::implExportShape( const Reference< XShape >& rxShape, bool bMaste mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" ); - sal_uInt16 nTextAdjust = ParagraphAdjust_LEFT; + sal_uInt16 nTextAdjust = (sal_uInt16)ParagraphAdjust_LEFT; OUString sTextAdjust; xShapePropSet->getPropertyValue( "ParaAdjust" ) >>= nTextAdjust; - switch( nTextAdjust ) + switch( (ParagraphAdjust)nTextAdjust ) { case ParagraphAdjust_LEFT: sTextAdjust = "left"; diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 3c17f1e7e3a8..0ce27865f7ce 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2373,7 +2373,7 @@ sal_Bool SAL_CALL ODatabaseForm::getGroupControl() { sal_Int32 nCycle = 0; ::cppu::enum2int(nCycle, m_aCycle); - return nCycle != TabulatorCycle_PAGE; + return (TabulatorCycle)nCycle != TabulatorCycle_PAGE; } if (isLoaded() && getConnection().is()) @@ -3812,13 +3812,13 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS _rxOutStream << m_aTargetFrame; // version 2 didn't know some options and the "default" state - sal_Int32 nCycle = TabulatorCycle_RECORDS; + sal_Int32 nCycle = (sal_Int32)TabulatorCycle_RECORDS; if (m_aCycle.hasValue()) { ::cppu::enum2int(nCycle, m_aCycle); if (m_aCycle == TabulatorCycle_PAGE) // unknown in earlier versions - nCycle = TabulatorCycle_RECORDS; + nCycle = (sal_Int32)TabulatorCycle_RECORDS; } _rxOutStream->writeShort((sal_Int16) nCycle); diff --git a/framework/inc/uielement/uielement.hxx b/framework/inc/uielement/uielement.hxx index 265e0db69661..0a55739cdcf6 100644 --- a/framework/inc/uielement/uielement.hxx +++ b/framework/inc/uielement/uielement.hxx @@ -37,9 +37,9 @@ struct DockedData m_nDockedArea( css::ui::DockingArea_DOCKINGAREA_TOP ), m_bLocked( false ) {} - css::awt::Point m_aPos; - sal_Int16 m_nDockedArea; - bool m_bLocked; + css::awt::Point m_aPos; + css::ui::DockingArea m_nDockedArea; + bool m_bLocked; }; struct FloatingData diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index 90c7e303ee3c..c68d732157eb 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -181,7 +181,7 @@ uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< un } // convert alignment constant to vcl's WindowAlign type -WindowAlign ImplConvertAlignment( sal_Int16 aAlignment ) +WindowAlign ImplConvertAlignment( ui::DockingArea aAlignment ) { if ( aAlignment == ui::DockingArea_DOCKINGAREA_LEFT ) return WindowAlign::Left; diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx index 3f5362990f25..0e663f8caddf 100644 --- a/framework/source/layoutmanager/helpers.hxx +++ b/framework/source/layoutmanager/helpers.hxx @@ -58,7 +58,7 @@ bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectang void setZeroRectangle( ::tools::Rectangle& rRect ); bool lcl_checkUIElement(const css::uno::Reference< css::ui::XUIElement >& xUIElement,css::awt::Rectangle& _rPosSize, css::uno::Reference< css::awt::XWindow >& _xWindow); css::uno::Reference< css::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::awt::XWindowPeer >& rParent, const char* pService ); -WindowAlign ImplConvertAlignment( sal_Int16 aAlignment ); +WindowAlign ImplConvertAlignment( css::ui::DockingArea aAlignment ); OUString getElementTypeFromResourceURL( const OUString& aResourceURL ); void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUString& aElementName ); ::tools::Rectangle putAWTToRectangle( const css::awt::Rectangle& rRect ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index c426d921121a..45ee6f67f135 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -518,7 +518,7 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem { ui::DockingArea eDockingArea; if ( aWindowState[n].Value >>= eDockingArea ) - rElementData.m_aDockedData.m_nDockedArea = sal_Int16( eDockingArea ); + rElementData.m_aDockedData.m_nDockedArea = eDockingArea; } else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_DOCKPOS ) { diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 508ecefc0fed..7ff134b79526 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -142,10 +142,10 @@ void ToolbarLayoutManager::implts_setDockingAreaWindowSizes( const awt::Rectangl SolarMutexClearableGuard aReadLock; tools::Rectangle aDockOffsets = m_aDockingAreaOffsets; uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); - uno::Reference< awt::XWindow > xTopDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); - uno::Reference< awt::XWindow > xBottomDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); - uno::Reference< awt::XWindow > xLeftDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); - uno::Reference< awt::XWindow > xRightDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + uno::Reference< awt::XWindow > xTopDockAreaWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xBottomDockAreaWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM] ); + uno::Reference< awt::XWindow > xLeftDockAreaWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockAreaWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_RIGHT] ); aReadLock.clear(); uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY ); @@ -257,7 +257,7 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea() tools::Rectangle aBorderSpace; sal_Int32 nCurrRowColumn( 0 ); sal_Int32 nCurrPos( 0 ); - sal_Int32 nCurrDockingArea( ui::DockingArea_DOCKINGAREA_TOP ); + ui::DockingArea nCurrDockingArea( ui::DockingArea_DOCKINGAREA_TOP ); std::vector< sal_Int32 > aRowColumnSizes[DOCKINGAREAS_COUNT]; UIElementVector::const_iterator pConstIter; @@ -265,8 +265,8 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea() aBorderSpace.setWidth(0); aBorderSpace.setHeight(0); - aRowColumnSizes[nCurrDockingArea].clear(); - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + aRowColumnSizes[(int)nCurrDockingArea].clear(); + aRowColumnSizes[(int)nCurrDockingArea].push_back( 0 ); for ( pConstIter = aWindowVector.begin(); pConstIter != aWindowVector.end(); ++pConstIter ) { @@ -288,8 +288,8 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea() nCurrDockingArea = pConstIter->m_aDockedData.m_nDockedArea; nCurrRowColumn = 0; nCurrPos = 0; - aRowColumnSizes[nCurrDockingArea].clear(); - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + aRowColumnSizes[(int)nCurrDockingArea].clear(); + aRowColumnSizes[(int)nCurrDockingArea].push_back( 0 ); } if ( pConstIter->m_aDockedData.m_nDockedArea == nCurrDockingArea ) @@ -300,11 +300,11 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea() { ++nCurrRowColumn; nCurrPos = pConstIter->m_aDockedData.m_aPos.Y; - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + aRowColumnSizes[(int)nCurrDockingArea].push_back( 0 ); } - if ( aPosSize.Height > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] ) - aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Height; + if ( aPosSize.Height > aRowColumnSizes[(int)nCurrDockingArea][nCurrRowColumn] ) + aRowColumnSizes[(int)nCurrDockingArea][nCurrRowColumn] = aPosSize.Height; } else { @@ -312,11 +312,11 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea() { ++nCurrRowColumn; nCurrPos = pConstIter->m_aDockedData.m_aPos.X; - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + aRowColumnSizes[(int)nCurrDockingArea].push_back( 0 ); } - if ( aPosSize.Width > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] ) - aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Width; + if ( aPosSize.Width > aRowColumnSizes[(int)nCurrDockingArea][nCurrRowColumn] ) + aRowColumnSizes[(int)nCurrDockingArea][nCurrRowColumn] = aPosSize.Width; } } } @@ -327,18 +327,18 @@ tools::Rectangle ToolbarLayoutManager::implts_calcDockingArea() // Sum up max heights from every row/column if ( !aWindowVector.empty() ) { - for ( sal_Int32 i = 0; i <= ui::DockingArea_DOCKINGAREA_RIGHT; i++ ) + for ( sal_Int32 i = 0; i <= (sal_Int32)ui::DockingArea_DOCKINGAREA_RIGHT; i++ ) { sal_Int32 nSize( 0 ); const sal_uInt32 nCount = aRowColumnSizes[i].size(); for ( sal_uInt32 j = 0; j < nCount; j++ ) nSize += aRowColumnSizes[i][j]; - if ( i == ui::DockingArea_DOCKINGAREA_TOP ) + if ( i == (sal_Int32)ui::DockingArea_DOCKINGAREA_TOP ) aBorderSpace.Top() = nSize; - else if ( i == ui::DockingArea_DOCKINGAREA_BOTTOM ) + else if ( i == (sal_Int32)ui::DockingArea_DOCKINGAREA_BOTTOM ) aBorderSpace.Bottom() = nSize; - else if ( i == ui::DockingArea_DOCKINGAREA_LEFT ) + else if ( i == (sal_Int32)ui::DockingArea_DOCKINGAREA_LEFT ) aBorderSpace.Left() = nSize; else aBorderSpace.Right() = nSize; @@ -816,7 +816,7 @@ bool ToolbarLayoutManager::dockToolbar( const OUString& rResourceURL, ui::Dockin if ( xDockWindow.is() ) { if ( eDockingArea != ui::DockingArea_DOCKINGAREA_DEFAULT ) - aUIElement.m_aDockedData.m_nDockedArea = sal_Int16( eDockingArea ); + aUIElement.m_aDockedData.m_nDockedArea = eDockingArea; if ( !isDefaultPos( aPos )) aUIElement.m_aDockedData.m_aPos = aPos; @@ -999,10 +999,10 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent* pEvent ) void ToolbarLayoutManager::resetDockingArea() { SolarMutexClearableGuard aReadLock; - uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); - uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); - uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); - uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_RIGHT] ); + uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM] ); aReadLock.clear(); if ( xTopDockingWindow.is() ) @@ -1027,10 +1027,10 @@ void ToolbarLayoutManager::setParentWindow( SolarMutexClearableGuard aWriteLock; m_xContainerWindow.set( xParentWindow, uno::UNO_QUERY ); - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] = xTopDockWindow; - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] = xLeftDockWindow; - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] = xRightDockWindow; - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] = xBottomDockWindow; + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP] = xTopDockWindow; + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT] = xLeftDockWindow; + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_RIGHT] = xRightDockWindow; + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM] = xBottomDockWindow; aWriteLock.clear(); if ( xParentWindow.is() ) @@ -1341,10 +1341,10 @@ void ToolbarLayoutManager::implts_reparentToolbars() SolarMutexClearableGuard aWriteLock; UIElementVector aUIElementVector = m_aUIElements; VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - VclPtr<vcl::Window> pTopDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); - VclPtr<vcl::Window> pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); - VclPtr<vcl::Window> pLeftDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); - VclPtr<vcl::Window> pRightDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + VclPtr<vcl::Window> pTopDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP] ); + VclPtr<vcl::Window> pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM] ); + VclPtr<vcl::Window> pLeftDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT] ); + VclPtr<vcl::Window> pRightDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_RIGHT] ); aWriteLock.clear(); SolarMutexGuard aGuard; @@ -1536,14 +1536,14 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno void ToolbarLayoutManager::implts_destroyDockingAreaWindows() { SolarMutexClearableGuard aWriteLock; - uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); - uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); - uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); - uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP].clear(); - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT].clear(); - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT].clear(); - m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM].clear(); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_RIGHT] ); + uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM] ); + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP].clear(); + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT].clear(); + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_RIGHT].clear(); + m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM].clear(); aWriteLock.clear(); // destroy windows @@ -1755,8 +1755,8 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() SolarMutexClearableGuard aReadLock; uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); - uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); - uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT] ); aReadLock.clear(); awt::Point aStartPos( nCascadeIndentX, nCascadeIndentY ); @@ -1836,8 +1836,8 @@ void ToolbarLayoutManager::implts_getUIElementVectorCopy( UIElementVector& rCopy uno::Reference< awt::XWindow > xBottomDockingAreaWindow; SolarMutexClearableGuard aReadLock; - xTopDockingAreaWindow = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP]; - xBottomDockingAreaWindow = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM]; + xTopDockingAreaWindow = m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP]; + xBottomDockingAreaWindow = m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM]; aReadLock.clear(); if ( xTopDockingAreaWindow.is() ) @@ -1860,7 +1860,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD /* SAFE AREA ----------------------------------------------------------------------------------------------- */ SolarMutexClearableGuard aReadLock; aWindowVector.reserve(m_aUIElements.size()); - xDockAreaWindow = m_xDockAreaWindows[eDockingArea]; + xDockAreaWindow = m_xDockAreaWindows[(int)eDockingArea]; UIElementVector::iterator pIter; for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter ) { @@ -2157,7 +2157,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D { SolarMutexClearableGuard aReadLock; VclPtr<vcl::Window> pContainerWindow( VCLUnoHelper::GetWindow( m_xContainerWindow )); - VclPtr<vcl::Window> pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[DockingArea] )); + VclPtr<vcl::Window> pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[(int)DockingArea] )); aReadLock.clear(); // Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect @@ -2254,7 +2254,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre SolarMutexClearableGuard aReadLock; if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT )) DockingArea = ui::DockingArea_DOCKINGAREA_TOP; - uno::Reference< awt::XWindow > xDockingWindow( m_xDockAreaWindows[DockingArea] ); + uno::Reference< awt::XWindow > xDockingWindow( m_xDockAreaWindows[(int)DockingArea] ); ::Size aDockingWinSize; vcl::Window* pDockingWindow( nullptr ); aReadLock.clear(); @@ -2635,7 +2635,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( ::tools::Rectangle aDockingAreaRect; aReadLock.reset(); - xDockingAreaWindow = m_xDockAreaWindows[eDockedArea]; + xDockingAreaWindow = m_xDockAreaWindows[(int)eDockedArea]; aReadLock.clear(); { @@ -2649,7 +2649,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( if ( pToolBox ) { // docked toolbars always have one line - ::Size aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( sal_Int16( eDockedArea )) ); + ::Size aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( eDockedArea ) ); aTrackingRect.SetSize( ::Size( aSize.Width(), aSize.Height() )); } } @@ -3070,7 +3070,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d aTrackingRect.setHeight( nSize ); aReadGuard.reset(); - uno::Reference< awt::XWindow > xDockingAreaWindow( m_xDockAreaWindows[eDockingArea] ); + uno::Reference< awt::XWindow > xDockingAreaWindow( m_xDockAreaWindows[(int)eDockingArea] ); uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); aReadGuard.clear(); @@ -3118,7 +3118,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( UIElementVector::iterator pIter; for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter ) { - if (( pIter->m_aDockedData.m_nDockedArea == sal_Int16( eDockingArea )) && ( pIter->m_aName != rUIElement.m_aName )) + if (( pIter->m_aDockedData.m_nDockedArea == eDockingArea ) && ( pIter->m_aName != rUIElement.m_aName )) { // Don't change toolbars without a valid docking position! if ( isDefaultPos( pIter->m_aDockedData.m_aPos )) @@ -3314,10 +3314,10 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent awt::DockingData aDockingData; uno::Reference< awt::XDockableWindow > xDockWindow( e.Source, uno::UNO_QUERY ); uno::Reference< awt::XWindow > xWindow( e.Source, uno::UNO_QUERY ); - uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); - uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); - uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); - uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_RIGHT] ); + uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[(int)ui::DockingArea_DOCKINGAREA_BOTTOM] ); uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); UIElement aUIDockingElement( m_aDockUIElement ); @@ -3334,7 +3334,7 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent { SolarMutexGuard aGuard; - sal_Int16 eDockingArea( -1 ); // none + ui::DockingArea eDockingArea( (ui::DockingArea)-1 ); // none sal_Int32 nMagneticZone( aUIDockingElement.m_bFloating ? MAGNETIC_DISTANCE_DOCK : MAGNETIC_DISTANCE_UNDOCK ); awt::Rectangle aNewTrackingRect; ::tools::Rectangle aTrackingRect( e.TrackingRectangle.X, e.TrackingRectangle.Y, @@ -3385,7 +3385,7 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX ) pToolBox = static_cast<ToolBox *>(pWindow.get()); - if ( eDockingArea != -1 ) + if ( eDockingArea != (ui::DockingArea)-1 ) { if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP ) { @@ -3456,7 +3456,7 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent aDockingData.TrackingRectangle.Y = e.MousePos.Y; } - aDockingData.bFloating = ( eDockingArea == -1 ); + aDockingData.bFloating = ( eDockingArea == (ui::DockingArea)-1 ); // Write current data to the member docking progress data SolarMutexGuard g; diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 14b94831f120..132334ebdcd7 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -2915,7 +2915,7 @@ void Frame::implts_sendFrameActionEvent( const css::frame::FrameAction& aAction (aAction == css::frame::FrameAction_CONTEXT_CHANGED ? OUString("CONTEXT CHANGED") : (aAction == css::frame::FrameAction_FRAME_UI_ACTIVATED ? OUString("FRAME UI ACTIVATED") : (aAction == css::frame::FrameAction_FRAME_UI_DEACTIVATING ? OUString("FRAME UI DEACTIVATING") : - (aAction == css::frame::FrameAction_MAKE_FIXED_SIZE ? OUString("MAKE_FIXED_SIZE") : + (aAction == css::frame::FrameAction::FrameAction_MAKE_FIXED_SIZE ? OUString("MAKE_FIXED_SIZE") : OUString("*invalid*"))))))))))); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 0f286a247f07..303af41db72e 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -149,7 +149,7 @@ void TestTextSearch::testWildcardSearch() aOptions.WildcardEscapeCharacter = '~'; // aOptions.searchFlag = ::css::util::SearchFlags::WILD_MATCH_SELECTION; // is not set, so substring match is allowed. - aOptions.transliterateFlags = ::css::i18n::TransliterationModules::TransliterationModules_IGNORE_CASE; + aOptions.transliterateFlags = (sal_Int32)::css::i18n::TransliterationModules::TransliterationModules_IGNORE_CASE; aText = "abAca"; aOptions.searchString = "a"; diff --git a/i18npool/source/inputchecker/inputsequencechecker.cxx b/i18npool/source/inputchecker/inputsequencechecker.cxx index e3b72cd51413..ed6f12c59d20 100644 --- a/i18npool/source/inputchecker/inputsequencechecker.cxx +++ b/i18npool/source/inputchecker/inputsequencechecker.cxx @@ -81,24 +81,25 @@ InputSequenceCheckerImpl::correctInputSequence(OUString& Text, sal_Int32 nStartP static ScriptTypeList typeList[] = { //{ UnicodeScript_kHebrew, UnicodeScript_kHebrew }, // 10, //{ UnicodeScript_kArabic, UnicodeScript_kArabic }, // 11, - { UnicodeScript_kDevanagari,UnicodeScript_kDevanagari, UnicodeScript_kDevanagari }, // 14, - { UnicodeScript_kThai, UnicodeScript_kThai, UnicodeScript_kThai }, // 24, + { UnicodeScript_kDevanagari, UnicodeScript_kDevanagari, (sal_Int16)UnicodeScript_kDevanagari }, // 14, + { UnicodeScript_kThai, UnicodeScript_kThai, (sal_Int16)UnicodeScript_kThai }, // 24, - { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, UnicodeScript_kScriptCount } // 88 + { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, (sal_Int16)UnicodeScript_kScriptCount } // 88 }; sal_Char* SAL_CALL InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode nChar) { - sal_Int16 type = unicode::getUnicodeScriptType( cChar, typeList, UnicodeScript_kScriptCount ); + css::i18n::UnicodeScript type = (css::i18n::UnicodeScript)unicode::getUnicodeScriptType( cChar, typeList, (sal_Int16)UnicodeScript_kScriptCount ); if (type != UnicodeScript_kScriptCount && - type == unicode::getUnicodeScriptType( nChar, typeList, UnicodeScript_kScriptCount )) { + type == (css::i18n::UnicodeScript)unicode::getUnicodeScriptType( nChar, typeList, (sal_Int16)UnicodeScript_kScriptCount )) { switch(type) { case UnicodeScript_kThai: return const_cast<sal_Char*>("th"); //case UnicodeScript_kArabic: return (sal_Char*)"ar"; //case UnicodeScript_kHebrew: return (sal_Char*)"he"; case UnicodeScript_kDevanagari: return const_cast<sal_Char*>("hi"); + default: break; } } return nullptr; diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index 0076f957a8e8..eccc2088b7de 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -170,36 +170,45 @@ TransliterationImpl::getType() throw ERROR; } +TransliterationModules operator&(TransliterationModules lhs, TransliterationModules rhs) { + return TransliterationModules(sal_Int32(lhs) & sal_Int32(rhs)); +} +TransliterationModules operator|(TransliterationModules lhs, TransliterationModules rhs) { + return TransliterationModules(sal_Int32(lhs) | sal_Int32(rhs)); +} + void SAL_CALL TransliterationImpl::loadModule( TransliterationModules modType, const Locale& rLocale ) { clear(); - if (modType&TransliterationModules_IGNORE_MASK && modType&TransliterationModules_NON_IGNORE_MASK) { + if (bool(modType & TransliterationModules_IGNORE_MASK) && + bool(modType & TransliterationModules_NON_IGNORE_MASK)) + { throw ERROR; - } else if (modType&TransliterationModules_IGNORE_MASK) { + } else if (bool(modType & TransliterationModules_IGNORE_MASK)) { #define TransliterationModules_IGNORE_CASE_MASK (TransliterationModules_IGNORE_CASE | \ TransliterationModules_IGNORE_WIDTH | \ TransliterationModules_IGNORE_KANA) - sal_Int32 mask = ((modType&TransliterationModules_IGNORE_CASE_MASK) == modType) ? + TransliterationModules mask = ((modType & TransliterationModules_IGNORE_CASE_MASK) == modType) ? TransliterationModules_IGNORE_CASE_MASK : TransliterationModules_IGNORE_MASK; - for (sal_Int16 i = 0; TMlist[i].tm & mask; i++) { - if (modType & TMlist[i].tm) + for (sal_Int16 i = 0; bool(TMlist[i].tm & mask); i++) { + if (bool(modType & TMlist[i].tm)) if (loadModuleByName(OUString::createFromAscii(TMlist[i].implName), bodyCascade[numCascade], rLocale)) numCascade++; } // additional transliterations from TranslationModuleExtra (we cannot extend TransliterationModule) - if (modType & TransliterationModulesExtra::IGNORE_DIACRITICS_CTL) + if (bool(modType & (TransliterationModules)TransliterationModulesExtra::IGNORE_DIACRITICS_CTL)) { if (loadModuleByName("ignoreDiacritics_CTL", bodyCascade[numCascade], rLocale)) numCascade++; } - if (modType & TransliterationModulesExtra::IGNORE_KASHIDA_CTL) + if (bool(modType & (TransliterationModules)TransliterationModulesExtra::IGNORE_KASHIDA_CTL)) if (loadModuleByName("ignoreKashida_CTL", bodyCascade[numCascade], rLocale)) numCascade++; - } else if (modType&TransliterationModules_NON_IGNORE_MASK) { - for (sal_Int16 i = 0; TMlist[i].tm; i++) { + } else if (bool(modType & TransliterationModules_NON_IGNORE_MASK)) { + for (sal_Int16 i = 0; bool(TMlist[i].tm); i++) { if (TMlist[i].tm == modType) { if (loadModuleByName(OUString::createFromAscii(TMlist[i].implName), bodyCascade[numCascade], rLocale)) numCascade++; @@ -213,17 +222,18 @@ void SAL_CALL TransliterationImpl::loadModuleNew( const Sequence < TransliterationModulesNew > & modType, const Locale& rLocale ) { clear(); - sal_Int32 mask = 0, count = modType.getLength(); + TransliterationModules mask = TransliterationModules_END_OF_MODULE; + sal_Int32 count = modType.getLength(); if (count > maxCascade) throw ERROR; // could not handle more than maxCascade for (sal_Int32 i = 0; i < count; i++) { - for (sal_Int16 j = 0; TMlist[j].tmn; j++) { + for (sal_Int16 j = 0; bool(TMlist[j].tmn); j++) { if (TMlist[j].tmn == modType[i]) { - if (mask == 0) - mask = TMlist[i].tm && (TMlist[i].tm&TransliterationModules_IGNORE_MASK) ? + if (mask == TransliterationModules_END_OF_MODULE) + mask = bool(TMlist[i].tm) && bool(TMlist[i].tm & TransliterationModules_IGNORE_MASK) ? TransliterationModules_IGNORE_MASK : TransliterationModules_NON_IGNORE_MASK; - else if (mask == (sal_Int32) TransliterationModules_IGNORE_MASK && - (TMlist[i].tm&TransliterationModules_IGNORE_MASK) == 0) + else if (mask == TransliterationModules_IGNORE_MASK && + (TMlist[i].tm&TransliterationModules_IGNORE_MASK) == TransliterationModules_END_OF_MODULE) throw ERROR; // could not mess up ignore trans. with non_ignore trans. if (loadModuleByName(OUString::createFromAscii(TMlist[j].implName), bodyCascade[numCascade], rLocale)) numCascade++; diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index 4f922d23621b..7610ee6f7a70 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/reflection/theCoreReflection.hpp> #include <comphelper/sequence.hxx> +#include <vector> using com::sun::star::uno::Reference; using com::sun::star::uno::XInterface; @@ -64,8 +65,6 @@ using com::sun::star::script::XInvocation; using com::sun::star::beans::XMaterialHolder; using com::sun::star::beans::theIntrospection; -#include <vector> - namespace pyuno { @@ -366,17 +365,17 @@ PyRef Runtime::any2PyObject (const Any &a ) const switch (a.getValueTypeClass ()) { - case typelib_TypeClass_VOID: + case css::uno::TypeClass_VOID: { Py_INCREF (Py_None); return PyRef(Py_None); } - case typelib_TypeClass_CHAR: + case css::uno::TypeClass_CHAR: { sal_Unicode c = *o3tl::forceAccess<sal_Unicode>(a); return PyRef( PyUNO_char_new( c , *this ), SAL_NO_ACQUIRE ); } - case typelib_TypeClass_BOOLEAN: + case css::uno::TypeClass_BOOLEAN: { bool b; if ((a >>= b) && b) @@ -384,52 +383,52 @@ PyRef Runtime::any2PyObject (const Any &a ) const else return Py_False; } - case typelib_TypeClass_BYTE: - case typelib_TypeClass_SHORT: - case typelib_TypeClass_UNSIGNED_SHORT: - case typelib_TypeClass_LONG: + case css::uno::TypeClass_BYTE: + case css::uno::TypeClass_SHORT: + case css::uno::TypeClass_UNSIGNED_SHORT: + case css::uno::TypeClass_LONG: { sal_Int32 l = 0; a >>= l; return PyRef( PyLong_FromLong (l), SAL_NO_ACQUIRE ); } - case typelib_TypeClass_UNSIGNED_LONG: + case css::uno::TypeClass_UNSIGNED_LONG: { sal_uInt32 l = 0; a >>= l; return PyRef( PyLong_FromUnsignedLong (l), SAL_NO_ACQUIRE ); } - case typelib_TypeClass_HYPER: + case css::uno::TypeClass_HYPER: { sal_Int64 l = 0; a >>= l; return PyRef( PyLong_FromLongLong (l), SAL_NO_ACQUIRE); } - case typelib_TypeClass_UNSIGNED_HYPER: + case css::uno::TypeClass_UNSIGNED_HYPER: { sal_uInt64 l = 0; a >>= l; return PyRef( PyLong_FromUnsignedLongLong (l), SAL_NO_ACQUIRE); } - case typelib_TypeClass_FLOAT: + case css::uno::TypeClass_FLOAT: { float f = 0.0; a >>= f; return PyRef(PyFloat_FromDouble (f), SAL_NO_ACQUIRE); } - case typelib_TypeClass_DOUBLE: + case css::uno::TypeClass_DOUBLE: { double d = 0.0; a >>= d; return PyRef( PyFloat_FromDouble (d), SAL_NO_ACQUIRE); } - case typelib_TypeClass_STRING: + case css::uno::TypeClass_STRING: { OUString tmp_ostr; a >>= tmp_ostr; return ustring2PyUnicode( tmp_ostr ); } - case typelib_TypeClass_TYPE: + case css::uno::TypeClass_TYPE: { Type t; a >>= t; @@ -439,13 +438,13 @@ PyRef Runtime::any2PyObject (const Any &a ) const o.getStr(), (css::uno::TypeClass)t.getTypeClass(), *this), SAL_NO_ACQUIRE); } - case typelib_TypeClass_ANY: + case css::uno::TypeClass_ANY: { //I don't think this can happen. Py_INCREF (Py_None); return Py_None; } - case typelib_TypeClass_ENUM: + case css::uno::TypeClass_ENUM: { sal_Int32 l = *static_cast<sal_Int32 const *>(a.getValue()); TypeDescription desc( a.getValueType() ); @@ -467,8 +466,8 @@ PyRef Runtime::any2PyObject (const Any &a ) const throw RuntimeException( "Any carries enum " + a.getValueType().getTypeName() + " with invalid value " + OUString::number(l) ); } - case typelib_TypeClass_EXCEPTION: - case typelib_TypeClass_STRUCT: + case css::uno::TypeClass_EXCEPTION: + case css::uno::TypeClass_STRUCT: { PyRef excClass = getClass( a.getValueType().getTypeName(), *this ); PyRef value = PyUNOStruct_new( a, getImpl()->cargo->xInvocation ); @@ -494,7 +493,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const } return ret; } - case typelib_TypeClass_SEQUENCE: + case css::uno::TypeClass_SEQUENCE: { Sequence<Any> s; @@ -534,7 +533,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const return tuple; } } - case typelib_TypeClass_INTERFACE: + case css::uno::TypeClass_INTERFACE: { Reference<XInterface> tmp_interface; a >>= tmp_interface; @@ -545,7 +544,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const } default: { - throw RuntimeException( "Unknown UNO type class " + OUString::number(a.getValueTypeClass()) ); + throw RuntimeException( "Unknown UNO type class " + OUString::number((int)a.getValueTypeClass()) ); } } } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 76a82593aafb..9dba6712a039 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -93,14 +93,7 @@ public: } }; -namespace com -{ -namespace sun -{ -namespace star -{ -namespace awt -{ +namespace com { namespace sun { namespace star { namespace awt { std::ostream& operator<<(std::ostream& rStrm, GradientStyle n) { @@ -108,19 +101,9 @@ std::ostream& operator<<(std::ostream& rStrm, GradientStyle n) return rStrm; } -} -} -} -} +} } } } -namespace com -{ -namespace sun -{ -namespace star -{ -namespace drawing -{ +namespace com { namespace sun { namespace star { namespace drawing { std::ostream& operator<<(std::ostream& rStrm, FillStyle n) { @@ -128,19 +111,9 @@ std::ostream& operator<<(std::ostream& rStrm, FillStyle n) return rStrm; } -} -} -} -} +} } } } -namespace com -{ -namespace sun -{ -namespace star -{ -namespace style -{ +namespace com { namespace sun { namespace star { namespace style { std::ostream& operator<<(std::ostream& rStrm, PageStyleLayout n) { @@ -148,19 +121,9 @@ std::ostream& operator<<(std::ostream& rStrm, PageStyleLayout n) return rStrm; } -} -} -} -} +} } } } -namespace com -{ -namespace sun -{ -namespace star -{ -namespace text -{ +namespace com { namespace sun { namespace star { namespace text { std::ostream& operator<<(std::ostream& rStrm, TextContentAnchorType n) { @@ -168,19 +131,9 @@ std::ostream& operator<<(std::ostream& rStrm, TextContentAnchorType n) return rStrm; } -} -} -} -} +} } } } -namespace com -{ -namespace sun -{ -namespace star -{ -namespace table -{ +namespace com { namespace sun { namespace star { namespace table { std::ostream& operator<<(std::ostream& rStrm, ShadowLocation n) { @@ -188,10 +141,7 @@ std::ostream& operator<<(std::ostream& rStrm, ShadowLocation n) return rStrm; } -} -} -} -} +} } } } DECLARE_RTFEXPORT_TEST(testZoom, "zoom.rtf") { diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 28c96fb690d3..191fc7a2664b 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -63,14 +63,7 @@ #include <bordertest.hxx> -namespace com -{ -namespace sun -{ -namespace star -{ -namespace beans -{ +namespace com { namespace sun { namespace star { namespace beans { std::ostream& operator<<(std::ostream& rStrm, PropertyState n) { @@ -78,18 +71,8 @@ std::ostream& operator<<(std::ostream& rStrm, PropertyState n) return rStrm; } -} -} -} -} -namespace com -{ -namespace sun -{ -namespace star -{ -namespace style -{ +} } } } +namespace com { namespace sun { namespace star { namespace style { std::ostream& operator<<(std::ostream& rStrm, BreakType n) { @@ -107,18 +90,8 @@ std::ostream& operator<<(std::ostream& rStrm, ParagraphAdjust n) return rStrm; } -} -} -} -} -namespace com -{ -namespace sun -{ -namespace star -{ -namespace drawing -{ +} } } } +namespace com { namespace sun { namespace star { namespace drawing { std::ostream& operator<<(std::ostream& rStrm, FillStyle n) { @@ -126,18 +99,8 @@ std::ostream& operator<<(std::ostream& rStrm, FillStyle n) return rStrm; } -} -} -} -} -namespace com -{ -namespace sun -{ -namespace star -{ -namespace text -{ +} } } } +namespace com { namespace sun { namespace star { namespace text { std::ostream& operator<<(std::ostream& rStrm, TextContentAnchorType n) { @@ -150,10 +113,7 @@ std::ostream& operator<<(std::ostream& rStrm, WrapTextMode n) return rStrm; } -} -} -} -} +} } } } class Test : public SwModelTestBase { |