23 #include <svx/svxids.hrc>
33 #include <strings.hrc>
51 const sal_uInt32 nSysNumFormat = pFormatter->
GetFormatIndex(NF_NUMBER_SYSTEM, eCurLanguage);
52 if (nDefaultFormat == nSysNumFormat)
54 const sal_uInt32 nSysShortDateFormat = pFormatter->
GetFormatIndex(NF_DATE_SYSTEM_SHORT, eCurLanguage);
55 if (nDefaultFormat == nSysShortDateFormat)
57 const sal_uInt32 nSysLongDateFormat = pFormatter->
GetFormatIndex(NF_DATE_SYSTEM_LONG, eCurLanguage);
58 if (nDefaultFormat == nSysLongDateFormat)
82 case SvNumFormatType::DATE:
83 case SvNumFormatType::DATE|SvNumFormatType::TIME:
84 nDefValue = SvxNumValCategory::Date;
87 case SvNumFormatType::TIME:
88 nDefValue = SvxNumValCategory::Time;
91 case SvNumFormatType::TEXT:
92 case SvNumFormatType::UNDEFINED:
93 nDefValue = SvxNumValCategory::Standard;
96 case SvNumFormatType::CURRENCY:
97 nDefValue = SvxNumValCategory::Currency;
100 case SvNumFormatType::PERCENT:
101 nDefValue = SvxNumValCategory::Percent;
104 case SvNumFormatType::LOGICAL:
105 nDefValue = SvxNumValCategory::Boolean;
109 nDefValue = SvxNumValCategory::Standard;
121 , mbCurrFormatTypeNeedsInit(true)
122 , bShowLanguageControl(false)
123 , bUseAutomaticLanguage(true)
128 : mxControl(
std::move(xControl))
134 : mxControl(
std::move(xControl))
173 OSL_ENSURE(pView,
"no view found");
184 switch( nFormatType )
186 case SvNumFormatType::NUMBER:
191 case SvNumFormatType::PERCENT:
196 case SvNumFormatType::CURRENCY:
201 case SvNumFormatType::DATETIME:
206 case SvNumFormatType::DATE:
211 case SvNumFormatType::TIME:
216 case SvNumFormatType::SCIENTIFIC:
221 case SvNumFormatType::FRACTION:
226 case SvNumFormatType::LOGICAL:
231 case SvNumFormatType::TEXT:
236 case SvNumFormatType::ALL:
242 OSL_FAIL(
"what a format?");
254 const sal_uInt32 nSysShortDateFormat = pFormatter->
GetFormatIndex(
262 static_cast<NfIndexTableOffset>(
nIndex), eCurLanguage );
263 pFormat = pFormatter->
GetEntry( nFormat );
267 ||
const_cast<SvNumberformat*
>(pFormat)->GetOutputString( fVal, sValue, &pCol )
268 || nFormatType == SvNumFormatType::UNDEFINED )
272 else if( nFormatType == SvNumFormatType::TEXT )
277 if (nFormat != nSysNumFormat &&
278 nFormat != nSysShortDateFormat &&
279 nFormat != nSysLongDateFormat)
281 append(OUString::number(nFormat), sValue);
284 nFormatType, eCurLanguage ) )
308 OSL_ENSURE(pView,
"no view found");
322 if (nFormat ==
get_id(
i).toUInt32())
333 const Color* pCol =
nullptr;
335 if (nType == SvNumFormatType::TEXT)
348 if ( lcl_isSystemFormat(nDefaultFormat, pFormatter, eCurLanguage) )
350 sValue +=
SwResId(RID_STR_SYSTEM);
354 set_id(nPos, OUString::number(nDefaultFormat));
361 return mxControl->get_active_id().toUInt32();
366 return mxControl->get_selected_id().toUInt32();
372 OUString sDefine(
SwResId( STR_DEFINE_NUMBERFORMAT ));
384 SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
385 SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
386 SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
387 SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
388 SID_ATTR_NUMBERFORMAT_ADD_AUTO,
389 SID_ATTR_NUMBERFORMAT_ADD_AUTO>{});
394 aCoreSet.Put(
SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, nFormat ));
397 SID_ATTR_NUMBERFORMAT_INFO ) );
399 if( (SvNumFormatType::DATE | SvNumFormatType::TIME) &
nCurrFormatType )
411 if (
RET_OK == pDlg->Execute())
414 GetItem( SID_ATTR_NUMBERFORMAT_INFO );
418 for ( sal_uInt32 key : static_cast<const SvxNumberInfoItem*>(pItem)->GetDelFormats() )
422 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
424 SID_ATTR_NUMBERFORMAT_VALUE,
false, &pItem ))
435 SID_ATTR_NUMBERFORMAT_ADD_AUTO,
false, &pItem ))
#define LINK(Instance, Class, Member)
LanguageType getLanguageType(bool bResolveSystem=true) const
SwWrtShell & GetWrtShell() const
LanguageType GetCurLang() const
Used by the UI to modify the document model.
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
const SfxItemPool & GetAttrPool() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const o3tl::enumarray< SvxNumValCategory, double > fSvxNumValConst
virtual VclPtr< SfxAbstractDialog > CreateNumFormatDialog(weld::Widget *pParent, const SfxItemSet &rAttr)=0
static SwAbstractDialogFactory * Create()
OUString SwResId(const char *pId)
SwDocShell * GetDocShell()
LanguageType GetAppLanguage()
const LanguageTag & GetLanguageTag() const
IMPL_LINK_NOARG(NumFormatListBox, SelectHdl, weld::ComboBox &, void)
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.