Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / extensions / source / bibliography / bibload.cxx
blob537010ef3962f2efb2bb5c9c97f256e2466fe309
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 #include <osl/mutex.hxx>
21 #include <tools/diagnose_ex.h>
22 #include <cppuhelper/weak.hxx>
23 #include <svl/itemprop.hxx>
24 #include <uno/environment.h>
25 #include <svl/urihelper.hxx>
26 #include <toolkit/helper/vclunohelper.hxx>
27 #include <comphelper/processfactory.hxx>
28 #include <cppuhelper/factory.hxx> // helper for factories
29 #include <com/sun/star/sdbc/ResultSetType.hpp>
30 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
31 #include <com/sun/star/sdb/XColumn.hpp>
32 #include <com/sun/star/util/XURLTransformer.hpp>
33 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
34 #include <com/sun/star/sdbc/XRowSet.hpp>
35 #include <com/sun/star/sdb/CommandType.hpp>
36 #include <com/sun/star/frame/XFrameLoader.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
39 #include <com/sun/star/beans/PropertyAttribute.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/container/XNameAccess.hpp>
42 #include <com/sun/star/text/BibliographyDataField.hpp>
43 #include <com/sun/star/form/XLoadListener.hpp>
44 #include <com/sun/star/frame/XLayoutManager.hpp>
45 #include <com/sun/star/uno/XAggregation.hpp>
46 #include <toolkit/awt/vclxwindow.hxx>
47 #include <vcl/window.hxx>
48 #include <vcl/edit.hxx>
49 #include <vcl/svapp.hxx>
50 #include <vcl/group.hxx>
51 #include <svtools/svmedit.hxx>
53 #include "bibresid.hxx"
54 #include "bib.hrc"
55 #include "bibcont.hxx"
56 #include "bibbeam.hxx"
57 #include "bibmod.hxx"
58 #include "bibview.hxx"
59 #include "framectr.hxx"
60 #include "datman.hxx"
61 #include <bibconfig.hxx>
62 #include <cppuhelper/implbase4.hxx> // helper for implementations
64 using namespace ::rtl;
65 using namespace ::com::sun::star;
66 using namespace ::com::sun::star::uno;
67 using namespace ::com::sun::star::beans;
68 using namespace ::com::sun::star::lang;
69 using namespace ::com::sun::star::sdb;
70 using namespace ::com::sun::star::sdbc;
71 using namespace ::com::sun::star::form;
72 using namespace ::com::sun::star::container;
73 using namespace ::com::sun::star::frame;
75 #define C2U(cChar) OUString::createFromAscii(cChar)
78 //-----------------------------------------------------------------------------
80 #define PROPERTY_FRAME 1
82 class BibliographyLoader : public cppu::WeakImplHelper4
83 < XServiceInfo, XNameAccess, XPropertySet, XFrameLoader >
85 HdlBibModul m_pBibMod;
86 Reference< XLoadable > m_xDatMan;
87 BibDataManager* m_pDatMan;
88 Reference< XNameAccess > m_xColumns;
89 Reference< XResultSet > m_xCursor;
91 private:
93 void loadView(const Reference< XFrame > & aFrame, const rtl::OUString& aURL,
94 const Sequence< PropertyValue >& aArgs,
95 const Reference< XLoadEventListener > & aListener);
97 BibDataManager* GetDataManager()const;
98 Reference< XNameAccess > GetDataColumns() const;
99 Reference< XResultSet > GetDataCursor() const;
100 Reference< sdb::XColumn > GetIdentifierColumn() const;
102 public:
103 BibliographyLoader();
104 ~BibliographyLoader();
106 // XServiceInfo
107 rtl::OUString SAL_CALL getImplementationName() throw( );
108 sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( );
109 Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
110 static rtl::OUString getImplementationName_Static() throw( )
114 return C2U("com.sun.star.extensions.Bibliography");
118 //XNameAccess
119 virtual Any SAL_CALL getByName(const rtl::OUString& aName) throw ( NoSuchElementException, WrappedTargetException, RuntimeException );
120 virtual Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw ( RuntimeException );
121 virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& aName) throw ( RuntimeException );
123 //XElementAccess
124 virtual Type SAL_CALL getElementType(void) throw ( RuntimeException );
125 virtual sal_Bool SAL_CALL hasElements(void) throw ( RuntimeException );
127 //XPropertySet
128 virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo(void) throw ( RuntimeException );
129 virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException );
130 virtual Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName) throw ( UnknownPropertyException, WrappedTargetException, RuntimeException );
131 virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
132 virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
133 virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
134 virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
136 static Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames_Static(void) throw( );
138 friend Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception );
140 // XLoader
141 virtual void SAL_CALL load(const Reference< XFrame > & aFrame, const rtl::OUString& aURL,
142 const Sequence< PropertyValue >& aArgs,
143 const Reference< XLoadEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException);
144 virtual void SAL_CALL cancel(void) throw (::com::sun::star::uno::RuntimeException);
147 BibliographyLoader::BibliographyLoader() :
148 m_pBibMod(0),
149 m_pDatMan(0)
153 BibliographyLoader::~BibliographyLoader()
155 Reference< lang::XComponent > xComp(m_xCursor, UNO_QUERY);
156 if (xComp.is())
157 xComp->dispose();
158 if(m_pBibMod)
159 CloseBibModul(m_pBibMod);
163 Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & /*rSMgr*/ ) throw( Exception )
165 return *(new BibliographyLoader);
169 // XServiceInfo
170 rtl::OUString BibliographyLoader::getImplementationName() throw( )
173 return getImplementationName_Static();
176 // XServiceInfo
177 sal_Bool BibliographyLoader::supportsService(const rtl::OUString& ServiceName) throw( )
179 Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
180 const rtl::OUString * pArray = aSNL.getConstArray();
181 for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
182 if( pArray[i] == ServiceName )
183 return sal_True;
184 return sal_False;
187 // XServiceInfo
188 Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames(void) throw( )
190 return getSupportedServiceNames_Static();
193 // ORegistryServiceManager_Static
194 Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames_Static(void) throw( )
196 Sequence< rtl::OUString > aSNS( 2 );
197 aSNS.getArray()[0] = C2U("com.sun.star.frame.FrameLoader");
199 aSNS.getArray()[1] = C2U("com.sun.star.frame.Bibliography");
201 return aSNS;
204 extern "C"
206 SAL_DLLPUBLIC_EXPORT void * SAL_CALL bib_component_getFactory(
207 const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ )
209 void * pRet = 0;
210 if (!BibliographyLoader::getImplementationName_Static().compareToAscii( pImplName ) )
212 // create the factory
213 Reference< XSingleServiceFactory > xFactory =
214 cppu::createSingleFactory(
215 pServiceManager,
216 BibliographyLoader::getImplementationName_Static(),
217 BibliographyLoader_CreateInstance,
218 BibliographyLoader::getSupportedServiceNames_Static() );
219 // acquire, because we return an interface pointer instead of a reference
220 xFactory->acquire();
221 pRet = xFactory.get();
223 return pRet;
227 // -----------------------------------------------------------------------
228 void BibliographyLoader::cancel(void) throw (::com::sun::star::uno::RuntimeException)
234 void BibliographyLoader::load(const Reference< XFrame > & rFrame, const rtl::OUString& rURL,
235 const Sequence< PropertyValue >& rArgs,
236 const Reference< XLoadEventListener > & rListener) throw (::com::sun::star::uno::RuntimeException)
239 SolarMutexGuard aGuard;
241 m_pBibMod = OpenBibModul();
243 String aURLStr( rURL );
244 String aPartName = aURLStr.GetToken( 1, '/' );
245 Reference<XPropertySet> xPrSet(rFrame, UNO_QUERY);
246 if(xPrSet.is())
248 Any aTitle;
249 aTitle <<= OUString(String(BibResId(RID_BIB_STR_FRAME_TITLE)));
250 xPrSet->setPropertyValue(C2U("Title"), aTitle);
252 if(aPartName.EqualsAscii("View") || aPartName.EqualsAscii("View1"))
254 loadView(rFrame, rURL, rArgs, rListener);
258 // -----------------------------------------------------------------------
259 void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const rtl::OUString& /*rURL*/,
260 const Sequence< PropertyValue >& /*rArgs*/,
261 const Reference< XLoadEventListener > & rListener)
263 SolarMutexGuard aGuard;
265 if(!m_pBibMod)
266 m_pBibMod = OpenBibModul();
268 m_pDatMan = (*m_pBibMod)->createDataManager();
269 m_xDatMan = m_pDatMan;
270 BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
272 if(aBibDesc.sDataSource.isEmpty())
274 DBChangeDialogConfig_Impl aConfig;
275 const Sequence<OUString> aSources = aConfig.GetDataSourceNames();
276 if(aSources.getLength())
277 aBibDesc.sDataSource = aSources.getConstArray()[0];
280 Reference< XForm > xForm = m_pDatMan->createDatabaseForm( aBibDesc );
282 Reference< awt::XWindow > aWindow = rFrame->getContainerWindow();
283 VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow);
285 Window* pParent = VCLUnoHelper::GetWindow( aWindow );
287 BibBookContainer *pMyWindow = new BibBookContainer( pParent );
288 pMyWindow->Show();
290 ::bib::BibView* pView = new ::bib::BibView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK );
291 pView->Show();
292 m_pDatMan->SetView( pView );
294 ::bib::BibBeamer* pBeamer = new ::bib::BibBeamer( pMyWindow, m_pDatMan );
295 pBeamer->Show();
296 pMyWindow->createTopFrame(pBeamer);
298 pMyWindow->createBottomFrame(pView);
300 Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY );
302 Reference< XController > xCtrRef( new BibFrameController_Impl( xWin, m_pDatMan ) );
304 xCtrRef->attachFrame(rFrame);
305 rFrame->setComponent( xWin, xCtrRef);
306 pBeamer->SetXController(xCtrRef);
309 // not earlier because SetFocus() is triggered in setVisible()
310 pParentComponent->setVisible(sal_True);
312 m_xDatMan->load();
313 // #100312# ----------
314 m_pDatMan->RegisterInterceptor(pBeamer);
316 if ( rListener.is() )
317 rListener->loadFinished( this );
319 // attach menu bar
320 Reference< XPropertySet > xPropSet( rFrame, UNO_QUERY );
321 Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
322 if ( xPropSet.is() )
326 Any a = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
327 a >>= xLayoutManager;
329 catch ( const uno::Exception& )
334 if ( xLayoutManager.is() )
335 xLayoutManager->createElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )));
338 BibDataManager* BibliographyLoader::GetDataManager()const
340 if(!m_pDatMan)
342 if(!m_pBibMod)
343 const_cast< BibliographyLoader* >( this )->m_pBibMod = OpenBibModul();
344 const_cast< BibliographyLoader* >( this )->m_pDatMan = (*m_pBibMod)->createDataManager();
345 const_cast< BibliographyLoader* >( this )->m_xDatMan = m_pDatMan;
347 return m_pDatMan;
350 Reference< XNameAccess > BibliographyLoader::GetDataColumns() const
352 if (!m_xColumns.is())
354 Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
355 Reference< XRowSet > xRowSet(xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
356 Reference< XPropertySet > xResultSetProps(xRowSet, UNO_QUERY);
357 DBG_ASSERT(xResultSetProps.is() , "BibliographyLoader::GetDataCursor : invalid row set (no XResultSet or no XPropertySet) !");
359 BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
361 Any aBibUrlAny; aBibUrlAny <<= aBibDesc.sDataSource;
362 xResultSetProps->setPropertyValue(C2U("DataSourceName"), aBibUrlAny);
363 Any aCommandType; aCommandType <<= aBibDesc.nCommandType;
364 xResultSetProps->setPropertyValue(C2U("CommandType"), aCommandType);
365 Any aTableName; aTableName <<= aBibDesc.sTableOrQuery;
366 xResultSetProps->setPropertyValue(C2U("Command"), aTableName);
367 Any aResultSetType; aResultSetType <<= (sal_Int32)(ResultSetType::SCROLL_INSENSITIVE);
368 xResultSetProps->setPropertyValue(C2U("ResultSetType"), aResultSetType);
369 Any aResultSetCurrency; aResultSetCurrency <<= (sal_Int32)(ResultSetConcurrency::UPDATABLE);
370 xResultSetProps->setPropertyValue(C2U("ResultSetConcurrency"), aResultSetCurrency);
372 sal_Bool bSuccess = sal_False;
375 xRowSet->execute();
376 bSuccess = sal_True;
378 catch(const SQLException&)
380 DBG_UNHANDLED_EXCEPTION();
382 catch(const Exception& )
384 DBG_UNHANDLED_EXCEPTION();
385 bSuccess = sal_False;
388 if (!bSuccess)
390 Reference< XComponent > xSetComp(xRowSet, UNO_QUERY);
391 if (xSetComp.is())
392 xSetComp->dispose();
393 xRowSet = NULL;
395 else
396 ((BibliographyLoader*)this)->m_xCursor = xRowSet.get();
398 Reference< sdbcx::XColumnsSupplier > xSupplyCols(m_xCursor, UNO_QUERY);
399 if (xSupplyCols.is())
400 ((BibliographyLoader*)this)->m_xColumns = xSupplyCols->getColumns();
403 return m_xColumns;
406 Reference< sdb::XColumn > BibliographyLoader::GetIdentifierColumn() const
408 BibDataManager* pDatMan = GetDataManager();
409 Reference< XNameAccess > xColumns = GetDataColumns();
410 rtl::OUString sIdentifierColumnName = pDatMan->GetIdentifierMapping();
412 Reference< sdb::XColumn > xReturn;
413 if (xColumns.is() && xColumns->hasByName(sIdentifierColumnName))
415 xReturn = Reference< XColumn > (*(Reference< XInterface > *)
416 xColumns->getByName(sIdentifierColumnName).getValue(), UNO_QUERY);
418 return xReturn;
421 Reference< XResultSet > BibliographyLoader::GetDataCursor() const
423 if (!m_xCursor.is())
424 GetDataColumns();
425 if (m_xCursor.is())
426 m_xCursor->first();
427 return m_xCursor;
430 static rtl::OUString lcl_AddProperty(Reference< XNameAccess > xColumns,
431 const Mapping* pMapping, const String& rColumnName)
433 String sColumnName(rColumnName);
434 if(pMapping)
436 for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
438 if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == OUString(rColumnName))
440 sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName;
441 break;
445 rtl::OUString uColumnName(sColumnName);
446 rtl::OUString uRet;
447 Reference< sdb::XColumn > xCol;
448 if (xColumns->hasByName(uColumnName))
449 xCol = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(uColumnName).getValue(), UNO_QUERY);
450 if (xCol.is())
451 uRet = xCol->getString();
452 return uRet;
454 //-----------------------------------------------------------------------------
455 Any BibliographyLoader::getByName(const rtl::OUString& rName) throw
456 ( NoSuchElementException, WrappedTargetException, RuntimeException )
458 Any aRet;
461 BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager();
462 Reference< XResultSet > xCursor = GetDataCursor();
463 Reference< sdbcx::XColumnsSupplier > xSupplyCols(xCursor, UNO_QUERY);
464 Reference< XNameAccess > xColumns;
465 if (!xSupplyCols.is())
466 return aRet;
467 xColumns = xSupplyCols->getColumns();
468 DBG_ASSERT(xSupplyCols.is(), "BibliographyLoader::getByName : invalid columns returned by the data cursor (may be the result set is not alive ?) !");
469 if (!xColumns.is())
470 return aRet;
472 String sIdentifierMapping = pDatMan->GetIdentifierMapping();
473 rtl::OUString sId = sIdentifierMapping;
474 Reference< sdb::XColumn > xColumn;
475 if (xColumns->hasByName(sId))
476 xColumn = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(sId).getValue(), UNO_QUERY);
477 if (xColumn.is())
481 if ((rName == xColumn->getString()) && !xColumn->wasNull())
483 Sequence<PropertyValue> aPropSequ(COLUMN_COUNT);
484 PropertyValue* pValues = aPropSequ.getArray();
485 BibConfig* pConfig = BibModul::GetConfig();
486 BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL();
487 const Mapping* pMapping = pConfig->GetMapping(aBibDesc);
488 for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
490 const String sColName = pConfig->GetDefColumnName(
491 nEntry);
492 pValues[nEntry].Name = sColName;
493 pValues[nEntry].Value <<= lcl_AddProperty(xColumns, pMapping, sColName);
495 aRet.setValue(&aPropSequ, ::getCppuType((Sequence<PropertyValue>*)0));
497 break;
500 while(xCursor->next());
503 catch(const Exception&)
505 DBG_UNHANDLED_EXCEPTION();
507 return aRet;
510 Sequence< rtl::OUString > BibliographyLoader::getElementNames(void) throw ( RuntimeException )
512 Sequence< rtl::OUString > aRet(10);
513 int nRealNameCount = 0;
516 Reference< XResultSet > xCursor(GetDataCursor());
517 Reference< sdb::XColumn > xIdColumn(GetIdentifierColumn());
518 if (xIdColumn.is()) // implies xCursor.is()
522 rtl::OUString sTemp = xIdColumn->getString();
523 if (!sTemp.isEmpty() && !xIdColumn->wasNull())
525 int nLen = aRet.getLength();
526 if(nLen == nRealNameCount)
527 aRet.realloc(nLen + 10);
528 rtl::OUString* pArray = aRet.getArray();
529 pArray[nRealNameCount] = sTemp;
530 nRealNameCount++;
533 while (xCursor->next());
536 catch(const Exception&)
538 DBG_UNHANDLED_EXCEPTION();
541 aRet.realloc(nRealNameCount);
542 return aRet;
545 sal_Bool BibliographyLoader::hasByName(const rtl::OUString& rName) throw ( RuntimeException )
547 sal_Bool bRet = sal_False;
550 Reference< XResultSet > xCursor = GetDataCursor();
551 Reference< sdb::XColumn > xIdColumn = GetIdentifierColumn();
553 if (xIdColumn.is()) // implies xCursor.is()
557 rtl::OUString sCurrentId = xIdColumn->getString();
558 if (!xIdColumn->wasNull() && (rName.compareTo(sCurrentId) == COMPARE_EQUAL))
560 bRet = sal_True;
561 break;
564 while(xCursor->next());
567 catch(const Exception&)
569 DBG_UNHANDLED_EXCEPTION();
571 return bRet;
574 Type BibliographyLoader::getElementType(void) throw ( RuntimeException )
576 return ::getCppuType((Sequence<PropertyValue>*)0);
579 sal_Bool BibliographyLoader::hasElements(void) throw ( RuntimeException )
581 Reference< XResultSet > xCursor = GetDataCursor();
582 Reference< XNameAccess > xColumns = GetDataColumns();
583 return xColumns.is() && (xColumns->getElementNames().getLength() != 0);
586 Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo(void) throw
587 ( RuntimeException )
589 static SfxItemPropertyMapEntry aBibProps_Impl[] =
591 { MAP_CHAR_LEN("BibliographyDataFieldNames"), 0, &::getCppuType((Sequence<PropertyValue>*)0), PropertyAttribute::READONLY, 0},
592 {0,0,0,0,0,0}
594 static Reference< XPropertySetInfo > xRet =
595 SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo();
596 return xRet;
599 void BibliographyLoader::setPropertyValue(const rtl::OUString& /*PropertyName*/,
600 const Any& /*aValue*/)
601 throw( UnknownPropertyException, PropertyVetoException,
602 IllegalArgumentException, WrappedTargetException, RuntimeException)
604 throw UnknownPropertyException();
605 //no changeable properties
608 Any BibliographyLoader::getPropertyValue(const rtl::OUString& rPropertyName)
609 throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
611 Any aRet;
612 static const sal_uInt16 aInternalMapping[] =
614 IDENTIFIER_POS , // BibliographyDataField_IDENTIFIER
615 AUTHORITYTYPE_POS , // BibliographyDataField_BIBILIOGRAPHIC_TYPE
616 ADDRESS_POS , // BibliographyDataField_ADDRESS
617 ANNOTE_POS , // BibliographyDataField_ANNOTE
618 AUTHOR_POS , // BibliographyDataField_AUTHOR
619 BOOKTITLE_POS , // BibliographyDataField_BOOKTITLE
620 CHAPTER_POS , // BibliographyDataField_CHAPTER
621 EDITION_POS , // BibliographyDataField_EDITION
622 EDITOR_POS , // BibliographyDataField_EDITOR
623 HOWPUBLISHED_POS , // BibliographyDataField_HOWPUBLISHED
624 INSTITUTION_POS , // BibliographyDataField_INSTITUTION
625 JOURNAL_POS , // BibliographyDataField_JOURNAL
626 MONTH_POS , // BibliographyDataField_MONTH
627 NOTE_POS , // BibliographyDataField_NOTE
628 NUMBER_POS , // BibliographyDataField_NUMBER
629 ORGANIZATIONS_POS , // BibliographyDataField_ORGANIZATIONS
630 PAGES_POS , // BibliographyDataField_PAGES
631 PUBLISHER_POS , // BibliographyDataField_PUBLISHER
632 SCHOOL_POS , // BibliographyDataField_SCHOOL
633 SERIES_POS , // BibliographyDataField_SERIES
634 TITLE_POS , // BibliographyDataField_TITLE
635 REPORTTYPE_POS , // BibliographyDataField_REPORT_TYPE
636 VOLUME_POS , // BibliographyDataField_VOLUME
637 YEAR_POS , // BibliographyDataField_YEAR
638 URL_POS , // BibliographyDataField_URL
639 CUSTOM1_POS , // BibliographyDataField_CUSTOM1
640 CUSTOM2_POS , // BibliographyDataField_CUSTOM2
641 CUSTOM3_POS , // BibliographyDataField_CUSTOM3
642 CUSTOM4_POS , // BibliographyDataField_CUSTOM4
643 CUSTOM5_POS , // BibliographyDataField_CUSTOM5
644 ISBN_POS //BibliographyDataField_ISBN
646 if(C2U("BibliographyDataFieldNames") == rPropertyName)
648 Sequence<PropertyValue> aSeq(COLUMN_COUNT);
649 PropertyValue* pArray = aSeq.getArray();
650 BibConfig* pConfig = BibModul::GetConfig();
651 for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++)
653 pArray[i].Name = pConfig->GetDefColumnName(aInternalMapping[i]);
654 pArray[i].Value <<= (sal_Int16) i;
656 aRet.setValue(&aSeq, ::getCppuType((Sequence<PropertyValue>*)0));
658 else
659 throw UnknownPropertyException();
660 return aRet;
663 void BibliographyLoader::addPropertyChangeListener(
664 const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
665 throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
667 //no bound properties
670 void BibliographyLoader::removePropertyChangeListener(
671 const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
672 throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
674 //no bound properties
677 void BibliographyLoader::addVetoableChangeListener(
678 const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
679 throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
681 //no vetoable properties
684 void BibliographyLoader::removeVetoableChangeListener(
685 const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
686 throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
688 //no vetoable properties
693 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */