1c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c45d927aSAndrew Rist  * distributed with this work for additional information
6c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10c45d927aSAndrew Rist  *
11c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12c45d927aSAndrew Rist  *
13c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17c45d927aSAndrew Rist  * specific language governing permissions and limitations
18c45d927aSAndrew Rist  * under the License.
19c45d927aSAndrew Rist  *
20c45d927aSAndrew Rist  *************************************************************/
21c45d927aSAndrew Rist 
22c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SD_TABLEDESIGNPANE_HXX
25cdf0e10cSrcweir #define _SD_TABLEDESIGNPANE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
28cdf0e10cSrcweir #include <com/sun/star/ui/XUIElement.hpp>
29*f6859a6bSAndre Fischer #include <com/sun/star/ui/LayoutSize.hpp>
30cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp>
31cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vcl/dialog.hxx>
34cdf0e10cSrcweir #include <vcl/fixed.hxx>
35cdf0e10cSrcweir #include <vcl/button.hxx>
36cdf0e10cSrcweir #include <svtools/valueset.hxx>
37*f6859a6bSAndre Fischer #include <sfx2/sidebar/ILayoutableWindow.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <boost/scoped_ptr.hpp>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include "TableDesignPane.hrc"
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace sd
44cdf0e10cSrcweir {
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace tools {
47cdf0e10cSrcweir class EventMultiplexerEvent;
48cdf0e10cSrcweir }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class ViewShellBase;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir // --------------------------------------------------------------------
53cdf0e10cSrcweir 
54*f6859a6bSAndre Fischer class TableDesignPane : public Control, public sfx2::sidebar::ILayoutableWindow
55cdf0e10cSrcweir {
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir 	TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
58cdf0e10cSrcweir 	virtual ~TableDesignPane();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	// callbacks
61cdf0e10cSrcweir 	void onSelectionChanged();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	// Control
64cdf0e10cSrcweir 	virtual void Resize();
65cdf0e10cSrcweir 
66*f6859a6bSAndre Fischer     // ILayoutableWindow
67*f6859a6bSAndre Fischer     virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
68*f6859a6bSAndre Fischer 
69cdf0e10cSrcweir     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	void ApplyOptions();
72cdf0e10cSrcweir 	void ApplyStyle();
73cdf0e10cSrcweir 
isStyleChanged() const74cdf0e10cSrcweir 	bool isStyleChanged() const { return mbStyleSelected; }
isOptionsChanged() const75cdf0e10cSrcweir 	bool isOptionsChanged() const { return mbOptionsChanged; }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir private:
78cdf0e10cSrcweir 	void addListener();
79cdf0e10cSrcweir 	void removeListener();
80cdf0e10cSrcweir 	void updateLayout();
81cdf0e10cSrcweir 	void updateControls();
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	void FillDesignPreviewControl();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
86cdf0e10cSrcweir 	DECL_LINK(implValueSetHdl, Control* );
87cdf0e10cSrcweir 	DECL_LINK(implCheckBoxHdl, Control* );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir private:
90cdf0e10cSrcweir 	ViewShellBase& mrBase;
91cdf0e10cSrcweir 	const rtl::OUString msTableTemplate;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	boost::scoped_ptr< Control > mxControls[DESIGNPANE_CONTROL_COUNT];
94cdf0e10cSrcweir 	int mnOrgOffsetY[DESIGNPANE_CONTROL_COUNT];
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedTable;
97cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
98cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableFamily;
99cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > mxToolbar;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	bool mbModal;
102cdf0e10cSrcweir 	bool mbStyleSelected;
103cdf0e10cSrcweir 	bool mbOptionsChanged;
104cdf0e10cSrcweir };
105cdf0e10cSrcweir 
106cdf0e10cSrcweir // --------------------------------------------------------------------
107cdf0e10cSrcweir 
108cdf0e10cSrcweir class TableDesignDialog : public ModalDialog
109cdf0e10cSrcweir {
110cdf0e10cSrcweir public:
111cdf0e10cSrcweir 	TableDesignDialog( ::Window* pParent, ViewShellBase& rBase );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	virtual short Execute();
114cdf0e10cSrcweir private:
115cdf0e10cSrcweir 	ViewShellBase& mrBase;
116cdf0e10cSrcweir 	boost::scoped_ptr< TableDesignPane > mpDesignPane;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	boost::scoped_ptr< FixedLine >		 mxFlSep1;
119cdf0e10cSrcweir 	boost::scoped_ptr< FixedLine >		 mxFlSep2;
120cdf0e10cSrcweir 	boost::scoped_ptr< HelpButton >		 mxHelpButton;
121cdf0e10cSrcweir 	boost::scoped_ptr< OKButton >		 mxOkButton;
122cdf0e10cSrcweir 	boost::scoped_ptr< CancelButton >	 mxCancelButton;
123cdf0e10cSrcweir };
124cdf0e10cSrcweir 
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir #endif // _SD_TABLEFORMATPANE_HXX
128