xref: /trunk/main/sfx2/source/inc/tplcomp.hxx (revision 353d8f4d)
1*353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*353d8f4dSAndrew Rist  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*353d8f4dSAndrew Rist  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19*353d8f4dSAndrew Rist  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _TPLCOMP_HXX
25cdf0e10cSrcweir #define _TPLCOMP_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <osl/mutex.hxx>
28cdf0e10cSrcweir //ASDBG #ifndef _USR_UNO_HXX
29cdf0e10cSrcweir //ASDBG #include <usr/uno.hxx>
30cdf0e10cSrcweir //ASDBG #endif
31cdf0e10cSrcweir //ASDBG #ifndef _USR_LSTCOMP_HXX
32cdf0e10cSrcweir //ASDBG #include <usr/iterhlp.hxx>
33cdf0e10cSrcweir //ASDBG #endif
34cdf0e10cSrcweir //ASDBG #ifndef _USR_SERVICES_HXX
35cdf0e10cSrcweir //ASDBG #include <usr/services.hxx>
36cdf0e10cSrcweir //ASDBG #endif
37cdf0e10cSrcweir #include <com/sun/star/chaos/XCommandExecutor.hpp>
38cdf0e10cSrcweir #include <com/sun/star/chaos/XStatusCallback.hpp>
39cdf0e10cSrcweir #include <com/sun/star/chaos/UnknownCommandException.hpp>
40cdf0e10cSrcweir #include <com/sun/star/chaos/StatusCallbackEvent.hpp>
41cdf0e10cSrcweir #include <com/sun/star/chaos/XURLContent.hpp>
42cdf0e10cSrcweir #include <com/sun/star/chaos/XExplorerExchange.hpp>
43cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp>
44cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
45cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
46cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp>
47cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp>
48cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp>
49cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp>
50cdf0e10cSrcweir #include <com/sun/star/beans/XVetoableChangeListener.hpp>
51cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
52cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
53cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
54cdf0e10cSrcweir #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
55cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
56cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
57cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp>
58cdf0e10cSrcweir #include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
59cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp>
60cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
61cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
62cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
63cdf0e10cSrcweir 
64cdf0e10cSrcweir class CntAnchor;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir class TplAnchorListener;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // -----------------
69cdf0e10cSrcweir // - TplComponent -
70cdf0e10cSrcweir // -----------------
71cdf0e10cSrcweir 
72cdf0e10cSrcweir class TplComponent : public ::com::sun::star::chaos::XURLContent, public ::com::sun::star::chaos::XCommandExecutor,
73cdf0e10cSrcweir 					 public ::com::sun::star::beans::XPropertySet, public ::com::sun::star::chaos::XExplorerExchange,
74cdf0e10cSrcweir 					 public ::cppu::OWeakObject, public ::com::sun::star::lang::XServiceInfo
75cdf0e10cSrcweir {
76cdf0e10cSrcweir private:
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	void						HandleNewEvt( const ::rtl::OUString& rCommand,
79cdf0e10cSrcweir 											  const ::com::sun::star::uno::Any& rAny );
80cdf0e10cSrcweir 	void						CreatePopupMenu( ::com::sun::star::uno::Any& rAny ) const;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir protected:
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	::rtl::OUString						maURL;
85cdf0e10cSrcweir 	::rtl::OUString						maName;
86cdf0e10cSrcweir     ::osl::Mutex         aMutex;
87cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper maListeners;
88cdf0e10cSrcweir 	TplAnchorListener*			mpListener;
89cdf0e10cSrcweir 	short						mnOpenMode;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 								TplComponent();
96cdf0e10cSrcweir 								~TplComponent();
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	// interface  ::com::sun::star::ucb::XContent
getParent()99cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >  SAL_CALL		getParent() throw ( ::com::sun::star::uno::RuntimeException )
100cdf0e10cSrcweir 			{ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >  aRef; return aRef; }
setParent(const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & Parent)101cdf0e10cSrcweir 	virtual void	    SAL_CALL				setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Parent ) throw ( ::com::sun::star::uno::RuntimeException )
102cdf0e10cSrcweir 			{}
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	// interface  ::com::sun::star::chaos::XURLContent
getURL()105cdf0e10cSrcweir 	virtual ::rtl::OUString	  SAL_CALL				getURL()  throw ( ::com::sun::star::uno::RuntimeException )
106cdf0e10cSrcweir 			{ return maURL; }
107cdf0e10cSrcweir 	virtual sal_Bool	   SAL_CALL				initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XURLContent > & aParent, const ::rtl::OUString& aURL ) throw ( ::com::sun::star::uno::RuntimeException );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	// interface  ::com::sun::star::chaos::XCommandExecutor
110cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >  SAL_CALL	 queryCommands()  throw ( ::com::sun::star::uno::RuntimeException );
cancel(const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & rCommandId)111cdf0e10cSrcweir 	virtual void	   SAL_CALL				cancel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rCommandId ) throw ( ::com::sun::star::uno::RuntimeException )
112cdf0e10cSrcweir 			{}
113cdf0e10cSrcweir 	virtual void	   SAL_CALL				execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Any& rArgs,
114cdf0e10cSrcweir 										 const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XStatusCallback > & rCallback ) throw ( ::com::sun::star::uno::RuntimeException );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	// interface  ::com::sun::star::beans::XPropertySet
117cdf0e10cSrcweir 	virtual	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >  SAL_CALL	 getPropertySetInfo()  throw ( ::com::sun::star::uno::RuntimeException );
118cdf0e10cSrcweir     virtual void      SAL_CALL	           setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw ( ::com::sun::star::uno::RuntimeException );
119cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any	 SAL_CALL				getPropertyValue( const ::rtl::OUString& aPropertyName )  throw ( ::com::sun::star::uno::RuntimeException );
120cdf0e10cSrcweir 	virtual void	  SAL_CALL				addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
121cdf0e10cSrcweir                                                            const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException );
122cdf0e10cSrcweir 	virtual void	  SAL_CALL				removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
123cdf0e10cSrcweir                                                               const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException );
124cdf0e10cSrcweir 	virtual void	  SAL_CALL				addVetoableChangeListener( const ::rtl::OUString& aPropertyName,
125cdf0e10cSrcweir                                                            const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException );
126cdf0e10cSrcweir 	virtual void	  SAL_CALL				removeVetoableChangeListener( const ::rtl::OUString& aPropertyName,
127cdf0e10cSrcweir                                                               const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener ) throw ( ::com::sun::star::uno::RuntimeException );
128cdf0e10cSrcweir 	// interface  ::com::sun::star::chaos::XExplorerExchange
129cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any	   SAL_CALL				createDataObject( sal_uInt16& nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException );
130cdf0e10cSrcweir 	virtual sal_uInt16	  SAL_CALL				insertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr,
131cdf0e10cSrcweir 												  sal_uInt16 nUserAction,
132cdf0e10cSrcweir 												  sal_uInt16 nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException );
133cdf0e10cSrcweir 	virtual sal_Bool	  SAL_CALL				queryInsertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr,
134cdf0e10cSrcweir 													   sal_uInt16 nUserAction,
135cdf0e10cSrcweir 													   sal_uInt16 nSourceOptions,
136cdf0e10cSrcweir 													   sal_uInt16& nResultingAction,
137cdf0e10cSrcweir 													   sal_uInt16& nDefaultAction ) throw ( ::com::sun::star::uno::RuntimeException );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	// -------------------------------------------------------------
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	void						CreateNewChild( CntAnchor* pAnchor,
143cdf0e10cSrcweir 												const String& rTitle );
144cdf0e10cSrcweir 	void						RemoveChild( CntAnchor* pAnchor );
145cdf0e10cSrcweir 	void						StopListening( CntAnchor* pAnchor );
146cdf0e10cSrcweir 	void						HandleOpenEvt();
147cdf0e10cSrcweir };
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // ------------------------
150cdf0e10cSrcweir // - TplContentsComponent -
151cdf0e10cSrcweir // ------------------------
152cdf0e10cSrcweir 
153cdf0e10cSrcweir class TplContentsListener;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir class TplContentsComponent : public TplComponent
156cdf0e10cSrcweir {
157cdf0e10cSrcweir private:
158cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::chaos::XURLContent > 				_xParent;
159cdf0e10cSrcweir 	TplContentsListener*		_pListener;
160cdf0e10cSrcweir 	SvDataObjectRef				_xObject;
161cdf0e10cSrcweir 	sal_uInt16						_nLayout;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	void						HandleOpenEvt( const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XStatusCallback > & rJob,
164cdf0e10cSrcweir 											   const ::com::sun::star::chaos::StatusCallbackEvent& rEvt );
165cdf0e10cSrcweir 	void						HandleNewEvt( const ::rtl::OUString& rCommand,
166cdf0e10cSrcweir 											  const ::com::sun::star::uno::Any& rAny );
167cdf0e10cSrcweir 	void						HandleInitEvt();
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	void						CreateFileName( String& rName,
170cdf0e10cSrcweir 												String& rDirURL );
171cdf0e10cSrcweir 	void						CreateNewTpl( const String& rFilter,
172cdf0e10cSrcweir 											  const String& rParentDir,
173cdf0e10cSrcweir 											  const String& rFileName,
174cdf0e10cSrcweir 											  const String& rDocName );
175cdf0e10cSrcweir protected:
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	void						CreatePopupMenu( ::com::sun::star::uno::Any& rAny ) const;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir public:
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 								TplContentsComponent();
184cdf0e10cSrcweir 								~TplContentsComponent();
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 	virtual sal_Bool   SAL_CALL				initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XURLContent > & aParent, const ::rtl::OUString& aURL ) throw ( ::com::sun::star::uno::RuntimeException );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	// interface  ::com::sun::star::chaos::XCommandExecutor
190cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >  SAL_CALL	 queryCommands()  throw ( ::com::sun::star::uno::RuntimeException );
191cdf0e10cSrcweir 	virtual void		 SAL_CALL			execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Any& rArgs,
192cdf0e10cSrcweir 										 const ::com::sun::star::uno::Reference< ::com::sun::star::chaos::XStatusCallback > & rCallback ) throw ( ::com::sun::star::uno::RuntimeException );
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 	// interface  ::com::sun::star::beans::XPropertySet
195cdf0e10cSrcweir 	virtual	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >  SAL_CALL	 getPropertySetInfo()  throw ( ::com::sun::star::uno::RuntimeException );
196cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any	  SAL_CALL				getPropertyValue( const ::rtl::OUString& aPropertyName )  throw ( ::com::sun::star::uno::RuntimeException );
197cdf0e10cSrcweir 	virtual void	   SAL_CALL				setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw ( ::com::sun::star::uno::RuntimeException );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	// interface  ::com::sun::star::chaos::XExplorerExchange
200cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any	    SAL_CALL				createDataObject( sal_uInt16& nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException );
201cdf0e10cSrcweir 	virtual sal_uInt16  SAL_CALL					insertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr,
202cdf0e10cSrcweir 												  sal_uInt16 nUserAction,
203cdf0e10cSrcweir 												  sal_uInt16 nSourceOptions ) throw ( ::com::sun::star::uno::RuntimeException );
204cdf0e10cSrcweir 	virtual sal_Bool    SAL_CALL					queryInsertDataObject( const ::com::sun::star::uno::Any& pSotDataObjectPtr,
205cdf0e10cSrcweir 													   sal_uInt16 nUserAction,
206cdf0e10cSrcweir 													   sal_uInt16 nSourceOptions,
207cdf0e10cSrcweir 													   sal_uInt16& nResultingAction,
208cdf0e10cSrcweir 													   sal_uInt16& nDefaultAction ) throw ( ::com::sun::star::uno::RuntimeException );
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	// -------------------------------------------------------------
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 	void						CreateNewChild( CntAnchor* pAnchor );
213cdf0e10cSrcweir 	void						HandleDeleteEvt();
214cdf0e10cSrcweir 	void						SetURL( const ::rtl::OUString& rURL);
215cdf0e10cSrcweir 	void						SetName( const ::rtl::OUString& rNewName );
216cdf0e10cSrcweir };
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 
219cdf0e10cSrcweir #endif
220cdf0e10cSrcweir 
221