/* -*- 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/.
*/
// insert all the custom color schemes for (size_t i = 0; i < aSchemeNames.size(); ++i) if (ThemeColors::IsCustomTheme(aSchemeNames[i]))
m_xSchemeList->append_text(aSchemeNames[i]);
// since this function just loads entries into the list, we don't call // MiscSettings::SetAppColorMode(...) here, and instead do so in the // SchemeChangeHdl callback. if (ThemeColors::IsAutomaticTheme(pColorConfig->GetCurrentSchemeName()))
m_xSchemeList->set_active_id(AUTOMATIC_COLOR_SCHEME); elseif (ThemeColors::IsLightTheme(pColorConfig->GetCurrentSchemeName()))
m_xSchemeList->set_active_id(LIGHT_COLOR_SCHEME); elseif (ThemeColors::IsDarkTheme(pColorConfig->GetCurrentSchemeName()))
m_xSchemeList->set_active_id(DARK_COLOR_SCHEME); else
m_xSchemeList->set_active_text(pColorConfig->GetCurrentSchemeName());
}
SvxAppearanceTabPage::~SvxAppearanceTabPage()
{ if (m_bRestartRequired)
::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), GetFrameWeld(),
svtools::RESTART_REASON_THEME_CHANGE);
}
// tdf#153497 set name of automatic icon theme, it may have changed due to "Apply" while this page is visible // TODO: the automatic icon theme changes based on the application appearance mode. // this doesn't work properly because appearance changes need a restart to properly // reflect. it would be fixed in a follow up patch which removes the restart dialog // and implements hot reloading.
InitIcons();
// set colorconfig value
aCurrentEntryColor.bIsVisible = m_xShowInDocumentChkBtn->get_active();
pColorConfig->SetColorValue(nEntry, aCurrentEntryColor);
}
// show/hide show in document button if (!cNames[nEntry].bCanBeVisible)
m_xShowInDocumentChkBtn->hide(); else
m_xShowInDocumentChkBtn->show();
}
IMPL_LINK_NOARG(SvxAppearanceTabPage, ColorValueChgHdl, ColorListBox&, void)
{ // get the active entry
ColorConfigEntry nEntry = GetActiveEntry(); if (nEntry == ColorConfigEntryCount) return;
// restart only for the UI colors if (nEntry >= WINDOWCOLOR)
m_bRestartRequired = true;
// set the color in pColorConfig
aCurrentEntryColor.nColor = m_xColorChangeBtn->GetSelectEntryColor();
// use nColor for caching the value of color in use. This avoids tedious refactoring which IMO // would use function calls to discriminate between colors. Those functions themself call some virtual functions // making the whole thing super slow (comparatively).
aCurrentEntryColor.nColor = m_xColorChangeBtn->GetSelectEntryColor();
if (ThemeColors::IsAutomaticTheme(m_xSchemeList->get_active_id()))
{
sNewScheme = AUTOMATIC_COLOR_SCHEME;
eMode = AppearanceMode::AUTO;
} elseif (ThemeColors::IsLightTheme(m_xSchemeList->get_active_id()))
{
sNewScheme = LIGHT_COLOR_SCHEME;
eMode = AppearanceMode::LIGHT;
} elseif (ThemeColors::IsDarkTheme(m_xSchemeList->get_active_id()))
{
sNewScheme = DARK_COLOR_SCHEME;
eMode = AppearanceMode::DARK;
} else
{
sNewScheme = m_xSchemeList->get_active_text(); // for custom theme, keep appearance to AUTO, doesn't matter for the most part, // but if some colors like document colors are not specified, then they will be // set as per the OS appearance mode
eMode = AppearanceMode::AUTO;
}
for (size_t i = 0; i < ColorConfigEntryCount; ++i)
pColorConfig->SetColorValue(static_cast<ColorConfigEntry>(i), aValue);
pColorConfig->Commit();
// RESET state for themes just prevents the theme colors from being used before // they are reloaded from the StyleSettings, please read the comment above // ColorConfig::SetupTheme()'s definition if (!ThemeColors::IsThemeDisabled())
{
ThemeColors::ResetTheme();
m_bRestartRequired = true;
}
}
// insert bitmap entries for (size_t i = 0; i < getBitmapList().size(); ++i)
m_xBitmapDropDown->append(getBitmapList()[i].aRawString,
getBitmapList()[i].aTranslatedString);
// check if the registry setting is valid or not bool bFound = false; for (size_t i = 0; i < getBitmapList().size(); ++i)
{ if (ThemeColors::GetAppBackBmpFileName() == getBitmapList()[i].aRawString)
{
bFound = true;
m_xBitmapDropDown->set_active_id(ThemeColors::GetAppBackBmpFileName()); break;
}
} if (!bFound)
m_xBitmapDropDown->set_active(0);
// insert bitmap draw type entries for (size_t i = 0; i < getBitmapDrawTypeList().size(); ++i)
m_xBitmapDrawTypeDropDown->append(getBitmapDrawTypeList()[i].aRawString,
getBitmapDrawTypeList()[i].aTranslatedString);
// check if the registry setting is valid or not
bFound = false; for (size_t i = 0; i < getBitmapDrawTypeList().size(); ++i)
{ if (ThemeColors::GetAppBackBmpDrawType() == getBitmapDrawTypeList()[i].aRawString)
{
bFound = true;
m_xBitmapDrawTypeDropDown->set_active_id(ThemeColors::GetAppBackBmpDrawType()); break;
}
} if (!bFound)
m_xBitmapDrawTypeDropDown->set_active(0);
IMPL_LINK_NOARG(SvxAppearanceTabPage, OnToolbarIconSizeChange, weld::ComboBox&, void)
{
SvtMiscOptions aMiscOptions; const sal_Int32 nToolbarIconSizeSel = m_xToolbarIconSize->get_active(); if (nInitialToolbarIconSizeSel != nToolbarIconSizeSel)
{
sal_Int16 eSet = SFX_SYMBOLS_SIZE_AUTO; switch (nToolbarIconSizeSel)
{ case 0:
eSet = SFX_SYMBOLS_SIZE_AUTO; break; case 1:
eSet = SFX_SYMBOLS_SIZE_SMALL; break; case 2:
eSet = SFX_SYMBOLS_SIZE_LARGE; break; case 3:
eSet = SFX_SYMBOLS_SIZE_32; break; default:
SAL_WARN("cui.options", "SvxAppearanceTabPage::OnToolbarIconSizeChange(): This state of " "m_xToolbarIcons should not be possible!");
}
aMiscOptions.SetSymbolsSize(eSet);
}
}
IMPL_LINK_NOARG(SvxAppearanceTabPage, OnSidebarIconSizeChange, weld::ComboBox&, void)
{ const sal_Int32 nSidebarIconSizeNewSel = m_xSidebarIconSize->get_active(); if (nInitialSidebarIconSizeSel != nSidebarIconSizeNewSel)
{
ToolBoxButtonSize eSet = ToolBoxButtonSize::DontCare; switch (nSidebarIconSizeNewSel)
{ case 0:
eSet = ToolBoxButtonSize::DontCare; break; case 1:
eSet = ToolBoxButtonSize::Small; break; case 2:
eSet = ToolBoxButtonSize::Large; break; default:
SAL_WARN("cui.options", "SvxAppearanceTabPage::OnSidebarIconSizeChange(): This state of " "m_xSidebarIconSize should not be possible!");
}
IMPL_LINK_NOARG(SvxAppearanceTabPage, OnNotebookbarIconSizeChange, weld::ComboBox&, void)
{ const sal_Int32 nNotebookbarSizeLB_NewSelection = m_xNotebookbarIconSize->get_active(); if (nInitialNotebookbarIconSizeSel != nNotebookbarSizeLB_NewSelection)
{
ToolBoxButtonSize eSet = ToolBoxButtonSize::DontCare; switch (nNotebookbarSizeLB_NewSelection)
{ case 0:
eSet = ToolBoxButtonSize::DontCare; break; case 1:
eSet = ToolBoxButtonSize::Small; break; case 2:
eSet = ToolBoxButtonSize::Large; break; default:
SAL_WARN("cui.options", "SvxAppearanceTabPage::OnNotebookbarIconSizeChange(): This state of " "m_xNotebookbarIconSizeLB should not be possible!");
}
// set automatic colors
m_xColorChangeBtn->SetAutoDisplayColor(ColorConfig::GetDefaultColor(nEntry)); // set values for the entry
m_xColorChangeBtn->SelectEntry(rCurrentEntryColor.nColor);
}
for (size_t i = DOCCOLOR; i <= SHADOWCOLOR; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
m_xColorEntryBtn->append_separator("SeparatorID");
for (size_t i = WRITERTEXTGRID; i <= WRITERNONPRINTCHARS; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
m_xColorEntryBtn->append_separator("SeparatorID");
for (size_t i = HTMLSGML; i <= HTMLUNKNOWN; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
m_xColorEntryBtn->append_separator("SeparatorID");
for (size_t i = CALCGRID; i <= CALCPROTECTEDBACKGROUND; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
m_xColorEntryBtn->append_separator("SeparatorID");
for (size_t i = AUTHOR1; i <= AUTHOR9; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
m_xColorEntryBtn->append_separator("SeparatorID");
for (size_t i = BASICEDITOR; i <= BASICERROR; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
m_xColorEntryBtn->append_separator("SeparatorID");
for (size_t i = SQLIDENTIFIER; i <= SQLCOMMENT; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
m_xColorEntryBtn->append_separator("SeparatorID");
// don't show UI customization options if theme is disabled if (!ThemeColors::IsThemeDisabled()) for (size_t i = WINDOWCOLOR; i <= INACTIVEBORDERCOLOR; ++i)
m_xColorEntryBtn->append(OUString(cNames[i].cName),
aRegistryEntries.at(static_cast<ColorConfigEntry>(i)));
}
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.