fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svx / sdr / table / tablecontroller.hxx
blob2f4126c12efa21d9e4261944e52f056a846ad274
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_TABLECONTROLLER_HXX_
21 #define _SVX_TABLECONTROLLER_HXX_
23 #include <com/sun/star/util/XModifyListener.hpp>
24 #include <com/sun/star/table/XTable.hpp>
25 #include <rtl/ref.hxx>
27 #include <svx/sdr/overlay/overlayobjectlist.hxx>
28 #include <svx/selectioncontroller.hxx>
29 #include <svx/svdotable.hxx>
30 #include <svx/svdview.hxx>
31 //#include <tablemodel.hxx>
33 class SdrObjEditView;
34 class SdrObject;
35 class SfxItemSet;
36 class SvxBoxInfoItem;
37 class SvxBoxItem;
39 namespace sdr { namespace table {
41 class TableModel;
43 class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController
45 public:
46 SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj );
47 SVX_DLLPRIVATE virtual ~SvxTableController();
49 // from sdr::SelectionController
50 SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin);
51 SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
52 SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
53 SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, Window* pWin);
55 SVX_DLLPRIVATE virtual bool DeleteMarked();
57 SVX_DLLPRIVATE virtual void onSelectionHasChanged();
59 SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet );
60 SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq );
62 SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const;
63 SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
65 SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet );
66 SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );
68 // slots
69 SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 );
70 SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId );
71 SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId );
72 SVX_DLLPRIVATE void onFormatTable( SfxRequest& rReq );
73 SVX_DLLPRIVATE void MergeMarkedCells();
74 SVX_DLLPRIVATE void SplitMarkedCells();
75 SVX_DLLPRIVATE void DistributeColumns();
76 SVX_DLLPRIVATE void DistributeRows();
77 SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
79 SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
81 SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
82 SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
83 /** Fill the values that are common for all selected cells.
85 * This lets the Borders dialog to display the line arrangement
86 * properly.
88 SVX_DLLPRIVATE void FillCommonBorderAttrFromSelectedCells(SvxBoxItem& rBox, SvxBoxInfoItem& rBoxInfo) const;
90 SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
91 SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
93 SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage );
94 SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel );
96 SVX_DLLPRIVATE bool hasSelectedCells() const { return mbCellSelectionMode || mpView->IsTextEdit(); }
98 void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
99 void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
100 void clearSelection();
101 void selectAll();
103 SVX_DLLPRIVATE void onTableModified();
105 private:
106 SvxTableController(SvxTableController &); // not defined
107 void operator =(SvxTableController &); // not defined
109 // internals
110 SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr );
111 SVX_DLLPRIVATE void UpdateTableShape();
113 SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs );
114 SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs );
116 SVX_DLLPRIVATE bool PasteObject( SdrTableObj* pPasteTableObj );
118 SVX_DLLPRIVATE bool checkTableObject();
119 SVX_DLLPRIVATE bool updateTableObject();
120 SVX_DLLPRIVATE const CellPos& getSelectionStart();
121 SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos );
122 SVX_DLLPRIVATE const CellPos& getSelectionEnd();
123 SVX_DLLPRIVATE void checkCell( CellPos& rPos );
125 SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
127 SVX_DLLPRIVATE void EditCell( const CellPos& rPos, ::Window* pWindow, const ::com::sun::star::awt::MouseEvent* pMouseEvent = 0, sal_uInt16 nAction = 0 );
128 SVX_DLLPRIVATE bool StopTextEdit();
130 SVX_DLLPRIVATE sal_uInt16 getKeyboardAction( const KeyEvent& rKEvt, Window* pWindow );
131 SVX_DLLPRIVATE bool executeAction( sal_uInt16 nAction, bool bSelect, Window* pWindow );
132 SVX_DLLPRIVATE void gotoCell( const CellPos& rCell, bool bSelect, Window* pWindow, sal_uInt16 nAction = 0 );
134 SVX_DLLPRIVATE void StartSelection( const CellPos& rPos );
135 SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos );
136 SVX_DLLPRIVATE void RemoveSelection();
137 SVX_DLLPRIVATE void updateSelectionOverlay();
138 SVX_DLLPRIVATE void destroySelectionOverlay();
140 SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos );
142 DECL_LINK( UpdateHdl, void * );
144 //TableModelRef mxTable;
145 rtl::Reference< TableModel > mxTable;
147 CellPos maCursorFirstPos;
148 CellPos maCursorLastPos;
149 bool mbCellSelectionMode;
150 CellPos maMouseDownPos;
151 bool mbLeftButtonDown;
152 ::sdr::overlay::OverlayObjectList* mpSelectionOverlay;
154 SdrView* mpView;
155 SdrObjectWeakRef mxTableObj;
156 SdrModel* mpModel;
158 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxModifyListener;
160 sal_uLong mnUpdateEvent;
165 #endif // _SVX_TABLECONTROLLER_HXX_
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */