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 .
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>
33 class SdXImpressDocument
;
34 class SvUnoWeakContainer
;
39 enum LayerAttribute
{ VISIBLE
, PRINTABLE
, LOCKED
};
41 /***********************************************************************
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
>
51 SdLayer( SdLayerManager
* pLayerManager_
, SdrLayer
* pSdrLayer_
) throw();
52 virtual ~SdLayer() throw();
55 SdrLayer
* GetSdrLayer() const throw() { return pLayer
; }
57 static String
convertToInternalName( const OUString
& rName
);
58 static OUString
convertToExternalName( const String
& rName
);
61 UNO3_GETIMPLEMENTATION_DECL( SdLayer
)
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
);
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
);
94 SdLayerManager
* pLayerManager
;
95 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XLayerManager
> mxLayerManager
;
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
;
121 SdLayerManager( SdXImpressDocument
& rMyModel
) throw();
122 virtual ~SdLayerManager() throw();
125 UNO3_GETIMPLEMENTATION_DECL( SdLayerManager
)
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
);
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
);
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
);
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
);
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.
156 The <type>SdrLayer</type> object for which to return the
157 associated <type>XLayer</type> object.
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
);
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
);
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();
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */