/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
void FillFieldSelect(weld::TreeView& rListBox)
{ for (autoconst& aID : FLD_SELECT)
rListBox.append_text(SwResId(aID));
}
SwFieldDokInfPage::SwFieldDokInfPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *const pCoreSet)
: SwFieldPage(pPage, pController, u"modules/swriter/ui/flddocinfopage.ui"_ustr, u"FieldDocInfoPage"_ustr, pCoreSet)
, m_nOldSel(0)
, m_nOldFormat(0)
, m_xTypeList(m_xBuilder->weld_tree_view(u"type-list"_ustr))
, m_xTypeTree(m_xBuilder->weld_tree_view(u"type-tree"_ustr)) // tdf#104278 have two tree views, one with expander and one without, the one with is only used // when there are custom properties which use the expander, so the common case of no custom // properties doesn't have an 'unexplained' expander margin
, m_pTypeView(m_xTypeTree.get())
, m_xSelection(m_xBuilder->weld_widget(u"selectframe"_ustr))
, m_xSelectionLB(m_xBuilder->weld_tree_view(u"select"_ustr))
, m_xFormat(m_xBuilder->weld_widget(u"formatframe"_ustr))
, m_xFormatLB(new SwNumFormatTreeView(m_xBuilder->weld_tree_view(u"format"_ustr)))
, m_xFixedCB(m_xBuilder->weld_check_button(u"fixed"_ustr))
{
m_xTypeList->make_sorted();
m_xTypeTree->make_sorted();
FillFieldSelect(*m_xSelectionLB);
auto nWidth = m_pTypeView->get_approximate_digit_width() * FIELD_COLUMN_WIDTH; auto nHeight = m_pTypeView->get_height_rows(10);
m_xTypeTree->set_size_request(nWidth, nHeight);
m_xTypeList->set_size_request(nWidth, nHeight);
m_xFormatLB->get_widget().set_size_request(nWidth * 2, nHeight);
m_xSelectionLB->set_size_request(nWidth, nHeight);
//enable 'active' language selection
m_xFormatLB->SetShowLanguageControl(true);
if (nSubType < DI_CREATE || nSubType == DI_DOCNO || nSubType == DI_EDIT|| nSubType == DI_CUSTOM )
{ // Format Box is empty for Title and Time
} else
{
nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode()); for (sal_uInt16 i = 0; i < nSize; ++i)
{
OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, i)));
m_xSelectionLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i)); if (IsFieldEdit() && i == nExtSubType)
nSelPos = i;
}
}
bool bEnable = nSize != 0;
if (nSize)
{ if (m_xSelectionLB->get_selected_index() == -1)
m_xSelectionLB->select(nSelPos == USHRT_MAX ? 0 : nSelPos);
bEnable = true;
}
m_xSelection->set_sensitive(bEnable);
return nSize;
}
bool SwFieldDokInfPage::FillItemSet(SfxItemSet* )
{ if (!m_xSelEntry) returnfalse;
sal_uInt16 nSubType = m_pTypeView->get_id(*m_xSelEntry).toUInt32(); if (nSubType == USHRT_MAX) returnfalse;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.