LCOV - code coverage report
Current view: top level - chart2/source/controller/dialogs - DataBrowser.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 2 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
      21             : #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
      22             : 
      23             : #include <svtools/editbrowsebox.hxx>
      24             : #include <vcl/outdev.hxx>
      25             : #include <svtools/fmtfield.hxx>
      26             : #include <com/sun/star/uno/XComponentContext.hpp>
      27             : 
      28             : #include <vector>
      29             : #include <boost/shared_ptr.hpp>
      30             : #include <boost/scoped_ptr.hpp>
      31             : 
      32             : namespace com { namespace sun { namespace star {
      33             :     namespace chart2 {
      34             :         class XChartDocument;
      35             :     }
      36             : }}}
      37             : 
      38             : namespace chart
      39             : {
      40             : 
      41             : class DataBrowserModel;
      42             : class NumberFormatterWrapper;
      43             : 
      44             : namespace impl
      45             : {
      46             : class SeriesHeader;
      47             : class SeriesHeaderEdit;
      48             : }
      49             : 
      50             : class DataBrowser : public ::svt::EditBrowseBox
      51             : {
      52             : protected:
      53             :     // EditBrowseBox overridables
      54             :     virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const SAL_OVERRIDE;
      55             :     virtual bool SeekRow( long nRow ) SAL_OVERRIDE;
      56             :     virtual bool IsTabAllowed( bool bForward ) const SAL_OVERRIDE;
      57             :     virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ) SAL_OVERRIDE;
      58             :     virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) SAL_OVERRIDE;
      59             :     virtual bool SaveModified() SAL_OVERRIDE;
      60             :     virtual void CursorMoved() SAL_OVERRIDE;
      61             :     // called whenever the control of the current cell has been modified
      62             :     virtual void CellModified() SAL_OVERRIDE;
      63             :     virtual void ColumnResized( sal_uInt16 nColId ) SAL_OVERRIDE;
      64             :     virtual void EndScroll() SAL_OVERRIDE;
      65             :     virtual void MouseButtonDown( const BrowserMouseEvent& rEvt ) SAL_OVERRIDE;
      66             : 
      67             :     void SetDirty();
      68             : 
      69             : public:
      70             :     DataBrowser( vcl::Window* pParent, WinBits nStyle, bool bLiveUpdate );
      71             :     virtual ~DataBrowser();
      72             :     virtual void dispose() SAL_OVERRIDE;
      73             : 
      74             :     /** GetCellText returns the text at the given position
      75             :         @param  nRow
      76             :             the number of the row
      77             :         @param  nColId
      78             :             the ID of the column
      79             :         @return
      80             :             the text out of the cell
      81             :     */
      82             :     virtual OUString  GetCellText(long nRow, sal_uInt16 nColId) const SAL_OVERRIDE;
      83             : 
      84             :     /** returns the number in the given cell. If a cell is empty or contains a
      85             :         string, the result will be Nan
      86             :     */
      87             :     double GetCellNumber( long nRow, sal_uInt16 nColumnId ) const;
      88             : 
      89             :     bool isDateString( const OUString& aInputString, double& fOutDateValue );
      90             : 
      91             :     // Window
      92             :     virtual void Resize() SAL_OVERRIDE;
      93             : 
      94             :     /// @return old state
      95             :     bool SetReadOnly( bool bNewState );
      96           0 :     bool IsReadOnly() const { return m_bIsReadOnly;}
      97             : 
      98             :     /// reset the dirty status, if changes have been saved
      99             :     void SetClean();
     100             : 
     101             :     void SetDataFromModel( const ::com::sun::star::uno::Reference<
     102             :                                ::com::sun::star::chart2::XChartDocument > & xChartDoc,
     103             :                            const ::com::sun::star::uno::Reference<
     104             :                                ::com::sun::star::uno::XComponentContext > & xContext );
     105             : 
     106             :     // predicates to determine what actions are possible at the current cursor
     107             :     // position.  This depends on the implementation of the according mutators
     108             :     // below.  (They are used for enabling toolbar icons)
     109             :     bool MayInsertRow() const;
     110             :     bool MayInsertColumn() const;
     111             :     bool MayDeleteRow() const;
     112             :     bool MayDeleteColumn() const;
     113             : 
     114             :     bool MaySwapRows() const;
     115             :     bool MaySwapColumns() const;
     116             : 
     117             :     // mutators mutating data
     118             :     void InsertRow();
     119             :     void InsertColumn();
     120             :     void InsertTextColumn();
     121             :     void RemoveRow();
     122             :     void RemoveColumn();
     123             : 
     124             :     using BrowseBox::RemoveColumn;
     125             :     using BrowseBox::MouseButtonDown;
     126             : 
     127             :     void SwapRow();
     128             :     void SwapColumn();
     129             : 
     130             :     void SetCursorMovedHdl( const Link<>& rLink );
     131             : 
     132             :     void SetCellModifiedHdl( const Link<>& rLink );
     133             : 
     134             :     /// confirms all pending changes to be ready to be closed
     135             :     bool EndEditing();
     136             : 
     137             :     // calls the protected inline-function BrowseBox::GetFirstVisibleColNumber()
     138             :     sal_Int16 GetFirstVisibleColumNumber() const;
     139             : 
     140             :     bool CellContainsNumbers( sal_Int32 nRow, sal_uInt16 nCol ) const;
     141             : 
     142             :     sal_uInt32 GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) const;
     143             : 
     144           0 :     bool IsEnableItem() { return m_bDataValid;}
     145             :     bool IsDataValid();
     146             :     void ShowWarningBox();
     147             :     bool ShowQueryBox();
     148             : 
     149             :     void RenewSeriesHeaders();
     150             : 
     151             : private:
     152             :     ::com::sun::star::uno::Reference<
     153             :             ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
     154             :     boost::scoped_ptr< DataBrowserModel > m_apDataBrowserModel;
     155             : 
     156             :     typedef ::std::vector< ::boost::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer;
     157             :     tSeriesHeaderContainer m_aSeriesHeaders;
     158             : 
     159             :     ::boost::shared_ptr< NumberFormatterWrapper >  m_spNumberFormatterWrapper;
     160             : 
     161             :     /// the row that is currently painted
     162             :     long                m_nSeekRow;
     163             :     bool                m_bIsReadOnly;
     164             :     bool                m_bIsDirty;
     165             :     bool                m_bLiveUpdate;
     166             :     bool                m_bDataValid;
     167             : 
     168             :     VclPtr<FormattedField>      m_aNumberEditField;
     169             :     VclPtr<Edit>                m_aTextEditField;
     170             : 
     171             :     /// note: m_aNumberEditField must precede this member!
     172             :     ::svt::CellControllerRef m_rNumberEditController;
     173             :     /// note: m_aTextEditField must precede this member!
     174             :     ::svt::CellControllerRef m_rTextEditController;
     175             : 
     176             :     Link<>              m_aCursorMovedHdlLink;
     177             :     Link<>              m_aCellModifiedLink;
     178             : 
     179             :     void clearHeaders();
     180             :     void RenewTable();
     181             :     void ImplAdjustHeaderControls();
     182             : 
     183             :     OUString GetColString( sal_Int32 nColumnId ) const;
     184             :     static OUString GetRowString( sal_Int32 nRow );
     185             : 
     186             :     DECL_LINK( SeriesHeaderGotFocus, impl::SeriesHeaderEdit* );
     187             :     DECL_LINK( SeriesHeaderChanged,  impl::SeriesHeaderEdit* );
     188             : 
     189             :     DataBrowser( const DataBrowser & ) SAL_DELETED_FUNCTION;
     190             : };
     191             : 
     192             : } // namespace chart
     193             : 
     194             : #endif // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DATABROWSER_HXX
     195             : 
     196             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11