Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_FILTER_SOURCE_XSLTDIALOG_XMLFILTERSETTINGSDIALOG_HXX
20 : #define INCLUDED_FILTER_SOURCE_XSLTDIALOG_XMLFILTERSETTINGSDIALOG_HXX
21 :
22 : #include <com/sun/star/lang/XComponent.hpp>
23 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 : #include <com/sun/star/container/XHierarchicalName.hpp>
25 : #include <com/sun/star/container/XNameContainer.hpp>
26 : #include <vcl/button.hxx>
27 : #include <vcl/dialog.hxx>
28 : #include <vcl/layout.hxx>
29 : #include <svtools/svtabbx.hxx>
30 : #include <svl/poolitem.hxx>
31 : #include <unotools/moduleoptions.hxx>
32 :
33 : #include "xmlfiltercommon.hxx"
34 :
35 : class HeaderBar;
36 : class XMLFilterListBox;
37 :
38 : class SvxPathControl : public vcl::Window
39 : {
40 : private:
41 : bool bHasBeenShown;
42 : VclPtr<VclVBox> m_pVBox;
43 : VclPtr<HeaderBar> m_pHeaderBar;
44 : VclPtr<XMLFilterListBox> m_pFocusCtrl;
45 : protected:
46 : virtual void Resize() SAL_OVERRIDE;
47 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
48 : public:
49 : SvxPathControl(vcl::Window* pParent);
50 0 : HeaderBar* getHeaderBar() { return m_pHeaderBar; }
51 0 : XMLFilterListBox* getListBox() { return m_pFocusCtrl; }
52 : virtual ~SvxPathControl();
53 : virtual void dispose() SAL_OVERRIDE;
54 :
55 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
56 : };
57 :
58 : class HeaderBar;
59 :
60 : class XMLFilterListBox : public SvTabListBox
61 : {
62 : private:
63 : VclPtr<HeaderBar> m_pHeaderBar;
64 :
65 : DECL_LINK( TabBoxScrollHdl_Impl, SvTabListBox* );
66 : DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
67 :
68 : static OUString getEntryString( const filter_info_impl* pInfo );
69 :
70 : public:
71 : XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl);
72 : virtual ~XMLFilterListBox();
73 : virtual void dispose() SAL_OVERRIDE;
74 :
75 : /** adds a new filter info entry to the ui filter list */
76 : void addFilterEntry( const filter_info_impl* pInfo );
77 :
78 : void changeEntry( const filter_info_impl* pInfo );
79 :
80 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
81 : };
82 :
83 :
84 :
85 : class XMLFilterSettingsDialog : public ModelessDialog
86 : {
87 : public:
88 : XMLFilterSettingsDialog(vcl::Window* pParent,
89 : const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
90 : Dialog::InitFlag eFlag = Dialog::InitFlag::Default);
91 : virtual ~XMLFilterSettingsDialog();
92 : virtual void dispose() SAL_OVERRIDE;
93 :
94 : DECL_LINK(ClickHdl_Impl, PushButton * );
95 : DECL_LINK(SelectionChangedHdl_Impl, void * );
96 : DECL_LINK(DoubleClickHdl_Impl, void * );
97 :
98 : virtual short Execute() SAL_OVERRIDE;
99 :
100 : void onNew();
101 : void onEdit();
102 : void onTest();
103 : void onDelete();
104 : void onSave();
105 : void onOpen();
106 : void onClose();
107 :
108 : void updateStates();
109 :
110 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
111 :
112 0 : bool isClosable() { return m_bIsClosable;}
113 :
114 : private:
115 : void initFilterList();
116 : void disposeFilterList();
117 :
118 : bool insertOrEdit( filter_info_impl* pNewInfo, const filter_info_impl* pOldInfo = NULL );
119 :
120 : OUString createUniqueFilterName( const OUString& rUIName );
121 : OUString createUniqueTypeName( const OUString& rTypeName );
122 : OUString createUniqueInterfaceName( const OUString& rInterfaceName );
123 :
124 : private:
125 :
126 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
127 : com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxFilterContainer;
128 : com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxTypeDetection;
129 : com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxExtendedTypeDetection;
130 :
131 : std::vector< filter_info_impl* > maFilterVector;
132 :
133 : VclPtr<XMLFilterListBox> m_pFilterListBox;
134 : VclPtr<SvxPathControl> m_pCtrlFilterList;
135 : VclPtr<PushButton> m_pPBNew;
136 : VclPtr<PushButton> m_pPBEdit;
137 : VclPtr<PushButton> m_pPBTest;
138 : VclPtr<PushButton> m_pPBDelete;
139 : VclPtr<PushButton> m_pPBSave;
140 : VclPtr<PushButton> m_pPBOpen;
141 : VclPtr<CloseButton> m_pPBClose;
142 :
143 : bool m_bIsClosable;
144 :
145 : OUString m_sTemplatePath;
146 : OUString m_sDocTypePrefix;
147 :
148 : SvtModuleOptions maModuleOpt;
149 : };
150 :
151 : #endif
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|