/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_SW_INC_BREAKIT_HXX #define INCLUDED_SW_INC_BREAKIT_HXX #include #include #include #include #include #include #include #include class SW_DLLPUBLIC SwBreakIt : private ::boost::noncopyable { com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak; LanguageTag * m_pLanguageTag; ///< language tag of the current locale com::sun::star::i18n::ForbiddenCharacters * m_pForbidden; LanguageType aForbiddenLang; ///< language of the current forbiddenChar struct void _GetLocale( const LanguageType aLang ); void _GetLocale( const LanguageTag& rLanguageTag ); void _GetForbidden( const LanguageType aLang ); void createBreakIterator() const; // private (see @ _Create, _Delete). explicit SwBreakIt( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext); ~SwBreakIt(); public: // private (see @ source/core/bastyp/init.cxx). static void _Create( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext); static void _Delete(); public: static SwBreakIt * Get(); com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > GetBreakIter() { createBreakIterator(); return xBreak; } const com::sun::star::lang::Locale& GetLocale( const LanguageType aLang ) { if( !m_pLanguageTag || m_pLanguageTag->getLanguageType() != aLang ) _GetLocale( aLang ); return m_pLanguageTag->getLocale(); } const com::sun::star::lang::Locale& GetLocale( const LanguageTag& rLanguageTag ) { // Use LanguageType comparison instead of LanguageTag::operator!=() // because here the LanguageTag is already a known LanguageType value // assigned, so LanguageTag does not need to convert to BCP47 for // comparison. if( !m_pLanguageTag || m_pLanguageTag->getLanguageType() != rLanguageTag.getLanguageType() ) _GetLocale( rLanguageTag ); return m_pLanguageTag->getLocale(); } const LanguageTag& GetLanguageTag( const LanguageType aLang ) { if( !m_pLanguageTag || m_pLanguageTag->getLanguageType() != aLang ) _GetLocale( aLang ); return *m_pLanguageTag; } const LanguageTag& GetLanguageTag( const LanguageTag& rLanguageTag ) { // Use LanguageType comparison instead of LanguageTag::operator!=() // because here the LanguageTag is already a known LanguageType value // assigned, so LanguageTag does not need to convert to BCP47 for // comparison. if( !m_pLanguageTag || m_pLanguageTag->getLanguageType() != rLanguageTag.getLanguageType() ) _GetLocale( rLanguageTag ); return *m_pLanguageTag; } const com::sun::star::i18n::ForbiddenCharacters& GetForbidden( const LanguageType aLang ) { if( !m_pForbidden || aForbiddenLang != aLang ) _GetForbidden( aLang ); return *m_pForbidden; } sal_uInt16 GetRealScriptOfText( const OUString& rTxt, sal_Int32 nPos ) const; sal_uInt16 GetAllScriptsOfText( const OUString& rTxt ) const; sal_Int32 getGraphemeCount(const OUString& rStr, sal_Int32 nStart, sal_Int32 nEnd) const; sal_Int32 getGraphemeCount(const OUString& rStr) const { return getGraphemeCount(rStr, 0, rStr.getLength()); } }; #define SW_BREAKITER() SwBreakIt::Get() // @@@ backward compatibility @@@ SW_DLLPUBLIC extern SwBreakIt* g_pBreakIt; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ tro/collabora/libreoffice-7-5+backports'>distro/collabora/libreoffice-7-5+backports LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2017-11-02improve constparam lopluginNoel Grandin
2017-10-31loplugin:constantparam in oox,registry,reportdesignNoel Grandin
2017-10-23loplugin:includeform: registryStephan Bergmann
2017-10-20loplugin:constmethod in codemaker,registry,storeNoel Grandin
2017-07-17loplugin:constparams in store,registryNoel Grandin
2017-07-14extend loplugin useuniqueptr to POD typesNoel Grandin
2017-06-12clang-tidy readability-delete-null-pointerNoel Grandin
2017-02-01loplugin:useuniqueptr extend to check local varsNoel Grandin
2017-01-25loplugin: unnecessary destructor oox..saxNoel Grandin
2016-03-17loplugin:constantparam in registryNoel Grandin
2016-02-09Remove excess newlinesChris Sherlock
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
2015-10-07Abstract out repeated code into a lambdaStephan Bergmann
2015-08-20new loplugin automemNoel Grandin
2015-07-03Make RegistryTypeWriter non-copyableStephan Bergmann
2015-07-03Remove RegistryTypeWriter_Api indirectionStephan Bergmann
2015-07-03Remove unused functionsStephan Bergmann
2015-07-03Move module-private includes from include/registry/ to registry/Stephan Bergmann
2015-06-15remove unnecessary check for null when calling deleteNoel Grandin
2015-04-15remove unnecessary use of void in function declarationsNoel Grandin
2015-04-09convert RTReferenceType to scoped enumNoel Grandin
2015-04-09convert RTMethodMode to scoped enumNoel Grandin
2015-04-09convert RT_ACCESS fields to scoped enumNoel Grandin
2015-03-28Clean up C-style casts from pointers to voidStephan Bergmann
2015-03-26const_cast: convert some C-style casts and remove some redundant onesStephan Bergmann
2015-01-05Some loplugin:revisibility clean-upStephan Bergmann
2014-05-23coverity#707966 Uninitialized pointer fieldCaolán McNamara
2014-05-10coverity#707966 Uninitialized pointer fieldCaolán McNamara
2014-03-19coverity#707966 Uninitialized pointer fieldCaolán McNamara
2013-04-07mass removal of rtl:: prefixes for O(U)String*Luboš Luňák
2013-03-27-Wunused-macrosStephan Bergmann