merge the formfield patch from ooo-build
[ooovba.git] / extensions / source / bibliography / datman.hxx
blob5dcb96fba8df8a23d6d26f0113398ef7e3103e21
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: datman.hxx,v $
10 * $Revision: 1.17 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _BIB_DATMAN_HXX
32 #define _BIB_DATMAN_HXX
34 #include <com/sun/star/awt/XControlModel.hpp>
35 #include <com/sun/star/form/XForm.hpp>
36 #include <com/sun/star/sdbc/XResultSet.hpp>
37 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
38 #include <com/sun/star/form/XFormController.hpp>
39 #include <cppuhelper/compbase2.hxx>
40 #include <cppuhelper/interfacecontainer.h>
41 #include <com/sun/star/form/XLoadable.hpp>
42 #include <comphelper/broadcasthelper.hxx>
43 // #100312# --------------------
44 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
45 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
46 #include <cppuhelper/implbase1.hxx>
48 class Window;
50 //-----------------------------------------------------------------------------
51 namespace bib
53 class BibView;
54 // #100312# -----------
55 class BibBeamer;
58 class BibToolBar;
59 struct BibDBDescriptor;
61 // #100312# ---------------------
62 class BibInterceptorHelper
63 :public cppu::WeakImplHelper1< ::com::sun::star::frame::XDispatchProviderInterceptor >
65 private:
66 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xMasterDispatchProvider;
67 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xSlaveDispatchProvider;
68 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xFormDispatch;
69 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > xInterception;
71 protected:
72 ~BibInterceptorHelper( );
74 public:
75 BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch);
77 void ReleaseInterceptor();
79 // XDispatchProvider
80 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException);
81 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException);
82 // XDispatchProviderInterceptor
83 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException);
84 virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException);
85 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException);
86 virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException);
89 typedef cppu::WeakComponentImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener
90 , ::com::sun::star::form::XLoadable
91 > BibDataManager_Base;
92 class BibDataManager
93 :public ::comphelper::OMutexAndBroadcastHelper
94 ,public BibDataManager_Base
96 private:
97 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xForm;
98 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > m_xGridModel;
99 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSourceProps;
100 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xParser;
101 ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > m_xFormCtrl;
102 // #100312# -------------------
103 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xFormDispatch;
104 BibInterceptorHelper* m_pInterceptorHelper;
106 ::rtl::OUString aActiveDataTable;
107 ::rtl::OUString aDataSourceURL;
108 ::rtl::OUString aQuoteChar;
109 ::com::sun::star::uno::Any aUID;
110 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xBibCursor;
112 ::cppu::OInterfaceContainerHelper m_aLoadListeners;
114 ::bib::BibView* pBibView;
115 BibToolBar* pToolbar;
117 rtl::OUString sIdentifierMapping;
118 protected:
120 void InsertFields(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid);
121 void SetMeAsUidListener();
122 void RemoveMeAsUidListener();
124 void UpdateAddressbookCursor(::rtl::OUString aSourceName);
126 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
127 updateGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xDbForm);
128 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
129 createGridModel( const ::rtl::OUString& rName );
131 // XLoadable
132 virtual void SAL_CALL load( ) throw (::com::sun::star::uno::RuntimeException);
133 virtual void SAL_CALL unload( ) throw (::com::sun::star::uno::RuntimeException);
134 virtual void SAL_CALL reload( ) throw (::com::sun::star::uno::RuntimeException);
135 virtual sal_Bool SAL_CALL isLoaded( ) throw (::com::sun::star::uno::RuntimeException);
136 virtual void SAL_CALL addLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
137 virtual void SAL_CALL removeLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
139 virtual void SAL_CALL disposing();
141 public:
143 BibDataManager();
144 ~BibDataManager();
146 virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt)
147 throw( ::com::sun::star::uno::RuntimeException );
148 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
149 throw( ::com::sun::star::uno::RuntimeException );
153 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > createDatabaseForm( BibDBDescriptor& aDesc);
155 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > updateGridModel();
157 ::com::sun::star::uno::Sequence< ::rtl::OUString> getDataSources();
159 ::rtl::OUString getActiveDataSource() {return aDataSourceURL;}
160 void setActiveDataSource(const ::rtl::OUString& rURL);
162 ::rtl::OUString getActiveDataTable();
163 void setActiveDataTable(const ::rtl::OUString& rTable);
165 void setFilter(const ::rtl::OUString& rQuery);
166 ::rtl::OUString getFilter();
168 ::com::sun::star::uno::Sequence< ::rtl::OUString> getQueryFields();
169 ::rtl::OUString getQueryField();
170 void startQueryWith(const ::rtl::OUString& rQuery);
172 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& getParser() { return m_xParser; }
173 const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& getForm() { return m_xForm; }
176 ::rtl::OUString getControlName(sal_Int32 nFormatKey );
178 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadControlModel(const ::rtl::OUString& rName,
179 sal_Bool bForceListBox = sal_False);
181 void CreateMappingDialog(Window* pParent);
182 ::rtl::OUString CreateDBChangeDialog(Window* pParent);
184 void DispatchDBChangeDialog();
185 sal_Bool HasActiveConnection() const;
187 void SetView( ::bib::BibView* pView ) { pBibView = pView; }
189 void SetToolbar(BibToolBar* pSet);
191 const rtl::OUString& GetIdentifierMapping();
192 void ResetIdentifierMapping() {sIdentifierMapping = rtl::OUString();}
194 ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > GetFormController();
195 // #100312# ----------
196 void RegisterInterceptor( ::bib::BibBeamer* pBibBeamer);
198 sal_Bool HasActiveConnection();
202 #endif