1*c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c45d927aSAndrew Rist * distributed with this work for additional information 6*c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9*c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10*c45d927aSAndrew Rist * 11*c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*c45d927aSAndrew Rist * 13*c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c45d927aSAndrew Rist * software distributed under the License is distributed on an 15*c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17*c45d927aSAndrew Rist * specific language governing permissions and limitations 18*c45d927aSAndrew Rist * under the License. 19*c45d927aSAndrew Rist * 20*c45d927aSAndrew Rist *************************************************************/ 21*c45d927aSAndrew Rist 22*c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SD_STLPOOL_HXX 25cdf0e10cSrcweir #define _SD_STLPOOL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 28cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 29cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 31cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 36cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx> 37cdf0e10cSrcweir #include <map> 38cdf0e10cSrcweir #include <vector> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <stlfamily.hxx> 41cdf0e10cSrcweir #include <stlsheet.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <sddllapi.h> 44cdf0e10cSrcweir 45cdf0e10cSrcweir class SdStyleSheet; 46cdf0e10cSrcweir class SdDrawDocument; 47cdf0e10cSrcweir class SdPage; 48cdf0e10cSrcweir 49cdf0e10cSrcweir typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap; 50cdf0e10cSrcweir 51cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper4< SfxStyleSheetPool, 52cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo, 53cdf0e10cSrcweir ::com::sun::star::container::XIndexAccess, 54cdf0e10cSrcweir ::com::sun::star::container::XNameAccess, 55cdf0e10cSrcweir ::com::sun::star::lang::XComponent > SdStyleSheetPoolBase; 56cdf0e10cSrcweir 57cdf0e10cSrcweir class SdStyleSheetPool : public SdStyleSheetPoolBase, public SfxListener 58cdf0e10cSrcweir { 59cdf0e10cSrcweir friend class SdDrawDocument; 60cdf0e10cSrcweir public: 61cdf0e10cSrcweir SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument); 62cdf0e10cSrcweir SetActualStyleSheet(SfxStyleSheetBase * pActStyleSheet)63cdf0e10cSrcweir void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; } GetActualStyleSheet()64cdf0e10cSrcweir SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; } 65cdf0e10cSrcweir 66cdf0e10cSrcweir SfxStyleSheetBase* GetTitleSheet(const String& rLayoutName); 67cdf0e10cSrcweir 68cdf0e10cSrcweir // Caller muss Liste loeschen 69cdf0e10cSrcweir List* CreateOutlineSheetList(const String& rLayoutName); 70cdf0e10cSrcweir 71cdf0e10cSrcweir /** creates all layout style sheets for the givin layout name if they 72cdf0e10cSrcweir don't exist yet. 73cdf0e10cSrcweir 74cdf0e10cSrcweir @param rLayoutName Must be the name of a master page 75cdf0e10cSrcweir @param bCheck If set to true, the debug version will assert if a style 76cdf0e10cSrcweir had to be created. This is used to assert errors in documents 77cdf0e10cSrcweir when styles are missing. 78cdf0e10cSrcweir */ 79cdf0e10cSrcweir SD_DLLPUBLIC void CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck = sal_False ); 80cdf0e10cSrcweir List* CreateLayoutSheetNames(const String& rLayoutName) const; 81cdf0e10cSrcweir void CreateLayoutSheetList(const String& rLayoutName, SdStyleSheetVector& rLayoutSheets); 82cdf0e10cSrcweir void CopyLayoutSheets(const String& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets ); 83cdf0e10cSrcweir void CopyGraphicSheets(SdStyleSheetPool& rSourcePool); 84cdf0e10cSrcweir void CopyCellSheets(SdStyleSheetPool& rSourcePool); 85cdf0e10cSrcweir void CopyTableStyles(SdStyleSheetPool& rSourcePool); 86cdf0e10cSrcweir 87cdf0e10cSrcweir void CreatePseudosIfNecessary(); 88cdf0e10cSrcweir void UpdateStdNames(); 89cdf0e10cSrcweir static void PutNumBulletItem( SfxStyleSheetBase* pSheet, Font& rBulletFont ); 90cdf0e10cSrcweir Font GetBulletFont() const; 91cdf0e10cSrcweir GetDoc() const92cdf0e10cSrcweir SdDrawDocument* GetDoc() const { return mpDoc; } 93cdf0e10cSrcweir 94cdf0e10cSrcweir static SdStyleSheetVector CreateChildList( SdStyleSheet* pSheet ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir 97cdf0e10cSrcweir public: 98cdf0e10cSrcweir void throwIfDisposed() throw(::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir 100cdf0e10cSrcweir // XServiceInfo 101cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // XNameAccess 106cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 107cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir 110cdf0e10cSrcweir // XElementAccess 111cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 113cdf0e10cSrcweir 114cdf0e10cSrcweir // XIndexAccess 115cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; 116cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 117cdf0e10cSrcweir 118cdf0e10cSrcweir // XComponent 119cdf0e10cSrcweir virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); 120cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 121cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 122cdf0e10cSrcweir 123cdf0e10cSrcweir virtual void SAL_CALL acquire (void) throw (); 124cdf0e10cSrcweir virtual void SAL_CALL release (void) throw (); 125cdf0e10cSrcweir protected: 126cdf0e10cSrcweir void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir virtual SfxStyleSheetBase* Create(const String& rName, SfxStyleFamily eFamily, sal_uInt16 nMask); 129cdf0e10cSrcweir virtual SfxStyleSheetBase* Create(const SdStyleSheet& rStyle); 130cdf0e10cSrcweir 131cdf0e10cSrcweir using SfxStyleSheetPool::Create; 132cdf0e10cSrcweir virtual ~SdStyleSheetPool(); 133cdf0e10cSrcweir 134cdf0e10cSrcweir void AddStyleFamily( const SdPage* pPage ); 135cdf0e10cSrcweir void RemoveStyleFamily( const SdPage* pPage ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir private: 138cdf0e10cSrcweir SfxStyleSheetBase* mpActualStyleSheet; 139cdf0e10cSrcweir SdDrawDocument* mpDoc; 140cdf0e10cSrcweir SdStyleFamilyRef mxGraphicFamily; 141cdf0e10cSrcweir SdStyleFamilyRef mxCellFamily; 142cdf0e10cSrcweir SdStyleFamilyMap maStyleFamilyMap; 143cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxTableFamily; 144cdf0e10cSrcweir rtl::OUString msTableFamilyName; 145cdf0e10cSrcweir }; 146cdf0e10cSrcweir 147cdf0e10cSrcweir #endif // _SD_STLPOOL_HXX 148