1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SD_TABLEDESIGNPANE_HXX
29 #define _SD_TABLEDESIGNPANE_HXX
30 
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/ui/XUIElement.hpp>
33 #include <com/sun/star/drawing/XDrawView.hpp>
34 #include <com/sun/star/container/XIndexAccess.hpp>
35 
36 #include <vcl/dialog.hxx>
37 #include <vcl/fixed.hxx>
38 #include <vcl/button.hxx>
39 #include <svtools/valueset.hxx>
40 
41 #include <boost/scoped_ptr.hpp>
42 
43 #include "TableDesignPane.hrc"
44 
45 namespace sd
46 {
47 
48 namespace tools {
49 class EventMultiplexerEvent;
50 }
51 
52 class ViewShellBase;
53 
54 // --------------------------------------------------------------------
55 
56 class TableDesignPane : public Control
57 {
58 public:
59 	TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
60 	virtual ~TableDesignPane();
61 
62 	// callbacks
63 	void onSelectionChanged();
64 
65 	// Control
66 	virtual void Resize();
67 
68     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
69 
70 	void ApplyOptions();
71 	void ApplyStyle();
72 
73 	bool isStyleChanged() const { return mbStyleSelected; }
74 	bool isOptionsChanged() const { return mbOptionsChanged; }
75 
76 private:
77 	void addListener();
78 	void removeListener();
79 	void updateLayout();
80 	void updateControls();
81 
82 	void FillDesignPreviewControl();
83 
84     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
85 	DECL_LINK(implValueSetHdl, Control* );
86 	DECL_LINK(implCheckBoxHdl, Control* );
87 
88 private:
89 	ViewShellBase& mrBase;
90 	const rtl::OUString msTableTemplate;
91 
92 	boost::scoped_ptr< Control > mxControls[DESIGNPANE_CONTROL_COUNT];
93 	int mnOrgOffsetY[DESIGNPANE_CONTROL_COUNT];
94 
95 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedTable;
96 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
97 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableFamily;
98 	::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > mxToolbar;
99 
100 	bool mbModal;
101 	bool mbStyleSelected;
102 	bool mbOptionsChanged;
103 };
104 
105 // --------------------------------------------------------------------
106 
107 class TableDesignDialog : public ModalDialog
108 {
109 public:
110 	TableDesignDialog( ::Window* pParent, ViewShellBase& rBase );
111 
112 	virtual short Execute();
113 private:
114 	ViewShellBase& mrBase;
115 	boost::scoped_ptr< TableDesignPane > mpDesignPane;
116 
117 	boost::scoped_ptr< FixedLine >		 mxFlSep1;
118 	boost::scoped_ptr< FixedLine >		 mxFlSep2;
119 	boost::scoped_ptr< HelpButton >		 mxHelpButton;
120 	boost::scoped_ptr< OKButton >		 mxOkButton;
121 	boost::scoped_ptr< CancelButton >	 mxCancelButton;
122 };
123 
124 }
125 
126 #endif // _SD_TABLEFORMATPANE_HXX
127