1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _BIB_DATMAN_HXX
30 #define _BIB_DATMAN_HXX
32 #include <com/sun/star/awt/XControlModel.hpp>
33 #include <com/sun/star/form/XForm.hpp>
34 #include <com/sun/star/sdbc/XResultSet.hpp>
35 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
36 #include <com/sun/star/form/runtime/XFormController.hpp>
37 #include <cppuhelper/compbase2.hxx>
38 #include <cppuhelper/interfacecontainer.h>
39 #include <com/sun/star/form/XLoadable.hpp>
40 #include <comphelper/broadcasthelper.hxx>
41 // #100312# --------------------
42 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
43 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
44 #include <cppuhelper/implbase1.hxx>
48 //-----------------------------------------------------------------------------
52 // #100312# -----------
57 struct BibDBDescriptor
;
59 // #100312# ---------------------
60 class BibInterceptorHelper
61 :public cppu::WeakImplHelper1
< ::com::sun::star::frame::XDispatchProviderInterceptor
>
64 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> xMasterDispatchProvider
;
65 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> xSlaveDispatchProvider
;
66 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> xFormDispatch
;
67 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterception
> xInterception
;
70 ~BibInterceptorHelper( );
73 BibInterceptorHelper( ::bib::BibBeamer
* pBibBeamer
, ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> xDispatch
);
75 void ReleaseInterceptor();
78 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
);
79 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
);
80 // XDispatchProviderInterceptor
81 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException
);
82 virtual void SAL_CALL
setSlaveDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewSlaveDispatchProvider
) throw (::com::sun::star::uno::RuntimeException
);
83 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> SAL_CALL
getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException
);
84 virtual void SAL_CALL
setMasterDispatchProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& xNewMasterDispatchProvider
) throw (::com::sun::star::uno::RuntimeException
);
87 typedef cppu::WeakComponentImplHelper2
< ::com::sun::star::beans::XPropertyChangeListener
88 , ::com::sun::star::form::XLoadable
89 > BibDataManager_Base
;
91 :public ::comphelper::OMutexAndBroadcastHelper
92 ,public BibDataManager_Base
95 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> m_xForm
;
96 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> m_xGridModel
;
97 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> m_xSourceProps
;
98 ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XSingleSelectQueryComposer
> m_xParser
;
99 ::com::sun::star::uno::Reference
< ::com::sun::star::form::runtime::XFormController
> m_xFormCtrl
;
100 // #100312# -------------------
101 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> m_xFormDispatch
;
102 BibInterceptorHelper
* m_pInterceptorHelper
;
104 ::rtl::OUString aActiveDataTable
;
105 ::rtl::OUString aDataSourceURL
;
106 ::rtl::OUString aQuoteChar
;
107 ::com::sun::star::uno::Any aUID
;
108 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSet
> xBibCursor
;
110 ::cppu::OInterfaceContainerHelper m_aLoadListeners
;
112 ::bib::BibView
* pBibView
;
113 BibToolBar
* pToolbar
;
115 rtl::OUString sIdentifierMapping
;
118 void InsertFields(const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XFormComponent
> & xGrid
);
119 void SetMeAsUidListener();
120 void RemoveMeAsUidListener();
122 void UpdateAddressbookCursor(::rtl::OUString aSourceName
);
124 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>
125 updateGridModel(const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> & xDbForm
);
126 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>
127 createGridModel( const ::rtl::OUString
& rName
);
130 virtual void SAL_CALL
load( ) throw (::com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
unload( ) throw (::com::sun::star::uno::RuntimeException
);
132 virtual void SAL_CALL
reload( ) throw (::com::sun::star::uno::RuntimeException
);
133 virtual sal_Bool SAL_CALL
isLoaded( ) throw (::com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
addLoadListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XLoadListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
135 virtual void SAL_CALL
removeLoadListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XLoadListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
137 virtual void SAL_CALL
disposing();
144 virtual void SAL_CALL
propertyChange(const ::com::sun::star::beans::PropertyChangeEvent
& evt
)
145 throw( ::com::sun::star::uno::RuntimeException
);
146 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
147 throw( ::com::sun::star::uno::RuntimeException
);
151 ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
> createDatabaseForm( BibDBDescriptor
& aDesc
);
153 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> updateGridModel();
155 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getDataSources();
157 ::rtl::OUString
getActiveDataSource() {return aDataSourceURL
;}
158 void setActiveDataSource(const ::rtl::OUString
& rURL
);
160 ::rtl::OUString
getActiveDataTable();
161 void setActiveDataTable(const ::rtl::OUString
& rTable
);
163 void setFilter(const ::rtl::OUString
& rQuery
);
164 ::rtl::OUString
getFilter();
166 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getQueryFields();
167 ::rtl::OUString
getQueryField();
168 void startQueryWith(const ::rtl::OUString
& rQuery
);
170 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XSingleSelectQueryComposer
>& getParser() { return m_xParser
; }
171 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XForm
>& getForm() { return m_xForm
; }
174 ::rtl::OUString
getControlName(sal_Int32 nFormatKey
);
176 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> loadControlModel(const ::rtl::OUString
& rName
,
177 sal_Bool bForceListBox
= sal_False
);
179 void CreateMappingDialog(Window
* pParent
);
180 ::rtl::OUString
CreateDBChangeDialog(Window
* pParent
);
182 void DispatchDBChangeDialog();
183 sal_Bool
HasActiveConnection() const;
185 void SetView( ::bib::BibView
* pView
) { pBibView
= pView
; }
187 void SetToolbar(BibToolBar
* pSet
);
189 const rtl::OUString
& GetIdentifierMapping();
190 void ResetIdentifierMapping() {sIdentifierMapping
= rtl::OUString();}
192 ::com::sun::star::uno::Reference
< ::com::sun::star::form::runtime::XFormController
> GetFormController();
193 // #100312# ----------
194 void RegisterInterceptor( ::bib::BibBeamer
* pBibBeamer
);
196 sal_Bool
HasActiveConnection();
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */