xref: /AOO41X/main/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx (revision 22e87013b212da8c80c93e291ad90de8f36964c2)
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 #ifndef _XMLFILTERSETTINGSDIALOG_HXX_
24 #define _XMLFILTERSETTINGSDIALOG_HXX_
25 
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/container/XHierarchicalName.hpp>
29 #include <com/sun/star/container/XNameContainer.hpp>
30 #include <vcl/wrkwin.hxx>
31 
32 #ifndef _SV_BUTTON_HXX
33 #include <vcl/button.hxx>
34 #endif
35 #include <svtools/svtabbx.hxx>
36 #include <svl/poolitem.hxx>
37 #include <unotools/moduleoptions.hxx>
38 
39 #include "xmlfiltercommon.hxx"
40 
41 // --------------------------------------------------------------------
42 
43 class SvxPathControl_Impl : public Control
44 {
45 private:
46     Control*        m_pFocusCtrl;
47 
48 public:
SvxPathControl_Impl(Window * pParent,const ResId & rId)49     SvxPathControl_Impl( Window* pParent, const ResId& rId ) :
50         Control( pParent, rId ), m_pFocusCtrl( NULL ) {}
51 
SetFocusControl(Control * pCtrl)52     void            SetFocusControl( Control* pCtrl ) { m_pFocusCtrl = pCtrl; }
53 
54     virtual long    Notify( NotifyEvent& rNEvt );
55 };
56 
57 // --------------------------------------------------------------------
58 
59 class HeaderBar;
60 
61 class XMLFilterListBox : public SvTabListBox
62 {
63 private:
64     bool        mbFirstPaint;
65     HeaderBar*  mpHeaderBar;
66 
67     DECL_LINK( TabBoxScrollHdl_Impl, SvTabListBox* );
68     DECL_LINK( HeaderSelect_Impl, HeaderBar* );
69     DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
70 
71     String getEntryString( const filter_info_impl* pInfo ) const;
72 
73 public:
74     XMLFilterListBox( SvxPathControl_Impl* pParent );
75     ~XMLFilterListBox();
76 
77     void Reset();
78 
79     /** adds a new filter info entry to the ui filter list */
80     void addFilterEntry( const filter_info_impl* pInfo );
81 
82     void changeEntry( const filter_info_impl* pInfo );
83 
84     virtual void    Paint( const Rectangle& rRect );
85 };
86 
87 // --------------------------------------------------------------------
88 
89 class XMLFilterTestDialog;
90 
91 class XMLFilterSettingsDialog : public WorkWindow
92 {
93 public:
94     XMLFilterSettingsDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF  );
95     virtual ~XMLFilterSettingsDialog();
96 
97     DECL_LINK(ClickHdl_Impl, PushButton * );
98     DECL_LINK(SelectionChangedHdl_Impl, void * );
99     DECL_LINK(DoubleClickHdl_Impl, void * );
100 
101     void ShowWindow();
102 
103     void    onNew();
104     void    onEdit();
105     void    onTest();
106     void    onDelete();
107     void    onSave();
108     void    onOpen();
109     void    onClose();
110 
111     void    updateStates();
112 
113     virtual long    Notify( NotifyEvent& rNEvt );
114 
115     bool    isClosable();
116 
117     static ResMgr* mpResMgr;
118 
119 private:
120     void    initFilterList();
121     void    disposeFilterList();
122 
123     bool    insertOrEdit( filter_info_impl* pNewInfo, const filter_info_impl* pOldInfo = NULL );
124 
125     rtl::OUString createUniqueFilterName( const rtl::OUString& rUIName );
126     rtl::OUString createUniqueTypeName( const rtl::OUString& rTypeName );
127     rtl::OUString createUniqueInterfaceName( const rtl::OUString& rInterfaceName );
128 
129 private:
130 
131     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
132     com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxFilterContainer;
133     com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxTypeDetection;
134     com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxExtendedTypeDetection;
135 
136     std::vector< filter_info_impl* > maFilterVector;
137 
138     XMLFilterListBox*   mpFilterListBox;
139     SvxPathControl_Impl maCtrlFilterList;
140     PushButton  maPBNew;
141     PushButton  maPBEdit;
142     PushButton  maPBTest;
143     PushButton  maPBDelete;
144     PushButton  maPBSave;
145     PushButton  maPBOpen;
146     HelpButton  maPBHelp;
147     PushButton  maPBClose;
148 
149     bool    mbIsClosable;
150 
151     ::rtl::OUString sTemplatePath;
152     ::rtl::OUString sDocTypePrefix;
153 
154     SvtModuleOptions maModuleOpt;
155 };
156 
157 #endif
158