/* -*- 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 "AppSwapWindow.hxx" #include #include #include "AppView.hxx" #include #include #include #include #include #include "AppController.hxx" using namespace ::dbaui; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; // class OApplicationSwapWindow OApplicationSwapWindow::OApplicationSwapWindow( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow ) :Window(_pParent,WB_DIALOGCONTROL ) ,m_aIconControl(VclPtr::Create(this)) ,m_eLastType(E_NONE) ,m_rBorderWin( _rBorderWindow ) { ImplInitSettings(); m_aIconControl->SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl)); m_aIconControl->setControlActionListener( &m_rBorderWin.getView()->getAppController() ); m_aIconControl->SetHelpId(HID_APP_SWAP_ICONCONTROL); m_aIconControl->Show(); } OApplicationSwapWindow::~OApplicationSwapWindow() { disposeOnce(); } void OApplicationSwapWindow::dispose() { m_aIconControl.disposeAndClear(); vcl::Window::dispose(); } void OApplicationSwapWindow::Resize() { Size aFLSize = LogicToPixel(Size(8, 0), MapMode(MapUnit::MapAppFont)); long nX = 0; if ( m_aIconControl->GetEntryCount() != 0 ) nX = m_aIconControl->GetBoundingBox( m_aIconControl->GetEntry(0) ).GetWidth() + aFLSize.Width(); Size aOutputSize = GetOutputSize(); m_aIconControl->SetPosSizePixel( Point(static_cast((aOutputSize.Width() - nX)*0.5), 0) ,Size(nX,aOutputSize.Height())); m_aIconControl->ArrangeIcons(); } void OApplicationSwapWindow::ImplInitSettings() { // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); SetPointFont(*this, aFont); SetTextColor( rStyleSettings.GetFieldTextColor() ); SetTextFillColor(); SetBackground( rStyleSettings.GetFieldColor() ); } void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt ) { Window::DataChanged( rDCEvt ); if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) || (rDCEvt.GetType() == DataChangedEventType::DISPLAY) || (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) || ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { ImplInitSettings(); Invalidate(); } } void OApplicationSwapWindow::clearSelection() { m_aIconControl->SetNoSelection(); SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(); if ( pEntry ) m_aIconControl->InvalidateEntry(pEntry); m_aIconControl->GetClickHdl().Call(m_aIconControl.get()); } void OApplicationSwapWindow::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics ) { m_aIconControl->CreateAutoMnemonics( _rMnemonics ); } bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent ) { const vcl::KeyCode& rKeyCode = _rEvent.GetKeyCode(); if ( rKeyCode.GetModifier() == KEY_MOD2 ) return m_aIconControl->DoKeyInput( _rEvent ); // not handled return false; } ElementType OApplicationSwapWindow::getElementType() const { SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(); return pEntry ? *static_cast(pEntry->GetUserData()) : E_NONE; } bool OApplicationSwapWindow::onContainerSelected( ElementType _eType ) { if ( m_eLastType == _eType ) return true; if ( m_rBorderWin.getView()->getAppController().onContainerSelect( _eType ) ) { if ( _eType != E_NONE ) m_eLastType = _eType; return true; } PostUserEvent( LINK( this, OApplicationSwapWindow, ChangeToLastSelected ), nullptr, true ); return false; } IMPL_LINK(OApplicationSwapWindow, OnContainerSelectHdl, SvtIconChoiceCtrl*, _pControl, void) { SvxIconChoiceCtrlEntry* pEntry = _pControl->GetSelectedEntry(); ElementType eType = E_NONE; if ( pEntry ) { eType = *static_cast(pEntry->GetUserData()); onContainerSelected( eType ); // i87582 } } IMPL_LINK_NOARG(OApplicationSwapWindow, ChangeToLastSelected, void*, void) { selectContainer(m_eLastType); } void OApplicationSwapWindow::selectContainer(ElementType _eType) { sal_uLong nCount = m_aIconControl->GetEntryCount(); SvxIconChoiceCtrlEntry* pEntry = nullptr; for (sal_uLong i=0; i < nCount; ++i) { pEntry = m_aIconControl->GetEntry(i); if ( pEntry && *static_cast(pEntry->GetUserData()) == _eType ) break; pEntry = nullptr; } if ( pEntry ) m_aIconControl->SetCursor(pEntry); // this call also initiates a onContainerSelected call else onContainerSelected( _eType ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ion> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-05-26loplugin:unusedmethodsNoel Grandin
Change-Id: Ib36bc0e87d00abb638cbfec511cd13b6179eabda Reviewed-on: https://gerrit.libreoffice.org/25431 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-19loplugin:unusedmethods in writerfilter to xmloffNoel Grandin
Change-Id: If95890eff0f785111e8b511ac1d5481c6910f099 Reviewed-on: https://gerrit.libreoffice.org/25148 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-12Avoid reserved identifiersStephan Bergmann
Change-Id: Iaff499c3c8012cfc13849b9b85ec544e1f5d6db8
2016-02-08wpftwriter: use service constructorDavid Tardon
Change-Id: I217988ca09b40af7cb2b3b28ea7c2af6a9db12d0
2015-12-21loplugin:unusedfields writerfilter,writerperfectNoel Grandin
Change-Id: I8863fcdb0751d2f1becea5b2487d4070e4fd4195
2015-11-25com::sun::star->css in writerperfect/Noel Grandin
Change-Id: I3b1f51d3a02b999476d12e680f2f76a11ac6b3b9 Reviewed-on: https://gerrit.libreoffice.org/20146 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-09-15Resolves: tdf#88206 replace cppu::WeakImplHelper* etc.Takeshi Abe
with the variadic variants. Change-Id: I7154f9472f02fdf47d27ba715db55bb1ec669a8a Reviewed-on: https://gerrit.libreoffice.org/18580 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-05-25cppcheck: noExplicitConstructorCaolán McNamara
Change-Id: I62076450ab77472bfd09b3fb9824f54b6ea1e0f7
2014-08-15use consistent style for writerperfectDavid Tardon
Change-Id: I47089586094b58c39a128e44e2671d69c2d50177
2014-05-23coverity#1215311 Uncaught exceptionCaolán McNamara
Change-Id: Ic000d3a3920dddb8cc8585bb31127d14cfc35eb7
2014-05-02writerperfect: sal_Bool->boolNoel Grandin
Change-Id: Ic51f9ed2c2c2fced13c8b279912410f9c1638ff9
2014-04-01Explicitly mark overriding destructors as "virtual"Stephan Bergmann
It appears that the C++ standard allows overriding destructors to be marked "override," but at least some MSVC versions complain about it, so at least make sure such destructors are explicitly marked "virtual." Change-Id: I0e1cafa7584fd16ebdce61f569eae2373a71b0a1
2014-03-27Second batch of adding SAL_OVERRIDE to overriding function declarationsStephan Bergmann
...mostly done with a rewriting Clang plugin, with just some manual tweaking necessary to fix poor macro usage. Change-Id: Ie656f9d653fc716f72ac175925272696d509038f
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
Change-Id: I56e32131b7991ee9948ce46765632eb823d463b3
2013-03-19::rtl::OUString -> OUString in writerperfectFridrich Štrba
Change-Id: I2d0f8868779e5ac4a802f3f061704d2de5826c5d
2012-07-05audit and re-license writerperfect.Fridrich Štrba
Written entirely by non-Oracle contributors to LibreOffice. Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
2012-04-20Monkey sberg's work for the other writerperfect libraryFridrich Štrba
2012-04-19Diminish the number of writerperfect librariesFridrich Štrba
Instead of a pleiade of libraries, one for graphic filters (wpftdraw) and one for text document filters (wpftwriter) to diminish duplicate static linking.