LibreOffice Module dbaccess (master) 1
UITools.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 <UITools.hxx>
21#include <sfx2/docfilt.hxx>
22#include <core_resource.hxx>
23#include <dlgsave.hxx>
25#include <strings.hxx>
27#include <com/sun/star/sdb/DatabaseContext.hpp>
28#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
29#include <com/sun/star/sdb/XCompletedConnection.hpp>
30#include <com/sun/star/sdbc/XDataSource.hpp>
31#include <com/sun/star/sdb/SQLContext.hpp>
32#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
33#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
34#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
35#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
36#include <com/sun/star/sdbcx/XAppend.hpp>
37#include <com/sun/star/sdbc/XRow.hpp>
38#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
39#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
40#include <com/sun/star/sdbc/ColumnValue.hpp>
41#include <com/sun/star/task/InteractionHandler.hpp>
42#include <com/sun/star/ucb/XContent.hpp>
43#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
44#include <com/sun/star/beans/PropertyValue.hpp>
45#include <com/sun/star/container/XNameContainer.hpp>
46#include <com/sun/star/ucb/InteractiveIOException.hpp>
47#include <com/sun/star/sdb/XDocumentDataSource.hpp>
48#include <com/sun/star/ucb/IOErrorCode.hpp>
49#include <vcl/syswin.hxx>
50#include <vcl/settings.hxx>
51#include <vcl/svapp.hxx>
52#include <com/sun/star/beans/XPropertySetInfo.hpp>
53#include <com/sun/star/beans/XPropertySet.hpp>
54#include <com/sun/star/container/XNameAccess.hpp>
55#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
56#include <com/sun/star/lang/XMultiServiceFactory.hpp>
57#include <com/sun/star/awt/TextAlign.hpp>
58#include <TypeInfo.hxx>
59#include <FieldDescriptions.hxx>
61#include <comphelper/types.hxx>
63
64#include <svx/svxids.hrc>
65
66#include <sal/log.hxx>
67#include <svl/numformat.hxx>
68#include <svl/itempool.hxx>
69#include <helpids.h>
70#include <svl/itemset.hxx>
71#include <sbagrid.hrc>
72#include <svl/rngitem.hxx>
73#include <svl/intitem.hxx>
74#include <svx/numinf.hxx>
75#include <svl/zforlist.hxx>
76#include <dlgattr.hxx>
77#include <com/sun/star/container/XChild.hpp>
78#include <com/sun/star/util/NumberFormatter.hpp>
79#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
80#include <com/sun/star/util/XNumberFormatter.hpp>
81#include <strings.hrc>
82#include <sqlmessage.hxx>
83#include <dlgsize.hxx>
85#include <tools/urlobj.hxx>
87#include <svl/numuno.hxx>
88#include <svl/filenotation.hxx>
90
92#include <memory>
93
94namespace dbaui
95{
96using namespace ::dbtools;
97using namespace ::comphelper;
98using namespace ::com::sun::star;
99using namespace ::com::sun::star::uno;
100using namespace ::com::sun::star::task;
101using namespace ::com::sun::star::sdbcx;
102using namespace ::com::sun::star::sdbc;
103using namespace ::com::sun::star::sdb;
104using namespace ::com::sun::star::util;
105using namespace ::com::sun::star::ucb;
106using namespace ::com::sun::star::beans;
107using namespace ::com::sun::star::container;
108using namespace ::com::sun::star::lang;
109using namespace ::com::sun::star::ui::dialogs;
110using namespace ::svt;
111using ::com::sun::star::ucb::InteractiveIOException;
112using ::com::sun::star::ucb::IOErrorCode_NO_FILE;
113using ::com::sun::star::ucb::IOErrorCode_NOT_EXISTING;
114
115SQLExceptionInfo createConnection( const OUString& _rsDataSourceName,
116 const Reference< css::container::XNameAccess >& _xDatabaseContext,
119 Reference< css::sdbc::XConnection>& _rOUTConnection )
120{
122 try
123 {
124 xProp.set(_xDatabaseContext->getByName(_rsDataSourceName),UNO_QUERY);
125 }
126 catch(const Exception&)
127 {
128 }
129
130 return createConnection(xProp,_rxContext,_rEvtLst,_rOUTConnection);
131}
132
136 Reference< css::sdbc::XConnection>& _rOUTConnection )
137{
138 SQLExceptionInfo aInfo;
139 if ( !_xDataSource.is() )
140 {
141 SAL_WARN("dbaccess.ui", "createConnection: could not retrieve the data source!");
142 return aInfo;
143 }
144
145 OUString sPwd, sUser;
146 bool bPwdReq = false;
147 try
148 {
149 _xDataSource->getPropertyValue(PROPERTY_PASSWORD) >>= sPwd;
150 bPwdReq = ::cppu::any2bool(_xDataSource->getPropertyValue(PROPERTY_ISPASSWORDREQUIRED));
151 _xDataSource->getPropertyValue(PROPERTY_USER) >>= sUser;
152 }
153 catch(const Exception&)
154 {
155 SAL_WARN("dbaccess.ui", "createConnection: error while retrieving data source properties!");
156 }
157
158 try
159 {
160 if(bPwdReq && sPwd.isEmpty())
161 { // password required, but empty -> connect using an interaction handler
162 Reference<XCompletedConnection> xConnectionCompletion(_xDataSource, UNO_QUERY);
163 if (!xConnectionCompletion.is())
164 {
165 SAL_WARN("dbaccess.ui", "createConnection: missing an interface ... need an error message here!");
166 }
167 else
168 { // instantiate the default SDB interaction handler
169 Reference< XInteractionHandler > xHandler = InteractionHandler::createWithParent(_rxContext, nullptr);
170 _rOUTConnection = xConnectionCompletion->connectWithCompletion(xHandler);
171 }
172 }
173 else
174 {
175 Reference<XDataSource> xDataSource(_xDataSource,UNO_QUERY);
176 _rOUTConnection = xDataSource->getConnection(sUser, sPwd);
177 }
178 // be notified when connection is in disposing
179 Reference< XComponent > xComponent(_rOUTConnection, UNO_QUERY);
180 if (xComponent.is() && _rEvtLst.is())
181 xComponent->addEventListener(_rEvtLst);
182 }
183 catch(const SQLContext& e) { aInfo = SQLExceptionInfo(e); }
184 catch(const SQLWarning& e) { aInfo = SQLExceptionInfo(e); }
185 catch(const SQLException& e) { aInfo = SQLExceptionInfo(e); }
186 catch(const Exception&) {
187 TOOLS_WARN_EXCEPTION("dbaccess.ui", "SbaTableQueryBrowser::OnExpandEntry: could not connect - unknown exception");
188 }
189
190 return aInfo;
191}
192
193Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName,
194 weld::Window* _pErrorMessageParent, const Reference< XComponentContext >& _rxContext, ::dbtools::SQLExceptionInfo* _pErrorInfo )
195{
196 Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create(_rxContext);
197
198 Reference< XDataSource > xDatasource;
199 SQLExceptionInfo aSQLError;
200 try
201 {
202 xDatabaseContext->getByName( _rDataSourceName ) >>= xDatasource;
203 }
204 catch(const WrappedTargetException& e)
205 {
206 InteractiveIOException aIOException;
207 if ( ( e.TargetException >>= aIOException )
208 && ( ( aIOException.Code == IOErrorCode_NO_FILE )
209 || ( aIOException.Code == IOErrorCode_NOT_EXISTING )
210 )
211 )
212 {
213 OUString sErrorMessage( DBA_RES( STR_FILE_DOES_NOT_EXIST ) );
214 OFileNotation aTransformer( e.Message );
215 sErrorMessage = sErrorMessage.replaceFirst( "$file$", aTransformer.get( OFileNotation::N_SYSTEM ) );
216 aSQLError = SQLExceptionInfo( sErrorMessage ).get();
217 }
218 else
219 {
220 aSQLError = SQLExceptionInfo( e.TargetException );
221 }
222 }
223 catch( const Exception& )
224 {
225 DBG_UNHANDLED_EXCEPTION("dbaccess");
226 }
227
228 if ( xDatasource.is() )
229 return xDatasource;
230
231 if ( aSQLError.isValid() )
232 {
233 if ( _pErrorInfo )
234 {
235 *_pErrorInfo = aSQLError;
236 }
237 else
238 {
239 showError( aSQLError, _pErrorMessageParent ? _pErrorMessageParent->GetXWindow() : nullptr, _rxContext );
240 }
241 }
242
243 return Reference<XDataSource>();
244}
245
247{
249 Reference<XDocumentDataSource> xDocumentDataSource(_xObject,UNO_QUERY);
250 if ( xDocumentDataSource.is() )
251 xRet = xDocumentDataSource->getDatabaseDocument();
252
253 if ( !xRet.is() )
254 {
255 Reference<XOfficeDatabaseDocument> xOfficeDoc(_xObject,UNO_QUERY);
256 if ( xOfficeDoc.is() )
257 xRet = xOfficeDoc->getDataSource();
258 }
259
260 return xRet;
261}
262
264 sal_Int32 _nType,
265 const OUString& _sTypeName,
266 const OUString& _sCreateParams,
267 sal_Int32 _nPrecision,
268 sal_Int32 _nScale,
269 bool _bAutoIncrement,
270 bool& _brForceToType)
271{
272 TOTypeInfoSP pTypeInfo;
273 _brForceToType = false;
274 // search for type
275 std::pair<OTypeInfoMap::const_iterator, OTypeInfoMap::const_iterator> aPair = _rTypeInfo.equal_range(_nType);
276 OTypeInfoMap::const_iterator aIter = aPair.first;
277 if(aIter != _rTypeInfo.end()) // compare with end is correct here
278 {
279 for(;aIter != aPair.second;++aIter)
280 {
281 // search the best matching type
282 #ifdef DBG_UTIL
283 OUString sDBTypeName = aIter->second->aTypeName; (void)sDBTypeName;
284 #endif
285 if ( (
286 _sTypeName.isEmpty()
287 || (aIter->second->aTypeName.equalsIgnoreAsciiCase(_sTypeName))
288 )
289 && (
290 (
291 !aIter->second->aCreateParams.getLength()
292 && _sCreateParams.isEmpty()
293 )
294 || (
295 (aIter->second->nPrecision >= _nPrecision)
296 && (aIter->second->nMaximumScale >= _nScale)
297 && ( (_bAutoIncrement && aIter->second->bAutoIncrement) || !_bAutoIncrement )
298 )
299 )
300 )
301 break;
302 }
303
304 if (aIter == aPair.second)
305 {
306 for(aIter = aPair.first; aIter != aPair.second; ++aIter)
307 {
308 sal_Int32 nPrec = aIter->second->nPrecision;
309 sal_Int32 nScale = aIter->second->nMaximumScale;
310 // search the best matching type (now comparing the local names)
311 if ( (aIter->second->aLocalTypeName.equalsIgnoreAsciiCase(_sTypeName))
312 && (nPrec >= _nPrecision)
313 && (nScale >= _nScale)
314 && ( (_bAutoIncrement && aIter->second->bAutoIncrement) || !_bAutoIncrement )
315 )
316 {
317 SAL_WARN("dbaccess.ui", "getTypeInfoFromType: assuming column type " <<
318 aIter->second->aTypeName << "\" (expected type name " <<
319 _sTypeName << " matches the type's local name).");
320 break;
321 }
322 }
323 }
324
325 if (aIter == aPair.second)
326 { // no match for the names, no match for the local names
327 // -> drop the precision and the scale restriction, accept any type with the property
328 // type id (nType)
329
330 for(aIter = aPair.first; aIter != aPair.second; ++aIter)
331 {
332 // search the best matching type (now comparing the local names)
333 sal_Int32 nPrec = aIter->second->nPrecision;
334 sal_Int32 nScale = aIter->second->nMaximumScale;
335 if ( (nPrec >= _nPrecision)
336 && (nScale >= _nScale)
337 && ( (_bAutoIncrement && aIter->second->bAutoIncrement) || !_bAutoIncrement )
338 )
339 break;
340 }
341 }
342 if (aIter == aPair.second)
343 {
344 if ( _bAutoIncrement )
345 {
346 for(aIter = aPair.first; aIter != aPair.second; ++aIter)
347 {
348 // search the best matching type (now comparing the local names)
349 sal_Int32 nScale = aIter->second->nMaximumScale;
350 if ( (nScale >= _nScale)
351 && (aIter->second->bAutoIncrement == _bAutoIncrement)
352 )
353 break;
354 }
355 if ( aIter == aPair.second )
356 {
357 // try it without the auto increment flag
358 pTypeInfo = getTypeInfoFromType(_rTypeInfo,
359 _nType,
360 _sTypeName,
361 _sCreateParams,
362 _nPrecision,
363 _nScale,
364 false,
365 _brForceToType);
366 }
367 else
368 pTypeInfo = aIter->second;
369 }
370 else
371 {
372 pTypeInfo = aPair.first->second;
373 _brForceToType = true;
374 }
375 }
376 else
377 pTypeInfo = aIter->second;
378 }
379 else
380 {
382 // search for typeinfo where the typename is equal _sTypeName
383 for (auto const& elem : _rTypeInfo)
384 {
385 if ( aCase( elem.second->getDBName() , _sTypeName ) )
386 {
387 pTypeInfo = elem.second;
388 break;
389 }
390 }
391 }
392
393 OSL_ENSURE(pTypeInfo, "getTypeInfoFromType: no type info found for this type!");
394 return pTypeInfo;
395}
396
398 std::u16string_view _rsTypeNames,
399 OTypeInfoMap& _rTypeInfoMap,
400 std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters)
401{
402 if(!_rxConnection.is())
403 return;
404 Reference< XResultSet> xRs = _rxConnection->getMetaData ()->getTypeInfo ();
405 Reference< XRow> xRow(xRs,UNO_QUERY);
406 // Information for a single SQL type
407 if(!xRs.is())
408 return;
409
410 Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY_THROW)->getMetaData();
412 std::vector<sal_Int32> aTypes;
413 std::vector<bool> aNullable;
414 // Loop on the result set until we reach end of file
415 while (xRs->next())
416 {
417 TOTypeInfoSP pInfo = std::make_shared<OTypeInfo>();
418 sal_Int32 nPos = 1;
419 if ( aTypes.empty() )
420 {
421 sal_Int32 nCount = xResultSetMetaData->getColumnCount();
422 if ( nCount < 1 )
423 nCount = 18;
424 aTypes.reserve(nCount+1);
425 aTypes.push_back(-1);
426 aNullable.push_back(false);
427 for (sal_Int32 j = 1; j <= nCount ; ++j)
428 {
429 aTypes.push_back(xResultSetMetaData->getColumnType(j));
430 aNullable.push_back(xResultSetMetaData->isNullable(j) != ColumnValue::NO_NULLS);
431 }
432 }
433
434 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
435 pInfo->aTypeName = aValue.getString();
436 ++nPos;
437 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
438 pInfo->nType = aValue.getInt32();
439 ++nPos;
440 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
441 pInfo->nPrecision = aValue.getInt32();
442 ++nPos;
443 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // LiteralPrefix
444 ++nPos;
445 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralSuffix
446 ++nPos;
447 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
448 pInfo->aCreateParams = aValue.getString();
449 ++nPos;
450 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
451 pInfo->bNullable = aValue.getInt32() == ColumnValue::NULLABLE;
452 ++nPos;
453 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
454 // bCaseSensitive
455 ++nPos;
456 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
457 pInfo->nSearchType = aValue.getInt16();
458 ++nPos;
459 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
460 // bUnsigned
461 ++nPos;
462 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
463 pInfo->bCurrency = aValue.getBool();
464 ++nPos;
465 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
466 pInfo->bAutoIncrement = aValue.getBool();
467 ++nPos;
468 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
469 pInfo->aLocalTypeName = aValue.getString();
470 ++nPos;
471 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
472 pInfo->nMinimumScale = aValue.getInt16();
473 ++nPos;
474 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
475 pInfo->nMaximumScale = aValue.getInt16();
476 assert(nPos == 15);
477 // 16 and 17 are unused
478 nPos = 18;
479 aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
480 pInfo->nNumPrecRadix = aValue.getInt32();
481
482 // check if values are less than zero like it happens in a oracle jdbc driver
483 if( pInfo->nPrecision < 0)
484 pInfo->nPrecision = 0;
485 if( pInfo->nMinimumScale < 0)
486 pInfo->nMinimumScale = 0;
487 if( pInfo->nMaximumScale < 0)
488 pInfo->nMaximumScale = 0;
489 if( pInfo->nNumPrecRadix <= 1)
490 pInfo->nNumPrecRadix = 10;
491
492 std::u16string_view aName;
493 switch(pInfo->nType)
494 {
495 case DataType::CHAR:
496 aName = o3tl::getToken(_rsTypeNames, TYPE_CHAR, ';');
497 break;
498 case DataType::VARCHAR:
499 aName = o3tl::getToken(_rsTypeNames, TYPE_TEXT, ';');
500 break;
501 case DataType::DECIMAL:
502 aName = o3tl::getToken(_rsTypeNames, TYPE_DECIMAL, ';');
503 break;
504 case DataType::NUMERIC:
505 aName = o3tl::getToken(_rsTypeNames, TYPE_NUMERIC, ';');
506 break;
507 case DataType::BIGINT:
508 aName = o3tl::getToken(_rsTypeNames, TYPE_BIGINT, ';');
509 break;
510 case DataType::FLOAT:
511 aName = o3tl::getToken(_rsTypeNames, TYPE_FLOAT, ';');
512 break;
513 case DataType::DOUBLE:
514 aName = o3tl::getToken(_rsTypeNames, TYPE_DOUBLE, ';');
515 break;
516 case DataType::LONGVARCHAR:
517 aName = o3tl::getToken(_rsTypeNames, TYPE_MEMO, ';');
518 break;
519 case DataType::LONGVARBINARY:
520 aName = o3tl::getToken(_rsTypeNames, TYPE_IMAGE, ';');
521 break;
522 case DataType::DATE:
523 aName = o3tl::getToken(_rsTypeNames, TYPE_DATE, ';');
524 break;
525 case DataType::TIME:
526 aName = o3tl::getToken(_rsTypeNames, TYPE_TIME, ';');
527 break;
528 case DataType::TIMESTAMP:
529 aName = o3tl::getToken(_rsTypeNames, TYPE_DATETIME, ';');
530 break;
531 case DataType::BIT:
532 if ( !pInfo->aCreateParams.isEmpty() )
533 {
534 aName = o3tl::getToken(_rsTypeNames, TYPE_BIT, ';');
535 break;
536 }
537 [[fallthrough]];
538 case DataType::BOOLEAN:
539 aName = o3tl::getToken(_rsTypeNames, TYPE_BOOL, ';');
540 break;
541 case DataType::TINYINT:
542 aName = o3tl::getToken(_rsTypeNames, TYPE_TINYINT, ';');
543 break;
544 case DataType::SMALLINT:
545 aName = o3tl::getToken(_rsTypeNames, TYPE_SMALLINT, ';');
546 break;
547 case DataType::INTEGER:
548 aName = o3tl::getToken(_rsTypeNames, TYPE_INTEGER, ';');
549 break;
550 case DataType::REAL:
551 aName = o3tl::getToken(_rsTypeNames, TYPE_REAL, ';');
552 break;
553 case DataType::BINARY:
554 aName = o3tl::getToken(_rsTypeNames, TYPE_BINARY, ';');
555 break;
556 case DataType::VARBINARY:
557 aName = o3tl::getToken(_rsTypeNames, TYPE_VARBINARY, ';');
558 break;
559 case DataType::SQLNULL:
560 aName = o3tl::getToken(_rsTypeNames, TYPE_SQLNULL, ';');
561 break;
562 case DataType::OBJECT:
563 aName = o3tl::getToken(_rsTypeNames, TYPE_OBJECT, ';');
564 break;
565 case DataType::DISTINCT:
566 aName = o3tl::getToken(_rsTypeNames, TYPE_DISTINCT, ';');
567 break;
568 case DataType::STRUCT:
569 aName = o3tl::getToken(_rsTypeNames, TYPE_STRUCT, ';');
570 break;
571 case DataType::ARRAY:
572 aName = o3tl::getToken(_rsTypeNames, TYPE_ARRAY, ';');
573 break;
574 case DataType::BLOB:
575 aName = o3tl::getToken(_rsTypeNames, TYPE_BLOB, ';');
576 break;
577 case DataType::CLOB:
578 aName = o3tl::getToken(_rsTypeNames, TYPE_CLOB, ';');
579 break;
580 case DataType::REF:
581 aName = o3tl::getToken(_rsTypeNames, TYPE_REF, ';');
582 break;
583 case DataType::OTHER:
584 aName = o3tl::getToken(_rsTypeNames, TYPE_OTHER, ';');
585 break;
586 }
587 if ( !aName.empty() )
588 {
589 pInfo->aUIName = aName;
590 pInfo->aUIName += " [ ";
591 }
592 pInfo->aUIName += pInfo->aTypeName;
593 if ( !aName.empty() )
594 pInfo->aUIName += " ]";
595 // Now that we have the type info, save it in the multimap
596 _rTypeInfoMap.emplace(pInfo->nType,pInfo);
597 }
598 // for a faster index access
599 _rTypeInfoIters.reserve(_rTypeInfoMap.size());
600
601 OTypeInfoMap::iterator aIter = _rTypeInfoMap.begin();
602 OTypeInfoMap::const_iterator aEnd = _rTypeInfoMap.end();
603 for(;aIter != aEnd;++aIter)
604 _rTypeInfoIters.push_back(aIter);
605
606 // Close the result set/statement.
607
608 ::comphelper::disposeComponent(xRs);
609}
610
611void setColumnProperties(const Reference<XPropertySet>& _rxColumn,const OFieldDescription* _pFieldDesc)
612{
613 _rxColumn->setPropertyValue(PROPERTY_NAME,Any(_pFieldDesc->GetName()));
614 _rxColumn->setPropertyValue(PROPERTY_TYPENAME,Any(_pFieldDesc->getTypeInfo()->aTypeName));
615 _rxColumn->setPropertyValue(PROPERTY_TYPE,Any(_pFieldDesc->GetType()));
616 _rxColumn->setPropertyValue(PROPERTY_PRECISION,Any(_pFieldDesc->GetPrecision()));
617 _rxColumn->setPropertyValue(PROPERTY_SCALE,Any(_pFieldDesc->GetScale()));
618 _rxColumn->setPropertyValue(PROPERTY_ISNULLABLE, Any(_pFieldDesc->GetIsNullable()));
619 _rxColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT, css::uno::Any(_pFieldDesc->IsAutoIncrement()));
620 _rxColumn->setPropertyValue(PROPERTY_DESCRIPTION,Any(_pFieldDesc->GetDescription()));
621 if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISCURRENCY) && _pFieldDesc->IsCurrency() )
622 _rxColumn->setPropertyValue(PROPERTY_ISCURRENCY, css::uno::Any(_pFieldDesc->IsCurrency()));
623 // set autoincrement value when available
624 // and only set when the entry is not empty, that lets the value in the column untouched
625 if ( _pFieldDesc->IsAutoIncrement() && !_pFieldDesc->GetAutoIncrementValue().isEmpty() && _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
626 _rxColumn->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,Any(_pFieldDesc->GetAutoIncrementValue()));
627}
628
629OUString createDefaultName(const Reference< XDatabaseMetaData>& _xMetaData,const Reference<XNameAccess>& _xTables,const OUString& _sName)
630{
631 OSL_ENSURE(_xMetaData.is(),"No MetaData!");
632 OUString sDefaultName = _sName;
633 try
634 {
635 OUString sCatalog,sSchema,sCompsedName;
636 if(_xMetaData->supportsCatalogsInTableDefinitions())
637 {
638 try
639 {
640 Reference< XConnection> xCon = _xMetaData->getConnection();
641 if ( xCon.is() )
642 sCatalog = xCon->getCatalog();
643 if ( sCatalog.isEmpty() )
644 {
645 Reference<XResultSet> xRes = _xMetaData->getCatalogs();
646 Reference<XRow> xRow(xRes,UNO_QUERY);
647 while(xRes.is() && xRes->next())
648 {
649 sCatalog = xRow->getString(1);
650 if(!xRow->wasNull())
651 break;
652 }
653 }
654 }
655 catch(const SQLException&)
656 {
657 }
658 }
659 if(_xMetaData->supportsSchemasInTableDefinitions())
660 {
661 sSchema = _xMetaData->getUserName();
662 }
663 sCompsedName = ::dbtools::composeTableName( _xMetaData, sCatalog, sSchema, _sName, false, ::dbtools::EComposeRule::InDataManipulation );
664 sDefaultName = ::dbtools::createUniqueName(_xTables,sCompsedName);
665 }
666 catch(const SQLException&)
667 {
668 }
669 return sDefaultName;
670}
671
672bool checkDataSourceAvailable(const OUString& _sDataSourceName,const Reference< css::uno::XComponentContext >& _xContext)
673{
674 Reference< XDatabaseContext > xDataBaseContext = DatabaseContext::create(_xContext);
675 bool bRet = xDataBaseContext->hasByName(_sDataSourceName);
676 if ( !bRet )
677 { // try if this one is a URL
678 try
679 {
680 bRet = xDataBaseContext->getByName(_sDataSourceName).hasValue();
681 }
682 catch(const Exception&)
683 {
684 }
685 }
686 return bRet;
687}
688
689sal_Int32 mapTextAlign(const SvxCellHorJustify& _eAlignment)
690{
691 sal_Int32 nAlignment = css::awt::TextAlign::LEFT;
692 switch (_eAlignment)
693 {
694 case SvxCellHorJustify::Standard:
695 case SvxCellHorJustify::Left: nAlignment = css::awt::TextAlign::LEFT; break;
696 case SvxCellHorJustify::Center: nAlignment = css::awt::TextAlign::CENTER; break;
697 case SvxCellHorJustify::Right: nAlignment = css::awt::TextAlign::RIGHT; break;
698 default:
699 SAL_WARN("dbaccess.ui", "Invalid TextAlign!");
700 }
701 return nAlignment;
702}
703
704SvxCellHorJustify mapTextJustify(sal_Int32 _nAlignment)
705{
706 SvxCellHorJustify eJustify = SvxCellHorJustify::Left;
707 switch (_nAlignment)
708 {
709 case css::awt::TextAlign::LEFT : eJustify = SvxCellHorJustify::Left; break;
710 case css::awt::TextAlign::CENTER : eJustify = SvxCellHorJustify::Center; break;
711 case css::awt::TextAlign::RIGHT : eJustify = SvxCellHorJustify::Right; break;
712 default:
713 SAL_WARN("dbaccess.ui", "Invalid TextAlign!");
714 }
715 return eJustify;
716}
717
719 const Reference<XPropertySet>& xField,
720 SvNumberFormatter* _pFormatter,
721 weld::Widget* _pParent)
722{
723 if (!(xAffectedCol.is() && xField.is()))
724 return;
725
726 try
727 {
728 Reference< XPropertySetInfo > xInfo = xAffectedCol->getPropertySetInfo();
729 bool bHasFormat = xInfo->hasPropertyByName(PROPERTY_FORMATKEY);
730 sal_Int32 nDataType = ::comphelper::getINT32(xField->getPropertyValue(PROPERTY_TYPE));
731
732 SvxCellHorJustify eJustify(SvxCellHorJustify::Standard);
733 Any aAlignment = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
734 if (aAlignment.hasValue())
735 eJustify = dbaui::mapTextJustify(::comphelper::getINT16(aAlignment));
736 sal_Int32 nFormatKey = 0;
737 if ( bHasFormat )
738 nFormatKey = ::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY));
739
740 if(callColumnFormatDialog(_pParent,_pFormatter,nDataType,nFormatKey,eJustify,bHasFormat))
741 {
742 xAffectedCol->setPropertyValue(PROPERTY_ALIGN, Any(static_cast<sal_Int16>(dbaui::mapTextAlign(eJustify))));
743 if (bHasFormat)
744 xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, Any(nFormatKey));
745
746 }
747 }
748 catch( const Exception& )
749 {
750 DBG_UNHANDLED_EXCEPTION("dbaccess");
751 }
752}
753
755 SvNumberFormatter* _pFormatter,
756 sal_Int32 _nDataType,
757 sal_Int32& _nFormatKey,
758 SvxCellHorJustify& _eJustify,
759 bool _bHasFormat)
760{
761 bool bRet = false;
762
763 // UNO->ItemSet
764 static SfxItemInfo aItemInfos[] =
765 {
766 { 0, false },
767 { SID_ATTR_NUMBERFORMAT_VALUE, true },
768 { SID_ATTR_ALIGN_HOR_JUSTIFY, true },
769 { SID_ATTR_NUMBERFORMAT_INFO, true },
770 { SID_ATTR_NUMBERFORMAT_ONE_AREA, true }
771 };
772 static const auto aAttrMap = svl::Items<
773 SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY,
774 SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
775 SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA
776 >;
777
778 std::vector<SfxPoolItem*> pDefaults
779 {
780 new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY),
781 new SfxUInt32Item(SBA_DEF_FMTVALUE),
782 new SvxHorJustifyItem(SvxCellHorJustify::Standard, SBA_ATTR_ALIGN_HOR_JUSTIFY),
783 new SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO),
784 new SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, false)
785 };
786
787 rtl::Reference<SfxItemPool> pPool(new SfxItemPool("GridBrowserProperties", SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults));
788 pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why
789 pPool->FreezeIdRanges(); // the same
790
791 std::optional<SfxItemSet> pFormatDescriptor(SfxItemSet(*pPool, aAttrMap));
792 // fill it
793 pFormatDescriptor->Put(SvxHorJustifyItem(_eJustify, SBA_ATTR_ALIGN_HOR_JUSTIFY));
794 bool bText = false;
795 if (_bHasFormat)
796 {
797 // if the col is bound to a text field we have to disallow all non-text formats
798 if ((DataType::CHAR == _nDataType) || (DataType::VARCHAR == _nDataType) || (DataType::LONGVARCHAR == _nDataType) || (DataType::CLOB == _nDataType))
799 {
800 bText = true;
801 pFormatDescriptor->Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, true));
802 if (!_pFormatter->IsTextFormat(_nFormatKey))
803 // text fields can only have text formats
804 _nFormatKey = _pFormatter->GetStandardFormat(SvNumFormatType::TEXT, Application::GetSettings().GetLanguageTag().getLanguageType());
805 }
806
807 pFormatDescriptor->Put(SfxUInt32Item(SBA_DEF_FMTVALUE, _nFormatKey));
808 }
809
810 if (!bText)
811 {
812 SvxNumberInfoItem aFormatter(_pFormatter, 1234.56789, SID_ATTR_NUMBERFORMAT_INFO);
813 pFormatDescriptor->Put(aFormatter);
814 }
815
816 { // want the dialog to be destroyed before our set
817 SbaSbAttrDlg aDlg(_pParent, &*pFormatDescriptor, _pFormatter, _bHasFormat);
818 if (RET_OK == aDlg.run())
819 {
820 // ItemSet->UNO
821 // UNO-properties
822 const SfxItemSet* pSet = aDlg.GetExampleSet();
823 // (of course we could put the modified items directly into the column, but then the UNO-model
824 // won't reflect these changes, and why do we have a model, then ?)
825
826 // horizontal justify
827 const SvxHorJustifyItem* pHorJustify = pSet->GetItem<SvxHorJustifyItem>(SBA_ATTR_ALIGN_HOR_JUSTIFY);
828
829 _eJustify = pHorJustify->GetValue();
830
831 // format key
832 if (_bHasFormat)
833 {
834 const SfxUInt32Item* pFormat = pSet->GetItem<SfxUInt32Item>(SBA_DEF_FMTVALUE);
835 _nFormatKey = static_cast<sal_Int32>(pFormat->GetValue());
836 }
837 bRet = true;
838 }
839 // deleted formats
840 const SfxItemSet* pResult = aDlg.GetOutputItemSet();
841 if (pResult)
842 {
843 const SfxPoolItem* pItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
844 const SvxNumberInfoItem* pInfoItem = static_cast<const SvxNumberInfoItem*>(pItem);
845 if (pInfoItem)
846 {
847 for (sal_uInt32 key : pInfoItem->GetDelFormats())
848 _pFormatter->DeleteEntry(key);
849 }
850 }
851 }
852
853 pFormatDescriptor.reset();
854 pPool.clear();
855 for (SfxPoolItem* pDefault : pDefaults)
856 delete pDefault;
857
858 return bRet;
859}
860
861std::shared_ptr<const SfxFilter> getStandardDatabaseFilter()
862{
863 std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
864 OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
865 return pFilter;
866}
867
868bool appendToFilter(const Reference<XConnection>& _xConnection,
869 const OUString& _sName,
870 const Reference< XComponentContext >& _rxContext,
871 weld::Window* pParent)
872{
873 bool bRet = false;
874 Reference< XChild> xChild(_xConnection,UNO_QUERY);
875 if(xChild.is())
876 {
877 Reference< XPropertySet> xProp(xChild->getParent(),UNO_QUERY);
878 if(xProp.is())
879 {
880 Sequence< OUString > aFilter;
881 xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= aFilter;
882 // first check if we have something like SCHEMA.%
883 bool bHasToInsert = true;
884 for (const OUString& rItem : std::as_const(aFilter))
885 {
886 if(rItem.indexOf('%') != -1)
887 {
888 sal_Int32 nLen = rItem.lastIndexOf('.');
889 if(nLen != -1 && !rItem.compareTo(_sName,nLen))
890 bHasToInsert = false;
891 else if(rItem.getLength() == 1)
892 bHasToInsert = false;
893 }
894 }
895
896 bRet = true;
897 if(bHasToInsert)
898 {
899 if(! ::dbaui::checkDataSourceAvailable(::comphelper::getString(xProp->getPropertyValue(PROPERTY_NAME)),_rxContext))
900 {
901 OUString aMessage(DBA_RES(STR_TABLEDESIGN_DATASOURCE_DELETED));
902 OSQLWarningBox aWarning(pParent, aMessage);
903 aWarning.run();
904 bRet = false;
905 }
906 else
907 {
908 aFilter.realloc(aFilter.getLength()+1);
909 aFilter.getArray()[aFilter.getLength()-1] = _sName;
910 xProp->setPropertyValue(PROPERTY_TABLEFILTER,Any(aFilter));
911 }
912 }
913 }
914 }
915 return bRet;
916}
917
918void notifySystemWindow(vcl::Window const * _pWindow, vcl::Window* _pToRegister, const ::comphelper::mem_fun1_t<TaskPaneList,vcl::Window*>& _rMemFunc)
919{
920 OSL_ENSURE(_pWindow,"Window can not be null!");
921 SystemWindow* pSystemWindow = _pWindow ? _pWindow->GetSystemWindow() : nullptr;
922 if ( pSystemWindow )
923 {
924 _rMemFunc( pSystemWindow->GetTaskPaneList(), _pToRegister );
925 }
926}
927
928void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId )
929{
930 sal_Int32 nColSize = -1;
931 sal_uInt32 nDefaultWidth = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
932 if ( nDefaultWidth != _pBox->GetColumnWidth( _nColId ) )
933 {
934 Size aSizeMM = _pBox->PixelToLogic( Size( _pBox->GetColumnWidth( _nColId ), 0 ), MapMode( MapUnit::MapMM ) );
935 nColSize = aSizeMM.Width() * 10;
936 }
937
938 Size aDefaultMM = _pBox->PixelToLogic( Size( nDefaultWidth, 0 ), MapMode( MapUnit::MapMM ) );
939
940 DlgSize aColumnSizeDlg(_pBox->GetFrameWeld(), nColSize, false, aDefaultMM.Width() * 10);
941 if (aColumnSizeDlg.run() != RET_OK)
942 return;
943
944 sal_Int32 nValue = aColumnSizeDlg.GetValue();
945 if ( -1 == nValue )
946 { // default width
947 nValue = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
948 }
949 else
950 {
951 Size aSizeMM( nValue / 10, 0 );
952 nValue = _pBox->LogicToPixel( aSizeMM, MapMode( MapUnit::MapMM ) ).Width();
953 }
954 _pBox->SetColumnWidth( _nColId, nValue );
955}
956
957// check if SQL92 name checking is enabled
959{
960 return ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_ENABLESQL92CHECK );
961}
962
964{
965 return ::dbtools::getBooleanDataSourceSetting( _xConnection, INFO_APPEND_TABLE_ALIAS );
966}
967
969{
970 return ::dbtools::getBooleanDataSourceSetting( _xConnection, INFO_AS_BEFORE_CORRELATION_NAME );
971}
972
974 bool& _rAutoIncrementValueEnabled,
975 OUString& _rsAutoIncrementValue)
976{
977 if ( !_xDatasource.is() )
978 return;
979
980 OSL_ENSURE(_xDatasource->getPropertySetInfo()->hasPropertyByName(PROPERTY_INFO),"NO datasource supplied!");
982 _xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
983
984 // search the right propertyvalue
985 const PropertyValue* pValue =std::find_if(std::cbegin(aInfo), std::cend(aInfo),
986 [](const PropertyValue& lhs)
987 {return lhs.Name == PROPERTY_AUTOINCREMENTCREATION;} );
988
989 if ( pValue != std::cend(aInfo) )
990 pValue->Value >>= _rsAutoIncrementValue;
991 pValue =std::find_if(std::cbegin(aInfo), std::cend(aInfo),
992 [](const PropertyValue& lhs)
993 {return lhs.Name == "IsAutoRetrievingEnabled";} );
994
995 if ( pValue != std::cend(aInfo) )
996 pValue->Value >>= _rAutoIncrementValueEnabled;
997}
998
1000 bool& _rAutoIncrementValueEnabled,
1001 OUString& _rsAutoIncrementValue)
1002{
1003 Reference< XChild> xChild(_xConnection,UNO_QUERY);
1004 if(xChild.is())
1005 {
1006 Reference< XPropertySet> xProp(xChild->getParent(),UNO_QUERY);
1007 fillAutoIncrementValue(xProp,_rAutoIncrementValueEnabled,_rsAutoIncrementValue);
1008 }
1009}
1010
1011OUString getStrippedDatabaseName(const Reference<XPropertySet>& _xDataSource,OUString& _rsDatabaseName)
1012{
1013 if ( _rsDatabaseName.isEmpty() && _xDataSource.is() )
1014 {
1015 try
1016 {
1017 _xDataSource->getPropertyValue(PROPERTY_NAME) >>= _rsDatabaseName;
1018 }
1019 catch(const Exception& )
1020 {
1021 DBG_UNHANDLED_EXCEPTION("dbaccess");
1022 }
1023 }
1024 OUString sName = _rsDatabaseName;
1026 if ( aURL.GetProtocol() != INetProtocol::NotValid )
1028 return sName;
1029}
1030
1032{
1033 OSL_ENSURE( _rxFormatter.is(),"setEvalDateFormatForFormatter: Formatter is NULL!");
1034 if ( !_rxFormatter.is() )
1035 return;
1036
1037 Reference< css::util::XNumberFormatsSupplier > xSupplier = _rxFormatter->getNumberFormatsSupplier();
1038
1039 auto pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xSupplier);
1040 OSL_ENSURE(pSupplierImpl,"No Supplier!");
1041
1042 if ( pSupplierImpl )
1043 {
1044 SvNumberFormatter* pFormatter = pSupplierImpl->GetNumberFormatter();
1046 }
1047}
1048
1050{
1051 TOTypeInfoSP pTypeInfo;
1052 // first we search for a type which supports autoIncrement
1053 for (auto const& elem : _rTypeInfo)
1054 {
1055 // OJ: we don't want to set an autoincrement column to be key
1056 // because we don't have the possibility to know how to create
1057 // such auto increment column later on
1058 // so until we know how to do it, we create a column without autoincrement
1059 // therefore we have searched
1060 if ( elem.second->nType == DataType::INTEGER )
1061 {
1062 pTypeInfo = elem.second; // alternative
1063 break;
1064 }
1065 else if ( !pTypeInfo && elem.second->nType == DataType::DOUBLE )
1066 pTypeInfo = elem.second; // alternative
1067 else if ( !pTypeInfo && elem.second->nType == DataType::REAL )
1068 pTypeInfo = elem.second; // alternative
1069 }
1070 if ( !pTypeInfo ) // just a fallback
1071 pTypeInfo = queryTypeInfoByType(DataType::VARCHAR,_rTypeInfo);
1072
1073 OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!");
1074 return pTypeInfo;
1075}
1076
1077TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rTypeInfo)
1078{
1079 OTypeInfoMap::const_iterator aIter = _rTypeInfo.find(_nDataType);
1080 if(aIter != _rTypeInfo.end())
1081 return aIter->second;
1082 // fall back if the type is unknown
1083 TOTypeInfoSP pTypeInfo;
1084 switch(_nDataType)
1085 {
1086 case DataType::TINYINT:
1087 if( (pTypeInfo = queryTypeInfoByType(DataType::SMALLINT,_rTypeInfo) ) )
1088 break;
1089 [[fallthrough]];
1090 case DataType::SMALLINT:
1091 if( (pTypeInfo = queryTypeInfoByType(DataType::INTEGER,_rTypeInfo) ) )
1092 break;
1093 [[fallthrough]];
1094 case DataType::INTEGER:
1095 if( (pTypeInfo = queryTypeInfoByType(DataType::FLOAT,_rTypeInfo) ) )
1096 break;
1097 [[fallthrough]];
1098 case DataType::FLOAT:
1099 if( (pTypeInfo = queryTypeInfoByType(DataType::REAL,_rTypeInfo) ) )
1100 break;
1101 [[fallthrough]];
1102 case DataType::DATE:
1103 case DataType::TIME:
1104 if( DataType::DATE == _nDataType || DataType::TIME == _nDataType )
1105 {
1106 if( (pTypeInfo = queryTypeInfoByType(DataType::TIMESTAMP,_rTypeInfo) ) )
1107 break;
1108 }
1109 [[fallthrough]];
1110 case DataType::TIMESTAMP:
1111 case DataType::REAL:
1112 case DataType::BIGINT:
1113 if ( (pTypeInfo = queryTypeInfoByType(DataType::DOUBLE,_rTypeInfo) ) )
1114 break;
1115 [[fallthrough]];
1116 case DataType::DOUBLE:
1117 if ( (pTypeInfo = queryTypeInfoByType(DataType::NUMERIC,_rTypeInfo) ) )
1118 break;
1119 [[fallthrough]];
1120 case DataType::NUMERIC:
1121 pTypeInfo = queryTypeInfoByType(DataType::DECIMAL,_rTypeInfo);
1122 break;
1123 case DataType::DECIMAL:
1124 if ( (pTypeInfo = queryTypeInfoByType(DataType::NUMERIC,_rTypeInfo) ) )
1125 break;
1126 if ( (pTypeInfo = queryTypeInfoByType(DataType::DOUBLE,_rTypeInfo) ) )
1127 break;
1128 break;
1129 case DataType::VARCHAR:
1130 if ( (pTypeInfo = queryTypeInfoByType(DataType::LONGVARCHAR,_rTypeInfo) ) )
1131 break;
1132 break;
1133 case DataType::LONGVARCHAR:
1134 if ( (pTypeInfo = queryTypeInfoByType(DataType::CLOB,_rTypeInfo) ) )
1135 break;
1136 break;
1137 default:
1138 ;
1139 }
1140 if ( !pTypeInfo )
1141 {
1142 bool bForce = true;
1143 pTypeInfo = ::dbaui::getTypeInfoFromType(_rTypeInfo,DataType::VARCHAR,OUString(),"x",50,0,false,bForce);
1144 }
1145 OSL_ENSURE(pTypeInfo,"Wrong DataType supplied!");
1146 return pTypeInfo;
1147}
1148
1149sal_Int32 askForUserAction(weld::Window* pParent, TranslateId pTitle, TranslateId pText, bool _bAll, std::u16string_view _sName)
1150{
1151 SolarMutexGuard aGuard;
1152 OUString aMsg = DBA_RES(pText);
1153 aMsg = aMsg.replaceFirst("%1", _sName);
1155 if ( _bAll )
1156 {
1157 aAsk.add_button(DBA_RES(STR_BUTTON_TEXT_ALL), RET_ALL, HID_CONFIRM_DROP_BUTTON_ALL);
1158 }
1159 return aAsk.run();
1160}
1161
1162namespace
1163{
1164 OUString lcl_createSDBCLevelStatement( const OUString& _rStatement, const Reference< XConnection >& _rxConnection )
1165 {
1166 OUString sSDBCLevelStatement( _rStatement );
1167 try
1168 {
1169 Reference< XMultiServiceFactory > xAnalyzerFactory( _rxConnection, UNO_QUERY_THROW );
1170 Reference< XSingleSelectQueryAnalyzer > xAnalyzer( xAnalyzerFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW );
1171 xAnalyzer->setQuery( _rStatement );
1172 sSDBCLevelStatement = xAnalyzer->getQueryWithSubstitution();
1173 }
1174 catch( const Exception& )
1175 {
1176 DBG_UNHANDLED_EXCEPTION("dbaccess");
1177 }
1178 return sSDBCLevelStatement;
1179 }
1180}
1181
1182Reference< XPropertySet > createView( const OUString& _rName, const Reference< XConnection >& _rxConnection,
1183 const OUString& _rCommand )
1184{
1185 Reference<XViewsSupplier> xSup(_rxConnection,UNO_QUERY);
1187 if(xSup.is())
1188 xViews = xSup->getViews();
1189 Reference<XDataDescriptorFactory> xFact(xViews,UNO_QUERY);
1190 OSL_ENSURE(xFact.is(),"No XDataDescriptorFactory available!");
1191 if(!xFact.is())
1192 return nullptr;
1193
1194 Reference<XPropertySet> xView = xFact->createDataDescriptor();
1195 if ( !xView.is() )
1196 return nullptr;
1197
1198 OUString sCatalog,sSchema,sTable;
1199 ::dbtools::qualifiedNameComponents(_rxConnection->getMetaData(),
1200 _rName,
1201 sCatalog,
1202 sSchema,
1203 sTable,
1204 ::dbtools::EComposeRule::InDataManipulation);
1205
1206 xView->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
1207 xView->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
1208 xView->setPropertyValue(PROPERTY_NAME,Any(sTable));
1209
1210 xView->setPropertyValue( PROPERTY_COMMAND, Any( _rCommand ) );
1211
1212 Reference<XAppend> xAppend(xViews,UNO_QUERY);
1213 if(xAppend.is())
1214 xAppend->appendByDescriptor(xView);
1215
1216 xView = nullptr;
1217 // we need to reget the view because after appending it, it is no longer valid
1218 // but this time it isn't a view object it is a table object with type "VIEW"
1219 Reference<XTablesSupplier> xTabSup(_rxConnection,UNO_QUERY);
1221 if ( xTabSup.is() )
1222 {
1223 xTables = xTabSup->getTables();
1224 if ( xTables.is() && xTables->hasByName( _rName ) )
1225 xTables->getByName( _rName ) >>= xView;
1226 }
1227
1228 return xView;
1229}
1230
1231Reference<XPropertySet> createView( const OUString& _rName, const Reference< XConnection >& _rxConnection
1232 ,const Reference<XPropertySet>& _rxSourceObject)
1233{
1234 OUString sCommand;
1235 Reference< XPropertySetInfo > xPSI( _rxSourceObject->getPropertySetInfo(), UNO_SET_THROW );
1236 if ( xPSI->hasPropertyByName( PROPERTY_COMMAND ) )
1237 {
1238 _rxSourceObject->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand;
1239
1240 bool bEscapeProcessing( false );
1241 OSL_VERIFY( _rxSourceObject->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
1242 if ( bEscapeProcessing )
1243 sCommand = lcl_createSDBCLevelStatement( sCommand, _rxConnection );
1244 }
1245 else
1246 {
1247 sCommand = "SELECT * FROM " + composeTableNameForSelect( _rxConnection, _rxSourceObject );
1248 }
1249 return createView( _rName, _rxConnection, sCommand );
1250}
1251
1254 const OUString& _sParentFolder,
1255 bool _bForm,
1256 bool _bCollection,
1257 const Reference<XContent>& _xContent,
1258 bool _bMove)
1259{
1260 OSL_ENSURE( _xNames.is(), "insertHierarchyElement: illegal name container!" );
1261 if ( !_xNames.is() )
1262 return false;
1263
1264 Reference<XNameAccess> xNameAccess( _xNames, UNO_QUERY );
1265 if ( _xNames->hasByHierarchicalName(_sParentFolder) )
1266 {
1267 Reference<XChild> xChild(_xNames->getByHierarchicalName(_sParentFolder),UNO_QUERY);
1268 xNameAccess.set(xChild,UNO_QUERY);
1269 if ( !xNameAccess.is() && xChild.is() )
1270 xNameAccess.set(xChild->getParent(),UNO_QUERY);
1271 }
1272
1273 OSL_ENSURE( xNameAccess.is(), "insertHierarchyElement: could not find the proper name container!" );
1274 if ( !xNameAccess.is() )
1275 return false;
1276
1277 OUString sNewName;
1278 Reference<XPropertySet> xProp(_xContent,UNO_QUERY);
1279 if ( xProp.is() )
1280 xProp->getPropertyValue(PROPERTY_NAME) >>= sNewName;
1281
1282 if ( !_bMove || sNewName.isEmpty() )
1283 {
1284 if ( sNewName.isEmpty() || xNameAccess->hasByName(sNewName) )
1285 {
1286 OUString sLabel, sTargetName;
1287 if ( !sNewName.isEmpty() )
1288 sTargetName = sNewName;
1289 else
1290 sTargetName = DBA_RES( _bCollection ? STR_NEW_FOLDER : ((_bForm) ? RID_STR_FORM : RID_STR_REPORT));
1291 sLabel = DBA_RES( _bCollection ? STR_FOLDER_LABEL : ((_bForm) ? STR_FRM_LABEL : STR_RPT_LABEL));
1292 sTargetName = ::dbtools::createUniqueName(xNameAccess,sTargetName);
1293
1294 // here we have everything needed to create a new query object ...
1295 HierarchicalNameCheck aNameChecker( _xNames, _sParentFolder );
1296 // ... ehm, except a new name
1297 OSaveAsDlg aAskForName(pParent,
1298 _rxContext,
1299 sTargetName,
1300 sLabel,
1301 aNameChecker,
1303 if ( RET_OK != aAskForName.run() )
1304 // cancelled by the user
1305 return false;
1306
1307 sNewName = aAskForName.getName();
1308 }
1309 }
1310 else if ( xNameAccess->hasByName(sNewName) )
1311 {
1312 OUString sError(DBA_RES(STR_NAME_ALREADY_EXISTS));
1313 sError = sError.replaceFirst("#",sNewName);
1314 throw SQLException(sError,nullptr,"S1000",0,Any());
1315 }
1316
1317 try
1318 {
1319 Reference<XMultiServiceFactory> xORB( xNameAccess, UNO_QUERY_THROW );
1320 uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
1321 {
1322 {"Name", uno::Any(sNewName)}, // set as folder
1323 {"Parent", uno::Any(xNameAccess)},
1324 {PROPERTY_EMBEDDEDOBJECT, uno::Any(_xContent)},
1325 }));
1326 OUString sServiceName(_bCollection ? (_bForm ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION)) : OUString(SERVICE_SDB_DOCUMENTDEFINITION));
1327
1328 Reference<XContent > xNew( xORB->createInstanceWithArguments( sServiceName, aArguments ), UNO_QUERY_THROW );
1329 Reference< XNameContainer > xNameContainer( xNameAccess, UNO_QUERY_THROW );
1330 xNameContainer->insertByName( sNewName, Any( xNew ) );
1331 }
1332 catch( const IllegalArgumentException& e )
1333 {
1334 ::dbtools::throwGenericSQLException( e.Message, e.Context );
1335 }
1336 catch( const Exception& )
1337 {
1338 DBG_UNHANDLED_EXCEPTION("dbaccess");
1339 return false;
1340 }
1341
1342 return true;
1343}
1344
1346{
1347 // create a formatter working with the connections format supplier
1349
1350 try
1351 {
1352 Reference< css::util::XNumberFormatsSupplier > xSupplier(::dbtools::getNumberFormats(_rxConnection, true, _rxContext));
1353
1354 if ( xSupplier.is() )
1355 {
1356 // create a new formatter
1357 xFormatter.set(util::NumberFormatter::create( _rxContext ), UNO_QUERY_THROW);
1358 xFormatter->attachNumberFormatsSupplier(xSupplier);
1359 }
1360 }
1361 catch(const Exception&)
1362 {
1363 DBG_UNHANDLED_EXCEPTION("dbaccess");
1364 }
1365 return xFormatter;
1366}
1367
1368} // dbaui
1369
1370/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nDataType
OptionalString sSchema
OptionalString sCatalog
OptionalString sName
#define RET_ALL
Definition: UITools.hxx:32
constexpr OUStringLiteral sServiceName
static const AllSettings & GetSettings()
void SetColumnWidth(sal_uInt16 nColumnId, sal_uLong nWidth)
OUString GetColumnTitle(sal_uInt16 nColumnId) const
sal_uLong GetDefaultColumnWidth(const OUString &_rText) const
sal_uLong GetColumnWidth(sal_uInt16 nColumnId) const
sal_uInt32 GetValue() const
static std::shared_ptr< const SfxFilter > GetFilterByName(const OUString &rName)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
virtual const SfxItemSet * GetExampleSet() const override
virtual short run() override
const SfxItemSet * GetOutputItemSet() const
constexpr tools::Long Width() const
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
void DeleteEntry(sal_uInt32 nKey)
bool IsTextFormat(sal_uInt32 nFIndex) const
void SetEvalDateFormat(NfEvalDateFormat eEDF)
const std::vector< sal_uInt32 > & GetDelFormats() const
TaskPaneList * GetTaskPaneList()
sal_Int32 getInt32() const
OUString getString() const
sal_Int16 getInt16() const
void fill(sal_Int32 _nPos, sal_Int32 _nType, const css::uno::Reference< css::sdbc::XRow > &_xRow)
sal_Int32 GetValue() const
Definition: dlgsize.cxx:59
class implementing the IObjectNameCheck interface, and checking given object names against a hierarch...
const TOTypeInfoSP & getTypeInfo() const
OUString GetAutoIncrementValue() const
sal_Int32 GetPrecision() const
sal_Int32 GetIsNullable() const
void add_button(const OUString &rText, int nResponse, const OUString &rHelpId={})
Definition: sqlmessage.hxx:109
const OUString & getName() const
Definition: dlgsave.cxx:276
const css::uno::Any & get() const
OUString get(NOTATION _eOutputNotation) const
SystemWindow * GetSystemWindow() const
virtual short run()
virtual css::uno::Reference< css::awt::XWindow > GetXWindow()=0
#define DBA_RES(id)
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
@ AdditionalDescription
SfxItemInfo const aItemInfos[]
sal_Int16 nValue
constexpr OUStringLiteral HID_CONFIRM_DROP_BUTTON_ALL
Definition: helpids.h:66
URL aURL
Definition: intercept.cxx:87
Sequence< PropertyValue > aArguments
Definition: intercept.cxx:88
OUString aName
sal_uInt16 nPos
#define SAL_WARN(area, stream)
@ Exception
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
const sal_uInt16 TYPE_IMAGE
Definition: TypeInfo.hxx:40
const sal_uInt16 TYPE_NUMERIC
Definition: TypeInfo.hxx:32
void fillTypeInfo(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, std::u16string_view _rsTypeNames, OTypeInfoMap &_rTypeInfoMap, std::vector< OTypeInfoMap::iterator > &_rTypeInfoIters)
fills a map and a vector with localized type names
css::uno::Reference< css::beans::XPropertySet > createView(const OUString &_sName, const css::uno::Reference< css::sdbc::XConnection > &_xConnection, const css::uno::Reference< css::beans::XPropertySet > &_xSourceObject)
creates a new view from a query or table
const sal_uInt16 TYPE_REAL
Definition: TypeInfo.hxx:48
void adjustBrowseBoxColumnWidth(::svt::EditBrowseBox *_pBox, sal_uInt16 _nColId)
Definition: UITools.cxx:928
const sal_uInt16 TYPE_OTHER
Definition: TypeInfo.hxx:60
void callColumnFormatDialog(const css::uno::Reference< css::beans::XPropertySet > &_xAffectedCol, const css::uno::Reference< css::beans::XPropertySet > &_xField, SvNumberFormatter *_pFormatter, weld::Widget *_pParent)
call the format dialog and set the selected format at the column
bool checkDataSourceAvailable(const OUString &_sDataSourceName, const Reference< css::uno::XComponentContext > &_xContext)
Definition: UITools.cxx:672
const sal_uInt16 TYPE_TINYINT
Definition: TypeInfo.hxx:51
const sal_uInt16 TYPE_DATE
Definition: TypeInfo.hxx:34
css::uno::Reference< css::sdbc::XDataSource > getDataSourceByName(const OUString &_rDataSourceName, weld::Window *_pErrorMessageParent, const css::uno::Reference< css::uno::XComponentContext > &_rxContext, ::dbtools::SQLExceptionInfo *_pErrorInfo)
retrieves a data source given by name or URL, and displays an error if this fails
const sal_uInt16 TYPE_SQLNULL
Definition: TypeInfo.hxx:52
TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap &_rTypeInfo)
query for a type info which can be used to create a primary key column
Definition: UITools.cxx:1049
::dbtools::SQLExceptionInfo createConnection(const OUString &_rsDataSourceName, const css::uno::Reference< css::container::XNameAccess > &_xDatabaseContext, const css::uno::Reference< css::uno::XComponentContext > &_rxContext, css::uno::Reference< css::lang::XEventListener > const &_rEvtLst, css::uno::Reference< css::sdbc::XConnection > &_rOUTConnection)
creates a new connection and appends the eventlistener
const sal_uInt16 TYPE_STRUCT
Definition: TypeInfo.hxx:55
bool generateAsBeforeTableAlias(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection)
determines whether when generating SQL statements, AS should be placed before a table alias
css::uno::Reference< css::util::XNumberFormatter > getNumberFormatter(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
creates a number formatter
void fillAutoIncrementValue(const css::uno::Reference< css::beans::XPropertySet > &_xDatasource, bool &_rAutoIncrementValueEnabled, OUString &_rsAutoIncrementValue)
fills the bool and string value with information out of the datasource info property
bool isAppendTableAliasEnabled(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
check if the alias name of the table should be added at select statements
const sal_uInt16 TYPE_SMALLINT
Definition: TypeInfo.hxx:50
const sal_uInt16 TYPE_CHAR
Definition: TypeInfo.hxx:41
void notifySystemWindow(vcl::Window const *_pWindow, vcl::Window *_pToRegister, const ::comphelper::mem_fun1_t< TaskPaneList, vcl::Window * > &_rMemFunc)
notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search...
Definition: UITools.cxx:918
std::multimap< sal_Int32, TOTypeInfoSP > OTypeInfoMap
Definition: TypeInfo.hxx:100
TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType, const OTypeInfoMap &_rTypeInfo)
query for a specific type.
Definition: UITools.cxx:1077
void setColumnProperties(const css::uno::Reference< css::beans::XPropertySet > &_rxColumn, const OFieldDescription *_pFieldDesc)
SvxCellHorJustify mapTextJustify(sal_Int32 _nAlignment)
maps css::awt::TextAlign to SvxCellHorJustify
Definition: UITools.cxx:704
TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap &_rTypeInfo, sal_Int32 _nType, const OUString &_sTypeName, const OUString &_sCreateParams, sal_Int32 _nPrecision, sal_Int32 _nScale, bool _bAutoIncrement, bool &_brForceToType)
return the most suitable typeinfo for a requested type
Definition: UITools.cxx:263
const sal_uInt16 TYPE_TEXT
Definition: TypeInfo.hxx:31
const sal_uInt16 TYPE_DECIMAL
Definition: TypeInfo.hxx:42
void setEvalDateFormatForFormatter(css::uno::Reference< css::util::XNumberFormatter > const &_rxFormatter)
set the evaluation flag at the number formatter
std::shared_ptr< OTypeInfo > TOTypeInfoSP
Definition: TypeInfo.hxx:99
OUString createDefaultName(const css::uno::Reference< css::sdbc::XDatabaseMetaData > &_xMetaData, const css::uno::Reference< css::container::XNameAccess > &_xTables, const OUString &_sName)
css::uno::Reference< css::uno::XInterface > getDataSourceOrModel(const css::uno::Reference< css::uno::XInterface > &_xObject)
returns either the model when data source is given as parameter, or returns a data source when a mode...
const sal_uInt16 TYPE_DATETIME
Definition: TypeInfo.hxx:33
const sal_uInt16 TYPE_OBJECT
Definition: TypeInfo.hxx:53
const sal_uInt16 TYPE_MEMO
Definition: TypeInfo.hxx:38
sal_Int32 askForUserAction(weld::Window *pParent, TranslateId pTitle, TranslateId pText, bool bAll, std::u16string_view rName)
returns the configuration node name of user defined drivers.
Definition: UITools.cxx:1149
bool isSQL92CheckEnabled(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
check if SQL92 name checking is enabled
const sal_uInt16 TYPE_CLOB
Definition: TypeInfo.hxx:58
const sal_uInt16 TYPE_DISTINCT
Definition: TypeInfo.hxx:54
const sal_uInt16 TYPE_BIT
Definition: TypeInfo.hxx:61
std::shared_ptr< const SfxFilter > getStandardDatabaseFilter()
returns the standard database filter
Definition: UITools.cxx:861
const sal_uInt16 TYPE_TIME
Definition: TypeInfo.hxx:35
const sal_uInt16 TYPE_BINARY
Definition: TypeInfo.hxx:43
sal_Int32 mapTextAlign(const SvxCellHorJustify &_eAlignment)
maps SvxCellHorJustify to css::awt::TextAlign
Definition: UITools.cxx:689
bool checkDataSourceAvailable(const OUString &_sDataSourceName, const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
checks if the given name exists in the database context
const sal_uInt16 TYPE_INTEGER
Definition: TypeInfo.hxx:49
const sal_uInt16 TYPE_VARBINARY
Definition: TypeInfo.hxx:44
const sal_uInt16 TYPE_ARRAY
Definition: TypeInfo.hxx:56
bool appendToFilter(const css::uno::Reference< css::sdbc::XConnection > &xConnection, const OUString &rName, const css::uno::Reference< css::uno::XComponentContext > &rxContext, weld::Window *pParent)
append a name to tablefilter of a datasource
OUString getStrippedDatabaseName(const css::uno::Reference< css::beans::XPropertySet > &_xDataSource, OUString &_rsDatabaseName)
returns the stripped database name.
bool insertHierarchyElement(weld::Window *pParent, const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const css::uno::Reference< css::container::XHierarchicalNameContainer > &_xNames, const OUString &_sParentFolder, bool _bForm, bool _bCollection=true, const css::uno::Reference< css::ucb::XContent > &_xContent=nullptr, bool _bMove=false)
opens a save dialog to store a form or report folder in the current hierarchy.
const sal_uInt16 TYPE_FLOAT
Definition: TypeInfo.hxx:47
const sal_uInt16 TYPE_BLOB
Definition: TypeInfo.hxx:57
const sal_uInt16 TYPE_BOOL
Definition: TypeInfo.hxx:36
const sal_uInt16 TYPE_REF
Definition: TypeInfo.hxx:59
const sal_uInt16 TYPE_DOUBLE
Definition: TypeInfo.hxx:46
const sal_uInt16 TYPE_BIGINT
Definition: TypeInfo.hxx:45
OUString composeTableNameForSelect(const Reference< XConnection > &_rxConnection, const OUString &_rCatalog, const OUString &_rSchema, const OUString &_rName)
void showError(const SQLExceptionInfo &_rInfo, const Reference< XWindow > &_xParent, const Reference< XComponentContext > &_rxContext)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
static constexpr auto Items
constexpr OUStringLiteral INFO_AS_BEFORE_CORRELATION_NAME
Definition: strings.hxx:221
constexpr OUStringLiteral PROPERTY_COMMAND(u"Command")
constexpr OUStringLiteral PROPERTY_TABLEFILTER(u"TableFilter")
constexpr OUStringLiteral PROPERTY_ISAUTOINCREMENT(u"IsAutoIncrement")
constexpr OUStringLiteral PROPERTY_ISCURRENCY(u"IsCurrency")
constexpr OUStringLiteral PROPERTY_USER(u"User")
constexpr OUStringLiteral PROPERTY_INFO(u"Info")
constexpr OUStringLiteral PROPERTY_PRECISION(u"Precision")
constexpr OUStringLiteral PROPERTY_TYPENAME(u"TypeName")
constexpr OUStringLiteral SERVICE_NAME_FORM_COLLECTION
Definition: strings.hxx:197
constexpr OUStringLiteral PROPERTY_ENABLESQL92CHECK(u"EnableSQL92Check")
constexpr OUStringLiteral INFO_APPEND_TABLE_ALIAS
Definition: strings.hxx:219
constexpr OUStringLiteral PROPERTY_ISNULLABLE(u"IsNullable")
constexpr OUStringLiteral PROPERTY_SCHEMANAME(u"SchemaName")
constexpr OUStringLiteral PROPERTY_DESCRIPTION(u"Description")
constexpr OUStringLiteral PROPERTY_FORMATKEY(u"FormatKey")
constexpr OUStringLiteral PROPERTY_SCALE(u"Scale")
constexpr OUStringLiteral SERVICE_SDB_DOCUMENTDEFINITION
Definition: strings.hxx:196
constexpr OUStringLiteral SERVICE_NAME_SINGLESELECTQUERYCOMPOSER
Definition: strings.hxx:201
constexpr OUStringLiteral PROPERTY_PASSWORD(u"Password")
constexpr OUStringLiteral PROPERTY_ESCAPE_PROCESSING(u"EscapeProcessing")
constexpr OUStringLiteral SERVICE_NAME_REPORT_COLLECTION
Definition: strings.hxx:198
constexpr OUStringLiteral PROPERTY_CATALOGNAME(u"CatalogName")
constexpr OUStringLiteral PROPERTY_TYPE(u"Type")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_ALIGN(u"Align")
constexpr OUStringLiteral PROPERTY_EMBEDDEDOBJECT(u"EmbeddedObject")
constexpr OUStringLiteral PROPERTY_AUTOINCREMENTCREATION(u"AutoIncrementCreation")
constexpr OUStringLiteral PROPERTY_ISPASSWORDREQUIRED(u"IsPasswordRequired")
SvxCellHorJustify
Reference< XComponentContext > _xContext
RET_OK
const SvXMLTokenMapEntry aTypes[]
NF_EVALDATEFORMAT_FORMAT