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