xref: /AOO41X/main/extensions/source/bibliography/bibload.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_extensions.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <osl/mutex.hxx>
33*cdf0e10cSrcweir #include <tools/urlobj.hxx>
34*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
35*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
36*cdf0e10cSrcweir #include <svl/itemprop.hxx>
37*cdf0e10cSrcweir #include <uno/environment.h>
38*cdf0e10cSrcweir #include <svl/urihelper.hxx>
39*cdf0e10cSrcweir #ifndef _TOOLKIT_UNOHLP_HXX
40*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
43*cdf0e10cSrcweir #include <cppuhelper/factory.hxx>	// helper for factories
44*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetType.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/sdb/XColumn.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSet.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp>
51*cdf0e10cSrcweir #include <com/sun/star/frame/XFrameLoader.hpp>
52*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
53*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
54*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
55*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
56*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
57*cdf0e10cSrcweir #include <com/sun/star/text/BibliographyDataField.hpp>
58*cdf0e10cSrcweir #include <com/sun/star/form/XLoadListener.hpp>
59*cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp>
60*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
61*cdf0e10cSrcweir #include <vcl/window.hxx>
62*cdf0e10cSrcweir #include <vcl/edit.hxx>
63*cdf0e10cSrcweir #include <vcl/svapp.hxx>
64*cdf0e10cSrcweir #include <vcl/group.hxx>
65*cdf0e10cSrcweir #include <svtools/svmedit.hxx>
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir #include "bibresid.hxx"
68*cdf0e10cSrcweir #ifndef BIB_HRC
69*cdf0e10cSrcweir #include "bib.hrc"
70*cdf0e10cSrcweir #endif
71*cdf0e10cSrcweir #include "bibcont.hxx"
72*cdf0e10cSrcweir #include "bibbeam.hxx"
73*cdf0e10cSrcweir #include "bibmod.hxx"
74*cdf0e10cSrcweir #include "bibview.hxx"
75*cdf0e10cSrcweir #include "framectr.hxx"
76*cdf0e10cSrcweir #include "datman.hxx"
77*cdf0e10cSrcweir #include <bibconfig.hxx>
78*cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> // helper for implementations
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir using namespace ::rtl;
81*cdf0e10cSrcweir using namespace ::com::sun::star;
82*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
83*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
84*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
85*cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
86*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
87*cdf0e10cSrcweir using namespace ::com::sun::star::form;
88*cdf0e10cSrcweir using namespace ::com::sun::star::container;
89*cdf0e10cSrcweir using namespace ::com::sun::star::frame;
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir #define C2U(cChar) OUString::createFromAscii(cChar)
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir //-----------------------------------------------------------------------------
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir #define PROPERTY_FRAME						1
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir class BibliographyLoader : public cppu::WeakImplHelper4
99*cdf0e10cSrcweir 							< XServiceInfo, XNameAccess, XPropertySet, XFrameLoader >
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir 	HdlBibModul 									m_pBibMod;
102*cdf0e10cSrcweir 	Reference< XLoadable >							m_xDatMan;
103*cdf0e10cSrcweir 	BibDataManager* 								m_pDatMan;
104*cdf0e10cSrcweir 	Reference< XNameAccess > 						m_xColumns;
105*cdf0e10cSrcweir 	Reference< XResultSet > 						m_xCursor;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir private:
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	void					loadView(const Reference< XFrame > & aFrame, const rtl::OUString& aURL,
110*cdf0e10cSrcweir 								const Sequence< PropertyValue >& aArgs,
111*cdf0e10cSrcweir 								const Reference< XLoadEventListener > & aListener);
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 	BibDataManager* 		GetDataManager()const;
114*cdf0e10cSrcweir 	Reference< XNameAccess > 			GetDataColumns() const;
115*cdf0e10cSrcweir 	Reference< XResultSet > 			GetDataCursor() const;
116*cdf0e10cSrcweir 	Reference< sdb::XColumn >				GetIdentifierColumn() const;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir public:
119*cdf0e10cSrcweir 							BibliographyLoader();
120*cdf0e10cSrcweir 							~BibliographyLoader();
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	// XServiceInfo
123*cdf0e10cSrcweir 	rtl::OUString				SAL_CALL getImplementationName() throw(  );
124*cdf0e10cSrcweir 	sal_Bool					SAL_CALL supportsService(const rtl::OUString& ServiceName) throw(  );
125*cdf0e10cSrcweir 	Sequence< rtl::OUString >	SAL_CALL getSupportedServiceNames(void) throw(	);
126*cdf0e10cSrcweir 	static rtl::OUString				getImplementationName_Static() throw(  )
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 							{
129*cdf0e10cSrcweir 								//!
130*cdf0e10cSrcweir 								return C2U("com.sun.star.extensions.Bibliography");
131*cdf0e10cSrcweir 								//!
132*cdf0e10cSrcweir 							}
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	//XNameAccess
135*cdf0e10cSrcweir 	virtual Any SAL_CALL getByName(const rtl::OUString& aName) throw ( NoSuchElementException, WrappedTargetException, RuntimeException );
136*cdf0e10cSrcweir 	virtual Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw ( RuntimeException );
137*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& aName) throw ( RuntimeException );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 	//XElementAccess
140*cdf0e10cSrcweir 	virtual Type  SAL_CALL getElementType(void) throw ( RuntimeException );
141*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements(void) throw ( RuntimeException );
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	//XPropertySet
144*cdf0e10cSrcweir 	virtual Reference< XPropertySetInfo >  SAL_CALL getPropertySetInfo(void) throw ( RuntimeException );
145*cdf0e10cSrcweir 	virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException );
146*cdf0e10cSrcweir 	virtual Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName) throw ( UnknownPropertyException, WrappedTargetException, RuntimeException );
147*cdf0e10cSrcweir 	virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
148*cdf0e10cSrcweir 	virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
149*cdf0e10cSrcweir 	virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
150*cdf0e10cSrcweir 	virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	static Sequence<rtl::OUString>	SAL_CALL getSupportedServiceNames_Static(void) throw(  );
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 	friend	Reference< XInterface > 	SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception );
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	// XLoader
157*cdf0e10cSrcweir 	virtual void			SAL_CALL load(const Reference< XFrame > & aFrame, const rtl::OUString& aURL,
158*cdf0e10cSrcweir 								const Sequence< PropertyValue >& aArgs,
159*cdf0e10cSrcweir 								const Reference< XLoadEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException);
160*cdf0e10cSrcweir 	virtual void			SAL_CALL cancel(void) throw (::com::sun::star::uno::RuntimeException);
161*cdf0e10cSrcweir };
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir BibliographyLoader::BibliographyLoader() :
164*cdf0e10cSrcweir 	m_pBibMod(0),
165*cdf0e10cSrcweir 	m_pDatMan(0)
166*cdf0e10cSrcweir {
167*cdf0e10cSrcweir }
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir BibliographyLoader::~BibliographyLoader()
170*cdf0e10cSrcweir {
171*cdf0e10cSrcweir 	Reference< lang::XComponent >  xComp(m_xCursor, UNO_QUERY);
172*cdf0e10cSrcweir 	if (xComp.is())
173*cdf0e10cSrcweir 		xComp->dispose();
174*cdf0e10cSrcweir 	if(m_pBibMod)
175*cdf0e10cSrcweir 		CloseBibModul(m_pBibMod);
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir Reference< XInterface >  SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory >  & /*rSMgr*/ ) throw( Exception )
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir 	return *(new BibliographyLoader);
182*cdf0e10cSrcweir }
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir // XServiceInfo
186*cdf0e10cSrcweir rtl::OUString BibliographyLoader::getImplementationName() throw(  )
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir {
189*cdf0e10cSrcweir 	return getImplementationName_Static();
190*cdf0e10cSrcweir }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir // XServiceInfo
193*cdf0e10cSrcweir sal_Bool BibliographyLoader::supportsService(const rtl::OUString& ServiceName) throw(  )
194*cdf0e10cSrcweir {
195*cdf0e10cSrcweir 	Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
196*cdf0e10cSrcweir 	const rtl::OUString * pArray = aSNL.getConstArray();
197*cdf0e10cSrcweir 	for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
198*cdf0e10cSrcweir 		if( pArray[i] == ServiceName )
199*cdf0e10cSrcweir 			return sal_True;
200*cdf0e10cSrcweir 	return sal_False;
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir // XServiceInfo
204*cdf0e10cSrcweir Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames(void) throw(  )
205*cdf0e10cSrcweir {
206*cdf0e10cSrcweir 	return getSupportedServiceNames_Static();
207*cdf0e10cSrcweir }
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir // ORegistryServiceManager_Static
210*cdf0e10cSrcweir Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames_Static(void) throw(	)
211*cdf0e10cSrcweir {
212*cdf0e10cSrcweir 	Sequence< rtl::OUString > aSNS( 2 );
213*cdf0e10cSrcweir 	aSNS.getArray()[0] = C2U("com.sun.star.frame.FrameLoader");
214*cdf0e10cSrcweir 	//!
215*cdf0e10cSrcweir 	aSNS.getArray()[1] = C2U("com.sun.star.frame.Bibliography");
216*cdf0e10cSrcweir 	//!
217*cdf0e10cSrcweir 	return aSNS;
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir extern "C"
221*cdf0e10cSrcweir {
222*cdf0e10cSrcweir 	void SAL_CALL component_getImplementationEnvironment(
223*cdf0e10cSrcweir 		const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
224*cdf0e10cSrcweir 	{
225*cdf0e10cSrcweir 		*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
226*cdf0e10cSrcweir 	}
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 	void * SAL_CALL component_getFactory(
229*cdf0e10cSrcweir 		const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ )
230*cdf0e10cSrcweir 	{
231*cdf0e10cSrcweir 		void * pRet = 0;
232*cdf0e10cSrcweir 		if (!BibliographyLoader::getImplementationName_Static().compareToAscii( pImplName ) )
233*cdf0e10cSrcweir 		{
234*cdf0e10cSrcweir 			// create the factory
235*cdf0e10cSrcweir 			Reference< XSingleServiceFactory > xFactory =
236*cdf0e10cSrcweir 				cppu::createSingleFactory(
237*cdf0e10cSrcweir 					pServiceManager,
238*cdf0e10cSrcweir 					BibliographyLoader::getImplementationName_Static(),
239*cdf0e10cSrcweir 					BibliographyLoader_CreateInstance,
240*cdf0e10cSrcweir 					BibliographyLoader::getSupportedServiceNames_Static() );
241*cdf0e10cSrcweir 			// acquire, because we return an interface pointer instead of a reference
242*cdf0e10cSrcweir 			xFactory->acquire();
243*cdf0e10cSrcweir 			pRet = xFactory.get();
244*cdf0e10cSrcweir 		}
245*cdf0e10cSrcweir 		return pRet;
246*cdf0e10cSrcweir 	}
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir }
249*cdf0e10cSrcweir // -----------------------------------------------------------------------
250*cdf0e10cSrcweir void BibliographyLoader::cancel(void) throw (::com::sun::star::uno::RuntimeException)
251*cdf0e10cSrcweir {
252*cdf0e10cSrcweir 	//!
253*cdf0e10cSrcweir 	//!
254*cdf0e10cSrcweir }
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir // -----------------------------------------------------------------------
257*cdf0e10cSrcweir void BibliographyLoader::load(const Reference< XFrame > & rFrame, const rtl::OUString& rURL,
258*cdf0e10cSrcweir 		const Sequence< PropertyValue >& rArgs,
259*cdf0e10cSrcweir 		const Reference< XLoadEventListener > & rListener) throw (::com::sun::star::uno::RuntimeException)
260*cdf0e10cSrcweir {
261*cdf0e10cSrcweir 	//!
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
264*cdf0e10cSrcweir     m_pBibMod = OpenBibModul();
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	String aURLStr( rURL );
267*cdf0e10cSrcweir 	String aPartName = aURLStr.GetToken( 1, '/' );
268*cdf0e10cSrcweir 	Reference<XPropertySet> xPrSet(rFrame, UNO_QUERY);
269*cdf0e10cSrcweir 	if(xPrSet.is())
270*cdf0e10cSrcweir 	{
271*cdf0e10cSrcweir 		Any aTitle;
272*cdf0e10cSrcweir 		aTitle <<= OUString(String(BibResId(RID_BIB_STR_FRAME_TITLE)));
273*cdf0e10cSrcweir 		xPrSet->setPropertyValue(C2U("Title"), aTitle);
274*cdf0e10cSrcweir 	}
275*cdf0e10cSrcweir 	if(aPartName.EqualsAscii("View") || aPartName.EqualsAscii("View1"))
276*cdf0e10cSrcweir 	{
277*cdf0e10cSrcweir 		loadView(rFrame, rURL, rArgs, rListener);
278*cdf0e10cSrcweir 	}
279*cdf0e10cSrcweir }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir // -----------------------------------------------------------------------
282*cdf0e10cSrcweir void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const rtl::OUString& /*rURL*/,
283*cdf0e10cSrcweir 		const Sequence< PropertyValue >& /*rArgs*/,
284*cdf0e10cSrcweir 		const Reference< XLoadEventListener > & rListener)
285*cdf0e10cSrcweir {
286*cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
287*cdf0e10cSrcweir     //!
288*cdf0e10cSrcweir 	if(!m_pBibMod)
289*cdf0e10cSrcweir 		m_pBibMod = OpenBibModul();
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir /*
292*cdf0e10cSrcweir 	//create the menu
293*cdf0e10cSrcweir 	ResMgr* pResMgr = (*m_pBibMod)->GetResMgr();
294*cdf0e10cSrcweir 	INetURLObject aEntry( URIHelper::SmartRelToAbs(pResMgr->GetFileName()) );
295*cdf0e10cSrcweir 	String aMenuRes( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ));
296*cdf0e10cSrcweir 	aMenuRes += ( aEntry.GetName() += '/' );
297*cdf0e10cSrcweir 	aMenuRes+=String::CreateFromInt32(RID_MAIN_MENU);
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 	util::URL aURL;
300*cdf0e10cSrcweir 	aURL.Complete = aMenuRes;
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir 	Reference< XMultiServiceFactory >  xMgr = comphelper::getProcessServiceFactory();
303*cdf0e10cSrcweir 	Reference< util::XURLTransformer >	xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
304*cdf0e10cSrcweir 	if( xTrans.is() )
305*cdf0e10cSrcweir 	{
306*cdf0e10cSrcweir 		// Datei laden
307*cdf0e10cSrcweir 		xTrans->parseStrict( aURL );
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 		Reference< XDispatchProvider >	xProv( rFrame, UNO_QUERY );
310*cdf0e10cSrcweir 		if ( xProv.is() )
311*cdf0e10cSrcweir 		{
312*cdf0e10cSrcweir 			Reference< XDispatch >	aDisp = xProv->queryDispatch( aURL, C2U("_menubar"), 12 );
313*cdf0e10cSrcweir 			if ( aDisp.is() )
314*cdf0e10cSrcweir 				aDisp->dispatch( aURL, Sequence<PropertyValue>() );
315*cdf0e10cSrcweir 		}
316*cdf0e10cSrcweir 	}
317*cdf0e10cSrcweir */
318*cdf0e10cSrcweir 	m_pDatMan = (*m_pBibMod)->createDataManager();
319*cdf0e10cSrcweir 	m_xDatMan = m_pDatMan;
320*cdf0e10cSrcweir 	BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 	if(!aBibDesc.sDataSource.getLength())
323*cdf0e10cSrcweir 	{
324*cdf0e10cSrcweir 		DBChangeDialogConfig_Impl aConfig;
325*cdf0e10cSrcweir 		const Sequence<OUString> aSources = aConfig.GetDataSourceNames();
326*cdf0e10cSrcweir 		if(aSources.getLength())
327*cdf0e10cSrcweir 			aBibDesc.sDataSource = aSources.getConstArray()[0];
328*cdf0e10cSrcweir 	}
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir 	Reference< XForm > xForm = m_pDatMan->createDatabaseForm( aBibDesc );
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir     Reference< awt::XWindow >  aWindow = rFrame->getContainerWindow();
333*cdf0e10cSrcweir     VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow);
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     Window* pParent = VCLUnoHelper::GetWindow( aWindow );
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir     BibBookContainer *pMyWindow = new BibBookContainer( pParent, m_pDatMan );
338*cdf0e10cSrcweir     pMyWindow->Show();
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir     ::bib::BibView* pView = new ::bib::BibView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK );
341*cdf0e10cSrcweir     pView->Show();
342*cdf0e10cSrcweir     m_pDatMan->SetView( pView );
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir     ::bib::BibBeamer* pBeamer = new ::bib::BibBeamer( pMyWindow, m_pDatMan );
345*cdf0e10cSrcweir     pBeamer->Show();
346*cdf0e10cSrcweir     pMyWindow->createTopFrame(pBeamer);
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     pMyWindow->createBottomFrame(pView);
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir     Reference< awt::XWindow >  xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY );
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir     Reference< XController >  xCtrRef( new BibFrameController_Impl( xWin, m_pDatMan ) );
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir     xCtrRef->attachFrame(rFrame);
355*cdf0e10cSrcweir     rFrame->setComponent( xWin, xCtrRef);
356*cdf0e10cSrcweir     pBeamer->SetXController(xCtrRef);
357*cdf0e10cSrcweir     //!
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir     // not earlier because SetFocus() is triggered in setVisible()
360*cdf0e10cSrcweir     pParentComponent->setVisible(sal_True);
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir     m_xDatMan->load();
363*cdf0e10cSrcweir     // #100312# ----------
364*cdf0e10cSrcweir     m_pDatMan->RegisterInterceptor(pBeamer);
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir     if ( rListener.is() )
367*cdf0e10cSrcweir         rListener->loadFinished( this );
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir     // attach menu bar
370*cdf0e10cSrcweir     Reference< XPropertySet > xPropSet( rFrame, UNO_QUERY );
371*cdf0e10cSrcweir     Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
372*cdf0e10cSrcweir     if ( xPropSet.is() )
373*cdf0e10cSrcweir     {
374*cdf0e10cSrcweir         try
375*cdf0e10cSrcweir         {
376*cdf0e10cSrcweir             Any a = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
377*cdf0e10cSrcweir             a >>= xLayoutManager;
378*cdf0e10cSrcweir         }
379*cdf0e10cSrcweir         catch ( uno::Exception& )
380*cdf0e10cSrcweir         {
381*cdf0e10cSrcweir         }
382*cdf0e10cSrcweir     }
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir     if ( xLayoutManager.is() )
385*cdf0e10cSrcweir         xLayoutManager->createElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )));
386*cdf0e10cSrcweir }
387*cdf0e10cSrcweir /* -----------------06.12.99 14:37-------------------
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir  --------------------------------------------------*/
390*cdf0e10cSrcweir BibDataManager* BibliographyLoader::GetDataManager()const
391*cdf0e10cSrcweir {
392*cdf0e10cSrcweir 	if(!m_pDatMan)
393*cdf0e10cSrcweir 	{
394*cdf0e10cSrcweir 		if(!m_pBibMod)
395*cdf0e10cSrcweir 			const_cast< BibliographyLoader* >( this )->m_pBibMod = OpenBibModul();
396*cdf0e10cSrcweir 		const_cast< BibliographyLoader* >( this )->m_pDatMan = (*m_pBibMod)->createDataManager();
397*cdf0e10cSrcweir 		const_cast< BibliographyLoader* >( this )->m_xDatMan = m_pDatMan;
398*cdf0e10cSrcweir 	}
399*cdf0e10cSrcweir 	return m_pDatMan;
400*cdf0e10cSrcweir }
401*cdf0e10cSrcweir /* -----------------06.12.99 14:39-------------------
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir  --------------------------------------------------*/
404*cdf0e10cSrcweir Reference< XNameAccess >  BibliographyLoader::GetDataColumns() const
405*cdf0e10cSrcweir {
406*cdf0e10cSrcweir 	if (!m_xColumns.is())
407*cdf0e10cSrcweir 	{
408*cdf0e10cSrcweir 		Reference< XMultiServiceFactory >  xMgr = comphelper::getProcessServiceFactory();
409*cdf0e10cSrcweir 		Reference< XRowSet >  xRowSet(xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
410*cdf0e10cSrcweir 		Reference< XPropertySet >  xResultSetProps(xRowSet, UNO_QUERY);
411*cdf0e10cSrcweir 		DBG_ASSERT(xResultSetProps.is() , "BibliographyLoader::GetDataCursor : invalid row set (no XResultSet or no XPropertySet) !");
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir 		BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 		Any aBibUrlAny; aBibUrlAny <<= aBibDesc.sDataSource;
416*cdf0e10cSrcweir 		xResultSetProps->setPropertyValue(C2U("DataSourceName"), aBibUrlAny);
417*cdf0e10cSrcweir 		Any aCommandType; aCommandType <<= aBibDesc.nCommandType;
418*cdf0e10cSrcweir 		xResultSetProps->setPropertyValue(C2U("CommandType"), aCommandType);
419*cdf0e10cSrcweir 		Any aTableName; aTableName <<= aBibDesc.sTableOrQuery;
420*cdf0e10cSrcweir 		xResultSetProps->setPropertyValue(C2U("Command"), aTableName);
421*cdf0e10cSrcweir 		Any aResultSetType; aResultSetType <<= (sal_Int32)(ResultSetType::SCROLL_INSENSITIVE);
422*cdf0e10cSrcweir 		xResultSetProps->setPropertyValue(C2U("ResultSetType"), aResultSetType);
423*cdf0e10cSrcweir 		Any aResultSetCurrency; aResultSetCurrency <<= (sal_Int32)(ResultSetConcurrency::UPDATABLE);
424*cdf0e10cSrcweir 		xResultSetProps->setPropertyValue(C2U("ResultSetConcurrency"), aResultSetCurrency);
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 		sal_Bool bSuccess = sal_False;
427*cdf0e10cSrcweir 		try
428*cdf0e10cSrcweir 		{
429*cdf0e10cSrcweir 			xRowSet->execute();
430*cdf0e10cSrcweir 			bSuccess = sal_True;
431*cdf0e10cSrcweir 		}
432*cdf0e10cSrcweir 		catch(const SQLException&)
433*cdf0e10cSrcweir 		{
434*cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
435*cdf0e10cSrcweir 		}
436*cdf0e10cSrcweir 		catch(const Exception& )
437*cdf0e10cSrcweir 		{
438*cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
439*cdf0e10cSrcweir 			bSuccess = sal_False;
440*cdf0e10cSrcweir 		}
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir 		if (!bSuccess)
443*cdf0e10cSrcweir 		{
444*cdf0e10cSrcweir 			Reference< XComponent >  xSetComp(xRowSet, UNO_QUERY);
445*cdf0e10cSrcweir 			if (xSetComp.is())
446*cdf0e10cSrcweir 				xSetComp->dispose();
447*cdf0e10cSrcweir 			xRowSet = NULL;
448*cdf0e10cSrcweir 		}
449*cdf0e10cSrcweir 		else
450*cdf0e10cSrcweir 			((BibliographyLoader*)this)->m_xCursor = xRowSet.get();
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir 		Reference< sdbcx::XColumnsSupplier >  xSupplyCols(m_xCursor, UNO_QUERY);
453*cdf0e10cSrcweir 		if (xSupplyCols.is())
454*cdf0e10cSrcweir 			((BibliographyLoader*)this)->m_xColumns = xSupplyCols->getColumns();
455*cdf0e10cSrcweir 	}
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 	return m_xColumns;
458*cdf0e10cSrcweir }
459*cdf0e10cSrcweir /* -----------------17.12.99 12:29-------------------
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir  --------------------------------------------------*/
462*cdf0e10cSrcweir Reference< sdb::XColumn >  BibliographyLoader::GetIdentifierColumn() const
463*cdf0e10cSrcweir {
464*cdf0e10cSrcweir 	BibDataManager* pDatMan = GetDataManager();
465*cdf0e10cSrcweir 	Reference< XNameAccess >  xColumns = GetDataColumns();
466*cdf0e10cSrcweir 	rtl::OUString sIdentifierColumnName = pDatMan->GetIdentifierMapping();
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir 	Reference< sdb::XColumn >  xReturn;
469*cdf0e10cSrcweir 	if (xColumns.is() && xColumns->hasByName(sIdentifierColumnName))
470*cdf0e10cSrcweir 	{
471*cdf0e10cSrcweir 		xReturn = Reference< XColumn > (*(Reference< XInterface > *)
472*cdf0e10cSrcweir 				xColumns->getByName(sIdentifierColumnName).getValue(), UNO_QUERY);
473*cdf0e10cSrcweir 	}
474*cdf0e10cSrcweir 	return xReturn;
475*cdf0e10cSrcweir }
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir /* -----------------06.12.99 15:05-------------------
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir  --------------------------------------------------*/
480*cdf0e10cSrcweir Reference< XResultSet >  BibliographyLoader::GetDataCursor() const
481*cdf0e10cSrcweir {
482*cdf0e10cSrcweir 	if (!m_xCursor.is())
483*cdf0e10cSrcweir 		GetDataColumns();
484*cdf0e10cSrcweir 	if (m_xCursor.is())
485*cdf0e10cSrcweir 		m_xCursor->first();
486*cdf0e10cSrcweir 	return m_xCursor;
487*cdf0e10cSrcweir }
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir /*-- 17.11.99 12:51:38---------------------------------------------------
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
492*cdf0e10cSrcweir rtl::OUString lcl_AddProperty(Reference< XNameAccess >  xColumns,
493*cdf0e10cSrcweir 		const Mapping* pMapping, const String& rColumnName)
494*cdf0e10cSrcweir {
495*cdf0e10cSrcweir 	String sColumnName(rColumnName);
496*cdf0e10cSrcweir 	if(pMapping)
497*cdf0e10cSrcweir 	{
498*cdf0e10cSrcweir 		for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
499*cdf0e10cSrcweir 		{
500*cdf0e10cSrcweir 			if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == OUString(rColumnName))
501*cdf0e10cSrcweir 			{
502*cdf0e10cSrcweir 				sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName;
503*cdf0e10cSrcweir 				break;
504*cdf0e10cSrcweir 			}
505*cdf0e10cSrcweir 		}
506*cdf0e10cSrcweir 	}
507*cdf0e10cSrcweir 	rtl::OUString uColumnName(sColumnName);
508*cdf0e10cSrcweir 	rtl::OUString uRet;
509*cdf0e10cSrcweir 	Reference< sdb::XColumn >  xCol;
510*cdf0e10cSrcweir 	if (xColumns->hasByName(uColumnName))
511*cdf0e10cSrcweir 		xCol = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(uColumnName).getValue(), UNO_QUERY);
512*cdf0e10cSrcweir 	if (xCol.is())
513*cdf0e10cSrcweir 		uRet = xCol->getString();
514*cdf0e10cSrcweir 	return uRet;
515*cdf0e10cSrcweir }
516*cdf0e10cSrcweir //-----------------------------------------------------------------------------
517*cdf0e10cSrcweir Any BibliographyLoader::getByName(const rtl::OUString& rName) throw
518*cdf0e10cSrcweir 						( NoSuchElementException, WrappedTargetException, RuntimeException )
519*cdf0e10cSrcweir {
520*cdf0e10cSrcweir 	Any aRet;
521*cdf0e10cSrcweir 	try
522*cdf0e10cSrcweir 	{
523*cdf0e10cSrcweir 		BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager();
524*cdf0e10cSrcweir 		Reference< XResultSet >  xCursor = GetDataCursor();
525*cdf0e10cSrcweir 		Reference< sdbcx::XColumnsSupplier >  xSupplyCols(xCursor, UNO_QUERY);
526*cdf0e10cSrcweir 		Reference< XNameAccess >  xColumns;
527*cdf0e10cSrcweir 		if (!xSupplyCols.is())
528*cdf0e10cSrcweir 			return aRet;
529*cdf0e10cSrcweir 		xColumns = xSupplyCols->getColumns();
530*cdf0e10cSrcweir 		DBG_ASSERT(xSupplyCols.is(), "BibliographyLoader::getByName : invalid columns returned by the data cursor (may be the result set is not alive ?) !");
531*cdf0e10cSrcweir 		if (!xColumns.is())
532*cdf0e10cSrcweir 			return aRet;
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir 		String sIdentifierMapping = pDatMan->GetIdentifierMapping();
535*cdf0e10cSrcweir 		rtl::OUString sId = sIdentifierMapping;
536*cdf0e10cSrcweir 		Reference< sdb::XColumn >  xColumn;
537*cdf0e10cSrcweir 		if (xColumns->hasByName(sId))
538*cdf0e10cSrcweir 			xColumn = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(sId).getValue(), UNO_QUERY);
539*cdf0e10cSrcweir 		if (xColumn.is())
540*cdf0e10cSrcweir 		{
541*cdf0e10cSrcweir 			do
542*cdf0e10cSrcweir 			{
543*cdf0e10cSrcweir 				if ((rName == xColumn->getString()) && !xColumn->wasNull())
544*cdf0e10cSrcweir 				{
545*cdf0e10cSrcweir 					Sequence<PropertyValue> aPropSequ(COLUMN_COUNT);
546*cdf0e10cSrcweir 					PropertyValue* pValues = aPropSequ.getArray();
547*cdf0e10cSrcweir 					BibConfig* pConfig = BibModul::GetConfig();
548*cdf0e10cSrcweir 					BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
549*cdf0e10cSrcweir 					const Mapping* pMapping = pConfig->GetMapping(aBibDesc);
550*cdf0e10cSrcweir 					for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
551*cdf0e10cSrcweir 					{
552*cdf0e10cSrcweir 						const String sColName = pConfig->GetDefColumnName(
553*cdf0e10cSrcweir 													nEntry);
554*cdf0e10cSrcweir 						pValues[nEntry].Name = sColName;
555*cdf0e10cSrcweir 						pValues[nEntry].Value <<= lcl_AddProperty(xColumns, pMapping, sColName);
556*cdf0e10cSrcweir 					}
557*cdf0e10cSrcweir 					aRet.setValue(&aPropSequ, ::getCppuType((Sequence<PropertyValue>*)0));
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir 					break;
560*cdf0e10cSrcweir 				}
561*cdf0e10cSrcweir 			}
562*cdf0e10cSrcweir 			while(xCursor->next());
563*cdf0e10cSrcweir 		}
564*cdf0e10cSrcweir 	}
565*cdf0e10cSrcweir 	catch(const Exception&)
566*cdf0e10cSrcweir 	{
567*cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
568*cdf0e10cSrcweir 	}
569*cdf0e10cSrcweir 	return aRet;
570*cdf0e10cSrcweir }
571*cdf0e10cSrcweir /*-- 17.11.99 12:51:39---------------------------------------------------
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
574*cdf0e10cSrcweir Sequence< rtl::OUString > BibliographyLoader::getElementNames(void) throw ( RuntimeException )
575*cdf0e10cSrcweir {
576*cdf0e10cSrcweir 	Sequence< rtl::OUString > aRet(10);
577*cdf0e10cSrcweir 	int nRealNameCount = 0;
578*cdf0e10cSrcweir 	try
579*cdf0e10cSrcweir 	{
580*cdf0e10cSrcweir 		Reference< XResultSet >  xCursor(GetDataCursor());
581*cdf0e10cSrcweir 		Reference< sdb::XColumn >  xIdColumn(GetIdentifierColumn());
582*cdf0e10cSrcweir 		if (xIdColumn.is()) // implies xCursor.is()
583*cdf0e10cSrcweir 		{
584*cdf0e10cSrcweir 			do
585*cdf0e10cSrcweir 			{
586*cdf0e10cSrcweir 				rtl::OUString sTemp = xIdColumn->getString();
587*cdf0e10cSrcweir 				if (sTemp.getLength() && !xIdColumn->wasNull())
588*cdf0e10cSrcweir 				{
589*cdf0e10cSrcweir 					int nLen = aRet.getLength();
590*cdf0e10cSrcweir                     if(nLen == nRealNameCount)
591*cdf0e10cSrcweir 						aRet.realloc(nLen + 10);
592*cdf0e10cSrcweir 					rtl::OUString* pArray = aRet.getArray();
593*cdf0e10cSrcweir 					pArray[nRealNameCount] = sTemp;
594*cdf0e10cSrcweir 					nRealNameCount++;
595*cdf0e10cSrcweir 				}
596*cdf0e10cSrcweir 			}
597*cdf0e10cSrcweir 			while (xCursor->next());
598*cdf0e10cSrcweir 		}
599*cdf0e10cSrcweir 	}
600*cdf0e10cSrcweir 	catch(const Exception&)
601*cdf0e10cSrcweir 	{
602*cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
603*cdf0e10cSrcweir 	}
604*cdf0e10cSrcweir 
605*cdf0e10cSrcweir 	aRet.realloc(nRealNameCount);
606*cdf0e10cSrcweir 	return aRet;
607*cdf0e10cSrcweir }
608*cdf0e10cSrcweir /*-- 17.11.99 12:51:39---------------------------------------------------
609*cdf0e10cSrcweir 
610*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
611*cdf0e10cSrcweir sal_Bool BibliographyLoader::hasByName(const rtl::OUString& rName) throw ( RuntimeException )
612*cdf0e10cSrcweir {
613*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
614*cdf0e10cSrcweir 	try
615*cdf0e10cSrcweir 	{
616*cdf0e10cSrcweir 		Reference< XResultSet >  xCursor = GetDataCursor();
617*cdf0e10cSrcweir 		Reference< sdb::XColumn >  xIdColumn = GetIdentifierColumn();
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir 		if (xIdColumn.is()) 	// implies xCursor.is()
620*cdf0e10cSrcweir 		{
621*cdf0e10cSrcweir 			do
622*cdf0e10cSrcweir 			{
623*cdf0e10cSrcweir 				rtl::OUString sCurrentId = xIdColumn->getString();
624*cdf0e10cSrcweir 				if (!xIdColumn->wasNull() && (rName.compareTo(sCurrentId) == COMPARE_EQUAL))
625*cdf0e10cSrcweir 				{
626*cdf0e10cSrcweir 					bRet = sal_True;
627*cdf0e10cSrcweir 					break;
628*cdf0e10cSrcweir 				}
629*cdf0e10cSrcweir 			}
630*cdf0e10cSrcweir 			while(xCursor->next());
631*cdf0e10cSrcweir 		}
632*cdf0e10cSrcweir 	}
633*cdf0e10cSrcweir 	catch(const Exception&)
634*cdf0e10cSrcweir 	{
635*cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
636*cdf0e10cSrcweir 	}
637*cdf0e10cSrcweir 	return bRet;
638*cdf0e10cSrcweir }
639*cdf0e10cSrcweir /*-- 17.11.99 12:51:39---------------------------------------------------
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
642*cdf0e10cSrcweir Type  BibliographyLoader::getElementType(void) throw ( RuntimeException )
643*cdf0e10cSrcweir {
644*cdf0e10cSrcweir 	return ::getCppuType((Sequence<PropertyValue>*)0);
645*cdf0e10cSrcweir }
646*cdf0e10cSrcweir /*-- 17.11.99 12:51:40---------------------------------------------------
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
649*cdf0e10cSrcweir sal_Bool BibliographyLoader::hasElements(void) throw ( RuntimeException )
650*cdf0e10cSrcweir {
651*cdf0e10cSrcweir 	Reference< XResultSet >  xCursor = GetDataCursor();
652*cdf0e10cSrcweir 	Reference< XNameAccess >  xColumns = GetDataColumns();
653*cdf0e10cSrcweir 	return xColumns.is() && (xColumns->getElementNames().getLength() != 0);
654*cdf0e10cSrcweir }
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir /*-- 07.12.99 14:28:39---------------------------------------------------
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
659*cdf0e10cSrcweir Reference< XPropertySetInfo >  BibliographyLoader::getPropertySetInfo(void) throw
660*cdf0e10cSrcweir 											( RuntimeException )
661*cdf0e10cSrcweir {
662*cdf0e10cSrcweir     static SfxItemPropertyMapEntry aBibProps_Impl[] =
663*cdf0e10cSrcweir 	{
664*cdf0e10cSrcweir 		{ MAP_CHAR_LEN("BibliographyDataFieldNames"), 0, &::getCppuType((Sequence<PropertyValue>*)0), PropertyAttribute::READONLY, 0},
665*cdf0e10cSrcweir 		{0,0,0,0,0,0}
666*cdf0e10cSrcweir 	};
667*cdf0e10cSrcweir 	static Reference< XPropertySetInfo >  xRet =
668*cdf0e10cSrcweir 		SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo();
669*cdf0e10cSrcweir 	return xRet;
670*cdf0e10cSrcweir }
671*cdf0e10cSrcweir /*-- 07.12.99 14:28:39---------------------------------------------------
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
674*cdf0e10cSrcweir void BibliographyLoader::setPropertyValue(const rtl::OUString& /*PropertyName*/,
675*cdf0e10cSrcweir 										const Any& /*aValue*/)
676*cdf0e10cSrcweir 	throw( UnknownPropertyException, PropertyVetoException,
677*cdf0e10cSrcweir 		IllegalArgumentException, WrappedTargetException, RuntimeException)
678*cdf0e10cSrcweir {
679*cdf0e10cSrcweir 	throw UnknownPropertyException();
680*cdf0e10cSrcweir 	//no changeable properties
681*cdf0e10cSrcweir }
682*cdf0e10cSrcweir /*-- 07.12.99 14:28:39---------------------------------------------------
683*cdf0e10cSrcweir 
684*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
685*cdf0e10cSrcweir Any BibliographyLoader::getPropertyValue(const rtl::OUString& rPropertyName)
686*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
687*cdf0e10cSrcweir {
688*cdf0e10cSrcweir 	Any aRet;
689*cdf0e10cSrcweir 	static const sal_uInt16 aInternalMapping[] =
690*cdf0e10cSrcweir 	{
691*cdf0e10cSrcweir 		IDENTIFIER_POS			   , // BibliographyDataField_IDENTIFIER
692*cdf0e10cSrcweir 		AUTHORITYTYPE_POS		   , // BibliographyDataField_BIBILIOGRAPHIC_TYPE
693*cdf0e10cSrcweir 		ADDRESS_POS 			   , // BibliographyDataField_ADDRESS
694*cdf0e10cSrcweir 		ANNOTE_POS				   , // BibliographyDataField_ANNOTE
695*cdf0e10cSrcweir 		AUTHOR_POS				   , // BibliographyDataField_AUTHOR
696*cdf0e10cSrcweir 		BOOKTITLE_POS			   , // BibliographyDataField_BOOKTITLE
697*cdf0e10cSrcweir 		CHAPTER_POS 			   , // BibliographyDataField_CHAPTER
698*cdf0e10cSrcweir 		EDITION_POS 			   , // BibliographyDataField_EDITION
699*cdf0e10cSrcweir 		EDITOR_POS				   , // BibliographyDataField_EDITOR
700*cdf0e10cSrcweir 		HOWPUBLISHED_POS		   , // BibliographyDataField_HOWPUBLISHED
701*cdf0e10cSrcweir 		INSTITUTION_POS 		   , // BibliographyDataField_INSTITUTION
702*cdf0e10cSrcweir 		JOURNAL_POS 			   , // BibliographyDataField_JOURNAL
703*cdf0e10cSrcweir 		MONTH_POS				   , // BibliographyDataField_MONTH
704*cdf0e10cSrcweir 		NOTE_POS				   , // BibliographyDataField_NOTE
705*cdf0e10cSrcweir 		NUMBER_POS				   , // BibliographyDataField_NUMBER
706*cdf0e10cSrcweir 		ORGANIZATIONS_POS		   , // BibliographyDataField_ORGANIZATIONS
707*cdf0e10cSrcweir 		PAGES_POS				   , // BibliographyDataField_PAGES
708*cdf0e10cSrcweir 		PUBLISHER_POS			   , // BibliographyDataField_PUBLISHER
709*cdf0e10cSrcweir 		SCHOOL_POS				   , // BibliographyDataField_SCHOOL
710*cdf0e10cSrcweir 		SERIES_POS				   , // BibliographyDataField_SERIES
711*cdf0e10cSrcweir 		TITLE_POS				   , // BibliographyDataField_TITLE
712*cdf0e10cSrcweir 		REPORTTYPE_POS			   , // BibliographyDataField_REPORT_TYPE
713*cdf0e10cSrcweir 		VOLUME_POS				   , // BibliographyDataField_VOLUME
714*cdf0e10cSrcweir 		YEAR_POS				   , // BibliographyDataField_YEAR
715*cdf0e10cSrcweir 		URL_POS 				   , // BibliographyDataField_URL
716*cdf0e10cSrcweir 		CUSTOM1_POS 			   , // BibliographyDataField_CUSTOM1
717*cdf0e10cSrcweir 		CUSTOM2_POS 			   , // BibliographyDataField_CUSTOM2
718*cdf0e10cSrcweir 		CUSTOM3_POS 			   , // BibliographyDataField_CUSTOM3
719*cdf0e10cSrcweir 		CUSTOM4_POS 			   , // BibliographyDataField_CUSTOM4
720*cdf0e10cSrcweir 		CUSTOM5_POS 			   , // BibliographyDataField_CUSTOM5
721*cdf0e10cSrcweir 		ISBN_POS					//BibliographyDataField_ISBN
722*cdf0e10cSrcweir 	};
723*cdf0e10cSrcweir 	if(C2U("BibliographyDataFieldNames") == rPropertyName)
724*cdf0e10cSrcweir 	{
725*cdf0e10cSrcweir 		Sequence<PropertyValue> aSeq(COLUMN_COUNT);
726*cdf0e10cSrcweir 		PropertyValue* pArray = aSeq.getArray();
727*cdf0e10cSrcweir 		BibConfig* pConfig = BibModul::GetConfig();
728*cdf0e10cSrcweir 		for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++)
729*cdf0e10cSrcweir 		{
730*cdf0e10cSrcweir 			pArray[i].Name = pConfig->GetDefColumnName(aInternalMapping[i]);
731*cdf0e10cSrcweir 			pArray[i].Value <<= (sal_Int16) i;
732*cdf0e10cSrcweir 		}
733*cdf0e10cSrcweir 		aRet.setValue(&aSeq, ::getCppuType((Sequence<PropertyValue>*)0));
734*cdf0e10cSrcweir 	}
735*cdf0e10cSrcweir 	else
736*cdf0e10cSrcweir 		throw UnknownPropertyException();
737*cdf0e10cSrcweir 	return aRet;
738*cdf0e10cSrcweir }
739*cdf0e10cSrcweir /*-- 07.12.99 14:28:40---------------------------------------------------
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
742*cdf0e10cSrcweir void BibliographyLoader::addPropertyChangeListener(
743*cdf0e10cSrcweir 		const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
744*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
745*cdf0e10cSrcweir {
746*cdf0e10cSrcweir 	//no bound properties
747*cdf0e10cSrcweir }
748*cdf0e10cSrcweir /*-- 07.12.99 14:28:40---------------------------------------------------
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
751*cdf0e10cSrcweir void BibliographyLoader::removePropertyChangeListener(
752*cdf0e10cSrcweir 		const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
753*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
754*cdf0e10cSrcweir {
755*cdf0e10cSrcweir 	//no bound properties
756*cdf0e10cSrcweir }
757*cdf0e10cSrcweir /*-- 07.12.99 14:28:40---------------------------------------------------
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
760*cdf0e10cSrcweir void BibliographyLoader::addVetoableChangeListener(
761*cdf0e10cSrcweir 	const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
762*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
763*cdf0e10cSrcweir {
764*cdf0e10cSrcweir 	//no vetoable properties
765*cdf0e10cSrcweir }
766*cdf0e10cSrcweir /*-- 07.12.99 14:28:40---------------------------------------------------
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
769*cdf0e10cSrcweir void BibliographyLoader::removeVetoableChangeListener(
770*cdf0e10cSrcweir 	const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
771*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
772*cdf0e10cSrcweir {
773*cdf0e10cSrcweir 	//no vetoable properties
774*cdf0e10cSrcweir }
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir 
778