1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
25cdf0e10cSrcweir #define _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _CPPUHELPER_PROPSHLP_HXX
28cdf0e10cSrcweir #include <cppuhelper/propshlp.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE4_HXX_
31cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef DBA_CONTENTHELPER_HXX
34cdf0e10cSrcweir #include "ContentHelper.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
37cdf0e10cSrcweir #include <comphelper/propertystatecontainer.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
40cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _DBASHARED_APITOOLS_HXX_
43cdf0e10cSrcweir #include "apitools.hxx"
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _COMPHELPER_UNO3_HXX_
46cdf0e10cSrcweir #include <comphelper/uno3.hxx>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
49cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
52cdf0e10cSrcweir #include <com/sun/star/frame/XComponentLoader.hpp>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
55cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir #ifndef _COM_SUN_STAR_EMBED_XSTATECHANGELISTENER_HPP_
58cdf0e10cSrcweir #include <com/sun/star/embed/XStateChangeListener.hpp>
59cdf0e10cSrcweir #endif
60cdf0e10cSrcweir #include <com/sun/star/sdb/XSubDocument.hpp>
61cdf0e10cSrcweir #include <com/sun/star/util/XCloseListener.hpp>
62cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalName.hpp>
63cdf0e10cSrcweir 
64cdf0e10cSrcweir namespace comphelper
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     class NamedValueCollection;
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir //........................................................................
70cdf0e10cSrcweir namespace dbaccess
71cdf0e10cSrcweir {
72cdf0e10cSrcweir //........................................................................
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	class OInterceptor;
75cdf0e10cSrcweir 	class OEmbeddedClientHelper;
76cdf0e10cSrcweir //==========================================================================
77cdf0e10cSrcweir //= ODocumentDefinition - a database "document" which is simply a link to a real
78cdf0e10cSrcweir //=					  document
79cdf0e10cSrcweir //==========================================================================
80cdf0e10cSrcweir 
81cdf0e10cSrcweir typedef ::cppu::ImplHelper4 <   ::com::sun::star::embed::XComponentSupplier
82cdf0e10cSrcweir                             ,   ::com::sun::star::sdb::XSubDocument
83cdf0e10cSrcweir                             ,   ::com::sun::star::util::XCloseListener
84cdf0e10cSrcweir                             ,   ::com::sun::star::container::XHierarchicalName
85cdf0e10cSrcweir                             >   ODocumentDefinition_Base;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir class ODocumentDefinition
88cdf0e10cSrcweir 		:public OContentHelper
89cdf0e10cSrcweir 		,public ::comphelper::OPropertyStateContainer
90cdf0e10cSrcweir 		,public ::comphelper::OPropertyArrayUsageHelper< ODocumentDefinition >
91cdf0e10cSrcweir         ,public ODocumentDefinition_Base
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject>			m_xEmbeddedObject;
94cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >	m_xListener;
95cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >             m_xLastKnownConnection;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	OInterceptor*																		m_pInterceptor;
98cdf0e10cSrcweir 	sal_Bool																			m_bForm; // <TRUE/> if it is a form
99cdf0e10cSrcweir 	sal_Bool																			m_bOpenInDesign;
100cdf0e10cSrcweir 	sal_Bool																			m_bInExecute;
101cdf0e10cSrcweir     sal_Bool																			m_bRemoveListener;
102cdf0e10cSrcweir 	OEmbeddedClientHelper*																m_pClientHelper;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir protected:
105cdf0e10cSrcweir 	virtual ~ODocumentDefinition();
106cdf0e10cSrcweir 
107cdf0e10cSrcweir public:
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	ODocumentDefinition(
110cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer,
111cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&,
112cdf0e10cSrcweir 			const TContentPtr& _pImpl,
113cdf0e10cSrcweir 			sal_Bool _bForm
114cdf0e10cSrcweir 		);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     void    initialLoad(
117cdf0e10cSrcweir 			    const ::com::sun::star::uno::Sequence< sal_Int8 >& i_rClassID,
118cdf0e10cSrcweir                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rCreationArgs,
119cdf0e10cSrcweir 			    const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& i_rConnection
120cdf0e10cSrcweir             );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir // com::sun::star::lang::XTypeProvider
123cdf0e10cSrcweir 	DECLARE_TYPEPROVIDER( );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir // ::com::sun::star::uno::XInterface
126cdf0e10cSrcweir 	DECLARE_XINTERFACE( )
127cdf0e10cSrcweir 
128cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo
129cdf0e10cSrcweir 	DECLARE_SERVICE_INFO_STATIC();
130cdf0e10cSrcweir 
131cdf0e10cSrcweir // ::com::sun::star::beans::XPropertySet
132cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     // OPropertySetHelper
135cdf0e10cSrcweir 	virtual void SAL_CALL getFastPropertyValue(
136cdf0e10cSrcweir                                 ::com::sun::star::uno::Any& o_rValue,
137cdf0e10cSrcweir                                 sal_Int32 i_nHandle
138cdf0e10cSrcweir                             ) const;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	// XComponentSupplier
141cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent(  ) throw (::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     // XSubDocument
144cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL open(  ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL openDesign(  ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir     virtual void SAL_CALL store(  ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL close(  ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	// XHierarchicalName
150cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getHierarchicalName(  ) throw (::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL composeHierarchicalName( const ::rtl::OUString& aRelativeName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir 
153cdf0e10cSrcweir // OPropertySetHelper
154cdf0e10cSrcweir 	virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	// XCommandProcessor
157cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::ucb::Command& aCommand, sal_Int32 CommandId, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& Environment ) throw (::com::sun::star::uno::Exception, ::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::RuntimeException) ;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	// XRename
160cdf0e10cSrcweir 	virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     // XCloseListener
163cdf0e10cSrcweir     virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir     virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     // XEventListener
167cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     /** returns the forms/reports container storage, depending on m_bForm. Our own storage
170cdf0e10cSrcweir         inside this container storage is the one with the name as indicated by m_pImpl->m_aProps.sPersistentName.
171cdf0e10cSrcweir     */
172cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
173cdf0e10cSrcweir         getContainerStorage() const;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	sal_Bool save(sal_Bool _bApprove);
176cdf0e10cSrcweir     sal_Bool saveAs();
177cdf0e10cSrcweir 	void closeObject();
178cdf0e10cSrcweir 	sal_Bool isModified();
isNewReport() const179cdf0e10cSrcweir     inline sal_Bool isNewReport() const { return !m_bForm && !m_pImpl->m_aProps.bAsTemplate; }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	static void fillReportData(
182cdf0e10cSrcweir                     const ::comphelper::ComponentContext& _rContext,
183cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >& _rxComponent,
184cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActiveConnection
185cdf0e10cSrcweir                 );
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
getConnection() const188cdf0e10cSrcweir         getConnection() const { return m_xLastKnownConnection; }
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     /** prepares closing the document component
191cdf0e10cSrcweir 
192cdf0e10cSrcweir         The method suspends the controller associated with the document, and saves the document
193cdf0e10cSrcweir         if necessary.
194cdf0e10cSrcweir 
195cdf0e10cSrcweir         @return
196cdf0e10cSrcweir             <TRUE/> if and only if the document component can be closed
197cdf0e10cSrcweir     */
198cdf0e10cSrcweir     bool prepareClose();
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     static ::com::sun::star::uno::Sequence< sal_Int8 > getDefaultDocumentTypeClassId();
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     static ::rtl::OUString GetDocumentServiceFromMediaType(
203cdf0e10cSrcweir         const ::rtl::OUString& _rMediaType,
204cdf0e10cSrcweir         const ::comphelper::ComponentContext& _rContext,
205cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId
206cdf0e10cSrcweir     );
207cdf0e10cSrcweir     static ::rtl::OUString GetDocumentServiceFromMediaType(
208cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxContainerStorage,
209cdf0e10cSrcweir         const ::rtl::OUString& _rEntityName,
210cdf0e10cSrcweir         const ::comphelper::ComponentContext& _rContext,
211cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId
212cdf0e10cSrcweir     );
213cdf0e10cSrcweir 
NotifierAccessdbaccess::ODocumentDefinition::NotifierAccess214cdf0e10cSrcweir     struct NotifierAccess { friend class NameChangeNotifier; private: NotifierAccess() { } };
getCurrentName() const215cdf0e10cSrcweir     const ::rtl::OUString& getCurrentName() const { return m_pImpl->m_aProps.aTitle; }
216cdf0e10cSrcweir     void firePropertyChange(
217cdf0e10cSrcweir                   sal_Int32 i_nHandle,
218cdf0e10cSrcweir             const ::com::sun::star::uno::Any& i_rNewValue,
219cdf0e10cSrcweir             const ::com::sun::star::uno::Any& i_rOldValue,
220cdf0e10cSrcweir                   sal_Bool i_bVetoable,
221cdf0e10cSrcweir             const NotifierAccess
222cdf0e10cSrcweir         );
223cdf0e10cSrcweir 
224cdf0e10cSrcweir private:
225cdf0e10cSrcweir     /** does necessary initializations after our embedded object has been switched to ACTIVE
226cdf0e10cSrcweir     */
227cdf0e10cSrcweir     void    impl_onActivateEmbeddedObject_nothrow( const bool i_bReactivated );
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     /** initializes a newly created view/controller of a form which is displaying our embedded object
230cdf0e10cSrcweir 
231cdf0e10cSrcweir         Has only to be called if the respective embedded object has been loaded for design (and
232cdf0e10cSrcweir         not for data entry)
233cdf0e10cSrcweir 
234cdf0e10cSrcweir         @param  _rxController
235cdf0e10cSrcweir             the controller which belongs to the XModel of our (active) embedded object
236cdf0e10cSrcweir     */
237cdf0e10cSrcweir     static void impl_initFormEditView( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController );
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     /** removes the given frame from the desktop's frame collection
240cdf0e10cSrcweir         @raises ::com::sun::star::uno::RuntimeException
241cdf0e10cSrcweir     */
242cdf0e10cSrcweir     static void impl_removeFrameFromDesktop_throw(
243cdf0e10cSrcweir                     const ::comphelper::ComponentContext& _rContxt,
244cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame
245cdf0e10cSrcweir                 );
246cdf0e10cSrcweir 
247cdf0e10cSrcweir     /** opens the UI for this sub document
248cdf0e10cSrcweir     */
249cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
250cdf0e10cSrcweir             impl_openUI_nolck_throw( bool _bForEditing );
251cdf0e10cSrcweir 
252cdf0e10cSrcweir     /** stores our document, if it's already loaded
253cdf0e10cSrcweir     */
254cdf0e10cSrcweir     void    impl_store_throw();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     /** closes our document, if it's open
257cdf0e10cSrcweir     */
258cdf0e10cSrcweir     bool    impl_close_throw();
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     /** returns our component, creates it if necessary
261cdf0e10cSrcweir     */
262cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >
263cdf0e10cSrcweir             impl_getComponent_throw( const bool i_ForceCreate = true );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     /** shows or hides our component
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         The embedded object must exist, and be in state LOADED, at least.
268cdf0e10cSrcweir     */
269cdf0e10cSrcweir     void    impl_showOrHideComponent_throw( const bool i_bShow );
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 	// OPropertyArrayUsageHelper
272cdf0e10cSrcweir 	virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     // helper
277cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
278cdf0e10cSrcweir 
279cdf0e10cSrcweir     // OContentHelper overridables
280cdf0e10cSrcweir     virtual ::rtl::OUString determineContentType() const;
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	/** fills the load arguments
283cdf0e10cSrcweir 	*/
284cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
285cdf0e10cSrcweir         fillLoadArgs(
286cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
287cdf0e10cSrcweir             const bool _bSuppressMacros,
288cdf0e10cSrcweir 			const bool _bReadOnly,
289cdf0e10cSrcweir             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rOpenCommandArguments,
290cdf0e10cSrcweir 			::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rEmbeddedObjectDescriptor
291cdf0e10cSrcweir         );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir     /** splits the given arguments to an "open*" command into arguments for loading the document, and arguments to be
294cdf0e10cSrcweir         put into the EmbeddedObjectDescriptor
295cdf0e10cSrcweir 
296cdf0e10cSrcweir         Any values already present in <code>o_rDocumentLoadArgs</code> and <code>o_rEmbeddedObjectDescriptor</code>
297cdf0e10cSrcweir         will be overwritten by values from <code>i_rOpenCommandArguments</code>, if applicable, otherwise they will
298cdf0e10cSrcweir         be preserved.
299cdf0e10cSrcweir 
300cdf0e10cSrcweir         @param i_rOpenCommandArguments
301cdf0e10cSrcweir             the arguments passed to the "open*" command at the content
302cdf0e10cSrcweir         @param o_rDocumentLoadArgs
303cdf0e10cSrcweir             the arguments to be passed when actually loading the embedded document.
304cdf0e10cSrcweir         @param o_rEmbeddedObjectDescriptor
305cdf0e10cSrcweir             the EmbeddedObjectDescriptor to be passed when initializing the embedded object
306cdf0e10cSrcweir     */
307cdf0e10cSrcweir     void separateOpenCommandArguments(
308cdf0e10cSrcweir             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&    i_rOpenCommandArguments,
309cdf0e10cSrcweir             ::comphelper::NamedValueCollection&                                                 o_rDocumentLoadArgs,
310cdf0e10cSrcweir             ::comphelper::NamedValueCollection&                                                 o_rEmbeddedObjectDescriptor
311cdf0e10cSrcweir         );
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	/** loads the EmbeddedObject if not already loaded
314cdf0e10cSrcweir 		@param	_aClassID
315cdf0e10cSrcweir 			If set, it will be used to create the embedded object.
316cdf0e10cSrcweir 	*/
317cdf0e10cSrcweir 	void loadEmbeddedObject(
318cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
319cdf0e10cSrcweir                 const ::com::sun::star::uno::Sequence< sal_Int8 >& _aClassID,
320cdf0e10cSrcweir                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rAdditionalArgs,
321cdf0e10cSrcweir                 const bool _bSuppressMacros,
322cdf0e10cSrcweir 				const bool _bReadOnly
323cdf0e10cSrcweir             );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir     /** loads the embedded object, if not already loaded. No new object can be created with this method.
326cdf0e10cSrcweir     */
loadEmbeddedObject(bool _bSuppressMacros=false)327cdf0e10cSrcweir     void    loadEmbeddedObject( bool _bSuppressMacros = false )
328cdf0e10cSrcweir     {
329cdf0e10cSrcweir         loadEmbeddedObject(
330cdf0e10cSrcweir             NULL,
331cdf0e10cSrcweir             ::com::sun::star::uno::Sequence< sal_Int8 >(),
332cdf0e10cSrcweir             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(),
333cdf0e10cSrcweir             _bSuppressMacros,
334cdf0e10cSrcweir             false
335cdf0e10cSrcweir         );
336cdf0e10cSrcweir     }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir     /** loads the embedded object for preview. Macros will be suppressed, and the document will
339cdf0e10cSrcweir         be read-only.
340cdf0e10cSrcweir     */
loadEmbeddedObjectForPreview()341cdf0e10cSrcweir     void    loadEmbeddedObjectForPreview()
342cdf0e10cSrcweir     {
343cdf0e10cSrcweir         loadEmbeddedObject(
344cdf0e10cSrcweir             NULL,
345cdf0e10cSrcweir             ::com::sun::star::uno::Sequence< sal_Int8 >(),
346cdf0e10cSrcweir             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(),
347cdf0e10cSrcweir             true,
348cdf0e10cSrcweir             true
349cdf0e10cSrcweir         );
350cdf0e10cSrcweir     }
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 	/** searches for read-only flag in the args of the model and sets it to the given value,
353cdf0e10cSrcweir 		if the value was not found, it will be appended.
354cdf0e10cSrcweir 		@param	_bReadOnly
355cdf0e10cSrcweir 			If <TRUE/> the document will be switched to readonly mode
356cdf0e10cSrcweir 	*/
357cdf0e10cSrcweir 	void updateDocumentTitle();
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	void registerProperties();
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     /** determines whether the document we represent supports embedded scripts and macros
362cdf0e10cSrcweir     */
363cdf0e10cSrcweir     sal_Bool objectSupportsEmbeddedScripts() const;
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     //-------------------------------------------------------------------------
366cdf0e10cSrcweir     //- commands
367cdf0e10cSrcweir     //-------------------------------------------------------------------------
368cdf0e10cSrcweir 
369cdf0e10cSrcweir     void onCommandGetDocumentProperties( ::com::sun::star::uno::Any& _rProps );
370cdf0e10cSrcweir 	void onCommandInsert( const ::rtl::OUString& _sURL, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( ::com::sun::star::uno::Exception );
371cdf0e10cSrcweir 	void onCommandPreview( ::com::sun::star::uno::Any& _rImage );
372cdf0e10cSrcweir     ::com::sun::star::uno::Any
373cdf0e10cSrcweir         onCommandOpenSomething(
374cdf0e10cSrcweir             const ::com::sun::star::uno::Any& _rArgument,
375cdf0e10cSrcweir             const bool _bActivate,
376cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& _rxEnvironment
377cdf0e10cSrcweir         );
378cdf0e10cSrcweir private:
379cdf0e10cSrcweir     using ::cppu::OPropertySetHelper::getFastPropertyValue;
380cdf0e10cSrcweir };
381cdf0e10cSrcweir 
382cdf0e10cSrcweir class NameChangeNotifier
383cdf0e10cSrcweir {
384cdf0e10cSrcweir public:
385cdf0e10cSrcweir     NameChangeNotifier(
386cdf0e10cSrcweir         ODocumentDefinition& i_rDocumentDefinition,
387cdf0e10cSrcweir         const ::rtl::OUString& i_rNewName,
388cdf0e10cSrcweir         ::osl::ResettableMutexGuard& i_rClearForNotify
389cdf0e10cSrcweir     );
390cdf0e10cSrcweir     ~NameChangeNotifier();
391cdf0e10cSrcweir 
392cdf0e10cSrcweir private:
393cdf0e10cSrcweir             ODocumentDefinition&            m_rDocumentDefinition;
394cdf0e10cSrcweir     const   ::com::sun::star::uno::Any      m_aOldValue;
395cdf0e10cSrcweir     const   ::com::sun::star::uno::Any      m_aNewValue;
3967925e912SMichael Stahl             ::osl::ResettableMutexGuard&    m_rClearForNotify;
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     void    impl_fireEvent_throw( const sal_Bool i_bVetoable );
399cdf0e10cSrcweir };
400cdf0e10cSrcweir 
401cdf0e10cSrcweir //........................................................................
402cdf0e10cSrcweir }	// namespace dbaccess
403cdf0e10cSrcweir //........................................................................
404cdf0e10cSrcweir 
405cdf0e10cSrcweir #endif // _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
406cdf0e10cSrcweir 
407