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/ui/LayoutSize.hpp>
30 #include <com/sun/star/drawing/XDrawView.hpp>
31 #include <com/sun/star/container/XIndexAccess.hpp>
32 
33 #include <vcl/dialog.hxx>
34 #include <vcl/fixed.hxx>
35 #include <vcl/button.hxx>
36 #include <svtools/valueset.hxx>
37 #include <sfx2/sidebar/ILayoutableWindow.hxx>
38 
39 #include <boost/scoped_ptr.hpp>
40 
41 #include "TableDesignPane.hrc"
42 
43 namespace sd
44 {
45 
46 namespace tools {
47 class EventMultiplexerEvent;
48 }
49 
50 class ViewShellBase;
51 
52 // --------------------------------------------------------------------
53 
54 class TableDesignPane : public Control, public sfx2::sidebar::ILayoutableWindow
55 {
56 public:
57 	TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
58 	virtual ~TableDesignPane();
59 
60 	// callbacks
61 	void onSelectionChanged();
62 
63 	// Control
64 	virtual void Resize();
65 
66     // ILayoutableWindow
67     virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
68 
69     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
70 
71 	void ApplyOptions();
72 	void ApplyStyle();
73 
isStyleChanged() const74 	bool isStyleChanged() const { return mbStyleSelected; }
isOptionsChanged() const75 	bool isOptionsChanged() const { return mbOptionsChanged; }
76 
77 private:
78 	void addListener();
79 	void removeListener();
80 	void updateLayout();
81 	void updateControls();
82 
83 	void FillDesignPreviewControl();
84 
85     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
86 	DECL_LINK(implValueSetHdl, Control* );
87 	DECL_LINK(implCheckBoxHdl, Control* );
88 
89 private:
90 	ViewShellBase& mrBase;
91 	const rtl::OUString msTableTemplate;
92 
93 	boost::scoped_ptr< Control > mxControls[DESIGNPANE_CONTROL_COUNT];
94 	int mnOrgOffsetY[DESIGNPANE_CONTROL_COUNT];
95 
96 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedTable;
97 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
98 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableFamily;
99 	::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > mxToolbar;
100 
101 	bool mbModal;
102 	bool mbStyleSelected;
103 	bool mbOptionsChanged;
104 };
105 
106 // --------------------------------------------------------------------
107 
108 class TableDesignDialog : public ModalDialog
109 {
110 public:
111 	TableDesignDialog( ::Window* pParent, ViewShellBase& rBase );
112 
113 	virtual short Execute();
114 private:
115 	ViewShellBase& mrBase;
116 	boost::scoped_ptr< TableDesignPane > mpDesignPane;
117 
118 	boost::scoped_ptr< FixedLine >		 mxFlSep1;
119 	boost::scoped_ptr< FixedLine >		 mxFlSep2;
120 	boost::scoped_ptr< HelpButton >		 mxHelpButton;
121 	boost::scoped_ptr< OKButton >		 mxOkButton;
122 	boost::scoped_ptr< CancelButton >	 mxCancelButton;
123 };
124 
125 }
126 
127 #endif // _SD_TABLEFORMATPANE_HXX
128