LCOV - code coverage report
Current view: top level - include/svx/sdr/table - tablecontroller.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 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_SVX_SDR_TABLE_TABLECONTROLLER_HXX
      21             : #define INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
      22             : 
      23             : #include <com/sun/star/util/XModifyListener.hpp>
      24             : #include <com/sun/star/table/XTable.hpp>
      25             : #include <rtl/ref.hxx>
      26             : 
      27             : #include <svx/sdr/overlay/overlayobjectlist.hxx>
      28             : #include <svx/selectioncontroller.hxx>
      29             : #include <svx/svdotable.hxx>
      30             : #include <svx/svdview.hxx>
      31             : 
      32             : class SdrObjEditView;
      33             : class SdrObject;
      34             : class SfxItemSet;
      35             : class SvxBoxInfoItem;
      36             : class SvxBoxItem;
      37             : 
      38             : namespace sdr { namespace table {
      39             : 
      40             : class TableModel;
      41             : 
      42             : class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController
      43             : {
      44             : public:
      45             :     SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj );
      46             :     SVX_DLLPRIVATE virtual ~SvxTableController();
      47             : 
      48             :     // from sdr::SelectionController
      49             :     SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin) SAL_OVERRIDE;
      50             :     SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin) SAL_OVERRIDE;
      51             :     SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin) SAL_OVERRIDE;
      52             :     SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, Window* pWin) SAL_OVERRIDE;
      53             : 
      54             :     SVX_DLLPRIVATE virtual bool DeleteMarked() SAL_OVERRIDE;
      55             : 
      56             :     SVX_DLLPRIVATE virtual void onSelectionHasChanged() SAL_OVERRIDE;
      57             : 
      58             :     SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet ) SAL_OVERRIDE;
      59             :     SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq ) SAL_OVERRIDE;
      60             : 
      61             :     SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const SAL_OVERRIDE;
      62             :     SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ) SAL_OVERRIDE;
      63             : 
      64             :     SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet  ) SAL_OVERRIDE;
      65             :     SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) SAL_OVERRIDE;
      66             : 
      67             :     // slots
      68             :     SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 );
      69             :     SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId );
      70             :     SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId );
      71             :     SVX_DLLPRIVATE void onFormatTable( SfxRequest& rReq );
      72             :     SVX_DLLPRIVATE void MergeMarkedCells();
      73             :     SVX_DLLPRIVATE void SplitMarkedCells();
      74             :     SVX_DLLPRIVATE void DistributeColumns();
      75             :     SVX_DLLPRIVATE void DistributeRows();
      76             :     SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
      77             : 
      78             :     SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
      79             : 
      80             :     SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
      81             :     SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
      82             :     /** Fill the values that are common for all selected cells.
      83             :       *
      84             :       * This lets the Borders dialog to display the line arrangement
      85             :       * properly.
      86             :       */
      87             :     SVX_DLLPRIVATE void FillCommonBorderAttrFromSelectedCells(SvxBoxItem& rBox, SvxBoxInfoItem& rBoxInfo) const;
      88             : 
      89             :     SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const SAL_OVERRIDE;
      90             :     SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) SAL_OVERRIDE;
      91             : 
      92             :     SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage ) SAL_OVERRIDE;
      93             :     SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ) SAL_OVERRIDE;
      94             : 
      95           0 :     SVX_DLLPRIVATE bool hasSelectedCells() const { return mbCellSelectionMode || mpView->IsTextEdit(); }
      96             : 
      97             :     void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
      98             :     void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
      99             :     void clearSelection();
     100             :     void selectAll();
     101             : 
     102             :     SVX_DLLPRIVATE void onTableModified();
     103             : 
     104             :     bool selectRow( sal_Int32 row );
     105             :     bool selectColumn( sal_Int32 column );
     106             :     bool deselectRow( sal_Int32 row );
     107             :     bool deselectColumn( sal_Int32 column );
     108             :     bool isRowSelected( sal_Int32 nRow );
     109             :     bool isColumnSelected( sal_Int32 nColumn );
     110             :     bool isRowHeader();
     111             :     bool isColumnHeader();
     112           0 :     ::sdr::table::SdrTableObj* GetTableObj() { return dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() ); }
     113             :     //declare event notification method
     114             :     void NotifySelection( const CellPos& firstPos, const CellPos& lastPos, const CellPos& newPos );
     115             : private:
     116             :     SvxTableController(SvxTableController &); // not defined
     117             :     void operator =(SvxTableController &); // not defined
     118             : 
     119             :     // internals
     120             :     SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr );
     121             :     SVX_DLLPRIVATE void UpdateTableShape();
     122             : 
     123             :     SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs );
     124             :     SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs );
     125             : 
     126             :     SVX_DLLPRIVATE bool PasteObject( SdrTableObj* pPasteTableObj );
     127             : 
     128             :     SVX_DLLPRIVATE bool checkTableObject();
     129             :     SVX_DLLPRIVATE bool updateTableObject();
     130             :     SVX_DLLPRIVATE const CellPos& getSelectionStart();
     131             :     SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos );
     132             :     SVX_DLLPRIVATE const CellPos& getSelectionEnd();
     133             :     SVX_DLLPRIVATE void checkCell( CellPos& rPos );
     134             : 
     135             :     SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
     136             : 
     137             :     SVX_DLLPRIVATE void EditCell( const CellPos& rPos, ::Window* pWindow, const ::com::sun::star::awt::MouseEvent* pMouseEvent = 0, sal_uInt16 nAction = 0 );
     138             :     SVX_DLLPRIVATE bool StopTextEdit();
     139             : 
     140             :     SVX_DLLPRIVATE sal_uInt16 getKeyboardAction( const KeyEvent& rKEvt, Window* pWindow );
     141             :     SVX_DLLPRIVATE bool executeAction( sal_uInt16 nAction, bool bSelect, Window* pWindow );
     142             :     SVX_DLLPRIVATE void gotoCell( const CellPos& rCell, bool bSelect, Window* pWindow, sal_uInt16 nAction = 0 );
     143             : 
     144             :     SVX_DLLPRIVATE void StartSelection( const CellPos& rPos );
     145             :     SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos );
     146             :     SVX_DLLPRIVATE void RemoveSelection();
     147             :     SVX_DLLPRIVATE void updateSelectionOverlay();
     148             :     SVX_DLLPRIVATE void destroySelectionOverlay();
     149             : 
     150             :     SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos );
     151             : 
     152             :     DECL_LINK( UpdateHdl, void * );
     153             : 
     154             :     //TableModelRef mxTable;
     155             :     rtl::Reference< TableModel > mxTable;
     156             : 
     157             :     CellPos maCursorFirstPos;
     158             :     CellPos maCursorLastPos;
     159             :     bool mbCellSelectionMode;
     160             :     CellPos maMouseDownPos;
     161             :     bool mbLeftButtonDown;
     162             :     ::sdr::overlay::OverlayObjectList*  mpSelectionOverlay;
     163             : 
     164             :     SdrView* mpView;
     165             :     SdrObjectWeakRef mxTableObj;
     166             :     SdrModel* mpModel;
     167             : 
     168             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxModifyListener;
     169             : 
     170             :     sal_uLong mnUpdateEvent;
     171             : };
     172             : 
     173             : rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
     174             : 
     175             : } }
     176             : 
     177             : #endif // INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
     178             : 
     179             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10