31#define USER_DATA_VERSION_1 "1"
32#define USER_DATA_VERSION USER_DATA_VERSION_1
35 :
SwFieldPage(pPage, pController,
"modules/swriter/ui/flddocumentpage.ui",
36 "FieldDocumentPage", pCoreSet)
39 , m_xTypeLB(m_xBuilder->weld_tree_view(
"type"))
40 , m_xSelection(m_xBuilder->weld_widget(
"selectframe"))
41 , m_xSelectionLB(m_xBuilder->weld_tree_view(
"select"))
42 , m_xValueFT(m_xBuilder->weld_label(
"valueft"))
43 , m_xValueED(m_xBuilder->weld_entry(
"value"))
44 , m_xLevelFT(m_xBuilder->weld_label(
"levelft"))
45 , m_xLevelED(m_xBuilder->weld_spin_button(
"level"))
46 , m_xDateFT(m_xBuilder->weld_label(
"daysft"))
47 , m_xTimeFT(m_xBuilder->weld_label(
"minutesft"))
48 , m_xDateOffsetED(m_xBuilder->weld_spin_button(
"offset"))
49 , m_xFormat(m_xBuilder->weld_widget(
"formatframe"))
50 , m_xFormatLB(m_xBuilder->weld_tree_view(
"format"))
52 , m_xFixedCB(m_xBuilder->weld_check_button(
"fixed"))
58 auto nHeight =
m_xTypeLB->get_height_rows(10);
60 m_xTypeLB->set_size_request(nWidth, nHeight);
160 if(nVal != USHRT_MAX)
162 for (
int i = 0, nEntryCount =
m_xTypeLB->n_children();
i < nEntryCount;
i++)
189 const sal_Int32 nOld = GetTypeSel();
192 SetTypeSel(m_xTypeLB->get_selected_index());
194 if(GetTypeSel() == -1)
197 m_xTypeLB->select(0);
200 if (nOld == GetTypeSel())
211 m_xSelectionLB->clear();
215 std::vector<OUString> aLst;
216 GetFieldMgr().GetSubTypes(nTypeId, aLst);
221 nCount = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
227 OUString
sId(OUString::number(
i));
229 m_xSelectionLB->append(
sId, aLst[
i]);
231 m_xSelectionLB->append(
sId, GetFieldMgr().GetFormatStr(nTypeId,
i));
235 bool bInsert =
false;
237 OUString
sId(OUString::number(
i));
243 m_xSelectionLB->append(
sId, aLst[
i]);
245 m_xSelectionLB->select_id(
sId);
247 m_xSelectionLB->select_id(
sId);
251 m_xSelectionLB->append(
sId, aLst[
i]);
252 if (GetCurField()->GetSubType() ==
i)
253 m_xSelectionLB->select_id(
sId);
258 const OUString sFormat(GetFieldMgr().GetFormatStr(nTypeId,
i));
259 m_xSelectionLB->append(
sId, sFormat);
260 m_xSelectionLB->select_text(GetFieldMgr().GetFormatStr(nTypeId, GetCurField()->
GetFormat()));
265 if (aLst[
i] == GetCurField()->GetPar1())
271 m_xSelectionLB->append(
sId, aLst[
i]);
283 nTypeId =
static_cast<SwFieldTypesEnum>(m_xSelectionLB->get_id(0).toUInt32());
288 bool bEnable =
nCount != 0;
290 if (bEnable && m_xSelectionLB->get_selected_index() == -1)
291 m_xSelectionLB->select(0);
293 m_xSelection->set_sensitive( bEnable );
296 sal_Int32 nSize = FillFormatLB(nTypeId);
298 bool bValue =
false, bLevel =
false, bNumFormat =
false, bOffset =
false;
299 bool bFormat = nSize != 0;
300 bool bOneArea =
false;
307 bFormat = bNumFormat = bOneArea = bOffset =
true;
309 nFormatType = SvNumFormatType::DATE;
313 m_xDateOffsetED->set_range(INT_MIN, INT_MAX);
316 m_xDateOffsetED->set_value(
static_cast<SwDateTimeField*
>(GetCurField())->GetOffset() / 24 / 60);
320 bFormat = bNumFormat = bOneArea = bOffset =
true;
322 nFormatType = SvNumFormatType::TIME;
326 m_xDateOffsetED->set_range(-1440, 1440);
329 m_xDateOffsetED->set_value(
static_cast<SwDateTimeField*
>(GetCurField())->GetOffset() );
336 const sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
340 sal_Int32 nOff = GetCurField()->GetPar2().toInt32();
342 m_xValueED->set_text(
343 OUString::number(nOff - 1) );
345 m_xValueED->set_text(
346 OUString::number(nOff + 1) );
348 m_xValueED->set_text(OUString());
351 m_xValueED->set_text(
static_cast<SwPageNumberField*
>(GetCurField())->GetUserString());
357 m_xValueFT->set_label(
SwResId(STR_LEVEL));
359 m_xLevelED->set_text(OUString::number(
static_cast<SwChapterField*
>(GetCurField())->GetLevel(GetWrtShell()->GetLayout()) + 1));
364 m_xValueFT->set_label(
SwResId( STR_OFFSET ));
366 m_xValueED->set_text(GetCurField()->GetPar2());
384 m_xNumFormatLB->SetDefFormat(GetCurField()->
GetFormat());
386 if (m_xNumFormatLB->GetFormatType() == (SvNumFormatType::DATE|SvNumFormatType::TIME))
390 m_xNumFormatLB->SetFormatType(SvNumFormatType::ALL);
391 m_xNumFormatLB->SetFormatType(nFormatType);
393 m_xNumFormatLB->SetDefFormat(GetCurField()->
GetFormat());
397 m_xNumFormatLB->SetFormatType(nFormatType);
399 m_xNumFormatLB->SetOneArea(bOneArea);
402 m_xFormatLB->set_visible(!bNumFormat);
403 m_xNumFormatLB->set_visible(bNumFormat);
405 m_xValueFT->set_visible(bValue);
406 m_xValueED->set_visible(bValue);
407 m_xLevelFT->set_visible(bLevel);
408 m_xLevelED->set_visible(bLevel);
409 m_xDateOffsetED->set_visible(bOffset);
410 m_xFixedCB->set_visible(!bValue && !bLevel && !bOffset);
412 m_xFormat->set_sensitive(bFormat);
413 m_xFixedCB->set_sensitive(bFixed);
418 if (m_xNumFormatLB->get_selected_index() == -1)
419 m_xNumFormatLB->select(0);
420 m_xValueFT->set_sensitive(bValue || bLevel || bOffset);
421 m_xValueED->set_sensitive(bValue);
431 sal_Int32
nPos = m_xSelectionLB->get_selected_index();
436 FillFormatLB(nTypeId);
442 pTextRes = STR_LEVEL;
448 ? STR_VALUE : STR_OFFSET;
452 pTextRes = STR_OFFSET;
458 m_xValueFT->set_label(
SwResId(pTextRes));
471 for( sal_uInt16
i = 0;
i < nSize; ++
i )
474 OUString
sId(OUString::number(nFormatId));
507 sal_Int32
nPos = m_xSelectionLB->get_selected_index();
518 sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
519 const OUString sOldText( m_xValueFT->get_label() );
523 if (sOldText != sNewText)
524 m_xValueFT->set_label(sNewText);
526 if (sOldText != m_xValueFT->get_label())
527 m_xValueED->set_text(OUString());
543 sal_uInt32 nFormat = 0;
544 sal_uInt16 nSubType = 0;
580 aVal = OUString::number(nVal * 60 * 24);
582 aVal = OUString::number(nVal);
594 sal_Int32 nVal =
m_xValueED->get_text().toInt32();
595 aVal = OUString::number(nVal);
625 return std::make_unique<SwFieldDokPage>(pPage, pController, pAttrSet);
635 const sal_Int32 nEntryPos =
m_xTypeLB->get_selected_index();
636 const sal_uInt16 nTypeSel = ( -1 == nEntryPos )
637 ? USHRT_MAX :
m_xTypeLB->get_id(nEntryPos).toUInt32();
void SetUserData(const OUString &rString)
const OUString & GetUserData() const
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
std::unique_ptr< weld::TreeView > m_xSelectionLB
virtual bool FillItemSet(SfxItemSet *rSet) override
void AddSubType(SwFieldTypesEnum nTypeId)
std::unique_ptr< weld::TreeView > m_xFormatLB
std::unique_ptr< weld::Entry > m_xValueED
std::unique_ptr< weld::CheckButton > m_xFixedCB
std::unique_ptr< weld::SpinButton > m_xLevelED
virtual void Reset(const SfxItemSet *rSet) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::SpinButton > m_xDateOffsetED
sal_Int32 FillFormatLB(SwFieldTypesEnum nTypeId)
virtual sal_uInt16 GetGroup() override
SwFieldDokPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *pSet)
virtual void FillUserData() override
virtual ~SwFieldDokPage() override
std::unique_ptr< SwNumFormatTreeView > m_xNumFormatLB
std::unique_ptr< weld::TreeView > m_xTypeLB
static const SwFieldGroupRgn & GetGroupRange(bool bHtmlMode, sal_uInt16 nGrpId)
sal_uInt16 GetFormatCount(SwFieldTypesEnum nTypeId, bool bHtmlMode) const
sal_uInt16 GetFormatId(SwFieldTypesEnum nTypeId, sal_uInt32 nFormatId) const
static const OUString & GetTypeStr(sal_uInt16 nPos)
static sal_uInt16 GetPos(SwFieldTypesEnum nTypeId)
static SwFieldTypesEnum GetTypeId(sal_uInt16 nPos)
void InsertField(SwFieldTypesEnum nTypeId, sal_uInt16 nSubType, const OUString &rPar1, const OUString &rPar2, sal_uInt32 nFormatId, sal_Unicode cDelim=' ', bool bIsAutomaticLanguage=true)
sal_Int32 GetTypeSel() const
void SavePos(const weld::TreeView &rLst1)
SwFieldMgr & GetFieldMgr()
bool IsFieldDlgHtmlMode() const
void RestorePos(weld::TreeView &rLst1)
SwWrtShell * GetWrtShell()
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
Base class of all fields.
SwFieldTypesEnum GetTypeId() const
bool IsAutomaticLanguage() const
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Used by the UI to modify the document model.
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
SwFieldTypesEnum
List of FieldTypes at UI.
#define USER_DATA_VERSION_1
#define USER_DATA_VERSION
IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView &, void)
#define FIELD_COLUMN_WIDTH
#define LINK(Instance, Class, Member)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
SwWrtShell * GetActiveWrtShell()
OUString SwResId(TranslateId aId)
constexpr sal_uInt8 MAXLEVEL