LibreOffice Module dbaccess (master) 1
FieldDescControl.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 <core_resource.hxx>
21#include <FieldDescControl.hxx>
22#include <FieldControls.hxx>
25#include <vcl/svapp.hxx>
26#include <FieldDescriptions.hxx>
27#include <svl/numuno.hxx>
28#include <vcl/transfer.hxx>
29#include <com/sun/star/sdbc/ColumnValue.hpp>
30#include <com/sun/star/util/NumberFormat.hpp>
31#include <com/sun/star/util/XNumberFormatPreviewer.hpp>
32#include <com/sun/star/util/XNumberFormatTypes.hpp>
33#include <com/sun/star/beans/XPropertySet.hpp>
34#include <QEnumTypes.hxx>
35#include <helpids.h>
39#include <comphelper/types.hxx>
40#include <UITools.hxx>
41#include <strings.hrc>
42#include <osl/diagnose.h>
43
44using namespace dbaui;
45using namespace dbtools;
46using namespace ::com::sun::star::uno;
47using namespace ::com::sun::star::beans;
48using namespace ::com::sun::star::lang;
49using namespace ::com::sun::star::sdbc;
50using namespace ::com::sun::star::util;
51
52namespace
53{
54 template< typename T1, typename T2> void lcl_HideAndDeleteControl(short& _nPos,std::unique_ptr<T1>& _pControl, std::unique_ptr<T2>& _pControlText)
55 {
56 if ( _pControl )
57 {
58 --_nPos;
59 _pControl->hide();
60 _pControlText->hide();
61 _pControl.reset();
62 _pControlText.reset();
63 }
64 }
65}
66
67OFieldDescControl::OFieldDescControl(weld::Container* pPage, OTableDesignHelpBar* pHelpBar)
68 : m_xBuilder(Application::CreateBuilder(pPage, "dbaccess/ui/fielddescpage.ui"))
69 , m_xContainer(m_xBuilder->weld_container("FieldDescPage"))
70 , m_pHelp( pHelpBar )
71 , m_pLastFocusWindow(nullptr)
72 , m_pActFocusWindow(nullptr)
73 , m_nPos(-1)
74 , aYes(DBA_RES(STR_VALUE_YES))
75 , aNo(DBA_RES(STR_VALUE_NO))
76 , m_nEditWidth(50)
77 , pActFieldDescr(nullptr)
78{
79 if (m_pHelp)
80 m_pHelp->connect_focus_out(LINK(this, OFieldDescControl, HelpFocusOut));
81}
82
84{
85 dispose();
86}
87
89{
90 // Destroy children
103 m_pHelp = nullptr;
104 m_pLastFocusWindow = nullptr;
105 m_pActFocusWindow = nullptr;
106 m_xDefaultText.reset();
107 m_xRequiredText.reset();
108 m_xAutoIncrementText.reset();
109 m_xTextLenText.reset();
110 m_xNumTypeText.reset();
111 m_xLengthText.reset();
112 m_xScaleText.reset();
113 m_xFormatText.reset();
114 m_xBoolDefaultText.reset();
115 m_xColumnNameText.reset();
116 m_xTypeText.reset();
118 m_xRequired.reset();
119 m_xNumType.reset();
120 m_xAutoIncrement.reset();
121 m_xDefault.reset();
122 m_xTextLen.reset();
123 m_xLength.reset();
124 m_xScale.reset();
125 m_xFormatSample.reset();
126 m_xBoolDefault.reset();
127 m_xColumnName.reset();
128 m_xType.reset();
129 m_xAutoIncrementValue.reset();
130 m_xFormat.reset();
131 m_xContainer.reset();
132 m_xBuilder.reset();
133}
134
135OUString OFieldDescControl::BoolStringPersistent(std::u16string_view rUIString) const
136{
137 if (rUIString == aNo)
138 return OUString('0');
139 if (rUIString == aYes)
140 return OUString('1');
141 return OUString();
142}
143
144OUString OFieldDescControl::BoolStringUI(const OUString& rPersistentString) const
145{
146 // Older versions may store a language dependent string as a default
147 if (rPersistentString == aYes || rPersistentString == aNo)
148 return rPersistentString;
150 if (rPersistentString == "0")
151 return aNo;
152 if (rPersistentString == "1")
153 return aYes;
154
155 return DBA_RES(STR_VALUE_NONE);
156}
157
159{
162}
163
164void OFieldDescControl::SetReadOnly( bool bReadOnly )
165{
166 // Enable/disable Controls
167 struct final
168 {
169 OWidgetBase * aggregate;
171 } const aggregates[] = {
172 {m_xRequired.get(), m_xRequiredText.get()}
173 , {m_xNumType.get(), m_xNumTypeText.get()}
175 , {m_xDefault.get(), m_xDefaultText.get()}
176 , {m_xTextLen.get(), m_xTextLenText.get()}
177 , {m_xLength.get(), m_xLengthText.get()}
178 , {m_xScale.get(), m_xScaleText.get()}
179 , {m_xColumnName.get(), m_xColumnNameText.get()}
180 , {m_xType.get(), m_xTypeText.get()}
182
183 for (auto const & aggregate: aggregates)
184 {
185 if (aggregate.text)
186 aggregate.text->set_sensitive(!bReadOnly);
187 if (aggregate.aggregate)
188 aggregate.aggregate->set_sensitive(!bReadOnly);
189 }
190
191 if (m_xFormat)
192 {
193 assert(m_xFormatText);
194 m_xFormat->set_sensitive(!bReadOnly);
195 m_xFormatText->set_sensitive(!bReadOnly);
196 }
197}
198
199void OFieldDescControl::SetControlText( sal_uInt16 nControlId, const OUString& rText )
200{
201 // Set the Controls' texts
202 switch( nControlId )
203 {
205 if (m_xBoolDefault)
206 {
207 OUString sOld = m_xBoolDefault->get_active_text();
208 m_xBoolDefault->set_active_text(rText);
209 if (sOld != rText)
210 ChangeHdl(m_xBoolDefault->GetComboBox());
211 }
212 break;
214 if (m_xDefault)
215 {
216 m_xDefault->set_text(rText);
218 }
219 break;
220
222 if (m_xRequired)
223 m_xRequired->set_active_text(rText);
224 break;
225
227 if (m_xTextLen)
228 m_xTextLen->set_text(rText);
229 break;
230
232 if (m_xNumType)
233 m_xNumType->set_active_text(rText);
234 break;
235
238 {
239 OUString sOld = m_xAutoIncrement->get_active_text();
240 m_xAutoIncrement->set_active_text(rText);
241 if (sOld != rText)
242 ChangeHdl(m_xAutoIncrement->GetComboBox());
243 }
244 break;
245
247 if (m_xLength)
248 m_xLength->set_text(rText);
249 break;
250
252 if (m_xScale)
253 m_xScale->set_text(rText);
254 break;
255
257 if (pActFieldDescr)
259 break;
261 if (m_xColumnName)
262 m_xColumnName->set_text(rText);
263 break;
265 if (m_xType)
266 m_xType->set_active_text(rText);
267 break;
270 m_xAutoIncrementValue->set_text(rText);
271 break;
272 }
273}
274
276{
277 // Create temporary Column, which is used for data exchange with Dialog
278 if( !pActFieldDescr )
279 return;
280
281 sal_Int32 nOldFormatKey(pActFieldDescr->GetFormatKey());
282 SvxCellHorJustify rOldJustify = pActFieldDescr->GetHorJustify();
283 Reference< XNumberFormatsSupplier > xSupplier = GetFormatter()->getNumberFormatsSupplier();
284 SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier );
285 if (!pSupplierImpl)
286 return;
287
288 SvNumberFormatter* pFormatter = pSupplierImpl->GetNumberFormatter();
289 if(!::dbaui::callColumnFormatDialog(m_xContainer.get(),pFormatter,pActFieldDescr->GetType(),nOldFormatKey,rOldJustify,true))
290 return;
291
292 bool bModified = false;
293 if(nOldFormatKey != pActFieldDescr->GetFormatKey())
294 {
295 pActFieldDescr->SetFormatKey( nOldFormatKey );
296 bModified = true;
297 }
298 if(rOldJustify != pActFieldDescr->GetHorJustify())
299 {
300 pActFieldDescr->SetHorJustify( rOldJustify );
301 bModified = true;
302 }
303
304 if(bModified)
305 {
306 SetModified(true);
307 UpdateFormatSample(pActFieldDescr);
308 }
309}
310
311void OFieldDescControl::SetModified(bool /*bModified*/)
312{
313}
314
315IMPL_LINK(OFieldDescControl, ChangeHdl, weld::ComboBox&, rListBox, void)
316{
317 if (!pActFieldDescr)
318 return;
319
320 if (rListBox.get_value_changed_from_saved())
321 SetModified(true);
322
323 // Special treatment for Bool fields
324 if (m_xRequired && &rListBox == m_xRequired->GetWidget() && m_xBoolDefault)
325 {
326 // If m_xRequired = sal_True then the sal_Bool field must NOT contain <<none>>
327 OUString sDef = BoolStringUI(::comphelper::getString(pActFieldDescr->GetControlDefault()));
328
329 if (m_xRequired->get_active() == 0) // Yes
330 {
331 m_xBoolDefault->remove_text(DBA_RES(STR_VALUE_NONE));
332 if (sDef != aYes && sDef != aNo)
333 m_xBoolDefault->set_active(1); // No as a default
334 else
335 m_xBoolDefault->set_active_text(sDef);
336 }
337 else if (m_xBoolDefault->get_count() < 3)
338 {
339 m_xBoolDefault->append_text(DBA_RES(STR_VALUE_NONE));
340 m_xBoolDefault->set_active_text(sDef);
341 }
342 }
343
344 // A special treatment only for AutoIncrement
345 if (m_xAutoIncrement && &rListBox == m_xAutoIncrement->GetWidget())
346 {
347 if (rListBox.get_active() == 1)
348 { // no
349 DeactivateAggregate( tpAutoIncrementValue );
350 if(pActFieldDescr->IsPrimaryKey())
351 DeactivateAggregate( tpRequired );
352 else if( pActFieldDescr->getTypeInfo()->bNullable )
353 {
354 ActivateAggregate( tpRequired );
355 if (m_xRequired)
356 {
357 if( pActFieldDescr->IsNullable() )
358 m_xRequired->set_active(1); // no
359 else
360 m_xRequired->set_active(0); // yes
361 }
362 }
363 ActivateAggregate( tpDefault );
364 }
365 else
366 {
367 DeactivateAggregate( tpRequired );
368 DeactivateAggregate( tpDefault );
369 ActivateAggregate( tpAutoIncrementValue );
370 }
371 }
372
373 if (m_xType && &rListBox == m_xType->GetWidget())
374 {
375 TOTypeInfoSP pTypeInfo = getTypeInfo(m_xType->get_active());
376 pActFieldDescr->FillFromTypeInfo(pTypeInfo,true,false); // SetType(pTypeInfo);
377
378 DisplayData(pActFieldDescr);
379 CellModified(-1, m_xType->GetPos());
380 }
381}
382
384{
385 // Create Controls
386 switch( eType )
387 {
388 case tpDefault:
389 if (m_xDefault)
390 return;
391 m_nPos++;
392 m_xDefaultText = m_xBuilder->weld_label("DefaultValueText");
393 m_xDefaultText->show();
394 m_xDefault = std::make_unique<OPropEditCtrl>(
395 m_xBuilder->weld_entry("DefaultValue"), STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT);
397 m_xDefault->show();
398 break;
401 return;
402 m_nPos++;
403 m_xAutoIncrementValueText = m_xBuilder->weld_label("AutoIncrementValueText");
405 m_xAutoIncrementValue = std::make_unique<OPropEditCtrl>(
406 m_xBuilder->weld_spin_button("AutoIncrementValue"), STR_HELP_AUTOINCREMENT_VALUE,
410 m_xAutoIncrementValue->show();
411 break;
412
413 case tpRequired:
414 {
415 if (m_xRequired)
416 return;
418
419 if(xMetaData.is() && xMetaData->supportsNonNullableColumns())
420 {
421 m_nPos++;
422 m_xRequiredText = m_xBuilder->weld_label("RequiredText");
423 m_xRequiredText->show();
424 m_xRequired = std::make_unique<OPropListBoxCtrl>(
425 m_xBuilder->weld_combo_box("Required"), STR_HELP_AUTOINCREMENT_VALUE,
427 m_xRequired->append_text(aYes);
428 m_xRequired->append_text(aNo);
429 m_xRequired->set_active(1);
430
432 m_xRequired->show();
433 }
434 }
435 break;
436 case tpAutoIncrement:
437 {
439 return;
440 m_nPos++;
441 m_xAutoIncrementText = m_xBuilder->weld_label("AutoIncrementText");
442 m_xAutoIncrementText->show();
443 m_xAutoIncrement = std::make_unique<OPropListBoxCtrl>(
444 m_xBuilder->weld_combo_box("AutoIncrement"), STR_HELP_AUTOINCREMENT,
446 m_xAutoIncrement->append_text(aYes);
447 m_xAutoIncrement->append_text(aNo);
448 m_xAutoIncrement->set_active(0);
450 m_xAutoIncrement->show();
451 }
452 break;
453 case tpTextLen:
454 if (m_xTextLen)
455 return;
456 m_nPos++;
457 m_xTextLenText = m_xBuilder->weld_label("TextLengthText");
458 m_xTextLenText->show();
459 m_xTextLen = CreateNumericControl("TextLength", STR_HELP_TEXT_LENGTH, FIELD_PROPERTY_TEXTLEN,HID_TAB_ENT_TEXT_LEN);
460 break;
461
462 case tpType:
463 if (m_xType)
464 return;
465 m_nPos++;
466 m_xTypeText = m_xBuilder->weld_label("TypeText");
467 m_xTypeText->show();
468 m_xType = std::make_unique<OPropListBoxCtrl>(
469 m_xBuilder->weld_combo_box("Type"), STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE);
470 {
471 const OTypeInfoMap* pTypeInfo = getTypeInfo();
472 for (auto const& elem : *pTypeInfo)
473 m_xType->append_text(elem.second->aUIName);
474 }
475 m_xType->set_active(0);
477 m_xType->show();
478 break;
479 case tpColumnName:
480 if (m_xColumnName)
481 return;
482 m_nPos++;
483 {
484 sal_Int32 nMax(0);
485 OUString aTmpString;
486 try
487 {
489 if ( xMetaData.is() )
490 {
491 nMax = xMetaData->getMaxColumnNameLength();
492 aTmpString = xMetaData->getExtraNameCharacters();
493 }
494 }
495 catch (const Exception&)
496 {
497 DBG_UNHANDLED_EXCEPTION("dbaccess");
498 }
499 m_xColumnNameText = m_xBuilder->weld_label("ColumnNameText");
500 m_xColumnNameText->show();
501 m_xColumnName = std::make_unique<OPropColumnEditCtrl>(
502 m_xBuilder->weld_entry("ColumnName"), aTmpString,
503 STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_COLUMNNAME);
504 m_xColumnName->set_max_length(nMax);
506 }
507
509 m_xColumnName->show();
510 break;
511 case tpNumType:
512 if (m_xNumType)
513 return;
514 m_nPos++;
515 m_xNumTypeText = m_xBuilder->weld_label("NumTypeText");
516 m_xNumTypeText->show();
517 m_xNumType = std::make_unique<OPropListBoxCtrl>(
518 m_xBuilder->weld_combo_box("NumType"), STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE);
519 m_xNumType->append_text("Byte");
520 m_xNumType->append_text("SmallInt");
521 m_xNumType->append_text("Integer");
522 m_xNumType->append_text("Single");
523 m_xNumType->append_text("Double");
524 m_xNumType->set_active(2);
526 m_xNumType->show();
527 break;
528
529 case tpLength:
530 if (m_xLength)
531 return;
532 m_nPos++;
533 m_xLengthText = m_xBuilder->weld_label("LengthText");
534 m_xLengthText->show();
536 break;
537
538 case tpScale:
539 if (m_xScale)
540 return;
541 m_nPos++;
542 m_xScaleText = m_xBuilder->weld_label("ScaleText");
543 m_xScaleText->show();
545 break;
546
547 case tpFormat:
548 if (!m_xFormat)
549 {
550 m_nPos++;
551 m_xFormatText = m_xBuilder->weld_label("FormatTextText");
552 m_xFormatText->show();
553
554 m_xFormatSample = std::make_unique<OPropEditCtrl>(
555 m_xBuilder->weld_entry("FormatText"), STR_HELP_FORMAT_CODE, -1);
556 m_xFormatSample->set_editable(false);
557 m_xFormatSample->set_sensitive(false);
559 m_xFormatSample->show();
560
561 m_xFormat = m_xBuilder->weld_button("FormatButton");
562 m_xFormat->connect_clicked( LINK( this, OFieldDescControl, FormatClickHdl ) );
564 m_xFormat->show();
565 }
566
568 break;
569 case tpBoolDefault:
570 if (m_xBoolDefault)
571 return;
572
573 m_nPos++;
574 m_xBoolDefaultText = m_xBuilder->weld_label("BoolDefaultText");
575 m_xBoolDefaultText->show();
576 m_xBoolDefault = std::make_unique<OPropListBoxCtrl>(
577 m_xBuilder->weld_combo_box("BoolDefault"), STR_HELP_BOOL_DEFAULT,
579 m_xBoolDefault->append_text(DBA_RES(STR_VALUE_NONE));
580 m_xBoolDefault->append_text(aYes);
581 m_xBoolDefault->append_text(aNo);
583 m_xBoolDefault->show();
584 break;
585 }
586}
587
588void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OUString& _sHelpId,bool _bAddChangeHandler)
589{
590 if ( _bAddChangeHandler )
591 _pControl->GetComboBox().connect_changed(LINK(this,OFieldDescControl,ChangeHdl));
592
593 InitializeControl(_pControl->GetWidget(), _sHelpId);
594}
595
596void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OUString& _sHelpId)
597{
598 pControl->set_help_id(_sHelpId);
599 pControl->connect_focus_in(LINK(this, OFieldDescControl, OnControlFocusGot));
600 pControl->connect_focus_out(LINK(this, OFieldDescControl, OnControlFocusLost));
601
602 if (dynamic_cast<weld::Entry*>(pControl))
603 {
604 int nWidthRequest = Application::GetDefaultDevice()->LogicToPixel(Size(m_nEditWidth, 0), MapMode(MapUnit::MapAppFont)).Width();
605 pControl->set_size_request(nWidthRequest, -1);
606 }
607}
608
609std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OUString& rId, TranslateId pHelpId, short _nProperty, const OUString& _sHelpId)
610{
611 auto xControl = std::make_unique<OPropNumericEditCtrl>(
612 m_xBuilder->weld_spin_button(rId), pHelpId, _nProperty);
613 xControl->set_digits(0);
614 xControl->set_range(0, 0x7FFFFFFF); // Should be changed outside, if needed
615 xControl->show();
616
617 InitializeControl(xControl->GetWidget(),_sHelpId);
618
619 return xControl;
620}
621
623{
624 m_pLastFocusWindow = nullptr;
625 // Destroy Controls
626 switch( eType )
627 {
628 case tpDefault:
629 lcl_HideAndDeleteControl(m_nPos,m_xDefault,m_xDefaultText);
630 break;
631
634 break;
635
636 case tpColumnName:
637 lcl_HideAndDeleteControl(m_nPos,m_xColumnName,m_xColumnNameText);
638 break;
639
640 case tpType:
641 lcl_HideAndDeleteControl(m_nPos,m_xType,m_xTypeText);
642 break;
643
644 case tpAutoIncrement:
645 lcl_HideAndDeleteControl(m_nPos,m_xAutoIncrement,m_xAutoIncrementText);
646 break;
647
648 case tpRequired:
649 lcl_HideAndDeleteControl(m_nPos,m_xRequired,m_xRequiredText);
650 break;
651
652 case tpTextLen:
653 lcl_HideAndDeleteControl(m_nPos,m_xTextLen,m_xTextLenText);
654 break;
655
656 case tpNumType:
657 lcl_HideAndDeleteControl(m_nPos,m_xNumType,m_xNumTypeText);
658 break;
659
660 case tpLength:
661 lcl_HideAndDeleteControl(m_nPos,m_xLength,m_xLengthText);
662 break;
663
664 case tpScale:
665 lcl_HideAndDeleteControl(m_nPos,m_xScale,m_xScaleText);
666 break;
667
668 case tpFormat:
669 // TODO: we have to check if we have to increment m_nPos again
670 lcl_HideAndDeleteControl(m_nPos,m_xFormat,m_xFormatText);
671 if (m_xFormatSample)
672 {
673 m_xFormatSample->hide();
674 m_xFormatSample.reset();
675 }
676 break;
677 case tpBoolDefault:
678 lcl_HideAndDeleteControl(m_nPos,m_xBoolDefault,m_xBoolDefaultText);
679 break;
680 }
681}
682
684{
685 pActFieldDescr = pFieldDescr;
686 if(!pFieldDescr)
687 {
688 if (m_pHelp)
689 m_pHelp->SetHelpText( OUString() );
703 // Reset the saved focus' pointer
704 m_pLastFocusWindow = nullptr;
705 return;
706 }
707
708 TOTypeInfoSP pFieldType(pFieldDescr->getTypeInfo());
709
712
713 OSL_ENSURE(pFieldType,"We need a type information here!");
714 // If the type has changed, substitute Controls
715 if( m_pPreviousType != pFieldType )
716 {
717 // Reset the saved focus' pointer
718 m_pLastFocusWindow = nullptr;
719
720 // Controls, which must NOT be displayed again
722
723 // determine which controls we should show and which not
724
725 // 1. the required control
726 if ( pFieldType->bNullable )
728 else
730
731 // 2. the autoincrement
732 if ( pFieldType->bAutoIncrement )
733 {
738 }
739 else
740 {
743 if(pFieldType->bNullable)
745 else
748 }
749 // 3. the scale and precision
750 if (pFieldType->nPrecision)
751 {
753 m_xLength->set_max(std::max<sal_Int32>(pFieldType->nPrecision,pFieldDescr->GetPrecision()));
754 m_xLength->set_editable(!pFieldType->aCreateParams.isEmpty());
755 }
756 else
758
759 if (pFieldType->nMaximumScale)
760 {
762 m_xScale->set_range(pFieldType->nMinimumScale,
763 std::max<sal_Int32>(pFieldType->nMaximumScale,pFieldDescr->GetScale()));
764 m_xScale->set_editable(!pFieldType->aCreateParams.isEmpty() && pFieldType->aCreateParams != "PRECISION");
765 }
766 else
768
769 // and now look for type specific things
770 switch( pFieldType->nType )
771 {
772 case DataType::CHAR:
773 case DataType::VARCHAR:
774 case DataType::LONGVARCHAR:
777
780 if (pFieldType->nPrecision)
781 {
783 m_xTextLen->set_max(std::max<sal_Int32>(pFieldType->nPrecision,pFieldDescr->GetPrecision()));
784 m_xTextLen->set_editable(!pFieldType->aCreateParams.isEmpty());
785 }
786 else
788 break;
789 case DataType::DATE:
790 case DataType::TIME:
791 case DataType::TIMESTAMP:
792 DeactivateAggregate( tpLength ); // we don't need a length for date types
795
798 break;
799 case DataType::BIT:
800 if ( !pFieldType->aCreateParams.isEmpty() )
801 {
805 break;
806 }
807 [[fallthrough]];
808 case DataType::BOOLEAN:
812
814 break;
815 case DataType::DECIMAL:
816 case DataType::NUMERIC:
817 case DataType::BIGINT:
818 case DataType::FLOAT:
819 case DataType::DOUBLE:
820 case DataType::TINYINT:
821 case DataType::SMALLINT:
822 case DataType::INTEGER:
823 case DataType::REAL:
826
828 break;
829 case DataType::BINARY:
830 case DataType::VARBINARY:
835
837 break;
838 case DataType::LONGVARBINARY:
839 case DataType::SQLNULL:
840 case DataType::OBJECT:
841 case DataType::DISTINCT:
842 case DataType::STRUCT:
843 case DataType::ARRAY:
844 case DataType::BLOB:
845 case DataType::CLOB:
846 case DataType::REF:
847 case DataType::OTHER:
851
852 break;
853 default:
854 OSL_FAIL("Unknown type");
855 }
856 m_pPreviousType = pFieldType;
857 }
858
859 if (pFieldDescr->IsPrimaryKey())
860 {
862 }
863 else if (!m_xAutoIncrement && pFieldType)
864 {
865 if (pFieldType->bNullable)
867 else
869 }
870 // Initialize Controls
872 {
873 if ( pFieldDescr->IsAutoIncrement() )
874 {
875 m_xAutoIncrement->set_active(0); // yes
878 m_xAutoIncrementValue->set_text(pFieldDescr->GetAutoIncrementValue());
881 }
882 else
883 {
884 // disable autoincrement value because it should only be visible when autoincrement is to true
886 m_xAutoIncrement->set_active(1); // no
888 // Affects pRequired
889 if(!pFieldDescr->IsPrimaryKey())
891 }
892 }
893
894 if (m_xDefault)
895 {
896 m_xDefault->set_text(getControlDefault(pFieldDescr));
897 m_xDefault->save_value();
898 }
899
900 if (m_xBoolDefault)
901 {
902 // If m_xRequired = sal_True then the sal_Bool field must NOT contain <<none>>
903 OUString sValue;
904 pFieldDescr->GetControlDefault() >>= sValue;
905 OUString sDef = BoolStringUI(sValue);
906
907 // Make sure that <<none>> is only present if the field can be NULL
908 if ( ( pFieldType && !pFieldType->bNullable ) || !pFieldDescr->IsNullable() )
909 {
910 pFieldDescr->SetIsNullable(ColumnValue::NO_NULLS); // The type says so
911
912 m_xBoolDefault->remove_text(DBA_RES(STR_VALUE_NONE));
913 if ( sDef != aYes && sDef != aNo )
914 m_xBoolDefault->set_active(1); // No as a default
915 else
916 m_xBoolDefault->set_active_text(sDef);
917
918 pFieldDescr->SetControlDefault(Any(BoolStringPersistent(m_xBoolDefault->get_active_text())));
919 }
920 else if (m_xBoolDefault->get_count() < 3)
921 {
922 m_xBoolDefault->append_text(DBA_RES(STR_VALUE_NONE));
923 m_xBoolDefault->set_active_text(sDef);
924 }
925 else
926 m_xBoolDefault->set_active_text(sDef);
927 }
928
929 if (m_xRequired)
930 {
931 if( pFieldDescr->IsNullable() )
932 m_xRequired->set_active(1); // no
933 else
934 m_xRequired->set_active(0); // yes
935 }
936
937 if (m_xTextLen)
938 {
939 m_xTextLen->set_text(OUString::number(pFieldDescr->GetPrecision()));
940 m_xTextLen->save_value();
941 }
942
943 if( m_xNumType )
944 {
945 OSL_FAIL("OFieldDescControl::DisplayData: invalid num type!");
946 }
947
948 if (m_xLength)
949 m_xLength->set_text(OUString::number(pFieldDescr->GetPrecision()));
950
951 if (m_xScale)
952 m_xScale->set_text(OUString::number(pFieldDescr->GetScale()));
953
954 if (m_xFormat)
955 UpdateFormatSample(pFieldDescr);
956
957 if (m_xColumnName)
958 m_xColumnName->set_text(pFieldDescr->GetName());
959
960 if (m_xType)
961 {
962 sal_Int32 nPos = pFieldType ? m_xType->find_text(pFieldDescr->getTypeInfo()->aUIName) : -1;
963 if (nPos == -1)
964 {
965 const OTypeInfoMap* pMap = getTypeInfo();
966 OTypeInfoMap::const_iterator aIter = pMap->find(pFieldType ? pFieldDescr->getTypeInfo()->nType : pFieldDescr->GetType());
967 if(aIter == pMap->end() && !pMap->empty())
968 {
969 aIter = pMap->begin();
970 if(pFieldDescr->GetPrecision() > aIter->second->nPrecision)
971 pFieldDescr->SetPrecision(aIter->second->nPrecision);
972 if(pFieldDescr->GetScale() > aIter->second->nMaximumScale)
973 pFieldDescr->SetScale(0);
974 if(!aIter->second->bNullable && pFieldDescr->IsNullable())
975 pFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
976 if(!aIter->second->bAutoIncrement && pFieldDescr->IsAutoIncrement())
977 pFieldDescr->SetAutoIncrement(false);
978 }
979 if ( aIter != pMap->end() )
980 {
981 pFieldDescr->SetType(aIter->second);
982 }
983 }
984 m_xType->set_active_text(pFieldDescr->getTypeInfo()->aUIName);
985 }
986
987 // Enable/disable Controls
988 bool bRead(IsReadOnly());
989
990 SetReadOnly( bRead );
991}
992
993IMPL_LINK(OFieldDescControl, OnControlFocusGot, weld::Widget&, rControl, void )
994{
995 OUString strHelpText;
996
997 if (m_xTextLen && &rControl == m_xTextLen->GetWidget())
998 {
999 m_xTextLen->save_value();
1000 strHelpText = m_xTextLen->GetHelp();
1001 }
1002 else if (m_xLength && &rControl == m_xLength->GetWidget())
1003 {
1004 m_xLength->save_value();
1005 strHelpText = m_xLength->GetHelp();
1006 }
1007 else if (m_xScale && &rControl == m_xScale->GetWidget())
1008 {
1009 m_xScale->save_value();
1010 strHelpText = m_xScale->GetHelp();
1011 }
1012 else if (m_xColumnName && &rControl == m_xColumnName->GetWidget())
1013 {
1014 m_xColumnName->save_value();
1015 strHelpText = m_xColumnName->GetHelp();
1016 }
1017 else if (m_xDefault && &rControl == m_xDefault->GetWidget())
1018 {
1019 m_xDefault->save_value();
1020 strHelpText = m_xDefault->GetHelp();
1021 }
1022 else if (m_xFormatSample && &rControl == m_xFormatSample->GetWidget())
1023 {
1024 m_xFormatSample->save_value();
1025 strHelpText = m_xFormatSample->GetHelp();
1026 }
1027 else if (m_xAutoIncrementValue && &rControl == m_xAutoIncrementValue->GetWidget())
1028 {
1029 m_xAutoIncrementValue->save_value();
1030 strHelpText = m_xAutoIncrementValue->GetHelp();
1031 }
1032 else if (m_xRequired && &rControl == m_xRequired->GetWidget())
1033 {
1034 m_xRequired->save_value();
1035 strHelpText = m_xRequired->GetHelp();
1036 }
1037 else if (m_xNumType && &rControl == m_xNumType->GetWidget())
1038 {
1039 m_xNumType->save_value();
1040 strHelpText = m_xNumType->GetHelp();
1041 }
1042 else if (m_xAutoIncrement && &rControl == m_xAutoIncrement->GetWidget())
1043 {
1044 m_xAutoIncrement->save_value();
1045 strHelpText = m_xAutoIncrement->GetHelp();
1046 }
1047 else if (m_xBoolDefault && &rControl == m_xBoolDefault->GetWidget())
1048 {
1049 m_xBoolDefault->save_value();
1050 strHelpText = m_xBoolDefault->GetHelp();
1051 }
1052 else if (m_xType && &rControl == m_xType->GetWidget())
1053 {
1054 m_xType->save_value();
1055 strHelpText = m_xType->GetHelp();
1056 }
1057 else if (m_xFormat && &rControl == m_xFormat.get())
1058 strHelpText = DBA_RES(STR_HELP_FORMAT_BUTTON);
1059
1060 if (!strHelpText.isEmpty() && m_pHelp)
1061 m_pHelp->SetHelpText(strHelpText);
1062
1063 m_pActFocusWindow = &rControl;
1064
1065 m_aControlFocusIn.Call(rControl);
1066}
1067
1068IMPL_LINK(OFieldDescControl, OnControlFocusLost, weld::Widget&, rControl, void )
1069{
1070 if (m_xLength && &rControl == m_xLength->GetWidget() && m_xLength->get_value_changed_from_saved())
1071 CellModified(-1, m_xLength->GetPos());
1072 else if (m_xTextLen && &rControl == m_xTextLen->GetWidget() && m_xTextLen->get_value_changed_from_saved())
1073 CellModified(-1, m_xTextLen->GetPos());
1074 else if (m_xScale && &rControl == m_xScale->GetWidget() && m_xScale->get_value_changed_from_saved())
1075 CellModified(-1, m_xScale->GetPos());
1076 else if (m_xColumnName && &rControl == m_xColumnName->GetWidget() && m_xColumnName->get_value_changed_from_saved())
1077 CellModified(-1, m_xColumnName->GetPos());
1078 else if (m_xDefault && &rControl == m_xDefault->GetWidget() && m_xDefault->get_value_changed_from_saved())
1079 CellModified(-1, m_xDefault->GetPos());
1080 else if (m_xFormatSample && &rControl == m_xFormatSample->GetWidget() && m_xFormatSample->get_value_changed_from_saved())
1081 CellModified(-1, m_xFormatSample->GetPos());
1082 else if (m_xAutoIncrementValue && &rControl == m_xAutoIncrementValue->GetWidget() && m_xAutoIncrementValue->get_value_changed_from_saved())
1083 CellModified(-1, m_xAutoIncrementValue->GetPos());
1084 else if (m_xRequired && &rControl == m_xRequired->GetWidget() && m_xRequired->get_value_changed_from_saved())
1085 CellModified(-1, m_xRequired->GetPos());
1086 else if (m_xNumType && &rControl == m_xNumType->GetWidget() && m_xNumType->get_value_changed_from_saved())
1087 CellModified(-1, m_xNumType->GetPos());
1088 else if (m_xAutoIncrement && &rControl == m_xAutoIncrement->GetWidget() && m_xAutoIncrement->get_value_changed_from_saved())
1089 CellModified(-1, m_xAutoIncrement->GetPos());
1090 else if (m_xBoolDefault && &rControl == m_xBoolDefault->GetWidget() && m_xBoolDefault->get_value_changed_from_saved())
1091 CellModified(-1, m_xBoolDefault->GetPos());
1092 else if (m_xType && &rControl == m_xType->GetWidget() && m_xType->get_value_changed_from_saved())
1093 CellModified(-1, m_xType->GetPos());
1094 else if (m_xDefault && &rControl == m_xDefault->GetWidget())
1095 UpdateFormatSample(pActFieldDescr);
1096
1097 implFocusLost(&rControl);
1098}
1099
1101{
1102 if( !pFieldDescr )
1103 return;
1104
1105 // Read out Controls
1106 OUString sDefault;
1107 if (m_xDefault)
1108 {
1109 // tdf#138409 take the control default in the UI Locale format, e.g. 12,34 and return a string
1110 // suitable as the database default, e.g. 12.34
1111 sDefault = CanonicalizeToControlDefault(pFieldDescr, m_xDefault->get_text());
1112 }
1113 else if (m_xBoolDefault)
1114 {
1115 sDefault = BoolStringPersistent(m_xBoolDefault->get_active_text());
1116 }
1117
1118 if ( !sDefault.isEmpty() )
1119 pFieldDescr->SetControlDefault(Any(sDefault));
1120 else
1121 pFieldDescr->SetControlDefault(Any());
1122
1123 if((m_xRequired && m_xRequired->get_active() == 0) || pFieldDescr->IsPrimaryKey() || (m_xBoolDefault && m_xBoolDefault->get_count() == 2)) // yes
1124 pFieldDescr->SetIsNullable( ColumnValue::NO_NULLS );
1125 else
1126 pFieldDescr->SetIsNullable( ColumnValue::NULLABLE );
1127
1128 if (m_xAutoIncrement)
1129 pFieldDescr->SetAutoIncrement(m_xAutoIncrement->get_active() == 0);
1130
1131 if( m_xTextLen )
1132 pFieldDescr->SetPrecision( static_cast<sal_Int32>(m_xTextLen->get_value()) );
1133 else if (m_xLength)
1134 pFieldDescr->SetPrecision( static_cast<sal_Int32>(m_xLength->get_value()) );
1135 if (m_xScale)
1136 pFieldDescr->SetScale( static_cast<sal_Int32>(m_xScale->get_value()) );
1137
1138 if (m_xColumnName)
1139 pFieldDescr->SetName(m_xColumnName->get_text());
1140
1142 pFieldDescr->SetAutoIncrementValue(m_xAutoIncrementValue->get_text());
1143}
1144
1146{
1147 if (pFieldDescr && m_xFormatSample)
1148 m_xFormatSample->set_text(getControlDefault(pFieldDescr,false));
1149}
1150
1152{
1153 m_xContainer->grab_focus();
1154
1155 // Set the Focus to the Control that has been active last
1157 {
1159 m_pLastFocusWindow = nullptr;
1160 }
1161}
1162
1164{
1165 // Remember the active Control
1166 if (!m_pLastFocusWindow)
1167 m_pLastFocusWindow = _pWhich;
1168
1169 // Reset HelpText
1170 if (m_pHelp && !m_pHelp->HasFocus())
1171 m_pHelp->SetHelpText( OUString() );
1172}
1173
1175{
1176 m_pHelp->SetHelpText(OUString());
1177}
1178
1180{
1181 if (m_xDefault && m_pActFocusWindow == m_xDefault->GetWidget())
1182 return true;
1183 if (m_xFormatSample && m_pActFocusWindow == m_xFormatSample->GetWidget())
1184 return true;
1185 if (m_xTextLen && m_pActFocusWindow == m_xTextLen->GetWidget())
1186 return true;
1187 if (m_xLength && m_pActFocusWindow == m_xLength->GetWidget())
1188 return true;
1189 if (m_xScale && m_pActFocusWindow == m_xScale->GetWidget())
1190 return true;
1191 if (m_xColumnName && m_pActFocusWindow == m_xColumnName->GetWidget())
1192 return true;
1194 return true;
1195 return false;
1196}
1197
1199{
1200 return m_xContainer && m_xContainer->has_child_focus();
1201}
1202
1204{
1205 int nStartPos, nEndPos;
1206 bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget() &&
1207 dynamic_cast<weld::Entry&>(*m_pActFocusWindow).get_selection_bounds(nStartPos, nEndPos);
1208 return bAllowed;
1209}
1210
1212{
1213 int nStartPos, nEndPos;
1214 bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget() &&
1215 dynamic_cast<weld::Entry&>(*m_pActFocusWindow).get_selection_bounds(nStartPos, nEndPos);
1216 return bAllowed;
1217}
1218
1220{
1221 bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget();
1222 if ( bAllowed )
1223 {
1225 bAllowed = aTransferData.HasFormat(SotClipboardFormatId::STRING);
1226 }
1227 return bAllowed;
1228}
1229
1231{
1232 if (isCutAllowed())
1233 dynamic_cast<weld::Entry&>(*m_pActFocusWindow).cut_clipboard();
1234}
1235
1237{
1238 if (isCopyAllowed()) // this only checks if the focus window is valid
1239 dynamic_cast<weld::Entry&>(*m_pActFocusWindow).copy_clipboard();
1240}
1241
1243{
1244 if (m_pActFocusWindow) // this only checks if the focus window is valid
1245 dynamic_cast<weld::Entry&>(*m_pActFocusWindow).paste_clipboard();
1246}
1247
1248bool OFieldDescControl::isTextFormat(const OFieldDescription* _pFieldDescr, sal_uInt32& _nFormatKey) const
1249{
1250 _nFormatKey = _pFieldDescr->GetFormatKey();
1251 bool bTextFormat = true;
1252
1253 try
1254 {
1255 if (!_nFormatKey)
1256 {
1257 Reference< css::util::XNumberFormatTypes> xNumberTypes(GetFormatter()->getNumberFormatsSupplier()->getNumberFormats(),UNO_QUERY);
1258 OSL_ENSURE(xNumberTypes.is(),"XNumberFormatTypes is null!");
1259
1260 _nFormatKey = ::dbtools::getDefaultNumberFormat( _pFieldDescr->GetType(),
1261 _pFieldDescr->GetScale(),
1262 _pFieldDescr->IsCurrency(),
1263 xNumberTypes,
1264 GetLocale());
1265 }
1266 sal_Int32 nNumberFormat = ::comphelper::getNumberFormatType(GetFormatter(),_nFormatKey);
1267 bTextFormat = (nNumberFormat == css::util::NumberFormat::TEXT);
1268 }
1269 catch(const Exception&)
1270 {
1271
1272 }
1273
1274 return bTextFormat;
1275}
1276
1277OUString OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldDescr, bool _bCheck) const
1278{
1279 OUString sDefault;
1280 bool bCheck = !_bCheck || _pFieldDescr->GetControlDefault().hasValue();
1281 if ( bCheck )
1282 {
1283 try
1284 {
1285 double nValue = 0.0;
1286 sal_uInt32 nFormatKey;
1287 bool bTextFormat = isTextFormat(_pFieldDescr,nFormatKey);
1288 if ( _pFieldDescr->GetControlDefault() >>= sDefault )
1289 {
1290 if ( !bTextFormat )
1291 {
1292 if ( !sDefault.isEmpty() )
1293 {
1294 try
1295 {
1296 nValue = GetFormatter()->convertStringToNumber(nFormatKey,sDefault);
1297 }
1298 catch(const Exception&)
1299 {
1300 return OUString(); // return empty string for format example
1301 }
1302 }
1303 }
1304 }
1305 else
1306 _pFieldDescr->GetControlDefault() >>= nValue;
1307
1309 Reference<XPropertySet> xFormSet = xNumberFormatter->getNumberFormatsSupplier()->getNumberFormats()->getByKey(nFormatKey);
1310 OSL_ENSURE(xFormSet.is(),"XPropertySet is null!");
1311 OUString sFormat;
1312 xFormSet->getPropertyValue("FormatString") >>= sFormat;
1313
1314 if ( !bTextFormat )
1315 {
1316 Locale aLocale;
1317 ::comphelper::getNumberFormatProperty(xNumberFormatter,nFormatKey,"Locale") >>= aLocale;
1318
1319 sal_Int32 nNumberFormat = ::comphelper::getNumberFormatType(xNumberFormatter,nFormatKey);
1320 if( (nNumberFormat & css::util::NumberFormat::DATE) == css::util::NumberFormat::DATE
1321 || (nNumberFormat & css::util::NumberFormat::DATETIME) == css::util::NumberFormat::DATETIME )
1322 {
1323 nValue = DBTypeConversion::toNullDate(DBTypeConversion::getNULLDate(xNumberFormatter->getNumberFormatsSupplier()),nValue);
1324 }
1325
1326 Reference< css::util::XNumberFormatPreviewer> xPreviewer(xNumberFormatter,UNO_QUERY);
1327 OSL_ENSURE(xPreviewer.is(),"XNumberFormatPreviewer is null!");
1328 sDefault = xPreviewer->convertNumberToPreviewString(sFormat,nValue,aLocale,true);
1329 }
1330 else if ( !(_bCheck && sDefault.isEmpty()) )
1331 sDefault = xNumberFormatter->formatString(nFormatKey, sDefault.isEmpty() ? sFormat : sDefault);
1332 }
1333 catch(const Exception&)
1334 {
1335
1336 }
1337 }
1338
1339 return sDefault;
1340}
1341
1342// tdf#138409 intended to be effectively the reverse of getControlDefault to
1343// turn a user's possibly 12,34 format into 12.34 format for numerical types
1344OUString OFieldDescControl::CanonicalizeToControlDefault(const OFieldDescription* pFieldDescr, const OUString& rDefault) const
1345{
1346 if (rDefault.isEmpty())
1347 return rDefault;
1348
1349 bool bIsNumericalType = false;
1350 switch (pFieldDescr->GetType())
1351 {
1352 case DataType::TINYINT:
1353 case DataType::SMALLINT:
1354 case DataType::INTEGER:
1355 case DataType::BIGINT:
1356 case DataType::FLOAT:
1357 case DataType::REAL:
1358 case DataType::DOUBLE:
1359 case DataType::NUMERIC:
1360 case DataType::DECIMAL:
1361 bIsNumericalType = true;
1362 break;
1363 }
1364
1365 if (!bIsNumericalType)
1366 return rDefault;
1367
1368 try
1369 {
1370 sal_uInt32 nFormatKey;
1371 bool bTextFormat = isTextFormat(pFieldDescr, nFormatKey);
1372 if (bTextFormat)
1373 return rDefault;
1374 double nValue = GetFormatter()->convertStringToNumber(nFormatKey, rDefault);
1375 return OUString::number(nValue);
1376 }
1377 catch(const Exception&)
1378 {
1379 }
1380
1381 return rDefault;
1382}
1383
1384
1385/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FIELD_PROPERTY_LENGTH
#define FIELD_PROPERTY_SCALE
#define FIELD_PROPERTY_NUMTYPE
#define FIELD_PROPERTY_TEXTLEN
#define FIELD_PROPERTY_REQUIRED
#define FIELD_PROPERTY_FORMAT
#define FIELD_PROPERTY_BOOL_DEFAULT
#define FIELD_PROPERTY_COLUMNNAME
#define FIELD_PROPERTY_AUTOINCREMENT
#define FIELD_PROPERTY_DEFAULT
#define FIELD_PROPERTY_TYPE
#define FIELD_PROPERTY_AUTOINC
sal_Int16 nControlId
static OutputDevice * GetDefaultDevice()
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
SvNumberFormatter * GetNumberFormatter() const
SvNumFormatType GetType(sal_uInt32 nFIndex) const
static TransferableDataHelper CreateFromClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard)
bool HasFormat(SotClipboardFormatId nFormat) const
virtual bool isCopyAllowed() override
virtual void ActivateAggregate(EControlType eType)
weld::Widget * m_pActFocusWindow
void SaveData(OFieldDescription *pFieldDescr)
std::unique_ptr< weld::Builder > m_xBuilder
std::unique_ptr< weld::Label > m_xDefaultText
weld::Widget * m_pLastFocusWindow
std::unique_ptr< OPropListBoxCtrl > m_xType
std::unique_ptr< OPropNumericEditCtrl > m_xLength
std::unique_ptr< OPropNumericEditCtrl > CreateNumericControl(const OUString &rId, TranslateId pHelpId, short _nProperty, const OUString &_sHelpId)
OUString BoolStringPersistent(std::u16string_view rUIString) const
virtual void SetModified(bool bModified)
virtual void copy() override
OUString getControlDefault(const OFieldDescription *pFieldDescr, bool _bCheck=true) const
std::unique_ptr< OPropNumericEditCtrl > m_xScale
void SetReadOnly(bool bReadOnly)
virtual void paste() override
virtual bool isAutoIncrementValueEnabled() const =0
std::unique_ptr< weld::Label > m_xTypeText
virtual css::uno::Reference< css::sdbc::XConnection > getConnection()=0
OFieldDescription * pActFieldDescr
virtual void cut() override
std::unique_ptr< OPropListBoxCtrl > m_xRequired
std::unique_ptr< weld::Label > m_xTextLenText
std::unique_ptr< weld::Label > m_xScaleText
std::unique_ptr< weld::Container > m_xContainer
std::unique_ptr< weld::Label > m_xColumnNameText
virtual bool isPasteAllowed() override
virtual OUString getAutoIncrementValue() const =0
std::unique_ptr< weld::Label > m_xNumTypeText
std::unique_ptr< weld::Label > m_xAutoIncrementText
void DisplayData(OFieldDescription *pFieldDescr)
std::unique_ptr< OPropListBoxCtrl > m_xNumType
void UpdateFormatSample(OFieldDescription const *pFieldDescr)
std::unique_ptr< OPropNumericEditCtrl > m_xTextLen
std::unique_ptr< weld::Label > m_xAutoIncrementValueText
OUString BoolStringUI(const OUString &rPersistentString) const
std::unique_ptr< weld::Button > m_xFormat
void SetControlText(sal_uInt16 nControlId, const OUString &rText)
std::unique_ptr< weld::Label > m_xFormatText
virtual bool isCutAllowed() override
bool isTextFormat(const OFieldDescription *_pFieldDescr, sal_uInt32 &_nFormatKey) const
std::unique_ptr< OPropListBoxCtrl > m_xBoolDefault
void implFocusLost(weld::Widget *_pWhich)
virtual const OTypeInfoMap * getTypeInfo() const =0
std::unique_ptr< weld::Label > m_xBoolDefaultText
std::unique_ptr< OPropColumnEditCtrl > m_xColumnName
void InitializeControl(weld::Widget *_pControl, const OUString &_sHelpId)
std::unique_ptr< OPropEditCtrl > m_xFormatSample
std::unique_ptr< weld::Label > m_xRequiredText
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > getMetaData()=0
std::unique_ptr< OPropEditCtrl > m_xDefault
std::unique_ptr< OPropEditCtrl > m_xAutoIncrementValue
std::unique_ptr< weld::Label > m_xLengthText
std::unique_ptr< OPropListBoxCtrl > m_xAutoIncrement
OUString CanonicalizeToControlDefault(const OFieldDescription *pFieldDescr, const OUString &rUserText) const
virtual void DeactivateAggregate(EControlType eType)
virtual css::lang::Locale GetLocale() const =0
virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const =0
OTableDesignHelpBar * m_pHelp
void SetControlDefault(const css::uno::Any &_rControlDefault)
void SetPrecision(sal_Int32 _rPrecision)
void SetIsNullable(sal_Int32 _rIsNullable)
const TOTypeInfoSP & getTypeInfo() const
void SetType(const TOTypeInfoSP &_pType)
void SetAutoIncrementValue(const OUString &_sAutoIncValue)
void SetAutoIncrement(bool _bAuto)
void SetName(const OUString &_rName)
sal_Int32 GetFormatKey() const
OUString GetAutoIncrementValue() const
css::uno::Any GetControlDefault() const
sal_Int32 GetPrecision() const
void SetScale(sal_Int32 _rScale)
weld::ComboBox & GetComboBox()
void SetHelpText(const OUString &rText)
void connect_focus_out(const Link< weld::Widget &, void > &rLink)
weld::Widget * GetWidget()
Definition: SqlNameEdit.hxx:85
void connect_changed(const Link< ComboBox &, void > &rLink)
virtual void cut_clipboard()=0
virtual bool get_selection_bounds(int &rStartPos, int &rEndPos)=0
virtual void copy_clipboard()=0
virtual void paste_clipboard()=0
virtual void grab_focus()=0
virtual void set_help_id(const OUString &rName)=0
virtual void set_size_request(int nWidth, int nHeight)=0
virtual void connect_focus_out(const Link< Widget &, void > &rLink)
virtual css::uno::Reference< css::datatransfer::clipboard::XClipboard > get_clipboard() const=0
virtual void connect_focus_in(const Link< Widget &, void > &rLink)
#define DBA_RES(id)
#define DBG_UNHANDLED_EXCEPTION(...)
size_t m_nPos
sal_Int16 nValue
bool bReadOnly
OUString eType
Definition: generalpage.cxx:78
constexpr OUStringLiteral HID_TAB_ENT_FORMAT_SAMPLE
Definition: helpids.h:52
constexpr OUStringLiteral HID_TAB_ENT_TEXT_LEN
Definition: helpids.h:57
constexpr OUStringLiteral HID_TAB_ENT_NUMTYP
Definition: helpids.h:60
constexpr OUStringLiteral HID_TAB_ENT_SCALE
Definition: helpids.h:62
constexpr OUStringLiteral HID_TAB_ENT_COLUMNNAME
Definition: helpids.h:59
constexpr OUStringLiteral HID_TAB_ENT_LEN
Definition: helpids.h:61
constexpr OUStringLiteral HID_TAB_ENT_TYPE
Definition: helpids.h:58
constexpr OUStringLiteral HID_TAB_ENT_BOOL_DEFAULT
Definition: helpids.h:54
constexpr OUStringLiteral HID_TAB_AUTOINCREMENTVALUE
Definition: helpids.h:74
constexpr OUStringLiteral HID_TAB_ENT_AUTOINCREMENT
Definition: helpids.h:56
constexpr OUStringLiteral HID_TAB_ENT_REQUIRED
Definition: helpids.h:55
constexpr OUStringLiteral HID_TAB_ENT_FORMAT
Definition: helpids.h:53
constexpr OUStringLiteral HID_TAB_ENT_DEFAULT
Definition: helpids.h:51
sal_uInt16 nPos
def text(shape, orig_st)
@ Exception
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
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
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
std::multimap< sal_Int32, TOTypeInfoSP > OTypeInfoMap
Definition: TypeInfo.hxx:100
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
bool isSQL92CheckEnabled(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
check if SQL92 name checking is enabled
EControlType
Definition: QEnumTypes.hxx:63
@ tpScale
Definition: QEnumTypes.hxx:69
@ tpRequired
Definition: QEnumTypes.hxx:65
@ tpBoolDefault
Definition: QEnumTypes.hxx:72
@ tpNumType
Definition: QEnumTypes.hxx:67
@ tpType
Definition: QEnumTypes.hxx:74
@ tpDefault
Definition: QEnumTypes.hxx:64
@ tpFormat
Definition: QEnumTypes.hxx:70
@ tpAutoIncrementValue
Definition: QEnumTypes.hxx:75
@ tpAutoIncrement
Definition: QEnumTypes.hxx:71
@ tpLength
Definition: QEnumTypes.hxx:68
@ tpTextLen
Definition: QEnumTypes.hxx:66
@ tpColumnName
Definition: QEnumTypes.hxx:73
Reference< XNumberFormatsSupplier > getNumberFormats(const Reference< XConnection > &_rxConn, bool _bAlloweDefault, const Reference< XComponentContext > &_rxContext)
Reference< XNameAccess > m_xContainer
Definition: objectnames.cxx:80
SvxCellHorJustify
sal_Int32 _nPos