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

Generated by: LCOV version 1.10