1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 #pragma once 21 22 #include <svtools/editbrowsebox.hxx> 23 #include <com/sun/star/awt/XWindow.hpp> 24 #include <com/sun/star/uno/Sequence.hxx> 25 #include "indexes.hxx" 26 27 namespace dbaui 28 { 29 30 class DbaMouseDownListBoxController; 31 32 // IndexFieldsControl 33 class IndexFieldsControl final : public ::svt::EditBrowseBox 34 { 35 IndexFields m_aSavedValue; 36 37 IndexFields m_aFields; // !! order matters !! 38 IndexFields::const_iterator m_aSeekRow; // !! 39 40 Link<IndexFieldsControl&,void> m_aModifyHdl; 41 42 VclPtr< ::svt::ListBoxControl> m_pSortingCell; 43 VclPtr< ::svt::ListBoxControl> m_pFieldNameCell; 44 45 OUString m_sAscendingText; 46 OUString m_sDescendingText; 47 48 bool m_bAddIndexAppendix; 49 50 public: 51 IndexFieldsControl(const css::uno::Reference<css::awt::XWindow> &rParent); 52 virtual ~IndexFieldsControl() override; 53 virtual void dispose() override; 54 55 void Init(const css::uno::Sequence< OUString >& _rAvailableFields, bool _bAddIndexAppendix); 56 57 void initializeFrom(const IndexFields& _rFields); 58 void commitTo(IndexFields& _rFields); 59 60 bool SaveModified() override; 61 using EditBrowseBox::IsModified; 62 GetSavedValue() const63 const IndexFields& GetSavedValue() const { return m_aSavedValue; } SaveValue()64 void SaveValue() { m_aSavedValue = m_aFields; } 65 SetModifyHdl(const Link<IndexFieldsControl &,void> & _rHdl)66 void SetModifyHdl(const Link<IndexFieldsControl&,void>& _rHdl) { m_aModifyHdl = _rHdl; } 67 virtual OUString GetCellText(sal_Int32 _nRow,sal_uInt16 nColId) const override; 68 69 private: 70 // EditBrowseBox overridables 71 virtual void PaintCell( OutputDevice& _rDev, const tools::Rectangle& _rRect, sal_uInt16 _nColumnId ) const override; 72 virtual bool SeekRow(sal_Int32 nRow) override; 73 virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override; 74 virtual bool IsTabAllowed(bool bForward) const override; 75 76 ::svt::CellController* GetController(sal_Int32 _nRow, sal_uInt16 _nColumnId) override; 77 void InitController(::svt::CellControllerRef&, sal_Int32 _nRow, sal_uInt16 _nColumnId) override; 78 79 OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const; 80 bool implGetFieldDesc(sal_Int32 _nRow, IndexFields::const_iterator& _rPos); 81 isNewField() const82 bool isNewField() const { return GetCurRow() >= static_cast<sal_Int32>(m_aFields.size()); } 83 84 DECL_LINK( OnListEntrySelected, DbaMouseDownListBoxController&, void ); 85 86 using ::svt::EditBrowseBox::Init; 87 }; 88 89 } // namespace dbaui 90 91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 92