bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / unoidl / unolayer.hxx
blob220880255c2e02c4a7829150f25063a2b03b5ccc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef SD_UNOLAYER_HXX
20 #define SD_UNOLAYER_HXX
22 #include <com/sun/star/container/XIndexAccess.hpp>
23 #include <com/sun/star/drawing/XLayer.hpp>
24 #include <com/sun/star/drawing/XLayerManager.hpp>
26 #include <cppuhelper/implbase5.hxx>
27 #include <comphelper/servicehelper.hxx>
29 #include <unomodel.hxx>
31 class SdrLayer;
32 class SdLayerManager;
33 class SdXImpressDocument;
34 class SvUnoWeakContainer;
36 namespace sd {
37 class View;
39 enum LayerAttribute { VISIBLE, PRINTABLE, LOCKED };
41 /***********************************************************************
42 * *
43 ***********************************************************************/
44 class SdLayer : public ::cppu::WeakImplHelper5< ::com::sun::star::drawing::XLayer,
45 ::com::sun::star::lang::XServiceInfo,
46 ::com::sun::star::container::XChild,
47 ::com::sun::star::lang::XUnoTunnel,
48 ::com::sun::star::lang::XComponent >
50 public:
51 SdLayer( SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_ ) throw();
52 virtual ~SdLayer() throw();
54 // intern
55 SdrLayer* GetSdrLayer() const throw() { return pLayer; }
57 static String convertToInternalName( const OUString& rName );
58 static OUString convertToExternalName( const String& rName );
60 // uno helper
61 UNO3_GETIMPLEMENTATION_DECL( SdLayer )
63 // XServiceInfo
64 virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
65 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
66 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
68 // ::com::sun::star::beans::XPropertySet
69 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
70 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
71 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
72 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
73 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
74 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
75 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
77 // ::com::sun::star::container::XChild
79 /** Returns the layer manager that manages this layer.
81 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
83 // XComponent
84 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
85 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
86 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
88 /** Not implemented. Always throws an exception.
89 @raises NoSupportException.
91 virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
93 private:
94 SdLayerManager* pLayerManager;
95 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayerManager > mxLayerManager;
97 SdrLayer* pLayer;
98 const SvxItemPropertySet* pPropSet;
100 sal_Bool get( LayerAttribute what ) throw();
101 void set( LayerAttribute what, sal_Bool flag ) throw();
108 /***********************************************************************
110 ***********************************************************************/
112 class SdLayerManager : public ::cppu::WeakImplHelper5< ::com::sun::star::drawing::XLayerManager,
113 ::com::sun::star::container::XNameAccess,
114 ::com::sun::star::lang::XServiceInfo,
115 ::com::sun::star::lang::XUnoTunnel,
116 ::com::sun::star::lang::XComponent >
118 friend class SdLayer;
120 public:
121 SdLayerManager( SdXImpressDocument& rMyModel ) throw();
122 virtual ~SdLayerManager() throw();
124 // uno helper
125 UNO3_GETIMPLEMENTATION_DECL( SdLayerManager )
127 // XServiceInfo
128 virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
129 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
130 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
132 // XLayerManager
133 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) throw(::com::sun::star::uno::RuntimeException);
134 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer >& xLayer ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
135 virtual void SAL_CALL attachShapeToLayer( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer >& xLayer ) throw(::com::sun::star::uno::RuntimeException);
136 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer > SAL_CALL getLayerForShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
138 // XIndexAccess
139 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
140 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);
142 // XNameAccess
143 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
144 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
145 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
147 // XElementAccess
148 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
149 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
151 /** Return the <type>XLayer</type> object that is associated with the
152 given <type>SdrLayer</type> object. If the requested object does
153 not yet exist it is created. All calls with the same argument
154 return the same object.
155 @param pLayer
156 The <type>SdrLayer</type> object for which to return the
157 associated <type>XLayer</type> object.
158 @return
159 The returned value is the unique <type>XLayer</type> object
160 associated with the specified argument. If no layer can be
161 created for the argument than an empty reference is returned.
163 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> GetLayer (SdrLayer* pLayer);
165 // XComponent
166 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
167 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
168 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
170 private:
171 SdXImpressDocument* mpModel;
172 SvUnoWeakContainer* mpLayers;
174 ::sd::View* GetView() const throw();
175 ::sd::DrawDocShell* GetDocShell() const throw() { return mpModel->mpDocShell; }
176 void UpdateLayerView( sal_Bool modify = sal_True ) const throw();
179 #endif
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */