bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / bibliography / datman.hxx
blob8d6e1a8a6c85d87ab46d5f3549c10c7f8f3d2503
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_DATMAN_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_DATMAN_HXX
23 #include <com/sun/star/awt/XControlModel.hpp>
24 #include <com/sun/star/form/XForm.hpp>
25 #include <com/sun/star/sdbc/XResultSet.hpp>
26 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
27 #include <com/sun/star/form/runtime/XFormController.hpp>
28 #include <cppuhelper/compbase2.hxx>
29 #include <cppuhelper/interfacecontainer.h>
30 #include <com/sun/star/form/XLoadable.hpp>
31 #include <comphelper/broadcasthelper.hxx>
32 // #100312# --------------------
33 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
34 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
35 #include <cppuhelper/implbase1.hxx>
36 #include <vcl/vclptr.hxx>
38 namespace vcl { class Window; }
41 namespace bib
43 class BibView;
44 // #100312# -----------
45 class BibBeamer;
48 class BibToolBar;
49 struct BibDBDescriptor;
51 // #100312# ---------------------
52 class BibInterceptorHelper
53 :public cppu::WeakImplHelper1< ::com::sun::star::frame::XDispatchProviderInterceptor >
55 private:
56 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xMasterDispatchProvider;
57 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xSlaveDispatchProvider;
58 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xFormDispatch;
59 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > xInterception;
61 protected:
62 virtual ~BibInterceptorHelper( );
64 public:
65 BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch);
67 void ReleaseInterceptor();
69 // XDispatchProvider
70 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 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, std::exception) SAL_OVERRIDE;
72 // XDispatchProviderInterceptor
73 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 typedef cppu::WeakComponentImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener
80 , ::com::sun::star::form::XLoadable
81 > BibDataManager_Base;
82 class BibDataManager
83 :public ::comphelper::OMutexAndBroadcastHelper
84 ,public BibDataManager_Base
86 private:
87 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xForm;
88 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > m_xGridModel;
89 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSourceProps;
90 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xParser;
91 ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xFormCtrl;
92 // #100312# -------------------
93 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xFormDispatch;
94 BibInterceptorHelper* m_pInterceptorHelper;
96 OUString aActiveDataTable;
97 OUString aDataSourceURL;
98 OUString aQuoteChar;
99 ::com::sun::star::uno::Any aUID;
100 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xBibCursor;
102 ::cppu::OInterfaceContainerHelper m_aLoadListeners;
104 VclPtr< ::bib::BibView> pBibView;
105 VclPtr<BibToolBar> pToolbar;
107 OUString sIdentifierMapping;
108 protected:
110 void InsertFields(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid);
111 void SetMeAsUidListener();
112 void RemoveMeAsUidListener();
114 void UpdateAddressbookCursor(const OUString& aSourceName);
116 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
117 updateGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xDbForm);
118 static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
119 createGridModel( const OUString& rName );
121 // XLoadable
122 virtual void SAL_CALL load( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 virtual void SAL_CALL unload( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 virtual void SAL_CALL reload( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 virtual sal_Bool SAL_CALL isLoaded( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 virtual void SAL_CALL addLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 virtual void SAL_CALL removeLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 virtual void SAL_CALL disposing() SAL_OVERRIDE;
131 public:
133 BibDataManager();
134 virtual ~BibDataManager();
136 virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt)
137 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
138 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
139 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
143 ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > createDatabaseForm( BibDBDescriptor& aDesc);
145 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > updateGridModel();
147 ::com::sun::star::uno::Sequence< OUString> getDataSources();
149 OUString getActiveDataSource() {return aDataSourceURL;}
150 void setActiveDataSource(const OUString& rURL);
152 OUString getActiveDataTable() { return aActiveDataTable;}
153 void setActiveDataTable(const OUString& rTable);
155 void setFilter(const OUString& rQuery);
156 OUString getFilter();
158 ::com::sun::star::uno::Sequence< OUString> getQueryFields();
159 OUString getQueryField();
160 void startQueryWith(const OUString& rQuery);
162 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& getParser() { return m_xParser; }
163 const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& getForm() { return m_xForm; }
166 static OUString getControlName(sal_Int32 nFormatKey );
168 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadControlModel(const OUString& rName,
169 bool bForceListBox = false);
171 void CreateMappingDialog(vcl::Window* pParent);
172 OUString CreateDBChangeDialog(vcl::Window* pParent);
174 void DispatchDBChangeDialog();
175 bool HasActiveConnection() const;
177 void SetView( ::bib::BibView* pView ) { pBibView = pView; }
179 void SetToolbar(BibToolBar* pSet);
181 const OUString& GetIdentifierMapping();
182 void ResetIdentifierMapping() {sIdentifierMapping.clear();}
184 ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController();
185 // #100312# ----------
186 void RegisterInterceptor( ::bib::BibBeamer* pBibBeamer);
188 bool HasActiveConnection();
192 #endif
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */