/* -*- 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/. */ #undef SC_DLLIMPLEMENTATION #include "tpdefaults.hxx" #include "sc.hrc" #include "scresid.hxx" #include "scmod.hxx" #include "defaultsoptions.hxx" #include "document.hxx" ScTpDefaultsOptions::ScTpDefaultsOptions(vcl::Window *pParent, const SfxItemSet &rCoreSet) : SfxTabPage(pParent, "OptDefaultPage", "modules/scalc/ui/optdefaultpage.ui", &rCoreSet) { get( m_pEdNSheets, "sheetsnumber"); get( m_pEdSheetPrefix, "sheetprefix"); m_pEdNSheets->SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) ); m_pEdSheetPrefix->SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) ); m_pEdSheetPrefix->SetGetFocusHdl( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) ); } ScTpDefaultsOptions::~ScTpDefaultsOptions() { } SfxTabPage* ScTpDefaultsOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs) { return new ScTpDefaultsOptions(pParent, *rCoreAttrs); } bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet) { bool bRet = false; ScDefaultsOptions aOpt; SCTAB nTabCount = static_cast(m_pEdNSheets->GetValue()); OUString aSheetPrefix = m_pEdSheetPrefix->GetText(); if ( m_pEdNSheets->IsValueChangedFromSaved() || m_pEdSheetPrefix->GetSavedValue() != aSheetPrefix ) { aOpt.SetInitTabCount( nTabCount ); aOpt.SetInitTabPrefix( aSheetPrefix ); rCoreSet->Put( ScTpDefaultsItem( SID_SCDEFAULTSOPTIONS, aOpt ) ); bRet = true; } return bRet; } void ScTpDefaultsOptions::Reset(const SfxItemSet* rCoreSet) { ScDefaultsOptions aOpt; const SfxPoolItem* pItem = NULL; if(SfxItemState::SET == rCoreSet->GetItemState(SID_SCDEFAULTSOPTIONS, false , &pItem)) aOpt = static_cast(pItem)->GetDefaultsOptions(); m_pEdNSheets->SetValue( static_cast( aOpt.GetInitTabCount()) ); m_pEdSheetPrefix->SetText( aOpt.GetInitTabPrefix() ); m_pEdNSheets->SaveValue(); m_pEdSheetPrefix->SaveValue(); } SfxTabPage::sfxpg ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/) { return KEEP_PAGE; } void ScTpDefaultsOptions::CheckNumSheets() { sal_Int64 nVal = m_pEdNSheets->GetValue(); if (nVal > MAXINITTAB) m_pEdNSheets->SetValue(MAXINITTAB); if (nVal < MININITTAB) m_pEdNSheets->SetValue(MININITTAB); } void ScTpDefaultsOptions::CheckPrefix(Edit* pEdit) { if (!pEdit) return; OUString aSheetPrefix = pEdit->GetText(); if ( !aSheetPrefix.isEmpty() && !ScDocument::ValidTabName( aSheetPrefix ) ) { // Revert to last good Prefix and also select it to // indicate something illegal was typed Selection aSel( 0, maOldPrefixValue.getLength() ); pEdit->SetText( maOldPrefixValue, aSel ); } else { OnFocusPrefixInput(pEdit); } } void ScTpDefaultsOptions::OnFocusPrefixInput(Edit* pEdit) { if (!pEdit) return; // Store Prefix in case we need to revert maOldPrefixValue = pEdit->GetText(); } IMPL_LINK_NOARG(ScTpDefaultsOptions, NumModifiedHdl) { CheckNumSheets(); return 0; } IMPL_LINK( ScTpDefaultsOptions, PrefixModifiedHdl, Edit*, pEdit ) { CheckPrefix(pEdit); return 0; } IMPL_LINK( ScTpDefaultsOptions, PrefixEditOnFocusHdl, Edit*, pEdit ) { OnFocusPrefixInput(pEdit); return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ n value='distro/collabora/cp-6.4'>distro/collabora/cp-6.4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2021-05-21add Toggleable as a separate thing to a ButtonCaolán McNamara
2021-05-20use toggle instead of click for RadioButtonCaolán McNamara
2021-04-19use more string_view in comphelper::stringNoel Grandin
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
2020-11-17loplugin:stringviewparam check methods tooNoel
2020-11-01use officecfg for Experimental flagNoel Grandin
2020-10-16Database Wizard: show info label instead of empty list.Gülşah Köse
2020-04-20tdf#42949 Fix IWYU warnings in dbaccess/source/ui/[a-d]*/*cxxGabor Kelemen
2020-04-15loplugin:flatten in dbaccessNoel Grandin
2020-02-21Set Firebird creation option experimentalJulien Nabet
2020-01-28New loplugin:unsignedcompareStephan Bergmann
2019-10-20cid#1453991 Wrapper object use after freeCaolán McNamara
2019-10-03merge msgbox and stdtextCaolán McNamara
2019-09-26TODO rename to GetFrameWeldCaolán McNamara
2019-09-26now drop TabPageParent intermediateCaolán McNamara
2019-09-26disinherit OWizardPage and SfxTabPage from vcl TabPageCaolán McNamara
2019-09-24drop OGeneralPageWizard::GetFocusCaolán McNamara
2019-08-22weld ODbTypeWizDialogSetupCaolán McNamara
2019-08-03some missed vcl::Window->TabPageParent opportunitiesCaolán McNamara
2019-08-02weld OGeneralPageDialogCaolán McNamara
2019-08-01weld OGeneralPage and OGeneralPageWizardCaolán McNamara
2019-05-22tdf#124951: Enable children depending on parentXisco Fauli
2019-05-22tdf#125436: Do not disable type options listXisco Fauli
2019-05-18tdf#124951 Open button on Database Wizard dialog is enabled..Noel Grandin
2019-05-17tdf#125267: relax the requirement of fixed value of current filterKatarina Behrens
2019-04-25WIP: Further preparations for deeper Item changesArmin Le Grand
2019-04-08tdf#42949 Fix IWYU warnings in include/sfx2/[t-z]*Gabor Kelemen
2019-02-25Simplify containers iterations in dbaccessArkadiy Illarionov
2019-02-25loplugin:unusedfields in dbaccessNoel Grandin
2019-02-13Remove dead and broken EmbeddedDatabases configurationStephan Bergmann
2019-02-11remove ControlDependencyManagerNoel Grandin
2019-02-06Make Firebird the (unconditional) default for new databasesStephan Bergmann
2018-10-23clang-tidy performance-unnecessary-copy-init in dbaccess..drawinglayerNoel Grandin
2018-10-14Revert removal of mysql jdbc connectorTamas Bunth
2018-09-22tdf#119850 show missing mysql connector optionsTamas Bunth
2018-09-14Fix warning out-of-range value from the DatasourceType selectionJulien Nabet
2018-09-08loplugin:useuniqueptr in OGenericAdministrationPageNoel Grandin
2018-08-01Add missing sal/log.hxx headersGabor Kelemen