diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /svl/source/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'svl/source/inc')
-rw-r--r-- | svl/source/inc/fsfactory.hxx | 54 | ||||
-rw-r--r-- | svl/source/inc/items_helper.hxx | 60 | ||||
-rw-r--r-- | svl/source/inc/poolio.hxx | 73 | ||||
-rw-r--r-- | svl/source/inc/stringio.hxx | 47 |
4 files changed, 234 insertions, 0 deletions
diff --git a/svl/source/inc/fsfactory.hxx b/svl/source/inc/fsfactory.hxx new file mode 100644 index 0000000000..450337639b --- /dev/null +++ b/svl/source/inc/fsfactory.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVL_SOURCE_INC_FSFACTORY_HXX +#define INCLUDED_SVL_SOURCE_INC_FSFACTORY_HXX + +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/implbase.hxx> +#include <osl/diagnose.h> + +class FSStorageFactory final : public ::cppu::WeakImplHelper< css::lang::XSingleServiceFactory, + css::lang::XServiceInfo > +{ + css::uno::Reference< css::uno::XComponentContext > m_xContext; + +public: + FSStorageFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext ) + : m_xContext( xContext ) + { + OSL_ENSURE( xContext.is(), "No service manager is provided!" ); + } + + // XSingleServiceFactory + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance() override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/inc/items_helper.hxx b/svl/source/inc/items_helper.hxx new file mode 100644 index 0000000000..a86b72eab8 --- /dev/null +++ b/svl/source/inc/items_helper.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/config.h> + +#include <sal/types.h> +#include <svl/whichranges.hxx> + +#include <utility> + +namespace svl::detail +{ +/** + * Determines the number of sal_uInt16s in a container of pairs of + * sal_uInt16s, each representing a range of sal_uInt16s, and total capacity of the ranges. + */ +inline sal_uInt16 CountRanges(const WhichRangesContainer& pRanges) +{ + sal_uInt16 nCapacity = 0; + for (const auto& rPair : pRanges) + { + nCapacity += rangeSize(rPair.first, rPair.second); + } + return nCapacity; +} + +inline bool validRanges2(const WhichRangesContainer& pRanges) +{ + for (sal_Int32 i = 0; i < pRanges.size(); ++i) + { + auto p = pRanges[i]; + if (!validRange(p.first, p.second)) + return false; + // ranges must be sorted + if (i < pRanges.size() - 1 && !validGap(p.second, pRanges[i + 1].first)) + return false; + } + return true; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx new file mode 100644 index 0000000000..118deaf50e --- /dev/null +++ b/svl/source/inc/poolio.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVL_SOURCE_INC_POOLIO_HXX +#define INCLUDED_SVL_SOURCE_INC_POOLIO_HXX + +#include <rtl/ref.hxx> +#include <svl/itempool.hxx> +#include <svl/SfxBroadcaster.hxx> +#include <tools/debug.hxx> +#include <memory> +#include <o3tl/sorted_vector.hxx> +#include <utility> + +class SfxPoolItem; +class SfxItemPoolUser; + +struct SfxItemPool_Impl +{ + SfxBroadcaster aBC; + OUString aName; + std::vector<SfxPoolItem*> maPoolDefaults; + std::vector<SfxPoolItem*>* mpStaticDefaults; + SfxItemPool* mpMaster; + rtl::Reference<SfxItemPool> mpSecondary; + WhichRangesContainer mpPoolRanges; + sal_uInt16 mnStart; + sal_uInt16 mnEnd; + MapUnit eDefMetric; + + SfxItemPool_Impl( SfxItemPool* pMaster, OUString _aName, sal_uInt16 nStart, sal_uInt16 nEnd ) + : aName(std::move(_aName)) + , maPoolDefaults(nEnd - nStart + 1) + , mpStaticDefaults(nullptr) + , mpMaster(pMaster) + , mnStart(nStart) + , mnEnd(nEnd) + , eDefMetric(MapUnit::MapCM) + { + DBG_ASSERT(mnStart, "Start-Which-Id must be greater 0" ); + } + + ~SfxItemPool_Impl() + { + DeleteItems(); + } + + void DeleteItems() + { + maPoolDefaults.clear(); + mpPoolRanges.reset(); + } +}; + +#endif // INCLUDED_SVL_SOURCE_INC_POOLIO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/inc/stringio.hxx b/svl/source/inc/stringio.hxx new file mode 100644 index 0000000000..51d52abeb3 --- /dev/null +++ b/svl/source/inc/stringio.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVL_SOURCE_INC_STRINGIO_HXX +#define INCLUDED_SVL_SOURCE_INC_STRINGIO_HXX + +#include <rtl/ustring.hxx> + +class SvStream; + +/** Read in a Unicode string from a streamed byte string representation. + + @param rStream Some (input) stream. Its Stream/TargetCharSets must + be set to correct values! + + @return On success, returns the reconstructed Unicode string. + */ +OUString readByteString(SvStream& rStream); + +/** Write a byte string representation of a Unicode string into a stream. + + @param rStream Some (output) stream. Its Stream/TargetCharSets must + be set to correct values! + + @param rString Some Unicode string. + */ +void writeByteString(SvStream& rStream, std::u16string_view rString); + +#endif // INCLUDED_SVL_SOURCE_INC_STRINGIO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |