1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <com/sun/star/uno/Any.hxx>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 #include <com/sun/star/container/XIndexAccess.hpp>
29 #include <com/sun/star/container/XNameContainer.hpp>
30 #include <com/sun/star/container/XNamed.hpp>
32 #include <rtl/ref.hxx>
34 #include <cppuhelper/implbase.hxx>
36 #include <svl/style.hxx>
40 struct SdStyleFamilyImpl
;
42 class SdStyleFamily final
: public ::cppu::WeakImplHelper
< css::container::XNameContainer
, css::container::XNamed
, css::container::XIndexAccess
, css::lang::XSingleServiceFactory
, css::lang::XServiceInfo
, css::lang::XComponent
, css::beans::XPropertySet
>
45 /// creates the style family for the given SfxStyleFamily
46 SdStyleFamily( rtl::Reference
< SfxStyleSheetPool
> xPool
, SfxStyleFamily nFamily
);
48 /// creates the presentation family for the given masterpage
49 SdStyleFamily( const rtl::Reference
< SfxStyleSheetPool
>& xPool
, const SdPage
* pMasterPage
);
51 virtual ~SdStyleFamily() override
;
54 virtual OUString SAL_CALL
getImplementationName() override
;
55 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
56 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
59 virtual OUString SAL_CALL
getName( ) override
;
60 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
63 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
64 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
65 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
68 virtual css::uno::Type SAL_CALL
getElementType() override
;
69 virtual sal_Bool SAL_CALL
hasElements() override
;
72 virtual sal_Int32 SAL_CALL
getCount() override
;
73 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
76 virtual void SAL_CALL
insertByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
77 virtual void SAL_CALL
removeByName( const OUString
& Name
) override
;
80 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
82 // XSingleServiceFactory
83 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstance( ) override
;
84 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstanceWithArguments( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
87 virtual void SAL_CALL
dispose( ) override
;
88 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
89 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
92 virtual css::uno::Reference
<css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
93 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
94 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
95 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
<css::beans::XPropertyChangeListener
>& xListener
) override
;
96 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
<css::beans::XPropertyChangeListener
>& aListener
) override
;
97 virtual void SAL_CALL
addVetoableChangeListener(const OUString
& PropertyName
, const css::uno::Reference
<css::beans::XVetoableChangeListener
>& aListener
) override
;
98 virtual void SAL_CALL
removeVetoableChangeListener(const OUString
& PropertyName
,const css::uno::Reference
<css::beans::XVetoableChangeListener
>&aListener
) override
;
101 /// @throws css::uno::RuntimeException
102 void throwIfDisposed() const;
103 /// @throws css::lang::IllegalArgumentException
104 SdStyleSheet
* GetValidNewSheet( const css::uno::Any
& rElement
);
105 /// @throws css::container::NoSuchElementException
106 /// @throws css::lang::WrappedTargetException
107 SdStyleSheet
* GetSheetByName( const OUString
& rName
);
109 SfxStyleFamily mnFamily
;
110 rtl::Reference
< SfxStyleSheetPool
> mxPool
;
111 std::unique_ptr
<SdStyleFamilyImpl
> mpImpl
;
114 typedef rtl::Reference
< SdStyleFamily
> SdStyleFamilyRef
;
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */