LibreOffice Module dbaccess (master) 1
xmlExport.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "xmlExport.hxx"
21#include "xmlAutoStyle.hxx"
23#include <utility>
24#include <xmloff/xmltoken.hxx>
27#include <comphelper/string.hxx>
28#include <comphelper/types.hxx>
29#include <strings.hxx>
30#include <sal/log.hxx>
31#include <com/sun/star/beans/XPropertyState.hpp>
32#include <com/sun/star/beans/PropertyAttribute.hpp>
33#include <com/sun/star/frame/XModel.hpp>
34#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
35#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp>
36#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
37#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
38#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
39#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
40#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
41
42#include <com/sun/star/awt/TextAlign.hpp>
43#include <xmloff/xmluconv.hxx>
44#include "xmlHelper.hxx"
45#include <com/sun/star/awt/FontDescriptor.hpp>
46#include <svl/filenotation.hxx>
51
52#include <optional>
53#include <memory>
54
55using namespace comphelper;
56using namespace ::com::sun::star::sdb;
57using namespace ::com::sun::star::sdbcx;
58using namespace ::com::sun::star::util;
59using namespace ::com::sun::star;
60
61extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
63 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
64{
65 return cppu::acquire(new ::dbaxml::ODBExport(context,
66 "com.sun.star.comp.sdb.DBExportFilter"));
67}
68
69extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
71 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
72{
73 return cppu::acquire(new ::dbaxml::ODBExport(context,
74 "com.sun.star.comp.sdb.XMLSettingsExporter",
75 SvXMLExportFlags::SETTINGS | SvXMLExportFlags::PRETTY ));
76}
77
78extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
80 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
81{
82 return cppu::acquire(new ::dbaxml::ODBExport(context,
83 "com.sun.star.comp.sdb.XMLFullExporter",
84 SvXMLExportFlags::ALL));
85}
86
87namespace dbaxml
88{
89 static OUString lcl_implGetPropertyXMLType(const Type& _rType)
90 {
91 // possible types we can write (either because we recognize them directly or because we convert _rValue
92 // into one of these types)
93
94 // handle the type description
95 switch (_rType.getTypeClass())
96 {
97 case TypeClass_STRING:
98 return "string";
99 case TypeClass_DOUBLE:
100 return "double";
101 case TypeClass_BOOLEAN:
102 return "boolean";
103 case TypeClass_BYTE:
104 case TypeClass_SHORT:
105 return "short";
106 case TypeClass_LONG:
107 return "int";
108 case TypeClass_HYPER:
109 return "long";
110 case TypeClass_ENUM:
111 return "int";
112
113 default:
114 OSL_FAIL( "lcl_implGetPropertyXMLType: unsupported value type!" );
115 return "double";
116 }
117 }
118
119 namespace {
120
121 class OSpecialHandleXMLExportPropertyMapper : public SvXMLExportPropertyMapper
122 {
123 public:
124 explicit OSpecialHandleXMLExportPropertyMapper(const rtl::Reference< XMLPropertySetMapper >& rMapper) : SvXMLExportPropertyMapper(rMapper )
125 {
126 }
129 virtual void handleSpecialItem(
130 comphelper::AttributeList& /*rAttrList*/,
131 const XMLPropertyState& /*rProperty*/,
132 const SvXMLUnitConverter& /*rUnitConverter*/,
133 const SvXMLNamespaceMap& /*rNamespaceMap*/,
134 const std::vector< XMLPropertyState > * /*pProperties*/ ,
135 sal_uInt32 /*nIdx*/ ) const override
136 {
137 // nothing to do here
138 }
139 };
140
141 }
142
143ODBExport::ODBExport(const Reference< XComponentContext >& _rxContext, OUString const & implementationName, SvXMLExportFlags nExportFlag)
144: SvXMLExport( _rxContext, implementationName, util::MeasureUnit::MM_10TH, XML_DATABASE,
145 SvXMLExportFlags::OASIS | nExportFlag)
146,m_aTypeCollection(_rxContext)
147,m_bAllreadyFilled(false)
148{
149 GetMM100UnitConverter().SetCoreMeasureUnit(util::MeasureUnit::MM_10TH);
150 GetMM100UnitConverter().SetXMLMeasureUnit(util::MeasureUnit::CM);
151
155
157
158 if( nExportFlag & (SvXMLExportFlags::STYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::FONTDECLS) )
160
161 if( nExportFlag & (SvXMLExportFlags::META|SvXMLExportFlags::STYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::CONTENT|SvXMLExportFlags::SCRIPTS|SvXMLExportFlags::SETTINGS) )
162 {
164 }
165 if( nExportFlag & SvXMLExportFlags::SETTINGS )
166 {
168 }
169
170 if( nExportFlag & (SvXMLExportFlags::STYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::CONTENT|SvXMLExportFlags::FONTDECLS) )
171 {
173 }
174
177
179 m_xColumnExportHelper = new OSpecialHandleXMLExportPropertyMapper(GetColumnStylesPropertySetMapper());
180
181 m_xCellExportHelper = new OSpecialHandleXMLExportPropertyMapper(GetCellStylesPropertySetMapper());
182 m_xRowExportHelper = new OSpecialHandleXMLExportPropertyMapper(OXMLHelper::GetRowStylesPropertySetMapper());
183
184 GetAutoStylePool()->AddFamily(
185 XmlStyleFamily::TABLE_TABLE,
187 m_xExportHelper.get(),
189
190 GetAutoStylePool()->AddFamily(
191 XmlStyleFamily::TABLE_COLUMN,
195
196 GetAutoStylePool()->AddFamily(
197 XmlStyleFamily::TABLE_CELL,
201
202 GetAutoStylePool()->AddFamily(
203 XmlStyleFamily::TABLE_ROW,
205 m_xRowExportHelper.get(),
207}
208
210{
211 try
212 {
213 Reference<XPropertySet> xProp( getDataSource(), UNO_SET_THROW );
214
215 bool bAutoIncrementEnabled = true;
216 TStringPair aAutoIncrement;
217
218 Reference< XPropertySet > xDataSourceSettings;
219 OSL_VERIFY( xProp->getPropertyValue( PROPERTY_SETTINGS ) >>= xDataSourceSettings );
220 Reference< XPropertyState > xSettingsState( xDataSourceSettings, UNO_QUERY_THROW );
221 Reference< XPropertySetInfo > xSettingsInfo( xDataSourceSettings->getPropertySetInfo(), UNO_SET_THROW );
222
223 TDelimiter aDelimiter;
224 xSettingsState->getPropertyDefault( INFO_TEXTDELIMITER ) >>= aDelimiter.sText;
225 xSettingsState->getPropertyDefault( INFO_FIELDDELIMITER ) >>= aDelimiter.sField;
226 xSettingsState->getPropertyDefault( INFO_DECIMALDELIMITER ) >>= aDelimiter.sDecimal;
227 xSettingsState->getPropertyDefault( INFO_THOUSANDSDELIMITER ) >>= aDelimiter.sThousand;
228
230 const OUString sURL = ::comphelper::getString(xProp->getPropertyValue(PROPERTY_URL));
231 const ::comphelper::NamedValueCollection& aDriverSupportedProperties( aDriverConfig.getProperties( sURL ) );
232
233 static OUString s_sTrue(::xmloff::token::GetXMLToken( XML_TRUE ));
234 static OUString s_sFalse(::xmloff::token::GetXMLToken( XML_FALSE ));
235 // loop through the properties, and export only those which are not defaulted
236 TSettingsMap aSettingsMap;
237 // Don't try to get XPropertySetInfo from xProp, simply wrap the attempt into try block
238 try
239 {
240 const Any aValue = xProp->getPropertyValue(PROPERTY_SUPPRESSVERSIONCL);
241 if (!getBOOL(aValue)) // default in the XML schema is true -> only write false
242 aSettingsMap.emplace(XML_SUPPRESS_VERSION_COLUMNS, s_sFalse);
243 }
244 catch (const UnknownPropertyException&)
245 {
246 }
247
248 Sequence< Property > aProperties = xSettingsInfo->getProperties();
249 const Property* pProperties = aProperties.getConstArray();
250 const Property* pPropertiesEnd = pProperties + aProperties.getLength();
251 for ( ; pProperties != pPropertiesEnd; ++pProperties )
252 {
253 OUString sValue;
254 Any aValue = xDataSourceSettings->getPropertyValue( pProperties->Name );
255 switch ( aValue.getValueTypeClass() )
256 {
257 case TypeClass_STRING:
258 aValue >>= sValue;
259 break;
260 case TypeClass_DOUBLE:
261 // let the unit converter format is as string
262 sValue = OUString::number( getDouble( aValue ) );
263 break;
264 case TypeClass_BOOLEAN:
265 sValue = ::xmloff::token::GetXMLToken( getBOOL( aValue ) ? XML_TRUE : XML_FALSE );
266 break;
267 case TypeClass_BYTE:
268 case TypeClass_SHORT:
269 case TypeClass_LONG:
270 // let the unit converter format is as string
271 sValue = OUString::number( getINT32( aValue ) );
272 break;
273 default:
274 break;
275 }
276
278
279 struct PropertyMap
280 {
281 const OUString sPropertyName;
282 const XMLTokenEnum eAttributeToken;
283 const ::std::optional< OUString > aXMLDefault;
284
285 PropertyMap( OUString _sPropertyName, const XMLTokenEnum _eToken )
286 :sPropertyName(std::move( _sPropertyName ))
287 ,eAttributeToken( _eToken )
288 ,aXMLDefault()
289 {
290 }
291
292 PropertyMap( OUString _sPropertyName, const XMLTokenEnum _eToken, const OUString& _rDefault )
293 :sPropertyName(std::move( _sPropertyName ))
294 ,eAttributeToken( _eToken )
295 ,aXMLDefault( _rDefault )
296 {
297 }
298 };
299
300 const PropertyMap aTokens[] =
301 {
313 };
314
315 bool bIsXMLDefault = false;
316 for (const auto & aToken : aTokens)
317 {
318 if ( pProperties->Name == aToken.sPropertyName )
319 {
320 eToken = aToken.eAttributeToken;
321
322 if ( !!aToken.aXMLDefault
323 && ( sValue == *aToken.aXMLDefault )
324 )
325 {
326 bIsXMLDefault = true;
327 }
328 break;
329 }
330 }
331
332 if ( bIsXMLDefault )
333 // the property has the value which is specified as default in the XML schema -> no need to write it
334 continue;
335
336 if ( eToken == XML_TOKEN_INVALID )
337 {
338 // for properties which are not REMOVABLE, we care for their state, and
339 // only export them if they're not DEFAULTed
340 if ( ( pProperties->Attributes & PropertyAttribute::REMOVABLE ) == 0 )
341 {
342 PropertyState ePropertyState = xSettingsState->getPropertyState( pProperties->Name );
343 if ( PropertyState_DEFAULT_VALUE == ePropertyState )
344 continue;
345 }
346
347 // special handlings
348 if ( pProperties->Name == PROPERTY_BOOLEANCOMPARISONMODE )
349 {
350 if ( sValue == "0" )
351 sValue = "equal-integer";
352 else if ( sValue == "1" )
353 sValue = "is-boolean";
354 else if ( sValue == "2" )
355 sValue = "equal-boolean";
356 else if ( sValue == "3" )
357 sValue = "equal-use-only-zero";
358 if ( sValue == "equal-integer" )
359 continue;
361 }
362 else if ( pProperties->Name == INFO_AUTORETRIEVEENABLED )
363 {
364 aValue >>= bAutoIncrementEnabled;
365 continue;
366 }
367 else if ( pProperties->Name == INFO_AUTORETRIEVEVALUE )
368 {
369 aAutoIncrement.first = sValue;
370 continue;
371 }
372 else if ( pProperties->Name == PROPERTY_AUTOINCREMENTCREATION )
373 {
374 aAutoIncrement.second = sValue;
375 continue;
376 }
377 else if ( pProperties->Name == INFO_TEXTDELIMITER )
378 {
379 aDelimiter.sText = sValue;
380 aDelimiter.bUsed = true;
381 continue;
382 }
383 else if ( pProperties->Name == INFO_FIELDDELIMITER )
384 {
385 aDelimiter.sField = sValue;
386 aDelimiter.bUsed = true;
387 continue;
388 }
389 else if ( pProperties->Name == INFO_DECIMALDELIMITER )
390 {
391 aDelimiter.sDecimal = sValue;
392 aDelimiter.bUsed = true;
393 continue;
394 }
395 else if ( pProperties->Name == INFO_THOUSANDSDELIMITER )
396 {
397 aDelimiter.sThousand = sValue;
398 aDelimiter.bUsed = true;
399 continue;
400 }
401 else if ( pProperties->Name == INFO_CHARSET )
402 {
403 m_sCharSet = sValue;
404 continue;
405 }
406 else
407 {
408 if ( !aDriverSupportedProperties.has(pProperties->Name) || aDriverSupportedProperties.get(pProperties->Name) != aValue )
409 {
410 m_aDataSourceSettings.emplace_back(
411 pProperties->Name, pProperties->Type, aValue );
412 }
413 continue;
414 }
415 }
416
417 aSettingsMap.emplace(eToken,sValue);
418 }
419 if ( bAutoIncrementEnabled && !(aAutoIncrement.first.isEmpty() && aAutoIncrement.second.isEmpty()) )
420 m_oAutoIncrement = aAutoIncrement;
421 if ( aDelimiter.bUsed )
422 m_aDelimiter.reset( new TDelimiter( aDelimiter ) );
423
424 SvXMLElementExport aElem(*this, XML_NAMESPACE_DB, XML_DATA_SOURCE, true, true);
425
427 exportDriverSettings(aSettingsMap);
429 }
430 catch( const Exception& )
431 {
432 DBG_UNHANDLED_EXCEPTION("dbaccess");
433 }
434}
435
437{
438 const ::xmloff::token::XMLTokenEnum pSettings[] = {
447 };
448 for (::xmloff::token::XMLTokenEnum i : pSettings)
449 {
450 TSettingsMap::const_iterator aFind = _aSettings.find(i);
451 if ( aFind != _aSettings.end() )
452 AddAttribute(XML_NAMESPACE_DB, aFind->first,aFind->second);
453 }
455
456 Reference<XPropertySet> xProp(getDataSource());
457 Sequence< OUString> aValue;
458 xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= aValue;
459 if ( aValue.hasElements() )
460 {
461 SvXMLElementExport aElem2(*this,XML_NAMESPACE_DB, XML_TABLE_FILTER, true, true);
463 }
464
465 xProp->getPropertyValue(PROPERTY_TABLETYPEFILTER) >>= aValue;
466 if ( aValue.hasElements() )
468
470}
471
473{
474 const ::xmloff::token::XMLTokenEnum pSettings[] = {
480 };
481 for (::xmloff::token::XMLTokenEnum nSetting : pSettings)
482 {
483 TSettingsMap::const_iterator aFind = _aSettings.find(nSetting);
484 if ( aFind != _aSettings.end() )
485 AddAttribute(XML_NAMESPACE_DB, aFind->first,aFind->second);
486 }
491}
492
494{
495 SvXMLElementExport aConnData(*this,XML_NAMESPACE_DB, XML_CONNECTION_DATA, true, true);
496
497 {
498 OUString sValue;
499 Reference<XPropertySet> xProp(getDataSource());
500 xProp->getPropertyValue(PROPERTY_URL) >>= sValue;
502 {
503 SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, true, true);
504 {
505 SvtPathOptions aPathOptions;
506 const OUString sOrigUrl = m_aTypeCollection.cutPrefix(sValue);
507 OUString sFileName = aPathOptions.SubstituteVariable(sOrigUrl);
508 if ( sOrigUrl == sFileName )
509 {
510 ::svt::OFileNotation aTransformer( sFileName );
511 OUStringBuffer sURL( aTransformer.get( ::svt::OFileNotation::N_URL ) );
512 if (sURL.isEmpty() || sURL[sURL.getLength() - 1] != '/')
513 sURL.append('/');
514
516 }
517 else
521 try
522 {
523 OUString sExtension;
525 sExtension = "mdb";
526 else
527 {
528 Reference< XPropertySet > xDataSourceSettings;
529 OSL_VERIFY( xProp->getPropertyValue( PROPERTY_SETTINGS ) >>= xDataSourceSettings );
530 xDataSourceSettings->getPropertyValue( INFO_TEXTFILEEXTENSION ) >>= sExtension;
531 }
532 if ( !sExtension.isEmpty() )
534 }
535 catch(const Exception&)
536 {
537 }
538 SvXMLElementExport aFileBasedDB(*this,XML_NAMESPACE_DB, XML_FILE_BASED_DATABASE, true, true);
539 }
540 }
541 else
542 {
543 OUString sDatabaseName,sHostName;
544 sal_Int32 nPort = -1;
545 m_aTypeCollection.extractHostNamePort(sValue,sDatabaseName,sHostName,nPort);
546 if ( sHostName.getLength() )
547 {
548 SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, true, true);
549 {
553 if ( nPort != -1 )
554 AddAttribute(XML_NAMESPACE_DB,XML_PORT,OUString::number(nPort));
555 if ( sDatabaseName.getLength() )
557
558 try
559 {
560 Reference< XPropertySet > xDataSourceSettings( xProp->getPropertyValue( PROPERTY_SETTINGS ), UNO_QUERY_THROW );
561 Reference< XPropertySetInfo > xSettingsInfo( xDataSourceSettings->getPropertySetInfo(), UNO_SET_THROW );
562
563
564 static constexpr OUStringLiteral sPropertyName = u"LocalSocket";
565 if ( xSettingsInfo->hasPropertyByName( sPropertyName ) )
566 {
567 OUString sPropertyValue;
568 if ( ( xDataSourceSettings->getPropertyValue( sPropertyName ) >>= sPropertyValue ) && !sPropertyValue.isEmpty() )
570 }
571 }
572 catch( const Exception& )
573 {
574 DBG_UNHANDLED_EXCEPTION("dbaccess");
575 }
576
577 SvXMLElementExport aServerDB(*this,XML_NAMESPACE_DB, XML_SERVER_DATABASE, true, true);
578 }
579 }
580 else
581 {
585 }
586 }
587
588 }
589
590 exportLogin();
591}
592
594 std::vector< TypedPropertyValue >::iterator const & in)
595{
596 css::uno::Sequence<T> anySeq;
597 bool bSuccess = in->Value >>= anySeq;
598 assert(bSuccess); (void)bSuccess;
599 for (T const & i : std::as_const(anySeq) )
600 {
602 // (no whitespace inside the tag)
603 Characters(implConvertAny(css::uno::Any(i)));
604 }
605}
606
608{
609 if ( m_aDataSourceSettings.empty() )
610 return;
611
613 std::vector< TypedPropertyValue >::iterator aIter = m_aDataSourceSettings.begin();
614 std::vector< TypedPropertyValue >::const_iterator aEnd = m_aDataSourceSettings.end();
615 for ( ; aIter != aEnd; ++aIter )
616 {
617 const bool bIsSequence = TypeClass_SEQUENCE == aIter->Type.getTypeClass();
618
619 Type aSimpleType(bIsSequence ? comphelper::getSequenceElementType(aIter->Value.getValueType()) : aIter->Type);
620
623
624 OUString sTypeName = lcl_implGetPropertyXMLType( aSimpleType );
625 if ( bIsSequence && aSimpleType.getTypeClass() == TypeClass_ANY )
626 {
627 Sequence<Any> aSeq;
628 aIter->Value >>= aSeq;
629 if ( aSeq.hasElements() )
630 sTypeName = lcl_implGetPropertyXMLType(aSeq[0].getValueType());
631 }
632
634
635 SvXMLElementExport aDataSourceSetting( *this, XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING, true, true );
636
637 if ( !bIsSequence )
638 {
639 SvXMLElementExport aDataValue( *this, XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_VALUE, true, false );
640 // (no whitespace inside the tag)
641 Characters( implConvertAny( aIter->Value ) );
642 }
643 else
644 {
645 // the not-that-simple case, we need to iterate through the sequence elements
646 switch (aSimpleType.getTypeClass())
647 {
648 case TypeClass_STRING:
649 exportDataSourceSettingsSequence< OUString >(
650 aIter );
651 break;
652 case TypeClass_DOUBLE:
653 exportDataSourceSettingsSequence< double >( aIter );
654 break;
655 case TypeClass_BOOLEAN:
656 exportDataSourceSettingsSequence< sal_Bool >( aIter );
657 break;
658 case TypeClass_BYTE:
659 exportDataSourceSettingsSequence< sal_Int8 >( aIter );
660 break;
661 case TypeClass_SHORT:
662 exportDataSourceSettingsSequence< sal_Int16 >( aIter );
663 break;
664 case TypeClass_LONG:
665 exportDataSourceSettingsSequence< sal_Int32 >( aIter );
666 break;
667 case TypeClass_ANY:
668 exportDataSourceSettingsSequence< Any >( aIter );
669 break;
670 default:
671 OSL_FAIL("unsupported sequence type !");
672 break;
673 }
674 }
675 }
676}
677
679{
680 if ( !m_sCharSet.isEmpty() )
681 {
683
684 SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_FONT_CHARSET, true, true);
685 }
686}
687
689{
690 if ( m_aDelimiter && m_aDelimiter->bUsed )
691 {
696 SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_DELIMITER, true, true);
697 }
698}
699
701{
703 {
707 }
708}
709
710void ODBExport::exportSequence(const Sequence< OUString>& _aValue
711 ,::xmloff::token::XMLTokenEnum _eTokenFilter
713{
714 if ( _aValue.hasElements() )
715 {
716 SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, _eTokenFilter, true, true);
717
718 const OUString* pIter = _aValue.getConstArray();
719 const OUString* pEnd = pIter + _aValue.getLength();
720 for(;pIter != pEnd;++pIter)
721 {
722 SvXMLElementExport aDataSource(*this,XML_NAMESPACE_DB, _eTokenType, true, false);
723 Characters(*pIter);
724 }
725 }
726}
727
729{
730 Reference<XPropertySet> xProp(getDataSource());
731 OUString sValue;
732 xProp->getPropertyValue(PROPERTY_USER) >>= sValue;
733 bool bAddLogin = !sValue.isEmpty();
734 if ( bAddLogin )
736 bool bValue = false;
737 if ( xProp->getPropertyValue(PROPERTY_ISPASSWORDREQUIRED) >>= bValue )
738 {
739 bAddLogin = true;
741 }
742 if ( bAddLogin )
743 SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, XML_LOGIN, true, true);
744}
745
746void ODBExport::exportCollection(const Reference< XNameAccess >& _xCollection
747 ,enum ::xmloff::token::XMLTokenEnum _eComponents
748 ,enum ::xmloff::token::XMLTokenEnum _eSubComponents
749 ,bool _bExportContext
750 ,const ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >& _aMemFunc
751 )
752{
753 if ( !_xCollection.is() )
754 return;
755
756 std::unique_ptr<SvXMLElementExport> pComponents;
757 if ( _bExportContext )
758 pComponents.reset( new SvXMLElementExport(*this,XML_NAMESPACE_DB, _eComponents, true, true));
759 Sequence< OUString> aSeq = _xCollection->getElementNames();
760 const OUString* pIter = aSeq.getConstArray();
761 const OUString* pEnd = pIter + aSeq.getLength();
762 for(;pIter != pEnd;++pIter)
763 {
764 Reference<XPropertySet> xProp(_xCollection->getByName(*pIter),UNO_QUERY);
765 if ( _bExportContext && XML_TABLE_REPRESENTATIONS != _eComponents )
767 Reference< XNameAccess > xSub(xProp,UNO_QUERY);
768 if ( xSub.is() )
769 {
770 exportCollection(xSub,_eSubComponents,_eSubComponents,_bExportContext,_aMemFunc);
771 }
772 else if ( xProp.is() )
773 _aMemFunc(this,xProp.get());
774 }
775}
776
777void ODBExport::exportComponent(XPropertySet* _xProp)
778{
779 OUString sValue;
780 _xProp->getPropertyValue(PROPERTY_PERSISTENT_NAME) >>= sValue;
781 bool bIsForm = true;
782 _xProp->getPropertyValue("IsForm") >>= bIsForm;
783 if ( bIsForm )
784 sValue = "forms/" + sValue;
785 else
786 sValue = "reports/" + sValue;
787
790 bool bAsTemplate = false;
791 _xProp->getPropertyValue(PROPERTY_AS_TEMPLATE) >>= bAsTemplate;
793 SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, XML_COMPONENT, true, true);
794}
795
796void ODBExport::exportQuery(XPropertySet* _xProp)
797{
799
800 if ( getBOOL(_xProp->getPropertyValue(PROPERTY_APPLYFILTER)) )
802
803 if ( _xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_APPLYORDER)
804 && getBOOL(_xProp->getPropertyValue(PROPERTY_APPLYORDER)) )
806
807 if ( ! getBOOL(_xProp->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)) )
809
811
812 SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, XML_QUERY, true, true);
813 Reference<XColumnsSupplier> xCol(_xProp,UNO_QUERY);
814 exportColumns(xCol);
817 exportTableName(_xProp,true);
818}
819
820void ODBExport::exportTable(XPropertySet* _xProp)
821{
822 exportTableName(_xProp,false);
823
824 if ( _xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION) )
826
827 if ( getBOOL(_xProp->getPropertyValue(PROPERTY_APPLYFILTER)) )
829
830 if ( _xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_APPLYORDER)
831 && getBOOL(_xProp->getPropertyValue(PROPERTY_APPLYORDER)) )
833
835
836 SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, XML_TABLE_REPRESENTATION, true, true);
837 Reference<XColumnsSupplier> xCol(_xProp,UNO_QUERY);
838 exportColumns(xCol);
841}
842
844{
845 Reference<XPropertySet> xFind(_xProp);
849}
850
851void ODBExport::exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,const uno::Reference<beans::XPropertySet>& _xProp,comphelper::AttributeList& _rAtt,TPropertyStyleMap& _rMap)
852{
853 TPropertyStyleMap::const_iterator aFind = _rMap.find(_xProp);
854 if ( aFind != _rMap.end() )
855 {
856 _rAtt.AddAttribute( GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DB, GetXMLToken(_eToken) ),
857 aFind->second );
858 _rMap.erase(aFind);
859 }
860}
861
862void ODBExport::exportTableName(XPropertySet* _xProp,bool _bUpdate)
863{
864 OUString sValue;
865 _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_TABLENAME) : OUString(PROPERTY_NAME)) >>= sValue;
866 if ( sValue.isEmpty() )
867 return;
868
870 _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_SCHEMANAME) : OUString(PROPERTY_SCHEMANAME)) >>= sValue;
871 if ( !sValue.isEmpty() )
873 _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_CATALOGNAME) : OUString(PROPERTY_CATALOGNAME)) >>= sValue;
874 if ( !sValue.isEmpty() )
876
877 if ( _bUpdate )
878 {
879 SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, XML_UPDATE_TABLE, true, true);
880 }
881}
882
883void ODBExport::exportFilter(XPropertySet* _xProp
884 ,const OUString& _sProp
885 ,enum ::xmloff::token::XMLTokenEnum _eStatementType)
886{
887 OSL_PRECOND(!GetAttrList().getLength(),"Invalid attribute length!");
888 OUString sCommand;
889 _xProp->getPropertyValue(_sProp) >>= sCommand;
890 if ( !sCommand.isEmpty() )
891 {
893 SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, _eStatementType, true, true);
894 }
895 SAL_WARN_IF(GetAttrList().getLength(), "dbaccess", "Invalid attribute length!");
896}
897
898void ODBExport::exportColumns(const Reference<XColumnsSupplier>& _xColSup)
899{
900 OSL_PRECOND( _xColSup.is(), "ODBExport::exportColumns: invalid columns supplier!" );
901 if ( !_xColSup.is() )
902 return;
903
904 try
905 {
906 Reference<XNameAccess> xNameAccess( _xColSup->getColumns(), UNO_SET_THROW );
907 if ( !xNameAccess->hasElements() )
908 {
909 Reference< XPropertySet > xComponent(_xColSup,UNO_QUERY);
910 TTableColumnMap::const_iterator aFind = m_aTableDummyColumns.find(xComponent);
911 if ( aFind != m_aTableDummyColumns.end() )
912 {
913 SvXMLElementExport aColumns(*this,XML_NAMESPACE_DB, XML_COLUMNS, true, true);
915 exportStyleName(aFind->second.get(),*pAtt);
916 AddAttributeList(pAtt);
917 SvXMLElementExport aColumn(*this,XML_NAMESPACE_DB, XML_COLUMN, true, true);
918
919 }
920 return;
921 }
922
923 SvXMLElementExport aColumns(*this,XML_NAMESPACE_DB, XML_COLUMNS, true, true);
924 Sequence< OUString> aSeq = xNameAccess->getElementNames();
925 const OUString* pIter = aSeq.getConstArray();
926 const OUString* pEnd = pIter + aSeq.getLength();
927 for( ; pIter != pEnd ; ++pIter)
928 {
929 Reference<XPropertySet> xProp(xNameAccess->getByName(*pIter),UNO_QUERY);
930 if ( xProp.is() )
931 {
933 exportStyleName(xProp.get(),*pAtt);
934
935 bool bHidden = getBOOL(xProp->getPropertyValue(PROPERTY_HIDDEN));
936
937 OUString sValue;
938 xProp->getPropertyValue(PROPERTY_HELPTEXT) >>= sValue;
939 Any aColumnDefault = xProp->getPropertyValue(PROPERTY_CONTROLDEFAULT);
940
941 if ( bHidden || !sValue.isEmpty() || aColumnDefault.hasValue() || pAtt->getLength() )
942 {
944 if ( bHidden )
946
947 if ( !sValue.isEmpty() )
949
950 if ( aColumnDefault.hasValue() )
951 {
952 OUStringBuffer sColumnDefaultString,sType;
954 sColumnDefaultString, sType, aColumnDefault );
955 AddAttribute(XML_NAMESPACE_DB, XML_TYPE_NAME,sType.makeStringAndClear());
956 AddAttribute(XML_NAMESPACE_DB, XML_DEFAULT_VALUE,sColumnDefaultString.makeStringAndClear());
957 }
958
959 if ( pAtt->getLength() )
960 AddAttributeList(pAtt);
961 }
962
963 if ( GetAttrList().getLength() )
964 {
965 SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, XML_COLUMN, true, true);
966 }
967 }
968 }
969 }
970 catch( const Exception& )
971 {
972 DBG_UNHANDLED_EXCEPTION("dbaccess");
973 }
974}
975
977{
978 Any aValue;
979 OUString sService;
981 aValue >>= sService;
982 if ( !sService.isEmpty() )
983 return;
984
985 Reference<XFormDocumentsSupplier> xSup(GetModel(),UNO_QUERY);
986 if ( xSup.is() )
987 {
988 Reference< XNameAccess > xCollection = xSup->getFormDocuments();
989 if ( xCollection.is() && xCollection->hasElements() )
990 {
992 exportCollection(xCollection,XML_FORMS,XML_COMPONENT_COLLECTION,true,aMemFunc);
993 }
994 }
995}
996
998{
999 Any aValue;
1000 OUString sService;
1001 dbtools::getDataSourceSetting(getDataSource(),"Reports",aValue);
1002 aValue >>= sService;
1003 if ( !sService.isEmpty() )
1004 return;
1005
1006 Reference<XReportDocumentsSupplier> xSup(GetModel(),UNO_QUERY);
1007 if ( xSup.is() )
1008 {
1009 Reference< XNameAccess > xCollection = xSup->getReportDocuments();
1010 if ( xCollection.is() && xCollection->hasElements() )
1011 {
1013 exportCollection(xCollection,XML_REPORTS,XML_COMPONENT_COLLECTION,true,aMemFunc);
1014 }
1015 }
1016}
1017
1018void ODBExport::exportQueries(bool _bExportContext)
1019{
1020 Any aValue;
1021 OUString sService;
1022 dbtools::getDataSourceSetting(getDataSource(),"CommandDefinitions",aValue);
1023 aValue >>= sService;
1024 if ( !sService.isEmpty() )
1025 return;
1026
1027 Reference<XQueryDefinitionsSupplier> xSup(getDataSource(),UNO_QUERY);
1028 if ( !xSup.is() )
1029 return;
1030
1031 Reference< XNameAccess > xCollection = xSup->getQueryDefinitions();
1032 if ( xCollection.is() && xCollection->hasElements() )
1033 {
1034 std::unique_ptr< ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > > pMemFunc;
1035 if ( _bExportContext )
1036 pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportQuery) );
1037 else
1038 pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportAutoStyle) );
1039
1040 exportCollection(xCollection,XML_QUERIES,XML_QUERY_COLLECTION,_bExportContext,*pMemFunc);
1041 }
1042}
1043
1044void ODBExport::exportTables(bool _bExportContext)
1045{
1046 Reference<XTablesSupplier> xSup(getDataSource(),UNO_QUERY);
1047 if ( !xSup.is() )
1048 return;
1049
1050 Reference< XNameAccess > xCollection = xSup->getTables();
1051 if ( xCollection.is() && xCollection->hasElements() )
1052 {
1053 std::unique_ptr< ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > > pMemFunc;
1054 if ( _bExportContext )
1055 pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportTable) );
1056 else
1057 pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportAutoStyle) );
1058 exportCollection(xCollection,XML_TABLE_REPRESENTATIONS,XML_TOKEN_INVALID,_bExportContext,*pMemFunc);
1059 }
1060}
1061
1062void ODBExport::exportAutoStyle(XPropertySet* _xProp)
1063{
1064 typedef std::pair<TPropertyStyleMap*,XmlStyleFamily> TEnumMapperPair;
1065 typedef std::pair< rtl::Reference < SvXMLExportPropertyMapper> , TEnumMapperPair> TExportPropMapperPair;
1066 Reference<XColumnsSupplier> xSup(_xProp,UNO_QUERY);
1067 if ( xSup.is() )
1068 {
1069 const TExportPropMapperPair pExportHelper[] = {
1070 TExportPropMapperPair(m_xExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XmlStyleFamily::TABLE_TABLE ))
1071 // ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XmlStyleFamily::TABLE_CELL))
1072 ,TExportPropMapperPair(m_xRowExportHelper,TEnumMapperPair(&m_aRowAutoStyleNames,XmlStyleFamily::TABLE_ROW))
1073 };
1074
1075 for (const auto & i : pExportHelper)
1076 {
1077 std::vector< XMLPropertyState > aPropertyStates = i.first->Filter(*this, _xProp);
1078 if ( !aPropertyStates.empty() )
1079 i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, std::move(aPropertyStates) ) );
1080 }
1081
1082 Reference< XNameAccess > xCollection;
1083 try
1084 {
1085 xCollection.set( xSup->getColumns(), UNO_SET_THROW );
1086 awt::FontDescriptor aFont;
1087 _xProp->getPropertyValue(PROPERTY_FONT) >>= aFont;
1088 GetFontAutoStylePool()->Add(aFont.Name,aFont.StyleName,static_cast<FontFamily>(aFont.Family),
1089 static_cast<FontPitch>(aFont.Pitch),aFont.CharSet );
1090
1091 m_aCurrentPropertyStates = m_xCellExportHelper->Filter(*this, _xProp);
1092 if ( !m_aCurrentPropertyStates.empty() && !xCollection->hasElements() )
1093 {
1094 Reference< XDataDescriptorFactory> xFac(xCollection,UNO_QUERY);
1095 if ( xFac.is() )
1096 {
1097 Reference< XPropertySet> xColumn = xFac->createDataDescriptor();
1098 m_aTableDummyColumns.emplace( Reference< XPropertySet>(_xProp),xColumn );
1099 exportAutoStyle(xColumn.get());
1100 }
1101 }
1102 else
1103 {
1105 exportCollection(xCollection,XML_TOKEN_INVALID,XML_TOKEN_INVALID,false,aMemFunc);
1106 }
1107 }
1108 catch(const Exception&)
1109 {
1110 DBG_UNHANDLED_EXCEPTION("dbaccess");
1111 }
1113 }
1114 else
1115 { // here I know I have a column
1116 const TExportPropMapperPair pExportHelper[] = {
1117 TExportPropMapperPair(m_xColumnExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XmlStyleFamily::TABLE_COLUMN ))
1118 ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XmlStyleFamily::TABLE_CELL))
1119 };
1120 for (const auto & i : pExportHelper)
1121 {
1122 std::vector< XMLPropertyState > aPropStates = i.first->Filter(*this, _xProp);
1123 if ( !aPropStates.empty() )
1124 {
1125 const rtl::Reference < XMLPropertySetMapper >& pStyle = i.first->getPropertySetMapper();
1126 for (auto & propState : aPropStates)
1127 {
1128 if ( propState.mnIndex != -1 )
1129 {
1130 switch ( pStyle->GetEntryContextId(propState.mnIndex) )
1131 {
1133 {
1134 sal_Int32 nNumberFormat = -1;
1135 if ( propState.maValue >>= nNumberFormat )
1136 addDataStyle(nNumberFormat);
1137 }
1138 break;
1140 if ( !propState.maValue.hasValue() )
1141 propState.maValue <<= css::awt::TextAlign::LEFT;
1142 break;
1143 }
1144 }
1145 }
1146
1147 }
1148 if ( XmlStyleFamily::TABLE_CELL == i.second.second )
1149 aPropStates.insert( aPropStates.end(), m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end() );
1150 if ( !aPropStates.empty() )
1151 i.second.first->emplace( _xProp,GetAutoStylePool()->Add( i.second.second, std::move(aPropStates) ) );
1152 }
1153 }
1154}
1155
1157{
1159 exportForms();
1160 exportReports();
1161 exportQueries(true);
1162 exportTables(true);
1163}
1164
1166{
1167 GetPageExport()->exportMasterStyles( true );
1168}
1169
1171{
1172 // there are no styles that require their own autostyles
1173 if ( getExportFlags() & SvXMLExportFlags::CONTENT )
1174 {
1176 GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_TABLE);
1177 GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_COLUMN);
1178 GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_CELL);
1179 GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_ROW);
1181 }
1182}
1183
1184void ODBExport::GetViewSettings(Sequence<PropertyValue>& aProps)
1185{
1186 Reference<XQueryDefinitionsSupplier> xSup(getDataSource(),UNO_QUERY);
1187 if ( !xSup.is() )
1188 return;
1189
1190 Reference< XNameAccess > xCollection = xSup->getQueryDefinitions();
1191 if ( !(xCollection.is() && xCollection->hasElements()) )
1192 return;
1193
1194 try
1195 {
1196 sal_Int32 nLength = aProps.getLength();
1197 aProps.realloc(nLength + 1);
1198 auto pProps = aProps.getArray();
1199 pProps[nLength].Name = "Queries";
1200 Sequence< OUString> aSeq = xCollection->getElementNames();
1201 const OUString* pIter = aSeq.getConstArray();
1202 const OUString* pEnd = pIter + aSeq.getLength();
1203
1204 Sequence<PropertyValue> aQueries(aSeq.getLength());
1205 auto aQueriesRange = asNonConstRange(aQueries);
1206 for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
1207 {
1208 Reference<XPropertySet> xProp(xCollection->getByName(*pIter),UNO_QUERY);
1209 if ( xProp.is() )
1210 {
1211 aQueriesRange[i].Name = *pIter;
1212 aQueriesRange[i].Value = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
1213 }
1214 }
1215 pProps[nLength].Value <<= aQueries;
1216 }
1217 catch(const Exception&)
1218 {
1219 TOOLS_WARN_EXCEPTION( "dbaccess", "ODBExport::GetViewSettings");
1220 }
1221
1222}
1223
1224void ODBExport::GetConfigurationSettings(Sequence<PropertyValue>& aProps)
1225{
1226 Reference<XPropertySet> xProp(getDataSource());
1227 if ( !xProp.is() )
1228 return;
1229
1230 sal_Int32 nLength = aProps.getLength();
1231 try
1232 {
1233 Any aValue = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
1234 Sequence< PropertyValue > aPropValues;
1235 aValue >>= aPropValues;
1236 if ( aPropValues.hasElements() )
1237 {
1238 aProps.realloc(nLength + 1);
1239 auto pProps = aProps.getArray();
1240 pProps[nLength].Name = "layout-settings";
1241 pProps[nLength].Value = aValue;
1242 }
1243 }
1244 catch(const Exception&)
1245 {
1246 OSL_FAIL("Could not access layout information from the data source!");
1247 }
1248}
1249
1250OUString ODBExport::implConvertAny(const Any& _rValue)
1251{
1252 OUStringBuffer aBuffer;
1253 switch (_rValue.getValueTypeClass())
1254 {
1255 case TypeClass_STRING:
1256 { // extract the string
1257 OUString sCurrentValue;
1258 _rValue >>= sCurrentValue;
1259 aBuffer.append(sCurrentValue);
1260 }
1261 break;
1262 case TypeClass_DOUBLE:
1263 // let the unit converter format is as string
1265 break;
1266 case TypeClass_BOOLEAN:
1267 aBuffer = getBOOL(_rValue) ? ::xmloff::token::GetXMLToken(XML_TRUE) : ::xmloff::token::GetXMLToken(XML_FALSE);
1268 break;
1269 case TypeClass_BYTE:
1270 case TypeClass_SHORT:
1271 case TypeClass_LONG:
1272 // let the unit converter format is as string
1273 aBuffer.append(getINT32(_rValue));
1274 break;
1275 default:
1276 OSL_FAIL("ODBExport::implConvertAny: Invalid type");
1277 }
1278
1279 return aBuffer.makeStringAndClear();
1280}
1281
1283{
1285 {
1287 }
1289}
1290
1292{
1294 {
1296 }
1298}
1299
1301{
1303 {
1305 }
1307}
1308
1310{
1311 return new OXMLAutoStylePoolP(*this);
1312}
1313
1314void SAL_CALL ODBExport::setSourceDocument( const Reference< XComponent >& xDoc )
1315{
1316 Reference<XOfficeDatabaseDocument> xOfficeDoc(xDoc,UNO_QUERY_THROW);
1317 m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW);
1318 OSL_ENSURE(m_xDataSource.is(),"DataSource is NULL!");
1319 Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
1322}
1323
1325{
1326 GetFontAutoStylePool(); // make sure the pool is created
1329}
1330
1332{
1333 if ( m_bAllreadyFilled )
1334 return;
1335
1336 m_bAllreadyFilled = true;
1337 exportQueries(false);
1338 exportTables(false);
1339}
1340
1341}// dbaxml
1342
1343/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
PropertiesInfo aProperties
const SvXMLNamespaceMap & GetNamespaceMap() const
OUString GetRelativeReference(const OUString &rValue)
void AddAttributeList(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
void Characters(const OUString &rChars)
SvXMLExportFlags getExportFlags() const
SvXMLNamespaceMap & GetNamespaceMap_()
virtual void exportDataStyles()
const css::uno::Reference< css::frame::XModel > & GetModel() const
rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool()
virtual void ExportFontDecls_()
rtl::Reference< XMLPageExport > const & GetPageExport()
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool()
virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat=false)
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
const SvXMLUnitConverter & GetMM100UnitConverter() const
comphelper::AttributeList & GetAttrList()
void SetNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > &_xNumberFormatSupplier)
sal_uInt16 Add(const OUString &rPrefix, const OUString &rName, sal_uInt16 nKey=XML_NAMESPACE_UNKNOWN)
void SetCoreMeasureUnit(sal_Int16 const eCoreMeasureUnit)
void SetXMLMeasureUnit(sal_Int16 const eXMLMeasureUnit)
OUString SubstituteVariable(const OUString &rVar) const
void AddAttribute(const OUString &sName, const OUString &sValue)
const ::comphelper::NamedValueCollection & getProperties(std::u16string_view _sURL) const
DATASOURCE_TYPE determineType(std::u16string_view _rDsn) const
Definition: dsntypes.cxx:299
OUString cutPrefix(std::u16string_view _sURL) const
on a given string, cut the type prefix and return the result
Definition: dsntypes.cxx:84
bool isFileSystemBased(std::u16string_view _sURL) const
check if the given data source type is based on the file system - i.e. the URL is a prefix plus a fil...
Definition: dsntypes.cxx:249
OUString getMediaType(std::u16string_view _sURL) const
returns the media type of a file based database
Definition: dsntypes.cxx:153
OUString getPrefix(std::u16string_view _sURL) const
on a given string, return the type prefix
Definition: dsntypes.cxx:110
void extractHostNamePort(const OUString &_rDsn, OUString &_sDatabaseName, OUString &_rHostname, sal_Int32 &_nPortNumber) const
Definition: dsntypes.cxx:202
virtual void GetViewSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
Definition: xmlExport.cxx:1184
void exportDataSource()
Definition: xmlExport.cxx:209
std::map< ::xmloff::token::XMLTokenEnum, OUString > TSettingsMap
Definition: xmlExport.hxx:58
Reference< XPropertySet > m_xDataSource
Definition: xmlExport.hxx:106
void exportDriverSettings(const TSettingsMap &_aSettings)
Definition: xmlExport.cxx:472
rtl::Reference< SvXMLExportPropertyMapper > m_xCellExportHelper
Definition: xmlExport.hxx:99
void exportTable(XPropertySet *_xProp)
Definition: xmlExport.cxx:820
rtl::Reference< XMLPropertySetMapper > const & GetTableStylesPropertySetMapper() const
Definition: xmlExport.cxx:1282
rtl::Reference< SvXMLExportPropertyMapper > m_xRowExportHelper
Definition: xmlExport.hxx:100
rtl::Reference< XMLPropertySetMapper > m_xTableStylesPropertySetMapper
Definition: xmlExport.hxx:102
void exportQuery(XPropertySet *_xProp)
Definition: xmlExport.cxx:796
rtl::Reference< SvXMLExportPropertyMapper > m_xColumnExportHelper
Definition: xmlExport.hxx:98
OUString m_sCharSet
Definition: xmlExport.hxx:96
virtual void ExportContent_() override
Definition: xmlExport.cxx:1156
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: xmlExport.cxx:1314
void exportDataSourceSettingsSequence(std::vector< TypedPropertyValue >::iterator const &in)
Definition: xmlExport.cxx:593
std::pair< OUString,OUString > TStringPair
Definition: xmlExport.hxx:60
void exportCollection(const Reference< XNameAccess > &_xCollection, enum ::xmloff::token::XMLTokenEnum _eComponents, enum ::xmloff::token::XMLTokenEnum _eSubComponents, bool _bExportContext, const ::comphelper::mem_fun1_t< ODBExport, XPropertySet * > &_aMemFunc)
Definition: xmlExport.cxx:746
virtual void ExportFontDecls_() override
Definition: xmlExport.cxx:1324
std::vector< TypedPropertyValue > m_aDataSourceSettings
Definition: xmlExport.hxx:90
::dbaccess::ODsnTypeCollection m_aTypeCollection
Definition: xmlExport.hxx:107
void exportTables(bool _bExportContext)
Definition: xmlExport.cxx:1044
void exportColumns(const Reference< XColumnsSupplier > &_xColSup)
Definition: xmlExport.cxx:898
void exportTableName(XPropertySet *_xProp, bool _bUpdate)
Definition: xmlExport.cxx:862
void exportComponent(XPropertySet *_xProp)
Definition: xmlExport.cxx:777
void exportFilter(XPropertySet *_xProp, const OUString &_sProp, enum ::xmloff::token::XMLTokenEnum _eStatementType)
Definition: xmlExport.cxx:883
void exportStyleName(XPropertySet *_xProp, comphelper::AttributeList &_rAtt)
Definition: xmlExport.cxx:843
rtl::Reference< SvXMLExportPropertyMapper > m_xExportHelper
Definition: xmlExport.hxx:97
void exportAutoIncrement()
Definition: xmlExport.cxx:700
std::unique_ptr< TDelimiter > m_aDelimiter
Definition: xmlExport.hxx:89
virtual SvXMLAutoStylePoolP * CreateAutoStylePool() override
Definition: xmlExport.cxx:1309
TPropertyStyleMap m_aCellAutoStyleNames
Definition: xmlExport.hxx:93
rtl::Reference< XMLPropertySetMapper > m_xCellStylesPropertySetMapper
Definition: xmlExport.hxx:104
void exportSequence(const Sequence< OUString > &_aValue,::xmloff::token::XMLTokenEnum _eTokenFilter,::xmloff::token::XMLTokenEnum _eTokenType)
Definition: xmlExport.cxx:710
void exportDataSourceSettings()
Definition: xmlExport.cxx:607
TPropertyStyleMap m_aAutoStyleNames
Definition: xmlExport.hxx:92
void exportQueries(bool _bExportContext)
Definition: xmlExport.cxx:1018
rtl::Reference< XMLPropertySetMapper > m_xColumnStylesPropertySetMapper
Definition: xmlExport.hxx:103
rtl::Reference< XMLPropertySetMapper > const & GetColumnStylesPropertySetMapper() const
Definition: xmlExport.cxx:1300
const Reference< XPropertySet > & getDataSource() const
Definition: xmlExport.hxx:174
void collectComponentStyles()
Definition: xmlExport.cxx:1331
void exportConnectionData()
Definition: xmlExport.cxx:493
virtual void ExportAutoStyles_() override
Definition: xmlExport.cxx:1170
std::optional< TStringPair > m_oAutoIncrement
Definition: xmlExport.hxx:88
virtual void ExportMasterStyles_() override
Definition: xmlExport.cxx:1165
TTableColumnMap m_aTableDummyColumns
Definition: xmlExport.hxx:95
std::vector< XMLPropertyState > m_aCurrentPropertyStates
Definition: xmlExport.hxx:91
void exportAutoStyle(XPropertySet *_xProp)
Definition: xmlExport.cxx:1062
static OUString implConvertAny(const Any &_rValue)
Definition: xmlExport.cxx:1250
void exportApplicationConnectionSettings(const TSettingsMap &_aSettings)
Definition: xmlExport.cxx:436
void exportDelimiter()
Definition: xmlExport.cxx:688
TPropertyStyleMap m_aRowAutoStyleNames
Definition: xmlExport.hxx:94
virtual void GetConfigurationSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
Definition: xmlExport.cxx:1224
rtl::Reference< XMLPropertySetMapper > const & GetCellStylesPropertySetMapper() const
Definition: xmlExport.cxx:1291
static rtl::Reference< XMLPropertySetMapper > GetRowStylesPropertySetMapper()
Definition: xmlHelper.cxx:144
static rtl::Reference< XMLPropertySetMapper > GetCellStylesPropertySetMapper(bool bForExport)
Definition: xmlHelper.cxx:96
static rtl::Reference< XMLPropertySetMapper > GetColumnStylesPropertySetMapper(bool bForExport)
Definition: xmlHelper.cxx:81
static rtl::Reference< XMLPropertySetMapper > GetTableStylesPropertySetMapper(bool bForExport)
Definition: xmlHelper.cxx:71
static void convertDouble(OUStringBuffer &rBuffer, double fNumber, bool bWriteUnits, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
static bool convertAny(OUStringBuffer &rsValue, OUStringBuffer &rsType, const css::uno::Any &rValue)
OUString get(NOTATION _eOutputNotation) const
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
float u
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME
constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME
FontPitch
FontFamily
Reference< XColumn > xColumn
OUString eType
Definition: generalpage.cxx:78
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
double getLength(const B2DPolygon &rCandidate)
@ Exception
OString stripEnd(const OString &rIn, char c)
bool getBOOL(const Any &_rAny)
Type getSequenceElementType(const Type &_rSequenceType)
double getDouble(const Any &_rAny)
sal_Int32 getINT32(const Any &_rAny)
OUString getString(const Any &_rAny)
Type
DATASOURCE_TYPE
known datasource types
Definition: dsntypes.hxx:36
@ DST_MSACCESS
Definition: dsntypes.hxx:37
static OUString lcl_implGetPropertyXMLType(const Type &_rType)
Definition: xmlExport.cxx:89
bool getDataSourceSetting(const Reference< XInterface > &_xChild, const OUString &_sAsciiSettingsName, Any &_rSettingsValue)
int i
constexpr OUStringLiteral implementationName
std::map< sal_Int32, STLPropertyMapEntry > PropertyMap
XML_DATA_SOURCE_SETTING
XML_ROW_RETRIEVING_STATEMENT
XML_IS_PASSWORD_REQUIRED
XML_APPLY_ORDER
XML_QUERY
XML_DELIMITER
XML_QUERY_COLLECTION
XML_N_XLINK
XML_CONNECTION_DATA
XML_N_OFFICE
XML_DRIVER_SETTINGS
XML_IGNORE_DRIVER_PRIVILEGES
XML_TABLE_REPRESENTATIONS
XML_SUPPRESS_VERSION_COLUMNS
XML_COLUMN
XML_REPORTS
XML_DESCRIPTION
XML_QUERIES
XML_DECIMAL
XML_DATABASE_NAME
XML_N_STYLE
XML_HREF
XML_HOSTNAME
XML_NP_NUMBER
XML_FILE_BASED_DATABASE
XML_PORT
XML_APPLY_FILTER
XML_DATA_SOURCE
XML_USE_CATALOG
XML_TRUE
XML_TOKEN_INVALID
XML_N_TABLE
XML_AUTO_INCREMENT
XML_IS_TABLE_NAME_LENGTH_LIMITED
XML_COMMAND
XML_NP_XLINK
XML_ENCODING
XML_BASE_DN
XML_SYSTEM_DRIVER_SETTINGS
XML_USER_NAME
XML_LOGIN
XML_DATA_SOURCE_SETTINGS
XML_TABLE_FILTER
XML_DEFAULT_CELL_STYLE_NAME
XML_DATA_SOURCE_SETTING_NAME
XML_NP_OFFICE
XML_DATA_SOURCE_SETTING_TYPE
XML_MAX_ROW_COUNT
XML_NP_STYLE
XML_THOUSAND
XML_IS_FIRST_ROW_HEADER_LINE
XML_SIMPLE
XML_STRING
XML_NP_OOO
XML_NP_TABLE
XML_TABLE_TYPE
XML_ESCAPE_PROCESSING
XML_FALSE
XML_STYLE_NAME
XML_N_SVG
XML_N_FO_COMPAT
XML_NP_FO
XML_TYPE_NAME
XML_COMPONENT_COLLECTION
XML_PARAMETER_NAME_SUBSTITUTION
XML_DATA_SOURCE_SETTING_IS_LIST
XML_LOCAL_SOCKET
XML_DEFAULT_VALUE
XML_NAME
XML_CONNECTION_RESOURCE
XML_NP_CONFIG
XML_APPEND_TABLE_ALIAS_NAME
XML_VISIBLE
XML_TABLE_INCLUDE_FILTER
XML_APPLICATION_CONNECTION_SETTINGS
XML_FILTER_STATEMENT
XML_SCHEMA_NAME
XML_COMPONENT
XML_DATABASE
XML_UPDATE_TABLE
XML_AS_TEMPLATE
XML_BOOLEAN_COMPARISON_MODE
XML_ORDER_STATEMENT
XML_DATABASE_DESCRIPTION
XML_NP_DB
XML_TABLE_FILTER_PATTERN
XML_SHOW_DELETED
XML_N_DB_OASIS
XML_MEDIA_TYPE
XML_SERVER_DATABASE
XML_N_CONFIG
XML_EXTENSION
XML_TABLE_REPRESENTATION
XML_ENABLE_SQL92_CHECK
XML_TABLE_TYPE_FILTER
XML_FORMS
XML_NP_SVG
XML_CATALOG_NAME
XML_ADDITIONAL_COLUMN_STATEMENT
XML_N_NUMBER
XML_FONT_CHARSET
XML_DATA_SOURCE_SETTING_VALUE
XML_COLUMNS
XML_HELP_MESSAGE
XML_N_OOO
XML_FIELD
XML_DEFAULT_ROW_STYLE_NAME
XML_TYPE
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
constexpr OUStringLiteral PROPERTY_COMMAND(u"Command")
constexpr OUStringLiteral PROPERTY_TABLEFILTER(u"TableFilter")
constexpr OUStringLiteral INFO_TEXTFILEEXTENSION
Definition: strings.hxx:207
constexpr OUStringLiteral PROPERTY_USER(u"User")
constexpr OUStringLiteral INFO_SHOWDELETEDROWS
Definition: strings.hxx:214
constexpr OUStringLiteral PROPERTY_URL(u"URL")
constexpr OUStringLiteral PROPERTY_UPDATE_TABLENAME(u"UpdateTableName")
constexpr OUStringLiteral INFO_AUTORETRIEVEVALUE
Definition: strings.hxx:217
constexpr OUStringLiteral PROPERTY_CONTROLDEFAULT(u"ControlDefault")
constexpr OUStringLiteral PROPERTY_NUMBERFORMATSSUPPLIER(u"NumberFormatsSupplier")
constexpr OUStringLiteral PROPERTY_ENABLESQL92CHECK(u"EnableSQL92Check")
constexpr OUStringLiteral INFO_DECIMALDELIMITER
Definition: strings.hxx:212
constexpr OUStringLiteral INFO_APPEND_TABLE_ALIAS
Definition: strings.hxx:219
constexpr OUStringLiteral INFO_TEXTFILEHEADER
Definition: strings.hxx:209
constexpr OUStringLiteral PROPERTY_UPDATE_SCHEMANAME(u"UpdateSchemaName")
constexpr OUStringLiteral PROPERTY_SETTINGS(u"Settings")
constexpr OUStringLiteral INFO_CONN_LDAP_ROWCOUNT
Definition: strings.hxx:227
constexpr OUStringLiteral PROPERTY_SCHEMANAME(u"SchemaName")
constexpr OUStringLiteral INFO_PARAMETERNAMESUBST
Definition: strings.hxx:223
constexpr OUStringLiteral PROPERTY_DESCRIPTION(u"Description")
constexpr OUStringLiteral PROPERTY_PERSISTENT_NAME(u"PersistentName")
constexpr OUStringLiteral PROPERTY_APPLYFILTER(u"ApplyFilter")
constexpr OUStringLiteral INFO_IGNOREDRIVER_PRIV
Definition: strings.hxx:224
constexpr OUStringLiteral INFO_TEXTDELIMITER
Definition: strings.hxx:211
constexpr OUStringLiteral PROPERTY_BOOLEANCOMPARISONMODE(u"BooleanComparisonMode")
constexpr OUStringLiteral PROPERTY_APPLYORDER(u"ApplyOrder")
constexpr OUStringLiteral PROPERTY_FILTER(u"Filter")
constexpr OUStringLiteral INFO_AUTORETRIEVEENABLED
Definition: strings.hxx:218
constexpr OUStringLiteral PROPERTY_TABLETYPEFILTER(u"TableTypeFilter")
constexpr OUStringLiteral PROPERTY_FONT(u"FontDescriptor")
constexpr OUStringLiteral PROPERTY_ESCAPE_PROCESSING(u"EscapeProcessing")
constexpr OUStringLiteral INFO_CHARSET
Definition: strings.hxx:208
constexpr OUStringLiteral PROPERTY_CATALOGNAME(u"CatalogName")
constexpr OUStringLiteral PROPERTY_HELPTEXT(u"HelpText")
constexpr OUStringLiteral PROPERTY_AS_TEMPLATE(u"AsTemplate")
constexpr OUStringLiteral INFO_ADDITIONALOPTIONS
Definition: strings.hxx:216
constexpr OUStringLiteral PROPERTY_SUPPRESSVERSIONCL(u"SuppressVersionColumns")
constexpr OUStringLiteral INFO_ALLOWLONGTABLENAMES
Definition: strings.hxx:215
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_UPDATE_CATALOGNAME(u"UpdateCatalogName")
constexpr OUStringLiteral PROPERTY_LAYOUTINFORMATION(u"LayoutInformation")
constexpr OUStringLiteral INFO_FIELDDELIMITER
Definition: strings.hxx:210
constexpr OUStringLiteral INFO_THOUSANDSDELIMITER
Definition: strings.hxx:213
constexpr OUStringLiteral PROPERTY_HIDDEN(u"Hidden")
constexpr OUStringLiteral PROPERTY_AUTOINCREMENTCREATION(u"AutoIncrementCreation")
constexpr OUStringLiteral INFO_CONN_LDAP_BASEDN
Definition: strings.hxx:226
constexpr OUStringLiteral PROPERTY_ISPASSWORDREQUIRED(u"IsPasswordRequired")
constexpr OUStringLiteral PROPERTY_ORDER(u"Order")
constexpr OUStringLiteral INFO_USECATALOG
Definition: strings.hxx:225
std::unique_ptr< char[]> aBuffer
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_sdb_XMLFullExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlExport.cxx:79
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_sdb_DBExportFilter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlExport.cxx:62
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_sdb_XMLSettingsExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlExport.cxx:70
#define CTF_DB_COLUMN_TEXT_ALIGN
Definition: xmlHelper.hxx:31
#define CTF_DB_NUMBERFORMAT
Definition: xmlHelper.hxx:30
SvXMLExportFlags
constexpr sal_uInt16 XML_NAMESPACE_DB
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_SVG
constexpr sal_uInt16 XML_NAMESPACE_TABLE
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
constexpr sal_uInt16 XML_NAMESPACE_CONFIG
constexpr sal_uInt16 XML_NAMESPACE_OOO
constexpr sal_uInt16 XML_NAMESPACE_STYLE
constexpr sal_uInt16 XML_NAMESPACE_FO
constexpr sal_uInt16 XML_NAMESPACE_NUMBER
sal_Int32 nLength
XMLTokenEnum eToken