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