/* -*- 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 .
*/
#include <sal/config.h>
#include <utility>
#include <optpage.hxx>
#include <doc.hxx>
#include <hintids.hxx>
#include <cmdid.h>
#include <fmtcol.hxx>
#include <charatr.hxx>
#include <swtypes.hxx>
#include <view.hxx>
#include <docsh.hxx>
#include <IDocumentDeviceAccess.hxx>
#include <IDocumentSettingAccess.hxx>
#include <swmodule.hxx>
#include <wrtsh.hxx>
#include <cfgitems.hxx>
#include <poolfmt.hxx>
#include <uiitems.hxx>
#include <printdata.hxx>
#include <modcfg.hxx>
#include <crstate.hxx>
#include <viewopt.hxx>
#include <globals.hrc>
#include <strings.hrc>
#include <swwrtshitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/langitem.hxx>
#include <editeng/svxenum.hxx>
#include <officecfg/Office/Common.hxx>
#include <officecfg/Office/Writer.hxx>
#include <officecfg/Office/WriterWeb.hxx>
#include <sal/macros.h>
#include <sfx2/dialoghelper.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/ctloptions.hxx>
#include <svl/eitem.hxx>
#include <svl/cjkoptions.hxx>
#include <svtools/ctrltool.hxx>
#include <svtools/unitconv.hxx>
#include <sfx2/htmlmode.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <optload.hxx>
using namespace ::com::sun::star;
namespace {
void drawRect(vcl::RenderContext& rRenderContext,
const tools::Rectangle &rRect,
const Color &rFillColor,
const Color &rLineColor)
{
rRenderContext.SetFillColor(rFillColor);
rRenderContext.SetLineColor(rLineColor);
rRenderContext.DrawRect(rRect);
}
}
// Tools->Options->Writer->View
// Tools->Options->Writer/Web->View
SwContentOptPage::SwContentOptPage(weld::Container* pPage, weld::DialogController*
pController, const SfxItemSet& rCoreSet)
: SfxTabPage(pPage, pController, u"modules/swriter/ui/viewoptionspage.ui" _ustr, u"ViewOptionsPage" _ustr, &rCoreSet)
, m_xCrossCB(m_xBuilder->weld_check_button(u"helplines" _ustr))
, m_xCrossImg(m_xBuilder->weld_widget(u"lockhelplines" _ustr))
, m_xHMetric(m_xBuilder->weld_combo_box(u"hrulercombobox" _ustr))
, m_xHMetricImg(m_xBuilder->weld_widget(u"lockhruler" _ustr))
, m_xVRulerCBox(m_xBuilder->weld_check_button(u"vruler" _ustr))
, m_xVRulerImg(m_xBuilder->weld_widget(u"lockvruler" _ustr))
, m_xVRulerRightCBox(m_xBuilder->weld_check_button(u"vrulerright" _ustr))
, m_xVRulerRightImg(m_xBuilder->weld_widget(u"lockvrulerright" _ustr))
, m_xVMetric(m_xBuilder->weld_combo_box(u"vrulercombobox" _ustr))
, m_xSmoothCBox(m_xBuilder->weld_check_button(u"smoothscroll" _ustr))
, m_xSmoothImg(m_xBuilder->weld_widget(u"locksmoothscroll" _ustr))
, m_xGrfCB(m_xBuilder->weld_check_button(u"graphics" _ustr))
, m_xGrfImg(m_xBuilder->weld_widget(u"lockgraphics" _ustr))
, m_xTableCB(m_xBuilder->weld_check_button(u"tables" _ustr))
, m_xTableImg(m_xBuilder->weld_widget(u"locktables" _ustr))
, m_xDrwCB(m_xBuilder->weld_check_button(u"drawings" _ustr))
, m_xDrwImg(m_xBuilder->weld_widget(u"lockdrawings" _ustr))
, m_xPostItCB(m_xBuilder->weld_check_button(u"comments" _ustr))
, m_xSettingsFrame(m_xBuilder->weld_frame(u"settingsframe" _ustr))
, m_xSettingsLabel(m_xBuilder->weld_label(u"settingslabel" _ustr))
, m_xMetricLabel(m_xBuilder->weld_label(u"measureunitlabel" _ustr))
, m_xMetricLB(m_xBuilder->weld_combo_box(u"measureunit" _ustr))
, m_xMetricImg(m_xBuilder->weld_widget(u"lockmeasureunit" _ustr))
, m_xShowInlineTooltips(m_xBuilder->weld_check_button(u"changestooltip" _ustr))
, m_xShowInlineTooltipsImg(m_xBuilder->weld_widget(u"lockchangestooltip" _ustr))
, m_xShowOutlineContentVisibilityButton(m_xBuilder->weld_check_button(u"outlinecontentvisibilitybutton" _ustr))
, m_xShowOutlineContentVImg(m_xBuilder->weld_widget(u"lockoutlinecontentvisibility" _ustr))
, m_xTreatSubOutlineLevelsAsContent(m_xBuilder->weld_check_button(u"suboutlinelevelsascontent" _ustr))
, m_xTreatSubOutlineLevelsImg(m_xBuilder->weld_widget(u"locksuboutlinelevels" _ustr))
, m_xShowChangesInMargin(m_xBuilder->weld_check_button(u"changesinmargin" _ustr))
, m_xShowChangesInMarginImg(m_xBuilder->weld_widget(u"lockchangesinmargin" _ustr))
, m_xFieldHiddenCB(m_xBuilder->weld_check_button(u"hiddentextfield" _ustr))
, m_xFieldHiddenImg(m_xBuilder->weld_widget(u"lockhiddentextfield" _ustr))
, m_xFieldHiddenParaCB(m_xBuilder->weld_check_button(u"hiddenparafield" _ustr))
, m_xFieldHiddenParaImg(m_xBuilder->weld_widget(u"lockhiddenparafield" _ustr))
, m_xZoomFrame(m_xBuilder->weld_frame(u"zoomframe" _ustr))
, m_xZoomLatestRB(m_xBuilder->weld_radio_button(u"zoomlatest" _ustr))
, m_xZoomPreferredRB(m_xBuilder->weld_radio_button(u"zoompreferred" _ustr))
, m_xZoomOptimalRB(m_xBuilder->weld_radio_button(u"zoomoptimal" _ustr))
, m_xZoomWidthAndHeightRB(m_xBuilder->weld_radio_button(u"zoomfitwandh" _ustr))
, m_xZoomWidthRB(m_xBuilder->weld_radio_button(u"zoomfitw" _ustr))
, m_xZoom100RB(m_xBuilder->weld_radio_button(u"zoom100pc" _ustr))
, m_xZoomCustomRB(m_xBuilder->weld_radio_button(u"zoomcustom" _ustr))
, m_xZoomValue(m_xBuilder->weld_metric_spin_button(u"zoomvalue" _ustr, FieldUnit::PERCENT))
{
m_xShowOutlineContentVisibilityButton->connect_toggled(LINK(this , SwContentOptPage, ShowOutlineContentVisibilityButtonHdl));
/* This part is visible only with Writer/Web->View dialogue. */
const SfxUInt16Item* pItem = rCoreSet.GetItemIfSet(SID_HTML_MODE, false );
if (!pItem || !(pItem->GetValue() & HTMLMODE_ON))
{
m_xSettingsFrame->hide();
m_xSettingsLabel->hide();
m_xMetricLabel->hide();
m_xMetricLB->hide();
Link<weld::Toggleable&, void > aZoomLatestLink = LINK(this , SwContentOptPage, ZoomLatestHdl);
m_xZoomLatestRB->connect_toggled(aZoomLatestLink);
m_xZoomPreferredRB->connect_toggled(aZoomLatestLink);
Link<weld::Toggleable&, void > aZoomLink = LINK(this , SwContentOptPage, ZoomHdl);
m_xZoomOptimalRB->connect_toggled(aZoomLink);
m_xZoomWidthAndHeightRB->connect_toggled(aZoomLink);
m_xZoomWidthRB->connect_toggled(aZoomLink);
m_xZoom100RB->connect_toggled(aZoomLink);
m_xZoomCustomRB->connect_toggled(aZoomLink);
m_xZoomValue->set_range(MINZOOM, MAXZOOM, FieldUnit::PERCENT);
}
else
{
m_xZoomFrame->hide();
m_xZoomLatestRB->hide();
m_xZoomPreferredRB->hide();
m_xZoomOptimalRB->hide();
m_xZoomWidthAndHeightRB->hide();
m_xZoomWidthRB->hide();
m_xZoom100RB->hide();
m_xZoomCustomRB->hide();
m_xZoomValue->hide();
}
if (!SvtCJKOptions::IsVerticalTextEnabled() )
m_xVRulerRightCBox->hide();
m_xVRulerCBox->connect_toggled(LINK(this , SwContentOptPage, VertRulerHdl ));
for (size_t i = 0; i < SwFieldUnitTable::Count(); ++i)
{
const OUString sMetric = SwFieldUnitTable::GetString(i);
FieldUnit eFUnit = SwFieldUnitTable::GetValue(i);
switch ( eFUnit )
{
case FieldUnit::MM:
case FieldUnit::CM:
case FieldUnit::POINT:
case FieldUnit::PICA:
case FieldUnit::INCH:
case FieldUnit::CHAR : // add two units , 'character' and 'line' , their ticks are not fixed
case FieldUnit::LINE:
{
// only use these metrics
// a horizontal ruler has not the 'line' unit
// there isn't 'line' unit in HTML format
if (eFUnit != FieldUnit::LINE)
{
m_xMetricLB->append(OUString::number(static_cast <sal_uInt32>(eFUnit)), sMetric);
m_xHMetric->append(OUString::number(static_cast <sal_uInt32>(eFUnit)), sMetric);
}
// a vertical ruler has not the 'character' unit
if (eFUnit != FieldUnit::CHAR )
{
m_xVMetric->append(OUString::number(static_cast <sal_uInt32>(eFUnit)), sMetric);
}
break ;
}
default :;//prevent warning
}
}
}
SwContentOptPage::~SwContentOptPage()
{
}
std::unique_ptr<SfxTabPage> SwContentOptPage::Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet)
{
return std::make_unique<SwContentOptPage>(pPage, pController, *rAttrSet);
}
static void lcl_SelectMetricLB(weld::ComboBox& rMetric, TypedWhichId<SfxUInt16Item> nSID, const SfxItemSet& rSet)
{
const SfxPoolItem* pItem;
if ( rSet.GetItemState( nSID, false , &pItem ) >= SfxItemState::DEFAULT )
{
FieldUnit eFieldUnit = static_cast <FieldUnit>(static_cast <const SfxUInt16Item*>(pItem)->GetValue());
for (sal_Int32 i = 0, nEntryCount = rMetric.get_count(); i < nEntryCount; ++i)
{
if (rMetric.get_id(i).toUInt32() == static_cast <sal_uInt32>(eFieldUnit))
{
rMetric.set_active(i);
break ;
}
}
}
rMetric.save_value();
}
void SwContentOptPage::Reset(const SfxItemSet* rSet)
{
bool bReadOnly = false ;
bool bWebOptionsPage = m_xSettingsFrame->is_visible();
const SwElemItem* pElemAttr = rSet->GetItemIfSet( FN_PARAM_ELEM , false );
if (pElemAttr)
{
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Content::Display::Table::isReadOnly() :
officecfg::Office::WriterWeb::Content::Display::Table::isReadOnly();
m_xTableCB->set_active(pElemAttr->m_bTable);
m_xTableCB->set_sensitive(!bReadOnly);
m_xTableImg->set_visible(bReadOnly);
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Content::Display::GraphicObject::isReadOnly() :
officecfg::Office::WriterWeb::Content::Display::GraphicObject::isReadOnly();
m_xGrfCB->set_active(pElemAttr->m_bGraphic);
m_xGrfCB->set_sensitive(!bReadOnly);
m_xGrfImg->set_visible(bReadOnly);
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Content::Display::DrawingControl::isReadOnly() :
officecfg::Office::WriterWeb::Content::Display::DrawingControl::isReadOnly();
m_xDrwCB->set_active(pElemAttr->m_bDrawing);
m_xDrwCB->set_sensitive(!bReadOnly);
m_xDrwImg->set_visible(bReadOnly);
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Content::Display::Note::isReadOnly() :
officecfg::Office::WriterWeb::Content::Display::Note::isReadOnly();
m_xPostItCB->set_active(pElemAttr->m_bNotes);
m_xPostItCB->set_sensitive(!bReadOnly);
m_xPostItCB->set_visible(pElemAttr->m_bNotes);
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Layout::Line::Guide::isReadOnly() :
officecfg::Office::WriterWeb::Layout::Line::Guide::isReadOnly();
m_xCrossCB->set_active(pElemAttr->m_bCrosshair);
m_xCrossCB->set_sensitive(!bReadOnly);
m_xCrossImg->set_visible(bReadOnly);
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Layout::Window::VerticalRuler::isReadOnly() :
officecfg::Office::WriterWeb::Layout::Window::VerticalRuler::isReadOnly();
m_xVRulerCBox->set_active(pElemAttr->m_bVertRuler);
m_xVRulerCBox->set_sensitive(!bReadOnly);
m_xVRulerImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Layout::Window::IsVerticalRulerRight::isReadOnly();
m_xVRulerRightCBox->set_active(pElemAttr->m_bVertRulerRight);
m_xVRulerRightCBox->set_sensitive(pElemAttr->m_bVertRuler && !bReadOnly);
m_xVRulerRightImg->set_visible(bReadOnly);
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Layout::Window::SmoothScroll::isReadOnly() :
officecfg::Office::WriterWeb::Layout::Window::SmoothScroll::isReadOnly();
m_xSmoothCBox->set_active(pElemAttr->m_bSmoothScroll);
m_xSmoothCBox->set_sensitive(!bReadOnly);
m_xSmoothImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Content::Display::ShowInlineTooltips::isReadOnly();
m_xShowInlineTooltips->set_active(pElemAttr->m_bShowInlineTooltips);
m_xShowInlineTooltips->set_sensitive(!bReadOnly);
m_xShowInlineTooltipsImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Content::Display::ShowOutlineContentVisibilityButton::isReadOnly();
m_xShowOutlineContentVisibilityButton->set_active(pElemAttr->m_bShowOutlineContentVisibilityButton);
m_xShowOutlineContentVisibilityButton->set_sensitive(!bReadOnly);
m_xShowOutlineContentVImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Content::Display::TreatSubOutlineLevelsAsContent::isReadOnly();
m_xTreatSubOutlineLevelsAsContent->set_active(pElemAttr->m_bTreatSubOutlineLevelsAsContent);
m_xTreatSubOutlineLevelsAsContent->set_sensitive(pElemAttr->m_bShowOutlineContentVisibilityButton && !bReadOnly);
m_xTreatSubOutlineLevelsImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Content::Display::ShowChangesInMargin::isReadOnly();
m_xShowChangesInMargin->set_active(pElemAttr->m_bShowChangesInMargin);
m_xShowChangesInMargin->set_sensitive(!bReadOnly);
m_xShowChangesInMarginImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Content::NonprintingCharacter::HiddenText::isReadOnly();
m_xFieldHiddenCB->set_active( pElemAttr->m_bFieldHiddenText );
m_xFieldHiddenCB->set_sensitive(!bReadOnly);
m_xFieldHiddenImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Content::NonprintingCharacter::HiddenParagraph::isReadOnly();
m_xFieldHiddenParaCB->set_active( pElemAttr->m_bShowHiddenPara );
m_xFieldHiddenParaCB->set_sensitive(!bReadOnly);
m_xFieldHiddenParaImg->set_visible(bReadOnly);
if (!bWebOptionsPage)
{
m_xZoomLatestRB->set_active(pElemAttr->IsDefaultZoom());
m_xZoomPreferredRB->set_active(!pElemAttr->IsDefaultZoom());
switch (pElemAttr->GetDefaultZoomType())
{
case SvxZoomType::OPTIMAL: m_xZoomOptimalRB->set_active(true ); break ;
case SvxZoomType::WHOLEPAGE: m_xZoomWidthAndHeightRB->set_active(true ); break ;
case SvxZoomType::PAGEWIDTH: m_xZoomWidthRB->set_active(true ); break ;
case SvxZoomType::PERCENT:
m_xZoom100RB->set_active(pElemAttr->GetDefaultZoomValue() == 100);
m_xZoomCustomRB->set_active(pElemAttr->GetDefaultZoomValue() != 100);
break ;
default :
break ;
}
m_xZoomValue->set_value(pElemAttr->GetDefaultZoomValue(), FieldUnit::PERCENT);
ZoomLatestHdl(*m_xZoomLatestRB);
}
}
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Layout::Window::HorizontalRulerUnit::isReadOnly() :
officecfg::Office::WriterWeb::Layout::Window::HorizontalRulerUnit::isReadOnly();
m_xHMetric->set_sensitive(!bReadOnly);
m_xHMetricImg->set_visible(bReadOnly);
bReadOnly = !bWebOptionsPage ? officecfg::Office::Writer::Layout::Window::VerticalRulerUnit::isReadOnly() :
officecfg::Office::WriterWeb::Layout::Window::VerticalRulerUnit::isReadOnly();
m_xVMetric->set_sensitive(!bReadOnly);
m_xMetricLB->set_active(-1);
if (bWebOptionsPage)
{
bReadOnly = officecfg::Office::WriterWeb::Layout::Other::MeasureUnit::isReadOnly();
m_xMetricLB->set_sensitive(!bReadOnly);
m_xMetricImg->set_visible(bReadOnly);
}
lcl_SelectMetricLB(*m_xMetricLB, SID_ATTR_METRIC, *rSet);
lcl_SelectMetricLB(*m_xHMetric, FN_HSCROLL_METRIC, *rSet);
lcl_SelectMetricLB(*m_xVMetric, FN_VSCROLL_METRIC, *rSet);
}
OUString SwContentOptPage::GetAllStrings()
{
OUString sAllStrings;
OUString labels[]
= { u"guideslabel" _ustr, u"displaylabel" _ustr, u"displayfl1" _ustr, u"changeslabel" _ustr, u"label3" _ustr,
u"hruler" _ustr, u"settingslabel" _ustr, u"measureunitlabel" _ustr, u"outlinelabel" _ustr };
for (const auto & label : labels)
{
if (const auto pString = m_xBuilder->weld_label(label))
sAllStrings += pString->get_label() + " " ;
}
OUString checkButton[] = { u"helplines" _ustr,
u"graphics" _ustr,
u"tables" _ustr,
u"drawings" _ustr,
u"comments" _ustr,
u"resolvedcomments" _ustr,
u"hiddentextfield" _ustr,
u"hiddenparafield" _ustr,
u"changesinmargin" _ustr,
u"changestooltip" _ustr,
u"vruler" _ustr,
u"vrulerright" _ustr,
u"smoothscroll" _ustr,
u"outlinecontentvisibilitybutton" _ustr,
u"suboutlinelevelsascontent" _ustr };
for (const auto & check : checkButton)
{
if (const auto pString = m_xBuilder->weld_check_button(check))
sAllStrings += pString->get_label() + " " ;
}
return sAllStrings.replaceAll("_" , "" );
}
bool SwContentOptPage::FillItemSet(SfxItemSet* rSet)
{
const SwElemItem* pOldAttr = GetOldItem(GetItemSet(), FN_PARAM_ELEM);
SwElemItem aElem;
aElem.m_bTable = m_xTableCB->get_active();
aElem.m_bGraphic = m_xGrfCB->get_active();
aElem.m_bDrawing = m_xDrwCB->get_active();
aElem.m_bNotes = m_xPostItCB->get_active();
aElem.m_bCrosshair = m_xCrossCB->get_active();
aElem.m_bVertRuler = m_xVRulerCBox->get_active();
aElem.m_bVertRulerRight = m_xVRulerRightCBox->get_active();
aElem.m_bSmoothScroll = m_xSmoothCBox->get_active();
aElem.m_bShowInlineTooltips = m_xShowInlineTooltips->get_active();
aElem.m_bShowOutlineContentVisibilityButton = m_xShowOutlineContentVisibilityButton->get_active();
aElem.m_bTreatSubOutlineLevelsAsContent = m_xTreatSubOutlineLevelsAsContent->get_active();
aElem.m_bShowChangesInMargin = m_xShowChangesInMargin->get_active();
aElem.m_bFieldHiddenText = m_xFieldHiddenCB->get_active();
aElem.m_bShowHiddenPara = m_xFieldHiddenParaCB->get_active();
if (m_xZoomLatestRB->is_visible())
{
aElem.SetDefaultZoom(m_xZoomLatestRB->get_active());
if (m_xZoomOptimalRB->get_active())
aElem.SetDefaultZoomType(SvxZoomType::OPTIMAL);
else if (m_xZoomWidthAndHeightRB->get_active())
aElem.SetDefaultZoomType(SvxZoomType::WHOLEPAGE);
else if (m_xZoomWidthRB->get_active())
aElem.SetDefaultZoomType(SvxZoomType::PAGEWIDTH);
else if (m_xZoom100RB->get_active())
{
aElem.SetDefaultZoomType(SvxZoomType::PERCENT);
aElem.SetDefaultZoomValue(100);
}
else
{
aElem.SetDefaultZoomType(SvxZoomType::PERCENT);
aElem.SetDefaultZoomValue(m_xZoomValue->get_value(FieldUnit::PERCENT));
}
}
bool bRet = !pOldAttr || aElem != *pOldAttr;
if (bRet)
bRet = nullptr != rSet->Put(aElem);
sal_Int32 nMPos = m_xMetricLB->get_active();
sal_Int32 nGlobalMetricPos = nMPos;
if ( m_xMetricLB->get_value_changed_from_saved() )
{
const sal_uInt16 nFieldUnit = m_xMetricLB->get_id(nMPos).toUInt32();
rSet->Put( SfxUInt16Item( SID_ATTR_METRIC, nFieldUnit ) );
bRet = true ;
}
nMPos = m_xHMetric->get_active();
if ( m_xHMetric->get_value_changed_from_saved() || nMPos != nGlobalMetricPos )
{
const sal_uInt16 nFieldUnit = m_xHMetric->get_id(nMPos).toUInt32();
rSet->Put( SfxUInt16Item( FN_HSCROLL_METRIC, nFieldUnit ) );
bRet = true ;
}
nMPos = m_xVMetric->get_active();
if ( m_xVMetric->get_value_changed_from_saved() || nMPos != nGlobalMetricPos )
{
const sal_uInt16 nFieldUnit = m_xVMetric->get_id(nMPos).toUInt32();
rSet->Put( SfxUInt16Item( FN_VSCROLL_METRIC, nFieldUnit ) );
bRet = true ;
}
return bRet;
}
IMPL_LINK(SwContentOptPage, VertRulerHdl, weld::Toggleable&, rBox, void )
{
m_xVRulerRightCBox->set_sensitive(rBox.get_sensitive() && rBox.get_active() &&
!officecfg::Office::Writer::Layout::Window::IsVerticalRulerRight::isReadOnly());
}
IMPL_LINK(SwContentOptPage, ShowOutlineContentVisibilityButtonHdl, weld::Toggleable&, rBox, void )
{
m_xTreatSubOutlineLevelsAsContent->set_sensitive(rBox.get_active());
}
IMPL_LINK_NOARG(SwContentOptPage, ZoomLatestHdl, weld::Toggleable&, void )
{
bool bZoomPreferred = m_xZoomPreferredRB->get_active();
m_xZoomOptimalRB->set_sensitive(bZoomPreferred);
m_xZoomWidthAndHeightRB->set_sensitive(bZoomPreferred);
m_xZoomWidthRB->set_sensitive(bZoomPreferred);
m_xZoom100RB->set_sensitive(bZoomPreferred);
m_xZoomCustomRB->set_sensitive(bZoomPreferred);
m_xZoomValue->set_sensitive(bZoomPreferred);
ZoomHdl(*m_xZoomOptimalRB);
}
IMPL_LINK_NOARG(SwContentOptPage, ZoomHdl, weld::Toggleable&, void )
{
if (m_xZoomCustomRB->get_active() && m_xZoomCustomRB->get_sensitive())
{
m_xZoomValue->set_sensitive(true );
m_xZoomValue->grab_focus();
}
else
{
m_xZoomValue->set_sensitive(false );
}
}
// TabPage Printer additional settings
SwAddPrinterTabPage::SwAddPrinterTabPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rCoreSet)
: SfxTabPage(pPage, pController, u"modules/swriter/ui/printoptionspage.ui" _ustr, u"PrintOptionsPage" _ustr, &rCoreSet)
, m_sNone(SwResId(SW_STR_NONE))
, m_bAttrModified(false )
, m_bPreview(false )
, m_bHTMLMode(false )
, m_xGrfCB(m_xBuilder->weld_check_button(u"graphics" _ustr))
, m_xGrfImg(m_xBuilder->weld_widget(u"lockgraphics" _ustr))
, m_xCtrlFieldCB(m_xBuilder->weld_check_button(u"formcontrols" _ustr))
, m_xCtrlFieldImg(m_xBuilder->weld_widget(u"lockformcontrols" _ustr))
, m_xBackgroundCB(m_xBuilder->weld_check_button(u"background" _ustr))
, m_xBackgroundImg(m_xBuilder->weld_widget(u"lockbackground" _ustr))
, m_xBlackFontCB(m_xBuilder->weld_check_button(u"inblack" _ustr))
, m_xBlackFontImg(m_xBuilder->weld_widget(u"lockinblack" _ustr))
, m_xPrintHiddenTextCB(m_xBuilder->weld_check_button(u"hiddentext" _ustr))
, m_xPrintHiddenTextImg(m_xBuilder->weld_widget(u"lockhiddentext" _ustr))
, m_xPrintTextPlaceholderCB(m_xBuilder->weld_check_button(u"textplaceholder" _ustr))
, m_xPrintTextPlaceholderImg(m_xBuilder->weld_widget(u"locktextplaceholder" _ustr))
, m_xPagesFrame(m_xBuilder->weld_widget(u"pagesframe" _ustr))
, m_xLeftPageCB(m_xBuilder->weld_check_button(u"leftpages" _ustr))
, m_xLeftPageImg(m_xBuilder->weld_widget(u"lockleftpages" _ustr))
, m_xRightPageCB(m_xBuilder->weld_check_button(u"rightpages" _ustr))
, m_xRightPageImg(m_xBuilder->weld_widget(u"lockrightpages" _ustr))
, m_xProspectCB(m_xBuilder->weld_check_button(u"brochure" _ustr))
, m_xProspectImg(m_xBuilder->weld_widget(u"lockbrochure" _ustr))
, m_xProspectCB_RTL(m_xBuilder->weld_check_button(u"rtl" _ustr))
, m_xProspectImg_RTL(m_xBuilder->weld_widget(u"lockrtl" _ustr))
, m_xCommentsFrame(m_xBuilder->weld_widget(u"commentsframe" _ustr))
, m_xNoRB(m_xBuilder->weld_radio_button(u"none" _ustr))
, m_xOnlyRB(m_xBuilder->weld_radio_button(u"only" _ustr))
, m_xEndRB(m_xBuilder->weld_radio_button(u"end" _ustr))
, m_xEndPageRB(m_xBuilder->weld_radio_button(u"endpage" _ustr))
, m_xInMarginsRB(m_xBuilder->weld_radio_button(u"inmargins" _ustr))
, m_xMarginsImg(m_xBuilder->weld_widget(u"lockcomments" _ustr))
, m_xPrintEmptyPagesCB(m_xBuilder->weld_check_button(u"blankpages" _ustr))
, m_xPrintEmptyPagesImg(m_xBuilder->weld_widget(u"lockblankpages" _ustr))
, m_xPaperFromSetupCB(m_xBuilder->weld_check_button(u"papertray" _ustr))
, m_xPaperFromSetupImg(m_xBuilder->weld_widget(u"lockpapertray" _ustr))
, m_xFaxLB(m_xBuilder->weld_combo_box(u"fax" _ustr))
, m_xFaxImg(m_xBuilder->weld_widget(u"lockfax" _ustr))
{
Link<weld::Toggleable&,void > aLk = LINK( this , SwAddPrinterTabPage, AutoClickHdl);
m_xGrfCB->connect_toggled( aLk );
m_xRightPageCB->connect_toggled( aLk );
m_xLeftPageCB->connect_toggled( aLk );
m_xCtrlFieldCB->connect_toggled( aLk );
m_xBackgroundCB->connect_toggled( aLk );
m_xBlackFontCB->connect_toggled( aLk );
m_xPrintHiddenTextCB->connect_toggled( aLk );
m_xPrintTextPlaceholderCB->connect_toggled( aLk );
m_xProspectCB->connect_toggled( aLk );
m_xProspectCB_RTL->connect_toggled( aLk );
m_xPaperFromSetupCB->connect_toggled( aLk );
m_xPrintEmptyPagesCB->connect_toggled( aLk );
m_xEndPageRB->connect_toggled( aLk );
m_xInMarginsRB->connect_toggled( aLk );
m_xEndRB->connect_toggled( aLk );
m_xOnlyRB->connect_toggled( aLk );
m_xNoRB->connect_toggled( aLk );
m_xFaxLB->connect_changed( LINK( this , SwAddPrinterTabPage, SelectHdl ) );
const SfxUInt16Item* pItem = rCoreSet.GetItemIfSet(SID_HTML_MODE, false );
if (pItem && pItem->GetValue() & HTMLMODE_ON)
{
m_bHTMLMode = true ;
m_xLeftPageCB->hide();
m_xRightPageCB->hide();
m_xPrintHiddenTextCB->hide();
m_xPrintTextPlaceholderCB->hide();
m_xPrintEmptyPagesCB->hide();
}
m_xProspectCB_RTL->set_sensitive(false );
SvtCTLOptions aCTLOptions;
m_xProspectCB_RTL->set_visible(SvtCTLOptions::IsCTLFontEnabled());
}
SwAddPrinterTabPage::~SwAddPrinterTabPage()
{
}
void SwAddPrinterTabPage::SetPreview(bool bPrev)
{
m_bPreview = bPrev;
m_xCommentsFrame->set_sensitive(!m_bPreview);
m_xPagesFrame->set_sensitive(!m_bPreview);
}
std::unique_ptr<SfxTabPage> SwAddPrinterTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet )
{
return std::make_unique<SwAddPrinterTabPage>(pPage, pController, *rAttrSet);
}
OUString SwAddPrinterTabPage::GetAllStrings()
{
OUString sAllStrings;
OUString labels[] = { u"label2" _ustr, u"label10" _ustr, u"label1" _ustr, u"label5" _ustr, u"4" _ustr };
for (const auto & label : labels)
{
if (const auto pString = m_xBuilder->weld_label(label))
sAllStrings += pString->get_label() + " " ;
}
OUString checkButton[]
= { u"graphics" _ustr, u"formcontrols" _ustr, u"background" _ustr, u"inblack" _ustr, u"hiddentext" _ustr, u"textplaceholder" _ustr,
u"leftpages" _ustr, u"rightpages" _ustr, u"brochure" _ustr, u"rtl" _ustr, u"blankpages" _ustr, u"papertray" _ustr };
for (const auto & check : checkButton)
{
if (const auto pString = m_xBuilder->weld_check_button(check))
sAllStrings += pString->get_label() + " " ;
}
OUString radioButton[] = { u"none" _ustr, u"only" _ustr, u"end" _ustr, u"endpage" _ustr, u"inmargins" _ustr };
for (const auto & radio : radioButton)
{
if (const auto pString = m_xBuilder->weld_radio_button(radio))
sAllStrings += pString->get_label() + " " ;
}
return sAllStrings.replaceAll("_" , "" );
}
bool SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet )
{
if ( m_bAttrModified )
{
SwAddPrinterItem aAddPrinterAttr;
aAddPrinterAttr.m_bPrintGraphic = m_xGrfCB->get_active();
aAddPrinterAttr.m_bPrintControl = m_xCtrlFieldCB->get_active();
aAddPrinterAttr.m_bPrintPageBackground = m_xBackgroundCB->get_active();
aAddPrinterAttr.m_bPrintBlackFont = m_xBlackFontCB->get_active();
aAddPrinterAttr.m_bPrintHiddenText = m_xPrintHiddenTextCB->get_active();
aAddPrinterAttr.m_bPrintTextPlaceholder = m_xPrintTextPlaceholderCB->get_active();
aAddPrinterAttr.m_bPrintLeftPages = m_xLeftPageCB->get_active();
aAddPrinterAttr.m_bPrintRightPages = m_xRightPageCB->get_active();
aAddPrinterAttr.m_bPrintProspect = m_xProspectCB->get_active();
aAddPrinterAttr.m_bPrintProspectRTL = m_xProspectCB_RTL->get_active();
aAddPrinterAttr.m_bPaperFromSetup = m_xPaperFromSetupCB->get_active();
aAddPrinterAttr.m_bPrintEmptyPages = m_xPrintEmptyPagesCB->get_active();
if (m_xNoRB->get_active()) aAddPrinterAttr.m_nPrintPostIts =
SwPostItMode::NONE;
if (m_xOnlyRB->get_active()) aAddPrinterAttr.m_nPrintPostIts =
SwPostItMode::Only;
if (m_xEndRB->get_active()) aAddPrinterAttr.m_nPrintPostIts =
SwPostItMode::EndDoc;
if (m_xEndPageRB->get_active()) aAddPrinterAttr.m_nPrintPostIts =
SwPostItMode::EndPage;
if (m_xInMarginsRB->get_active()) aAddPrinterAttr.m_nPrintPostIts =
SwPostItMode::InMargins;
const OUString sFax = m_xFaxLB->get_active_text();
aAddPrinterAttr.m_sFaxName = m_sNone == sFax ? OUString() : sFax;
rCoreSet->Put(aAddPrinterAttr);
}
return m_bAttrModified;
}
void SwAddPrinterTabPage::Reset( const SfxItemSet* )
{
const SfxItemSet& rSet = GetItemSet();
bool bReadOnly = false ;
if ( const SwAddPrinterItem* pAddPrinterAttr = rSet.GetItemIfSet( FN_PARAM_ADDPRINTER , false ) )
{
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Content::Graphic::isReadOnly() :
officecfg::Office::WriterWeb::Print::Content::Graphic::isReadOnly();
m_xGrfCB->set_active(pAddPrinterAttr->m_bPrintGraphic);
m_xGrfCB->set_sensitive(!bReadOnly);
m_xGrfImg->set_visible(bReadOnly);
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Content::Control::isReadOnly() :
officecfg::Office::WriterWeb::Print::Content::Control::isReadOnly();
m_xCtrlFieldCB->set_active( pAddPrinterAttr->m_bPrintControl);
m_xCtrlFieldCB->set_sensitive(!bReadOnly);
m_xCtrlFieldImg->set_visible(bReadOnly);
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Content::Background::isReadOnly() :
officecfg::Office::WriterWeb::Print::Content::Background::isReadOnly();
m_xBackgroundCB->set_active( pAddPrinterAttr->m_bPrintPageBackground);
m_xBackgroundCB->set_sensitive(!bReadOnly);
m_xBackgroundImg->set_visible(bReadOnly);
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Content::PrintBlack::isReadOnly() :
officecfg::Office::WriterWeb::Print::Content::PrintBlack::isReadOnly();
m_xBlackFontCB->set_active( pAddPrinterAttr->m_bPrintBlackFont);
m_xBlackFontCB->set_sensitive(!bReadOnly);
m_xBlackFontImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Print::Content::PrintHiddenText::isReadOnly();
m_xPrintHiddenTextCB->set_active( pAddPrinterAttr->m_bPrintHiddenText);
m_xPrintHiddenTextCB->set_sensitive(!bReadOnly);
m_xPrintHiddenTextImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Print::Content::PrintPlaceholders::isReadOnly();
m_xPrintTextPlaceholderCB->set_active(pAddPrinterAttr->m_bPrintTextPlaceholder);
m_xPrintTextPlaceholderCB->set_sensitive(!bReadOnly);
m_xPrintTextPlaceholderImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Print::Page::LeftPage::isReadOnly();
m_xLeftPageCB->set_active( pAddPrinterAttr->m_bPrintLeftPages);
m_xLeftPageCB->set_sensitive(!bReadOnly);
m_xLeftPageImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Print::Page::RightPage::isReadOnly();
m_xRightPageCB->set_active( pAddPrinterAttr->m_bPrintRightPages);
m_xRightPageCB->set_sensitive(!bReadOnly);
m_xRightPageImg->set_visible(bReadOnly);
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Papertray::FromPrinterSetup::isReadOnly() :
officecfg::Office::WriterWeb::Print::Papertray::FromPrinterSetup::isReadOnly();
m_xPaperFromSetupCB->set_active(pAddPrinterAttr->m_bPaperFromSetup);
m_xPaperFromSetupCB->set_sensitive(!bReadOnly);
m_xPaperFromSetupImg->set_visible(bReadOnly);
bReadOnly = officecfg::Office::Writer::Print::EmptyPages::isReadOnly();
m_xPrintEmptyPagesCB->set_active(pAddPrinterAttr->m_bPrintEmptyPages);
m_xPrintEmptyPagesCB->set_sensitive(!bReadOnly);
m_xPrintEmptyPagesImg->set_visible(bReadOnly);
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Page::Brochure::isReadOnly() :
officecfg::Office::WriterWeb::Print::Page::Brochure::isReadOnly();
m_xProspectCB->set_active( pAddPrinterAttr->m_bPrintProspect);
m_xProspectCB->set_sensitive(!bReadOnly);
m_xProspectImg->set_visible(bReadOnly);
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Page::BrochureRightToLeft::isReadOnly() :
officecfg::Office::WriterWeb::Print::Page::BrochureRightToLeft::isReadOnly();
m_xProspectCB_RTL->set_active( pAddPrinterAttr->m_bPrintProspectRTL);
m_xProspectCB_RTL->set_sensitive(!bReadOnly);
m_xProspectImg_RTL->set_visible(bReadOnly);
m_xNoRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::NONE ) ;
m_xOnlyRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::Only ) ;
m_xEndRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::EndDoc ) ;
m_xEndPageRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::EndPage ) ;
m_xInMarginsRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::InMargins ) ;
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Content::Note::isReadOnly() :
officecfg::Office::WriterWeb::Print::Content::Note::isReadOnly();
m_xNoRB->set_sensitive(!bReadOnly);
m_xOnlyRB->set_sensitive(!bReadOnly);
m_xEndRB->set_sensitive(!bReadOnly);
m_xEndPageRB->set_sensitive(!bReadOnly);
m_xInMarginsRB->set_sensitive(!bReadOnly);
m_xMarginsImg->set_visible(bReadOnly);
auto nFound = m_xFaxLB->find_text(pAddPrinterAttr->m_sFaxName);
if (nFound != -1)
m_xFaxLB->set_active(nFound);
else if (m_xFaxLB->get_count())
m_xFaxLB->set_active(0);
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Output::Fax::isReadOnly() :
officecfg::Office::WriterWeb::Print::Output::Fax::isReadOnly();
m_xFaxLB->set_sensitive(!bReadOnly);
m_xFaxImg->set_visible(bReadOnly);
}
bReadOnly = !m_bHTMLMode ? officecfg::Office::Writer::Print::Page::BrochureRightToLeft::isReadOnly() :
officecfg::Office::WriterWeb::Print::Page::BrochureRightToLeft::isReadOnly();
if (m_xProspectCB->get_active())
{
m_xProspectCB_RTL->set_sensitive(!bReadOnly);
m_xNoRB->set_sensitive( false );
m_xOnlyRB->set_sensitive( false );
m_xEndRB->set_sensitive( false );
m_xEndPageRB->set_sensitive( false );
}
else
m_xProspectCB_RTL->set_sensitive( false );
m_xProspectImg_RTL->set_visible(bReadOnly);
}
IMPL_LINK_NOARG(SwAddPrinterTabPage, AutoClickHdl, weld::Toggleable&, void )
{
m_bAttrModified = true ;
bool bIsProspect = m_xProspectCB->get_active();
if (!bIsProspect)
m_xProspectCB_RTL->set_active( false );
m_xProspectCB_RTL->set_sensitive( bIsProspect );
m_xNoRB->set_sensitive( !bIsProspect );
m_xOnlyRB->set_sensitive( !bIsProspect );
m_xEndRB->set_sensitive( !bIsProspect );
m_xEndPageRB->set_sensitive( !bIsProspect );
m_xInMarginsRB->set_sensitive( !bIsProspect );
}
void SwAddPrinterTabPage::SetFax( const std::vector<OUString>& rFaxLst )
{
m_xFaxLB->append_text(m_sNone);
for (const auto & i : rFaxLst)
{
m_xFaxLB->append_text(i);
}
m_xFaxLB->set_active(0);
}
IMPL_LINK_NOARG(SwAddPrinterTabPage, SelectHdl, weld::ComboBox&, void )
{
m_bAttrModified=true ;
}
void SwAddPrinterTabPage::PageCreated( const SfxAllItemSet& aSet)
{
const SfxBoolItem* pListItem = aSet.GetItem<SfxBoolItem>(SID_FAX_LIST, false );
const SfxBoolItem* pPreviewItem = aSet.GetItem<SfxBoolItem>(SID_PREVIEWFLAG_TYPE, false );
if (pPreviewItem)
{
SetPreview(pPreviewItem->GetValue());
Reset(&aSet);
}
if (pListItem && pListItem->GetValue())
{
std::vector<OUString> aFaxList;
const std::vector<OUString>& rPrinters = Printer::GetPrinterQueues();
for (const auto & rPrinter : rPrinters)
aFaxList.insert(aFaxList.begin(), rPrinter);
SetFax( aFaxList );
}
}
// Tabpage Standardfonts
SwStdFontTabPage::SwStdFontTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, u"modules/swriter/ui/optfonttabpage.ui" _ustr, u"OptFontTabPage" _ustr, &rSet)
, m_pPrt(nullptr)
, m_pFontConfig(nullptr)
, m_pWrtShell(nullptr)
, m_eLanguage( GetAppLanguage() )
, m_bListDefault(false )
, m_bSetListDefault(true )
, m_bLabelDefault(false )
, m_bSetLabelDefault(true )
, m_bIdxDefault(false )
, m_bSetIdxDefault(true )
, m_bDisposePrinter(false )
, m_nFontGroup(FONT_GROUP_DEFAULT)
, m_sScriptWestern(SwResId(ST_SCRIPT_WESTERN))
, m_sScriptAsian(SwResId(ST_SCRIPT_ASIAN))
, m_sScriptComplex(SwResId(ST_SCRIPT_CTL))
, m_xLabelFT(m_xBuilder->weld_label(u"label1" _ustr))
, m_xStandardBox(m_xBuilder->weld_combo_box(u"standardbox" _ustr))
, m_xStandardBoxImg(m_xBuilder->weld_widget(u"lockstandardbox" _ustr))
, m_xStandardHeightLB(new FontSizeBox(m_xBuilder->weld_combo_box(u"standardheight" _ustr)))
, m_xStandardHeightImg(m_xBuilder->weld_widget(u"lockstandardheight" _ustr))
, m_xTitleBox(m_xBuilder->weld_combo_box(u"titlebox" _ustr))
, m_xTitleBoxImg(m_xBuilder->weld_widget(u"locktitlebox" _ustr))
, m_xTitleHeightLB(new FontSizeBox(m_xBuilder->weld_combo_box(u"titleheight" _ustr)))
, m_xTitleHeightImg(m_xBuilder->weld_widget(u"locktitleheight" _ustr))
, m_xListBox(m_xBuilder->weld_combo_box(u"listbox" _ustr))
, m_xListBoxImg(m_xBuilder->weld_widget(u"locklistbox" _ustr))
, m_xListHeightLB(new FontSizeBox(m_xBuilder->weld_combo_box(u"listheight" _ustr)))
, m_xListHeightImg(m_xBuilder->weld_widget(u"locklistheight" _ustr))
, m_xLabelBox(m_xBuilder->weld_combo_box(u"labelbox" _ustr))
, m_xLabelBoxImg(m_xBuilder->weld_widget(u"locklabelbox" _ustr))
, m_xLabelHeightLB(new FontSizeBox(m_xBuilder->weld_combo_box(u"labelheight" _ustr)))
, m_xLabelHeightImg(m_xBuilder->weld_widget(u"locklabelheight" _ustr))
, m_xIdxBox(m_xBuilder->weld_combo_box(u"idxbox" _ustr))
, m_xIdxBoxImg(m_xBuilder->weld_widget(u"lockidxbox" _ustr))
, m_xIndexHeightLB(new FontSizeBox(m_xBuilder->weld_combo_box(u"indexheight" _ustr)))
, m_xIndexHeightImg(m_xBuilder->weld_widget(u"lockindexheight" _ustr))
, m_xStandardPB(m_xBuilder->weld_button(u"standard" _ustr))
{
m_xStandardBox->make_sorted();
m_xTitleBox->make_sorted();
m_xListBox->make_sorted();
m_xLabelBox->make_sorted();
m_xIdxBox->make_sorted();
m_xStandardPB->connect_clicked(LINK(this , SwStdFontTabPage, StandardHdl));
m_xStandardBox->connect_changed( LINK(this , SwStdFontTabPage, ModifyHdl));
m_xListBox->connect_changed( LINK(this , SwStdFontTabPage, ModifyHdl));
m_xLabelBox->connect_changed( LINK(this , SwStdFontTabPage, ModifyHdl));
m_xIdxBox->connect_changed( LINK(this , SwStdFontTabPage, ModifyHdl));
Link<weld::Widget&,void > aFocusLink = LINK( this , SwStdFontTabPage, LoseFocusHdl);
m_xStandardBox->connect_focus_out( aFocusLink );
m_xTitleBox->connect_focus_out( aFocusLink );
m_xListBox->connect_focus_out( aFocusLink );
m_xLabelBox->connect_focus_out( aFocusLink );
m_xIdxBox->connect_focus_out( aFocusLink );
}
SwStdFontTabPage::~SwStdFontTabPage()
{
m_xIndexHeightLB.reset();
m_xLabelHeightLB.reset();
m_xListHeightLB.reset();
m_xTitleHeightLB.reset();
m_xStandardHeightLB.reset();
m_pFontList.reset();
if (m_bDisposePrinter)
m_pPrt.disposeAndClear();
else
m_pPrt.reset();
}
std::unique_ptr<SfxTabPage> SwStdFontTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet* rAttrSet )
{
return std::make_unique<SwStdFontTabPage>(pPage, pController, *rAttrSet);
}
static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
SfxPrinter const * pPrt, const OUString& rStyle,
sal_uInt16 nFontWhich)
{
vcl::Font aFont( rStyle, Size( 0, 10 ) );
if ( pPrt )
aFont = pPrt->GetFontMetric( aFont );
SwTextFormatColl *pColl = pWrtShell->GetTextCollFromPool(nType);
pColl->SetFormatAttr(SvxFontItem(aFont.GetFamilyTypeMaybeAskConfig(), aFont.GetFamilyName(),
OUString(), aFont.GetPitchMaybeAskConfig(), aFont.GetCharSet(), nFontWhich));
}
static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
sal_Int32 nHeight, sal_uInt16 nFontHeightWhich)
{
float fSize = static_cast <float >(nHeight) / 10;
nHeight = CalcToUnit( fSize, MapUnit::MapTwip );
SwTextFormatColl *pColl = pWrtShell->GetTextCollFromPool(nType);
pColl->SetFormatAttr(SvxFontHeightItem(nHeight, 100, nFontHeightWhich));
}
OUString SwStdFontTabPage::GetAllStrings()
{
OUString sAllStrings;
OUString labels[] = { u"label1" _ustr, u"font_label" _ustr, u"size_label" _ustr, u"default_label" _ustr,
u"heading_label" _ustr, u"list_label" _ustr, u"caption_label" _ustr, u"index_label" _ustr };
for (const auto & label : labels)
{
if (const auto pString = m_xBuilder->weld_label(label))
sAllStrings += pString->get_label() + " " ;
}
sAllStrings += m_xStandardPB->get_label() + " " ;
return sAllStrings.replaceAll("_" , "" );
}
bool SwStdFontTabPage::FillItemSet( SfxItemSet* )
{
SwModule::get()->GetModuleConfig()->SetDefaultFontInCurrDocOnly(false );
const OUString sStandard = m_xStandardBox->get_active_text();
const OUString sTitle = m_xTitleBox->get_active_text();
const OUString sList = m_xListBox->get_active_text();
const OUString sLabel = m_xLabelBox->get_active_text();
const OUString sIdx = m_xIdxBox->get_active_text();
bool bStandardHeightChanged = m_xStandardHeightLB->get_value_changed_from_saved();
bool bTitleHeightChanged = m_xTitleHeightLB->get_value_changed_from_saved();
bool bListHeightChanged = m_xListHeightLB->get_value_changed_from_saved();
bool bLabelHeightChanged = m_xLabelHeightLB->get_value_changed_from_saved();
bool bIndexHeightChanged = m_xIndexHeightLB->get_value_changed_from_saved();
m_pFontConfig->SetFontStandard(sStandard, m_nFontGroup);
m_pFontConfig->SetFontOutline(sTitle, m_nFontGroup);
m_pFontConfig->SetFontList(sList, m_nFontGroup);
m_pFontConfig->SetFontCaption(sLabel, m_nFontGroup);
m_pFontConfig->SetFontIndex(sIdx, m_nFontGroup);
if (bStandardHeightChanged)
{
float fSize = static_cast <float >(m_xStandardHeightLB->get_value()) / 10;
m_pFontConfig->SetFontHeight( CalcToUnit( fSize, MapUnit::MapTwip ), FONT_STANDARD, m_nFontGroup );
}
if (bTitleHeightChanged)
{
float fSize = static_cast <float >(m_xTitleHeightLB->get_value()) / 10;
m_pFontConfig->SetFontHeight( CalcToUnit( fSize, MapUnit::MapTwip ), FONT_OUTLINE, m_nFontGroup );
}
if (bListHeightChanged)
{
float fSize = static_cast <float >(m_xListHeightLB->get_value()) / 10;
m_pFontConfig->SetFontHeight( CalcToUnit( fSize, MapUnit::MapTwip ), FONT_LIST, m_nFontGroup );
}
if (bLabelHeightChanged)
{
float fSize = static_cast <float >(m_xLabelHeightLB->get_value()) / 10;
m_pFontConfig->SetFontHeight( CalcToUnit( fSize, MapUnit::MapTwip ), FONT_CAPTION, m_nFontGroup );
}
if (bIndexHeightChanged)
{
float fSize = static_cast <float >(m_xIndexHeightLB->get_value()) / 10;
m_pFontConfig->SetFontHeight( CalcToUnit( fSize, MapUnit::MapTwip ), FONT_INDEX, m_nFontGroup );
}
if (m_pWrtShell)
{
m_pWrtShell->StartAllAction();
SfxPrinter* pPrinter = m_pWrtShell->getIDocumentDeviceAccess().getPrinter( false );
bool bMod = false ;
const sal_uInt16 nFontWhich =
m_nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT :
FONT_GROUP_CJK == m_nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT;
const sal_uInt16 nFontHeightWhich =
m_nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONTSIZE :
FONT_GROUP_CJK == m_nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE;
if (sStandard != m_sShellStd)
{
vcl::Font aFont( sStandard, Size( 0, 10 ) );
if ( pPrinter )
aFont = pPrinter->GetFontMetric( aFont );
m_pWrtShell->SetDefault(SvxFontItem(aFont.GetFamilyTypeMaybeAskConfig(), aFont.GetFamilyName(),
OUString(), aFont.GetPitchMaybeAskConfig(), aFont.GetCharSet(), nFontWhich));
SwTextFormatColl *pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_STANDARD);
pColl->ResetFormatAttr(nFontWhich);
bMod = true ;
}
if (bStandardHeightChanged)
{
float fSize = static_cast <float >(m_xStandardHeightLB->get_value()) / 10;
m_pWrtShell->SetDefault(SvxFontHeightItem( CalcToUnit( fSize, MapUnit::MapTwip ), 100, nFontHeightWhich ) );
SwTextFormatColl *pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_STANDARD);
pColl->ResetFormatAttr(nFontHeightWhich);
bMod = true ;
}
if (sTitle != m_sShellTitle )
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_HEADLINE_BASE, pPrinter, sTitle, nFontWhich);
bMod = true ;
}
if (bTitleHeightChanged)
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_HEADLINE_BASE,
sal::static_int_cast< sal_uInt16, sal_Int64 >(m_xTitleHeightLB->get_value()), nFontHeightWhich);
bMod = true ;
}
if (sList != m_sShellList && (!m_bListDefault || !m_bSetListDefault ))
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_NUMBER_BULLET_BASE, pPrinter, sList, nFontWhich);
bMod = true ;
}
if (bListHeightChanged)
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_NUMBER_BULLET_BASE,
sal::static_int_cast< sal_uInt16, sal_Int64 >(m_xListHeightLB->get_value()), nFontHeightWhich);
bMod = true ;
}
if (sLabel != m_sShellLabel && (!m_bLabelDefault || !m_bSetLabelDefault))
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_LABEL, pPrinter, sLabel, nFontWhich);
bMod = true ;
}
if (bLabelHeightChanged)
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_LABEL,
sal::static_int_cast< sal_uInt16, sal_Int64 >(m_xLabelHeightLB->get_value()), nFontHeightWhich);
bMod = true ;
}
if (sIdx != m_sShellIndex && (!m_bIdxDefault || !m_bSetIdxDefault))
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_REGISTER_BASE, pPrinter, sIdx, nFontWhich);
bMod = true ;
}
if (bIndexHeightChanged)
{
lcl_SetColl(m_pWrtShell, RES_POOLCOLL_REGISTER_BASE,
sal::static_int_cast< sal_uInt16, sal_Int64 >(m_xIndexHeightLB->get_value()), nFontHeightWhich);
bMod = true ;
}
if ( bMod )
m_pWrtShell->SetModified();
m_pWrtShell->EndAllAction();
}
return false ;
}
void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
{
const TypedWhichId<SvxLanguageItem> nLangSlot = m_nFontGroup == FONT_GROUP_DEFAULT ? SID_ATTR_LANGUAGE :
FONT_GROUP_CJK == m_nFontGroup ? SID_ATTR_CHAR_CJK_LANGUAGE : SID_ATTR_CHAR_CTL_LANGUAGE;
if ( const SvxLanguageItem* pLang = rSet->GetItemIfSet(nLangSlot, false ) )
m_eLanguage = pLang->GetValue();
OUString sToReplace = m_sScriptWestern;
if (FONT_GROUP_CJK == m_nFontGroup )
sToReplace = m_sScriptAsian;
else if (FONT_GROUP_CTL == m_nFontGroup )
sToReplace = m_sScriptComplex;
m_xLabelFT->set_label(m_xLabelFT->get_label().replaceFirst("%1" , sToReplace));
if (m_bDisposePrinter)
{
m_pPrt.disposeAndClear();
m_bDisposePrinter = false ;
}
if (const SwPtrItem* pItem = rSet->GetItemIfSet(FN_PARAM_PRINTER, false ))
{
m_pPrt = static_cast <SfxPrinter*>(pItem->GetValue());
}
else
{
auto pPrinterSet = std::make_unique<SfxItemSetFixed
<SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC>>( *rSet->GetPool() );
m_pPrt = VclPtr<SfxPrinter>::Create(std::move(pPrinterSet));
m_bDisposePrinter = true ;
}
m_pFontList.reset(new FontList( m_pPrt ));
// #i94536# prevent duplication of font entries when 'reset' button is pressed
if ( !m_xStandardBox->get_count() )
{
// get the set of distinct available family names
std::set< OUString > aFontNames;
int nFontNames = m_pPrt->GetFontFaceCollectionCount();
for ( int i = 0; i < nFontNames; i++ )
{
FontMetric aFontMetric( m_pPrt->GetFontMetricFromCollection( i ) );
aFontNames.insert( aFontMetric.GetFamilyName() );
}
// insert to listboxes
for ( const auto & rFontName : aFontNames )
{
m_xStandardBox->append_text( rFontName );
m_xTitleBox->append_text( rFontName );
m_xListBox->append_text( rFontName );
m_xLabelBox->append_text( rFontName );
m_xIdxBox->append_text( rFontName );
}
}
if (const SwPtrItem* pItem = rSet->GetItemIfSet(FN_PARAM_STDFONTS, false ))
{
m_pFontConfig = static_cast <SwStdFontConfig*>(pItem->GetValue());
}
if (const SwPtrItem* pItem = rSet->GetItemIfSet(FN_PARAM_WRTSHELL, false ))
{
m_pWrtShell = static_cast <SwWrtShell*>(pItem->GetValue());
}
OUString sStdBackup;
OUString sOutBackup;
OUString sListBackup;
OUString sCapBackup;
OUString sIdxBackup;
sal_Int32 nStandardHeight = -1;
sal_Int32 nTitleHeight = -1;
sal_Int32 nListHeight = -1;
sal_Int32 nLabelHeight = -1;
sal_Int32 nIndexHeight = -1;
if (!m_pWrtShell)
{
sStdBackup = m_pFontConfig->GetFontStandard(m_nFontGroup);
sOutBackup = m_pFontConfig->GetFontOutline(m_nFontGroup);
sListBackup= m_pFontConfig->GetFontList(m_nFontGroup);
sCapBackup = m_pFontConfig->GetFontCaption(m_nFontGroup);
sIdxBackup = m_pFontConfig->GetFontIndex(m_nFontGroup);
nStandardHeight = m_pFontConfig->GetFontHeight( FONT_STANDARD, m_nFontGroup, m_eLanguage );
nTitleHeight = m_pFontConfig->GetFontHeight( FONT_OUTLINE , m_nFontGroup, m_eLanguage );
nListHeight = m_pFontConfig->GetFontHeight( FONT_LIST , m_nFontGroup, m_eLanguage );
nLabelHeight = m_pFontConfig->GetFontHeight( FONT_CAPTION , m_nFontGroup, m_eLanguage );
nIndexHeight = m_pFontConfig->GetFontHeight( FONT_INDEX , m_nFontGroup, m_eLanguage );
if ( nStandardHeight <= 0)
nStandardHeight = SwStdFontConfig::GetDefaultHeightFor( FONT_STANDARD + m_nFontGroup * FONT_PER_GROUP, m_eLanguage);
if ( nTitleHeight <= 0)
nTitleHeight = SwStdFontConfig::GetDefaultHeightFor( FONT_OUTLINE + m_nFontGroup * FONT_PER_GROUP, m_eLanguage);
if ( nListHeight <= 0)
nListHeight = SwStdFontConfig::GetDefaultHeightFor( FONT_LIST + m_nFontGroup * FONT_PER_GROUP, m_eLanguage);
if ( nLabelHeight <= 0)
nLabelHeight = SwStdFontConfig::GetDefaultHeightFor( FONT_CAPTION + m_nFontGroup * FONT_PER_GROUP, m_eLanguage);
if ( nIndexHeight <= 0)
nIndexHeight = SwStdFontConfig::GetDefaultHeightFor( FONT_INDEX + m_nFontGroup * FONT_PER_GROUP, m_eLanguage);
}
else
{
SwTextFormatColl *pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_STANDARD);
const SvxFontItem& rFont = !m_nFontGroup ? pColl->GetFont() :
FONT_GROUP_CJK == m_nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
m_sShellStd = sStdBackup = rFont.GetFamilyName();
const TypedWhichId<SvxFontHeightItem> nFontHeightWhich =
m_nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONTSIZE :
FONT_GROUP_CJK == m_nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE;
const SvxFontHeightItem& rFontHeightStandard = pColl->GetFormatAttr(nFontHeightWhich);
nStandardHeight = static_cast <sal_Int32>(rFontHeightStandard.GetHeight());
pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_HEADLINE_BASE);
const SvxFontItem& rFontHL = !m_nFontGroup ? pColl->GetFont() :
FONT_GROUP_CJK == m_nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
m_sShellTitle = sOutBackup = rFontHL.GetFamilyName();
const SvxFontHeightItem& rFontHeightTitle = pColl->GetFormatAttr( nFontHeightWhich );
nTitleHeight = static_cast <sal_Int32>(rFontHeightTitle.GetHeight());
const sal_uInt16 nFontWhich =
m_nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT :
FONT_GROUP_CJK == m_nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT;
pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_NUMBER_BULLET_BASE);
const SvxFontItem& rFontLS = !m_nFontGroup ? pColl->GetFont() :
FONT_GROUP_CJK == m_nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
m_bListDefault = SfxItemState::DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false );
m_sShellList = sListBackup = rFontLS.GetFamilyName();
const SvxFontHeightItem& rFontHeightList = pColl->GetFormatAttr(nFontHeightWhich);
nListHeight = static_cast <sal_Int32>(rFontHeightList.GetHeight());
pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_LABEL);
m_bLabelDefault = SfxItemState::DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false );
const SvxFontItem& rFontCP = !m_nFontGroup ? pColl->GetFont() :
FONT_GROUP_CJK == m_nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
m_sShellLabel = sCapBackup = rFontCP.GetFamilyName();
const SvxFontHeightItem& rFontHeightLabel = pColl->GetFormatAttr(nFontHeightWhich);
nLabelHeight = static_cast <sal_Int32>(rFontHeightLabel.GetHeight());
pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_REGISTER_BASE);
m_bIdxDefault = SfxItemState::DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, false );
const SvxFontItem& rFontIDX = !m_nFontGroup ? pColl->GetFont() :
FONT_GROUP_CJK == m_nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
m_sShellIndex = sIdxBackup = rFontIDX.GetFamilyName();
const SvxFontHeightItem& rFontHeightIndex = pColl->GetFormatAttr(nFontHeightWhich);
nIndexHeight = static_cast <sal_Int32>(rFontHeightIndex.GetHeight());
}
m_xStandardBox->set_entry_text(sStdBackup );
m_xTitleBox->set_entry_text(sOutBackup );
m_xListBox->set_entry_text(sListBackup);
m_xLabelBox->set_entry_text(sCapBackup );
m_xIdxBox->set_entry_text(sIdxBackup );
m_xStandardHeightLB->Fill( m_pFontList.get() );
m_xTitleHeightLB->Fill( m_pFontList.get() );
m_xListHeightLB->Fill( m_pFontList.get() );
m_xLabelHeightLB->Fill( m_pFontList.get() );
m_xIndexHeightLB->Fill( m_pFontList.get() );
m_xStandardHeightLB->set_value( CalcToPoint( nStandardHeight, MapUnit::MapTwip, 10 ) );
m_xTitleHeightLB->set_value( CalcToPoint( nTitleHeight , MapUnit::MapTwip, 10 ) );
m_xListHeightLB->set_value( CalcToPoint( nListHeight , MapUnit::MapTwip, 10 ) );
m_xLabelHeightLB->set_value( CalcToPoint( nLabelHeight , MapUnit::MapTwip, 10 ));
m_xIndexHeightLB->set_value( CalcToPoint( nIndexHeight , MapUnit::MapTwip, 10 ));
if (m_nFontGroup == FONT_GROUP_DEFAULT)
{
bool bReadonly = officecfg::Office::Writer::DefaultFont::Standard::isReadOnly();
m_xStandardBox->set_sensitive(!bReadonly);
m_xStandardBoxImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::StandardHeight::isReadOnly();
m_xStandardHeightLB->set_sensitive(!bReadonly);
m_xStandardHeightImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::Heading::isReadOnly();
m_xTitleBox->set_sensitive(!bReadonly);
m_xTitleBoxImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::HeadingHeight::isReadOnly();
m_xTitleHeightLB->set_sensitive(!bReadonly);
m_xTitleHeightImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::List::isReadOnly();
m_xListBox->set_sensitive(!bReadonly);
m_xListBoxImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::ListHeight::isReadOnly();
m_xListHeightLB->set_sensitive(!bReadonly);
m_xListHeightImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::Caption::isReadOnly();
m_xLabelBox->set_sensitive(!bReadonly);
m_xLabelBoxImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::CaptionHeight::isReadOnly();
m_xLabelHeightLB->set_sensitive(!bReadonly);
m_xLabelHeightImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::Index::isReadOnly();
m_xIdxBox->set_sensitive(!bReadonly);
m_xIdxBoxImg->set_visible(bReadonly);
bReadonly = officecfg::Office::Writer::DefaultFont::IndexHeight::isReadOnly();
m_xIndexHeightLB->set_sensitive(!bReadonly);
m_xIndexHeightImg->set_visible(bReadonly);
}
m_xStandardBox->save_value();
m_xTitleBox->save_value();
m_xListBox->save_value();
m_xLabelBox->save_value();
m_xIdxBox->save_value();
m_xStandardHeightLB->save_value();
m_xTitleHeightLB->save_value();
m_xListHeightLB->save_value();
m_xLabelHeightLB->save_value();
m_xIndexHeightLB->save_value();
}
IMPL_LINK_NOARG(SwStdFontTabPage, StandardHdl, weld::Button&, void )
{
sal_uInt8 nFontOffset = m_nFontGroup * FONT_PER_GROUP;
m_xStandardBox->set_entry_text(SwStdFontConfig::GetDefaultFor(FONT_STANDARD + nFontOffset, m_eLanguage));
m_xTitleBox->set_entry_text(SwStdFontConfig::GetDefaultFor(FONT_OUTLINE + nFontOffset, m_eLanguage));
m_xListBox->set_entry_text(SwStdFontConfig::GetDefaultFor(FONT_LIST + nFontOffset, m_eLanguage));
m_xLabelBox->set_entry_text(SwStdFontConfig::GetDefaultFor(FONT_CAPTION + nFontOffset, m_eLanguage));
m_xIdxBox->set_entry_text(SwStdFontConfig::GetDefaultFor(FONT_INDEX + nFontOffset, m_eLanguage));
m_xStandardBox->save_value();
m_xTitleBox->save_value();
m_xListBox->save_value();
m_xLabelBox->save_value();
m_xIdxBox->save_value();
m_xStandardHeightLB->set_value( CalcToPoint(
SwStdFontConfig::GetDefaultHeightFor(FONT_STANDARD + nFontOffset, m_eLanguage),
MapUnit::MapTwip, 10 ));
m_xTitleHeightLB->set_value(CalcToPoint(
SwStdFontConfig::GetDefaultHeightFor(FONT_OUTLINE +
nFontOffset, m_eLanguage), MapUnit::MapTwip, 10 ));
m_xListHeightLB->set_value(CalcToPoint(
SwStdFontConfig::GetDefaultHeightFor(FONT_LIST + nFontOffset, m_eLanguage),
MapUnit::MapTwip, 10 ));
m_xLabelHeightLB->set_value(CalcToPoint(
SwStdFontConfig::GetDefaultHeightFor(FONT_CAPTION + nFontOffset, m_eLanguage),
MapUnit::MapTwip, 10 ));
m_xIndexHeightLB->set_value(CalcToPoint(
SwStdFontConfig::GetDefaultHeightFor(FONT_INDEX + nFontOffset, m_eLanguage),
MapUnit::MapTwip, 10 ));
}
IMPL_LINK( SwStdFontTabPage, ModifyHdl, weld::ComboBox&, rBox, void )
{
if (&rBox == m_xStandardBox.get())
{
const OUString sEntry = rBox.get_active_text();
if (m_bSetListDefault && m_bListDefault)
m_xListBox->set_entry_text(sEntry);
if (m_bSetLabelDefault && m_bLabelDefault)
m_xLabelBox->set_entry_text(sEntry);
if (m_bSetIdxDefault && m_bIdxDefault)
m_xIdxBox->set_entry_text(sEntry);
}
else if (&rBox == m_xListBox.get())
{
m_bSetListDefault = false ;
}
else if (&rBox == m_xLabelBox.get())
{
m_bSetLabelDefault = false ;
}
else if (&rBox == m_xIdxBox.get())
{
m_bSetIdxDefault = false ;
}
}
IMPL_LINK( SwStdFontTabPage, LoseFocusHdl, weld::Widget&, rControl, void )
{
weld::ComboBox& rBox = dynamic_cast <weld::ComboBox&>(rControl);
FontSizeBox* pHeightLB = nullptr;
if (&rBox == m_xStandardBox.get())
{
pHeightLB = m_xStandardHeightLB.get();
}
else if (&rBox == m_xTitleBox.get())
{
pHeightLB = m_xTitleHeightLB.get();
}
else if (&rBox == m_xListBox.get())
{
pHeightLB = m_xListHeightLB.get();
}
else if (&rBox == m_xLabelBox.get())
{
pHeightLB = m_xLabelHeightLB.get();
}
else /*if (&rBox == m_xIndexHeightLB.get())*/
{
pHeightLB = m_xIndexHeightLB.get();
}
pHeightLB->Fill( m_pFontList.get() );
}
void SwStdFontTabPage::PageCreated( const SfxAllItemSet& aSet)
{
const SfxUInt16Item* pFlagItem = aSet.GetItem<SfxUInt16Item>(SID_FONTMODE_TYPE, false );
if (pFlagItem)
m_nFontGroup = sal::static_int_cast< sal_uInt8, sal_uInt16>( pFlagItem->GetValue() );
}
SwTableOptionsTabPage::SwTableOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, u"modules/swriter/ui/opttablepage.ui" _ustr, u"OptTablePage" _ustr, &rSet)
, m_pWrtShell(nullptr)
, m_bHTMLMode(false )
, m_xHeaderCB(m_xBuilder->weld_check_button(u"header" _ustr))
, m_xHeaderImg(m_xBuilder->weld_widget(u"lockheader" _ustr))
, m_xRepeatHeaderCB(m_xBuilder->weld_check_button(u"repeatheader" _ustr))
, m_xRepeatHeaderImg(m_xBuilder->weld_widget(u"lockrepeatheader" _ustr))
, m_xDontSplitCB(m_xBuilder->weld_check_button(u"dontsplit" _ustr))
, m_xDontSplitImg(m_xBuilder->weld_widget(u"lockdontsplit" _ustr))
, m_xBorderCB(m_xBuilder->weld_check_button(u"border" _ustr))
, m_xBorderImg(m_xBuilder->weld_widget(u"lockborder" _ustr))
, m_xNumFormattingCB(m_xBuilder->weld_check_button(u"numformatting" _ustr))
, m_xNumFormattingImg(m_xBuilder->weld_widget(u"locknumformatting" _ustr))
, m_xNumFormatFormattingCB(m_xBuilder->weld_check_button(u"numfmtformatting" _ustr))
, m_xNumFormatFormattingImg(m_xBuilder->weld_widget(u"locknumfmtformatting" _ustr))
, m_xNumAlignmentCB(m_xBuilder->weld_check_button(u"numalignment" _ustr))
, m_xNumAlignmentImg(m_xBuilder->weld_widget(u"locknumalignment" _ustr))
, m_xRowMoveMF(m_xBuilder->weld_metric_spin_button(u"rowmove" _ustr, FieldUnit::CM))
, m_xRowMoveImg(m_xBuilder->weld_widget(u"lockrowmove" _ustr))
, m_xColMoveMF(m_xBuilder->weld_metric_spin_button(u"colmove" _ustr, FieldUnit::CM))
, m_xColMoveImg(m_xBuilder->weld_widget(u"lockcolmove" _ustr))
, m_xRowInsertMF(m_xBuilder->weld_metric_spin_button(u"rowinsert" _ustr, FieldUnit::CM))
, m_xRowInsertImg(m_xBuilder->weld_widget(u"lockrowinsert" _ustr))
, m_xColInsertMF(m_xBuilder->weld_metric_spin_button(u"colinsert" _ustr, FieldUnit::CM))
, m_xColInsertImg(m_xBuilder->weld_widget(u"lockcolinsert" _ustr))
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5 C=95 H=85 G=90
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet)
¤
*© Formatika GbR, Deutschland