LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/inc - pvlaydlg.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-27 Functions: 0 1 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             :  *
       4             :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5             :  *
       6             :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7             :  *
       8             :  * OpenOffice.org - a multi-platform office productivity suite
       9             :  *
      10             :  * This file is part of OpenOffice.org.
      11             :  *
      12             :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13             :  * it under the terms of the GNU Lesser General Public License version 3
      14             :  * only, as published by the Free Software Foundation.
      15             :  *
      16             :  * OpenOffice.org is distributed in the hope that it will be useful,
      17             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19             :  * GNU Lesser General Public License version 3 for more details
      20             :  * (a copy is included in the LICENSE file that accompanied this code).
      21             :  *
      22             :  * You should have received a copy of the GNU Lesser General Public License
      23             :  * version 3 along with OpenOffice.org.  If not, see
      24             :  * <http://www.openoffice.org/license.html>
      25             :  * for a copy of the LGPLv3 License.
      26             :  *
      27             :  * This file incorporates work covered by the following license notice:
      28             :  *
      29             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      30             :  *   contributor license agreements. See the NOTICE file distributed
      31             :  *   with this work for additional information regarding copyright
      32             :  *   ownership. The ASF licenses this file to you under the Apache
      33             :  *   License, Version 2.0 (the "License"); you may not use this file
      34             :  *   except in compliance with the License. You may obtain a copy of
      35             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      36             :  ************************************************************************/
      37             : 
      38             : #ifndef SC_PVLAYDLG_HXX
      39             : #define SC_PVLAYDLG_HXX
      40             : 
      41             : #include <memory>
      42             : #include <vector>
      43             : 
      44             : #include <boost/ptr_container/ptr_vector.hpp>
      45             : #include <boost/scoped_ptr.hpp>
      46             : 
      47             : #include <formula/funcutl.hxx>
      48             : #include <svtools/stdctrl.hxx>
      49             : #include <vcl/lstbox.hxx>
      50             : #include <vcl/morebtn.hxx>
      51             : #include <vcl/scrbar.hxx>
      52             : 
      53             : #include "anyrefdg.hxx"
      54             : #include "fieldwnd.hxx"
      55             : 
      56             : /*==========================================================================*\
      57             : 
      58             :     An instance of the class ScPivotLayoutDlg is a (semi-)modal dialog
      59             :     that can be associated to the mouse fields with column headings of
      60             :     the three pivot categories "column", "row" and "data".
      61             : 
      62             :     The dialog receives information about these headers (name,
      63             :     type (number/string) and function mask) in the label data structure
      64             :     Furthermore, three pivot field arrays are passed on, with which the three
      65             :     category windows are initialized. A window class is represented by an
      66             :     instance of class FieldWindow. Such a window is responsible for the
      67             :     representation of data structures on the screen. It reports on mouse
      68             :     actions in the dialogue and provides appropriate methods for
      69             :     changing the representation. The dialogue provides the adjustment of the
      70             :     internal data structures with respect to the representation on the screen.
      71             :     Another FieldWindow(Select) provides all table headers for selection,
      72             :     is thus "read only".
      73             : 
      74             : \*==========================================================================*/
      75             : 
      76             : class ScViewData;
      77             : class ScDocument;
      78             : struct ScPivotFuncData;
      79             : class ScDPObject;
      80             : 
      81             : class ScPivotLayoutDlg : public ScAnyRefDlg
      82             : {
      83             :     /** data source type */
      84             :     enum DataSrcType {
      85             :         SRC_REF,     /// range reference
      86             :         SRC_NAME,    /// range name
      87             :         SRC_INVALID  /// invalid range
      88             :     };
      89             : public:
      90             :                         ScPivotLayoutDlg(
      91             :                             SfxBindings* pB,
      92             :                             SfxChildWindow* pCW,
      93             :                             Window* pParent,
      94             :                             const ScDPObject& rDPObject,
      95             :                             bool bNewOutput );
      96             :     virtual             ~ScPivotLayoutDlg();
      97             : 
      98             :     void                    NotifyDoubleClick    ( ScPivotFieldType eType, size_t nFieldIndex );
      99             :     PointerStyle            NotifyMouseButtonDown( ScPivotFieldType eType, size_t nFieldIndex );
     100             :     void                    NotifyFieldFocus     ( ScPivotFieldType eType, bool bGotFocus );
     101             :     void                    NotifyMoveFieldToEnd      ( ScPivotFieldType eToType );
     102             :     void                    NotifyRemoveField    ( ScPivotFieldType eType, size_t nFieldIndex );
     103             : 
     104             :     Size                    GetStdFieldBtnSize() const;
     105             : 
     106             :     /**
     107             :      * Drop currently dragged field item into specified position.
     108             :      *
     109             :      * @param rScrPos screen position of mouse cursor.
     110             :      * @param eToType type of field at mouse cursor position.
     111             :      */
     112             :     void DropFieldItem( const Point& rScrPos, ScPivotFieldType eToType );
     113             : 
     114             :     /**
     115             :      * Get pointer style at current mouse position during dragging of field
     116             :      * item.
     117             :      */
     118             :     PointerStyle GetPointerStyleAtPoint( const Point& rScrPos, ScPivotFieldType eFieldType );
     119             : 
     120             :     /**
     121             :      * Determine the type of field at mouse cursor position.
     122             :      *
     123             :      * @param rScrPos mouse cursor position (screen position).
     124             :      */
     125             :     ScPivotFieldType GetFieldTypeAtPoint( const Point& rScrPos ) const;
     126             : 
     127             : protected:
     128             :     virtual void        Deactivate();
     129             :     virtual void        SetReference( const ScRange& rRef, ScDocument* pDoc );
     130             :     virtual sal_Bool    IsRefInputMode() const;
     131             :     virtual void        SetActive();
     132             :     virtual sal_Bool    Close();
     133             : 
     134             : private:
     135             :     /** Returns the localized function name for the specified (1-based) resource index. */
     136           0 :     inline const rtl::OUString& GetFuncName( sal_uInt16 nFuncIdx ) const { return maFuncNames[nFuncIdx-1]; }
     137             : 
     138             :     /** Fills the field windows from the current pivot table settings. */
     139             :     void                InitFieldWindows();
     140             :     /** Sets focus to the specified field control, if it is not empty. */
     141             :     void                GrabFieldFocus( ScDPFieldControlBase& rFieldWindow );
     142             : 
     143             :     void InitWndSelect(const ScDPLabelDataVector& rLabels);
     144             :     void InitWndData(const std::vector<ScPivotField>& rFields);
     145             :     void                    InitFieldWindow ( const ::std::vector<ScPivotField>& rFields, ScPivotFieldType eType );
     146             :     void                    AdjustDlgSize();
     147             :     ScDPLabelData* GetLabelData( SCCOL nCol );
     148             :     rtl::OUString GetLabelString(SCsCOL nCol);
     149             :     bool                    IsOrientationAllowed( SCsCOL nCol, ScPivotFieldType eType );
     150             :     rtl::OUString GetFuncString( sal_uInt16& rFuncMask, bool bIsValue = true );
     151             : 
     152             :     void                    AddField        ( size_t nFromIndex,
     153             :                                               ScPivotFieldType eToType, const Point& rAtPos );
     154             :     void                    AppendField(size_t nFromIndex, ScPivotFieldType eToType);
     155             :     void                    MoveField       ( ScPivotFieldType eFromType, size_t nFromIndex,
     156             :                                               ScPivotFieldType eToType, const Point&  rAtPos );
     157             :     void                    MoveFieldToEnd(ScPivotFieldType eFromType, size_t nFromIndex, ScPivotFieldType eToType);
     158             :     void                    RemoveField     ( ScPivotFieldType eRemType, size_t nRemIndex );
     159             : 
     160             :     bool                    GetPivotArrays( ::std::vector<ScPivotField>& rPageFields,
     161             :                                             ::std::vector<ScPivotField>& rColFields,
     162             :                                             ::std::vector<ScPivotField>& rRowFields,
     163             :                                             ::std::vector<ScPivotField>& rDataFields );
     164             : 
     165             :     void UpdateSrcRange();
     166             :     void UpdateOutputPos();
     167             :     void OutputPosUpdated();
     168             :     void MoreBtnClicked();
     169             : 
     170             :     void                    RepaintFieldWindows();
     171             : 
     172             :     /**
     173             :      * Initialize control sizes and the dialog size which depends on them.
     174             :      */
     175             :     void InitControlAndDlgSizes();
     176             : 
     177             :     ScDPFieldControlBase* GetFieldWindow(ScPivotFieldType eType);
     178             : 
     179             :     /**
     180             :      * Get pointers to field windows that are <b>not</b> the window of
     181             :      * specified type.  The select window type is not included.
     182             :      */
     183             :     void GetOtherFieldWindows(
     184             :         ScPivotFieldType eType, ScDPFieldControlBase*& rpWnd1, ScDPFieldControlBase*& rpWnd2);
     185             : 
     186             :     // Handler
     187             :     DECL_LINK( ClickHdl, PushButton * );
     188             :     DECL_LINK( OkHdl, void * );
     189             :     DECL_LINK( CancelHdl, void * );
     190             :     DECL_LINK( MoreClickHdl, void * );
     191             :     DECL_LINK( EdOutModifyHdl, void * );
     192             :     DECL_LINK( EdInModifyHdl, void * );
     193             :     DECL_LINK( SelAreaHdl, void * );
     194             :     DECL_LINK( GetRefEditFocusHdl, formula::RefEdit* );
     195             : 
     196             : private:
     197             :     typedef boost::scoped_ptr<ScDPObject> ScDPObjectPtr;
     198             : 
     199             :     FixedLine               maFlLayout;
     200             :     FixedText               maFtPage;
     201             :     ScDPPageFieldControl    maWndPage;
     202             :     FixedText               maFtCol;
     203             :     ScDPColFieldControl     maWndCol;
     204             :     FixedText               maFtRow;
     205             :     ScDPRowFieldControl     maWndRow;
     206             :     FixedText               maFtData;
     207             :     ScDPDataFieldControl    maWndData;
     208             :     ScDPSelectFieldControl  maWndSelect;
     209             :     FixedInfo               maFtInfo;
     210             : 
     211             :     std::vector<ScDPFieldControlBase*> maFieldCtrls;
     212             : 
     213             :     FixedLine               maFlAreas;
     214             :     FixedText               maFtInArea;
     215             :     ::formula::RefEdit      maEdInPos;
     216             :     ::formula::RefButton    maRbInPos;
     217             :     ListBox                 maLbOutPos;
     218             :     FixedText               maFtOutArea;
     219             :     formula::RefEdit        maEdOutPos;
     220             :     formula::RefButton      maRbOutPos;
     221             :     CheckBox                maBtnIgnEmptyRows;
     222             :     CheckBox                maBtnDetectCat;
     223             :     CheckBox                maBtnTotalCol;
     224             :     CheckBox                maBtnTotalRow;
     225             :     CheckBox                maBtnFilter;
     226             :     CheckBox                maBtnDrillDown;
     227             : 
     228             :     OKButton                maBtnOk;
     229             :     CancelButton            maBtnCancel;
     230             :     HelpButton              maBtnHelp;
     231             :     PushButton              maBtnRemove;
     232             :     PushButton              maBtnOptions;
     233             :     MoreButton              maBtnMore;
     234             :     std::vector<rtl::OUString> maFuncNames;     /// Localized function names from resource.
     235             :     boost::ptr_vector<rtl::OUString> maRefStrs; /// Reference strings stored with the output list box.
     236             :     ScDPObjectPtr           mxDlgDPObject;      /// Clone of the pivot table object this dialog is based on.
     237             :     ScPivotParam            maPivotData;        /// The pivot table field configuration.
     238             :     ScDPLabelDataVector     maLabelData;        /// Information about all dimensions.
     239             : 
     240             :     ScViewData*             mpViewData;
     241             :     ScDocument*             mpDoc;
     242             :     formula::RefEdit*       mpRefInputEdit;
     243             : 
     244             :     const rtl::OUString     maStrUndefined;
     245             :     const rtl::OUString     maStrNewTable;
     246             :     rtl::OUString           maOutputRefStr; /// Used only for caching in UI.
     247             : 
     248             :     ScPivotFieldType           meDnDFromType;
     249             :     size_t                  mnDnDFromIndex;
     250             :     bool                    mbIsDrag;
     251             : 
     252             :     ScPivotFieldType        meLastActiveType;        /// Type of last active area.
     253             :     size_t                  mnOffset;                /// Offset of first field in TYPE_SELECT area.
     254             : 
     255             :     ScRange                 maOldRange;
     256             :     bool                    mbRefInputMode;
     257             : };
     258             : 
     259             : 
     260             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
     261             : 
     262             : #endif

Generated by: LCOV version 1.10