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