LCOV - code coverage report
Current view: top level - sc/source/ui/inc - csvtablebox.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 8 0.0 %
Date: 2014-11-03 Functions: 0 7 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_SC_SOURCE_UI_INC_CSVTABLEBOX_HXX
      21             : #define INCLUDED_SC_SOURCE_UI_INC_CSVTABLEBOX_HXX
      22             : 
      23             : #include <vcl/ctrl.hxx>
      24             : #include <vcl/scrbar.hxx>
      25             : #include "scdllapi.h"
      26             : #include "csvcontrol.hxx"
      27             : #include "csvruler.hxx"
      28             : #include "csvgrid.hxx"
      29             : 
      30             : class ListBox;
      31             : class ScAsciiOptions;
      32             : 
      33             : /* ============================================================================
      34             : Position: Positions between the characters (the dots in the ruler).
      35             : Character: The characters (the range from one position to the next).
      36             : Split: Positions which contain a split to divide characters into groups (columns).
      37             : Column: The range between two splits.
      38             : ============================================================================ */
      39             : 
      40             : /** The control in the CSV import dialog that contains a ruler and a data grid
      41             :     to visualize and modify the current import settings. */
      42           0 : class SC_DLLPUBLIC ScCsvTableBox : public ScCsvControl
      43             : {
      44             : private:
      45             :     ScCsvLayoutData             maData;             /// Current layout data of the controls.
      46             : 
      47             :     ScCsvRuler                  maRuler;            /// The ruler for fixed width mode.
      48             :     ScCsvGrid                   maGrid;             /// Calc-like data table for fixed width mode.
      49             :     ScrollBar                   maHScroll;          /// Horizontal scroll bar.
      50             :     ScrollBar                   maVScroll;          /// Vertical scroll bar.
      51             :     ScrollBarBox                maScrollBox;        /// For the bottom right edge.
      52             : 
      53             :     Link                        maUpdateTextHdl;    /// Updates all cell texts.
      54             :     Link                        maColTypeHdl;       /// Handler for exporting the column type.
      55             : 
      56             :     ScCsvColStateVec            maFixColStates;     /// Column states in fixed width mode.
      57             :     ScCsvColStateVec            maSepColStates;     /// Column states in separators mode.
      58             : 
      59             :     sal_Int32                   mnFixedWidth;       /// Cached total width for fixed width mode.
      60             : 
      61             :     bool                        mbFixedMode;        /// false = Separators, true = Fixed width.
      62             : 
      63             : public:
      64             :     explicit                    ScCsvTableBox( vcl::Window* pParent, WinBits nBits );
      65             : 
      66             :     /** Finishes initialization. Must be called after constructing a new object. */
      67             :     void Init();
      68             : 
      69             :     // common table box handling ----------------------------------------------
      70             : public:
      71             :     /** Sets the control to separators mode. */
      72             :     void                        SetSeparatorsMode();
      73             :     /** Sets the control to fixed width mode. */
      74             :     void                        SetFixedWidthMode();
      75             : 
      76             : private:
      77             :     /** Initializes the children controls (pos/size, scroll bars, ...). */
      78             :     SAL_DLLPRIVATE void                        InitControls();
      79             :     /** Initializes size and position data of horizontal scrollbar. */
      80             :     SAL_DLLPRIVATE void                        InitHScrollBar();
      81             :     /** Initializes size and position data of vertical scrollbar. */
      82             :     SAL_DLLPRIVATE void                        InitVScrollBar();
      83             : 
      84             :     /** Calculates and sets valid position offset nearest to nPos. */
      85           0 :     SAL_DLLPRIVATE inline void                 ImplSetPosOffset( sal_Int32 nPos )
      86           0 :                                     { maData.mnPosOffset = std::max( std::min( nPos, GetMaxPosOffset() ), sal_Int32( 0 ) ); }
      87             :     /** Calculates and sets valid line offset nearest to nLine. */
      88           0 :     SAL_DLLPRIVATE inline void                 ImplSetLineOffset( sal_Int32 nLine )
      89           0 :                                     { maData.mnLineOffset = std::max( std::min( nLine, GetMaxLineOffset() ), sal_Int32( 0 ) ); }
      90             :     /** Moves controls (not cursors!) so that nPos becomes visible. */
      91             :     SAL_DLLPRIVATE void                        MakePosVisible( sal_Int32 nPos );
      92             : 
      93             :     // cell contents ----------------------------------------------------------
      94             : public:
      95             :     /** Fills all cells of all lines with the passed texts (Unicode strings). */
      96             :     void                        SetUniStrings(
      97             :                                     const OUString* pTextLines, const OUString& rSepChars,
      98             :                                     sal_Unicode cTextSep, bool bMergeSep );
      99             : 
     100             :     // column settings --------------------------------------------------------
     101             : public:
     102             :     /** Reads UI strings for data types from the list box. */
     103             :     void                        InitTypes( const ListBox& rListBox );
     104             :     /** Returns the data type of the selected columns. */
     105           0 :     inline sal_Int32            GetSelColumnType() const { return maGrid.GetSelColumnType(); }
     106             : 
     107             :     /** Fills the options object with current column data. */
     108             :     void                        FillColumnData( ScAsciiOptions& rOptions ) const;
     109             : 
     110             :     // event handling ---------------------------------------------------------
     111             : public:
     112             :     /** Sets a new handler for "update cell texts" requests. */
     113           0 :     inline void                 SetUpdateTextHdl( const Link& rHdl ) { maUpdateTextHdl = rHdl; }
     114             :     /** Returns the handler for "update cell texts" requests. */
     115             :     inline const Link&          GetUpdateTextHdl() const { return maUpdateTextHdl; }
     116             :     /** Sets a new handler for "column selection changed" events. */
     117           0 :     inline void                 SetColTypeHdl( const Link& rHdl ) { maColTypeHdl = rHdl; }
     118             :     /** Returns the handler for "column selection changed" events. */
     119             :     inline const Link&          GetColTypeHdl() const { return maColTypeHdl; }
     120             : 
     121             : protected:
     122             :     virtual void                Resize() SAL_OVERRIDE;
     123             :     virtual void                DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     124             :     virtual Size                GetOptimalSize() const SAL_OVERRIDE;
     125             : 
     126             : private:
     127             :     SAL_DLLPRIVATE              DECL_LINK( CsvCmdHdl, ScCsvControl* );
     128             :     SAL_DLLPRIVATE              DECL_LINK( ScrollHdl, ScrollBar* );
     129             :     SAL_DLLPRIVATE              DECL_LINK( ScrollEndHdl, ScrollBar* );
     130             : 
     131             :     // accessibility ----------------------------------------------------------
     132             : public:
     133             :     /** Creates and returns the accessible object of this control. */
     134             :     virtual XAccessibleRef      CreateAccessible() SAL_OVERRIDE;
     135             : 
     136             : protected:
     137             :     /** Creates a new accessible object. */
     138             :     virtual ScAccessibleCsvControl* ImplCreateAccessible() SAL_OVERRIDE;
     139             : };
     140             : 
     141             : #endif
     142             : 
     143             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10