2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* $RCSfile: documentdefinition.hxx,v $
|
2008-05-05 14:50:37 +00:00
|
|
|
* $Revision: 1.30 $
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:46:38 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
|
|
|
|
#define _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
|
|
|
|
|
|
|
|
#ifndef _CPPUHELPER_PROPSHLP_HXX
|
|
|
|
#include <cppuhelper/propshlp.hxx>
|
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef DBA_CONTENTHELPER_HXX
|
|
|
|
#include "ContentHelper.hxx"
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
|
|
|
|
#include <comphelper/propertystatecontainer.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
|
|
|
|
#include <comphelper/proparrhlp.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _DBASHARED_APITOOLS_HXX_
|
|
|
|
#include "apitools.hxx"
|
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef _COMPHELPER_UNO3_HXX_
|
|
|
|
#include <comphelper/uno3.hxx>
|
2000-10-18 15:16:39 +00:00
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
|
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
|
|
|
|
#include <com/sun/star/frame/XComponentLoader.hpp>
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
2005-10-24 07:29:13 +00:00
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
|
|
|
|
#include <com/sun/star/frame/XController.hpp>
|
|
|
|
#endif
|
2004-08-02 14:10:49 +00:00
|
|
|
#ifndef _COM_SUN_STAR_EMBED_XSTATECHANGELISTENER_HPP_
|
|
|
|
#include <com/sun/star/embed/XStateChangeListener.hpp>
|
2000-10-25 06:42:28 +00:00
|
|
|
#endif
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2000-10-18 15:16:39 +00:00
|
|
|
//........................................................................
|
|
|
|
namespace dbaccess
|
|
|
|
{
|
|
|
|
//........................................................................
|
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
class OInterceptor;
|
|
|
|
class OEmbeddedClientHelper;
|
2000-09-18 23:16:46 +00:00
|
|
|
//==========================================================================
|
|
|
|
//= ODocumentDefinition - a database "document" which is simply a link to a real
|
|
|
|
//= document
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-03-06 17:00:42 +00:00
|
|
|
typedef ::cppu::ImplHelper1 < ::com::sun::star::embed::XComponentSupplier
|
|
|
|
> ODocumentDefinition_Base;
|
2005-12-21 12:36:17 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
class ODocumentDefinition
|
2004-08-02 14:10:49 +00:00
|
|
|
:public OContentHelper
|
|
|
|
,public ::comphelper::OPropertyStateContainer
|
2000-10-11 10:21:40 +00:00
|
|
|
,public ::comphelper::OPropertyArrayUsageHelper< ODocumentDefinition >
|
2004-08-02 14:10:49 +00:00
|
|
|
,public ODocumentDefinition_Base
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2004-08-02 14:10:49 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject> m_xEmbeddedObject;
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener > m_xListener;
|
2006-02-07 09:19:24 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > m_xDesktop;
|
2005-03-18 15:33:00 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xLastKnownConnection;
|
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
OInterceptor* m_pInterceptor;
|
|
|
|
sal_Bool m_bForm; // <TRUE/> if it is a form
|
2005-01-21 16:04:48 +00:00
|
|
|
sal_Bool m_bOpenInDesign;
|
2005-09-23 11:06:40 +00:00
|
|
|
sal_Bool m_bInExecute;
|
2004-08-02 14:10:49 +00:00
|
|
|
OEmbeddedClientHelper* m_pClientHelper;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
protected:
|
2004-08-02 14:10:49 +00:00
|
|
|
virtual ~ODocumentDefinition();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
public:
|
2001-02-07 12:15:00 +00:00
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
ODocumentDefinition(
|
2004-08-02 14:10:49 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer
|
|
|
|
,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
|
|
|
|
,const TContentPtr& _pImpl
|
|
|
|
,sal_Bool _bForm
|
|
|
|
,const ::com::sun::star::uno::Sequence< sal_Int8 >& _aClassID = ::com::sun::star::uno::Sequence< sal_Int8 >()
|
|
|
|
,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>()
|
2000-09-18 23:16:46 +00:00
|
|
|
);
|
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
DECLARE_TYPEPROVIDER( );
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
// ::com::sun::star::uno::XInterface
|
2004-08-02 14:10:49 +00:00
|
|
|
DECLARE_XINTERFACE( )
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
2004-08-02 14:10:49 +00:00
|
|
|
DECLARE_SERVICE_INFO_STATIC();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
// ::com::sun::star::beans::XPropertySet
|
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
// XComponentSupplier
|
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent( ) throw (::com::sun::star::uno::RuntimeException);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
// OPropertySetHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
// XCommandProcessor
|
|
|
|
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) ;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
// XRename
|
|
|
|
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);
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-03-06 17:00:42 +00:00
|
|
|
/** returns the forms/reports container storage, depending on m_bForm. Our own storage
|
|
|
|
inside this container storage is the one with the name as indicated by m_pImpl->m_aProps.sPersistentName.
|
|
|
|
*/
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
|
|
|
|
getContainerStorage() const;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
sal_Bool save(sal_Bool _bApprove);
|
2008-01-29 13:06:27 +00:00
|
|
|
sal_Bool saveAs();
|
2004-08-02 14:10:49 +00:00
|
|
|
void closeObject();
|
|
|
|
sal_Bool isModified();
|
2007-11-21 14:39:47 +00:00
|
|
|
void fillReportData();
|
2008-01-29 13:06:27 +00:00
|
|
|
inline sal_Bool isNewReport() const { return !m_bForm && !m_pImpl->m_aProps.bAsTemplate; }
|
2005-09-23 11:06:40 +00:00
|
|
|
|
|
|
|
/** prepares closing the document component
|
|
|
|
|
|
|
|
The method suspends the controller associated with the document, and saves the document
|
|
|
|
if necessary.
|
|
|
|
|
|
|
|
@return
|
|
|
|
<TRUE/> if and only if the document component can be closed
|
|
|
|
*/
|
|
|
|
bool prepareClose();
|
|
|
|
|
2005-12-21 12:36:17 +00:00
|
|
|
static ::com::sun::star::uno::Sequence< sal_Int8 > getDefaultDocumentTypeClassId();
|
|
|
|
|
2005-10-24 07:29:13 +00:00
|
|
|
/** does necessary initializations after our embedded object has been switched to ACTIVE
|
|
|
|
@param _bOpenedInDesignMode
|
|
|
|
determines whether the embedded object has been opened for designing it or for data display
|
|
|
|
*/
|
2007-11-21 14:39:47 +00:00
|
|
|
void impl_onActivateEmbeddedObject();
|
2005-10-24 07:29:13 +00:00
|
|
|
|
|
|
|
/** initializes a newly created view/controller which is displaying our embedded object
|
|
|
|
|
|
|
|
Has only to be called if the respective embedded object has been loaded for design (and
|
|
|
|
not for data entry)
|
|
|
|
|
|
|
|
@param _rxController
|
|
|
|
the controller which belongs to the XModel of our (active) embedded object
|
|
|
|
*/
|
|
|
|
void impl_initObjectEditView( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController );
|
|
|
|
|
2006-02-07 09:19:24 +00:00
|
|
|
/** removes the given frame from the desktop's frame collection
|
|
|
|
@raises ::com::sun::star::uno::RuntimeException
|
|
|
|
*/
|
|
|
|
void impl_removeFrameFromDesktop_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
|
|
|
|
|
2007-07-06 06:54:31 +00:00
|
|
|
static ::rtl::OUString GetDocumentServiceFromMediaType( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage
|
|
|
|
,const ::rtl::OUString& sEntName
|
|
|
|
,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
|
|
|
|
,::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId
|
|
|
|
);
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
protected:
|
2004-08-02 14:10:49 +00:00
|
|
|
// OPropertyArrayUsageHelper
|
2000-09-18 23:16:46 +00:00
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
|
|
|
|
|
2006-08-15 09:45:56 +00:00
|
|
|
virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
|
2004-08-02 14:10:49 +00:00
|
|
|
// helper
|
|
|
|
virtual void SAL_CALL disposing();
|
|
|
|
|
|
|
|
private:
|
2007-11-21 14:39:47 +00:00
|
|
|
/** fills the load arguments
|
|
|
|
*/
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
|
|
|
|
fillLoadArgs(
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
|
|
|
|
const bool _bSuppressMacros,
|
|
|
|
const bool _bReadOnly,
|
|
|
|
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rAdditionalArgs,
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rEmbeddedObjectDescriptor
|
|
|
|
);
|
|
|
|
|
|
|
|
/** loads the EmbeddedObject if not already loaded
|
|
|
|
@param _aClassID
|
|
|
|
If set, it will be used to create the embedded object.
|
|
|
|
*/
|
|
|
|
void loadEmbeddedObject(
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
|
|
|
|
const ::com::sun::star::uno::Sequence< sal_Int8 >& _aClassID,
|
|
|
|
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rAdditionalArgs,
|
|
|
|
const bool _bSuppressMacros,
|
|
|
|
const bool _bReadOnly
|
|
|
|
);
|
|
|
|
|
|
|
|
/** loads the embedded object, if not already loaded. No new object can be created with this method.
|
|
|
|
*/
|
2008-05-05 14:50:37 +00:00
|
|
|
void loadEmbeddedObject( bool _bSuppressMacros = false )
|
2007-11-21 14:39:47 +00:00
|
|
|
{
|
|
|
|
loadEmbeddedObject(
|
|
|
|
NULL,
|
|
|
|
::com::sun::star::uno::Sequence< sal_Int8 >(),
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(),
|
2008-05-05 14:50:37 +00:00
|
|
|
_bSuppressMacros,
|
2007-11-21 14:39:47 +00:00
|
|
|
false
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** loads the embedded object for preview. Macros will be suppressed, and the document will
|
|
|
|
be read-only.
|
|
|
|
*/
|
|
|
|
void loadEmbeddedObjectForPreview()
|
|
|
|
{
|
|
|
|
loadEmbeddedObject(
|
|
|
|
NULL,
|
|
|
|
::com::sun::star::uno::Sequence< sal_Int8 >(),
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(),
|
|
|
|
true,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** searches for read-only flag in the args of the model and sets it to the given value,
|
|
|
|
if the value was not found, it will be appended.
|
|
|
|
@param _bReadOnly
|
|
|
|
If <TRUE/> the document will be switched to readonly mode
|
|
|
|
*/
|
|
|
|
void updateDocumentTitle();
|
|
|
|
|
2004-08-02 14:10:49 +00:00
|
|
|
void registerProperties();
|
2008-03-06 17:00:42 +00:00
|
|
|
|
|
|
|
/** determines whether the document we represent supports embedded scripts and macros
|
|
|
|
*/
|
|
|
|
sal_Bool objectSupportsEmbeddedScripts() const;
|
2000-10-18 15:16:39 +00:00
|
|
|
|
2007-11-21 14:39:47 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//- commands
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2008-02-26 13:38:02 +00:00
|
|
|
void onCommandGetDocumentProperties( ::com::sun::star::uno::Any& _rProps );
|
2007-11-21 14:39:47 +00:00
|
|
|
void onCommandInsert( const ::rtl::OUString& _sURL, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( ::com::sun::star::uno::Exception );
|
|
|
|
void onCommandPreview( ::com::sun::star::uno::Any& _rImage );
|
|
|
|
void onCommandOpenSomething( const ::com::sun::star::uno::Any& _rArgument, const bool _bActivate,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& _rxEnvironment, ::com::sun::star::uno::Any& _out_rComponent );
|
2000-09-18 23:16:46 +00:00
|
|
|
};
|
|
|
|
|
2000-10-18 15:16:39 +00:00
|
|
|
//........................................................................
|
|
|
|
} // namespace dbaccess
|
|
|
|
//........................................................................
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif // _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
|
|
|
|
|