24#include <svx/svxids.hrc>
28#include <osl/diagnose.h>
53 const sal_uInt32 nSysNumFormat = pFormatter->
GetFormatIndex(NF_NUMBER_SYSTEM, eCurLanguage);
54 if (nDefaultFormat == nSysNumFormat)
56 const sal_uInt32 nSysShortDateFormat = pFormatter->
GetFormatIndex(NF_DATE_SYSTEM_SHORT, eCurLanguage);
57 if (nDefaultFormat == nSysShortDateFormat)
59 const sal_uInt32 nSysLongDateFormat = pFormatter->
GetFormatIndex(NF_DATE_SYSTEM_LONG, eCurLanguage);
60 if (nDefaultFormat == nSysLongDateFormat)
84 case SvNumFormatType::DATE:
85 case SvNumFormatType::DATE|SvNumFormatType::TIME:
86 nDefValue = SvxNumValCategory::Date;
89 case SvNumFormatType::TIME:
90 nDefValue = SvxNumValCategory::Time;
93 case SvNumFormatType::TEXT:
94 case SvNumFormatType::UNDEFINED:
95 nDefValue = SvxNumValCategory::Standard;
98 case SvNumFormatType::CURRENCY:
99 nDefValue = SvxNumValCategory::Currency;
102 case SvNumFormatType::PERCENT:
103 nDefValue = SvxNumValCategory::Percent;
106 case SvNumFormatType::LOGICAL:
107 nDefValue = SvxNumValCategory::Boolean;
111 nDefValue = SvxNumValCategory::Standard;
123 , mbCurrFormatTypeNeedsInit(true)
124 , m_bShowLanguageControl(false)
125 , m_bUseAutomaticLanguage(true)
130 : mxControl(
std::move(xControl))
136 : mxControl(
std::move(xControl))
183 switch( nFormatType )
185 case SvNumFormatType::NUMBER:
190 case SvNumFormatType::PERCENT:
195 case SvNumFormatType::CURRENCY:
200 case SvNumFormatType::DATETIME:
205 case SvNumFormatType::DATE:
210 case SvNumFormatType::TIME:
215 case SvNumFormatType::SCIENTIFIC:
220 case SvNumFormatType::FRACTION:
225 case SvNumFormatType::LOGICAL:
230 case SvNumFormatType::TEXT:
235 case SvNumFormatType::ALL:
241 OSL_FAIL(
"what a format?");
253 const sal_uInt32 nSysShortDateFormat = pFormatter->
GetFormatIndex(
262 pFormat = pFormatter->
GetEntry( nFormat );
266 ||
const_cast<SvNumberformat*
>(pFormat)->GetOutputString( fVal, sValue, &pCol )
267 || nFormatType == SvNumFormatType::UNDEFINED )
271 else if( nFormatType == SvNumFormatType::TEXT )
276 if (nFormat != nSysNumFormat &&
277 nFormat != nSysShortDateFormat &&
278 nFormat != nSysLongDateFormat)
280 append(OUString::number(nFormat), sValue);
331 const Color* pCol =
nullptr;
333 if (
nType == SvNumFormatType::TEXT)
346 if ( lcl_isSystemFormat(nDefaultFormat, pFormatter,
m_eCurLanguage) )
348 sValue +=
SwResId(RID_STR_SYSTEM);
352 set_id(
nPos, OUString::number(nDefaultFormat));
359 return mxControl->get_active_id().toUInt32();
364 return mxControl->get_selected_id().toUInt32();
370 OUString sDefine(
SwResId( STR_DEFINE_NUMBERFORMAT ));
380 SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
381 SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
382 SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
383 SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
384 SID_ATTR_NUMBERFORMAT_ADD_AUTO,
385 SID_ATTR_NUMBERFORMAT_ADD_AUTO> aCoreSet( rSh.
GetAttrPool() );
390 aCoreSet.Put(
SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, nFormat ));
393 SID_ATTR_NUMBERFORMAT_INFO ) );
407 if (
RET_OK == pDlg->Execute())
410 GetItem( SID_ATTR_NUMBERFORMAT_INFO );
412 if( pFormatInfoItem )
418 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
420 SID_ATTR_NUMBERFORMAT_VALUE,
false ))
422 sal_uInt32 nNumberFormat = pFormatValueItem->GetValue();
432 SID_ATTR_NUMBERFORMAT_ADD_AUTO,
false)))
LanguageType getLanguageType(bool bResolveSystem=true) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const LanguageTag & GetLanguageTag() const
const std::vector< sal_uInt32 > & GetDelFormats() const
virtual VclPtr< SfxAbstractDialog > CreateNumFormatDialog(weld::Widget *pParent, const SfxItemSet &rAttr)=0
static SwAbstractDialogFactory * Create()
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
const SfxItemPool & GetAttrPool() const
SwWrtShell & GetWrtShell() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
const o3tl::enumarray< SvxNumValCategory, double > fSvxNumValConst
LanguageType GetAppLanguage()
#define LINK(Instance, Class, Member)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
IMPL_LINK_NOARG(NumFormatListBox, SelectHdl, weld::ComboBox &, void)
OUString SwResId(TranslateId aId)
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND