/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * 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 #include #include #include #include #include #include "SmElementsPanel.hxx" #include #include #include #include namespace sm::sidebar { // static std::unique_ptr SmElementsPanel::Create(weld::Widget& rParent, const SfxBindings& rBindings) { return std::make_unique(rParent, rBindings); } SmElementsPanel::SmElementsPanel(weld::Widget& rParent, const SfxBindings& rBindings) : PanelLayout(&rParent, u"MathElementsPanel"_ustr, u"modules/smath/ui/sidebarelements_math.ui"_ustr) , mrBindings(rBindings) , mxCategoryList(m_xBuilder->weld_combo_box(u"categorylist"_ustr)) , mxElementsControl( std::make_unique(m_xBuilder->weld_icon_view(u"elements"_ustr))) { for (const auto& rCategoryId : SmElementsControl::categories()) mxCategoryList->append_text(SmResId(rCategoryId)); mxCategoryList->set_size_request(-1, -1); mxCategoryList->connect_changed(LINK(this, SmElementsPanel, CategorySelectedHandle)); mxCategoryList->set_active(0); mxElementsControl->setElementSetIndex(0); mxElementsControl->SetSelectHdl(LINK(this, SmElementsPanel, ElementClickHandler)); } SmElementsPanel::~SmElementsPanel() { mxElementsControl.reset(); mxCategoryList.reset(); } IMPL_LINK(SmElementsPanel, CategorySelectedHandle, weld::ComboBox&, rList, void) { const int nActive = rList.get_active(); if (nActive == -1) return; mxElementsControl->setElementSetIndex(nActive); if (SmViewShell* pViewSh = GetView()) mxElementsControl->setSmSyntaxVersion(pViewSh->GetDoc()->GetSmSyntaxVersion()); } IMPL_LINK(SmElementsPanel, ElementClickHandler, const OUString&, ElementSource, void) { if (SmViewShell* pViewSh = GetView()) { SfxStringItem aInsertCommand(SID_INSERTCOMMANDTEXT, ElementSource); pViewSh->GetViewFrame().GetDispatcher()->ExecuteList( SID_INSERTCOMMANDTEXT, SfxCallMode::RECORD, { &aInsertCommand }); } } SmViewShell* SmElementsPanel::GetView() const { SfxViewShell* pView = mrBindings.GetDispatcher()->GetFrame()->GetViewShell(); SmViewShell* pSmViewShell = dynamic_cast(pView); if (!pSmViewShell && comphelper::LibreOfficeKit::isActive()) { auto* pWindow = static_cast(LokStarMathHelper(pView).GetGraphicWindow()); if (pWindow) pSmViewShell = &pWindow->GetGraphicWidget().GetView(); } return pSmViewShell; } } // end of namespace sm::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ collabora/cp-5.0'>distro/collabora/cp-5.0 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2015-09-15Resolves: tdf#88206 replace cppu::WeakImplHelper* etc.Takeshi Abe
2015-04-01Replace remaining getCppuType et al with cppu::UnoTypeStephan Bergmann
2015-01-04stdexcept for std::runtime_errorCaolán McNamara
2015-01-04boost::unordered_map->std::unordered_mapCaolán McNamara
2014-12-18sccomp: Use appropriate OUString functions on string constantsStephan Bergmann
2014-06-06coverity#1202902 Uncaught CoinError exceptionCaolán McNamara
2014-05-15Resolves fdo#70681: fixincludeguards.pl: all that's leftThomas Arnhold
2014-04-24sccomp: sal_Bool->boolNoel Grandin
2014-04-04sccomp: Fix description of com.sun.star.comp.Calc.CoinMPSolver.Matúš Kukan
2014-04-03loplugin:saloverrideStephan Bergmann
2014-04-03remove unnecessary scope qualifier from sal_Bool usesNoel Grandin
2014-04-03override specifier 'override' not allowed on a destructorMatúš Kukan
2014-04-03sccomp: Share common code and have only one library.Matúš Kukan
2014-04-01sccomp: Make the source files more similar and fix some problems.Matúš Kukan
2014-04-01Install coinmp and lpsolve linear solvers in parallel.Matúš Kukan
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann
2014-03-04fdo#54938: Convert some places to use cppu::supportsServiceMarcos Paulo de Souza
2014-03-03118160: Use CoinMP as replacement for lp_solve.Andre Fischer
2014-03-03Rename sccomp/source/solver/solver.cxx to solver-lpsolve.cxxMatúš Kukan
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
2014-02-26Remove visual noise from sccompAlexander Wilms
2014-02-23Remove unneccessary commentsAlexander Wilms
2013-12-17Adapt all (non-extension, SharedLibrary) .components to environment="..."Stephan Bergmann
2013-11-11remove unnecessary use of OUString constructorNoel Grandin
2013-10-25fdo#54938: More uses of cppu::supportsServiceMarcos Paulo de Souza
2013-08-16Related: fdo#38838 ToInt64 and a EqualsIgnoreCaseAscii variant are now unusedCaolán McNamara
2013-06-04MPLv2 subset improvements.Michael Meeks
2013-04-07mass removal of rtl:: prefixes for O(U)String*Luboš Luňák
2013-03-27Missing #include "sal/config.h"Stephan Bergmann
2013-03-27-Wunused-macrosStephan Bergmann