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

Generated by: LCOV version 1.11