xref: /aoo41x/main/sfx2/inc/sfx2/dinfdlg.hxx (revision c3916d03)
1353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5353d8f4dSAndrew Rist  * distributed with this work for additional information
6353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10353d8f4dSAndrew Rist  *
11353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12353d8f4dSAndrew Rist  *
13353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18353d8f4dSAndrew Rist  * under the License.
19353d8f4dSAndrew Rist  *
20353d8f4dSAndrew Rist  *************************************************************/
21353d8f4dSAndrew Rist 
22353d8f4dSAndrew Rist 
23cdf0e10cSrcweir #ifndef _SFX_DINFDLG_HXX
24cdf0e10cSrcweir #define _SFX_DINFDLG_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "sal/config.h"
27cdf0e10cSrcweir #include "sfx2/dllapi.h"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp>
30cdf0e10cSrcweir #include <vcl/edit.hxx>
31cdf0e10cSrcweir #include <vcl/field.hxx>
32cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
33cdf0e10cSrcweir #include <svl/stritem.hxx>
34cdf0e10cSrcweir #include <svtools/svmedit.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <vcl/edit.hxx>
37cdf0e10cSrcweir #include <vcl/lstbox.hxx>
38cdf0e10cSrcweir #include <vcl/scrbar.hxx>
39cdf0e10cSrcweir #include <svtools/headbar.hxx>
40cdf0e10cSrcweir #include <unotools/syslocale.hxx>
41cdf0e10cSrcweir #include <svl/zforlist.hxx>
42cdf0e10cSrcweir #include <com/sun/star/util/Duration.hpp>
43cdf0e10cSrcweir #include "tabdlg.hxx"
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace com { namespace sun { namespace star {
46cdf0e10cSrcweir     namespace document {
47cdf0e10cSrcweir         class XDocumentProperties;
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir } } }
50cdf0e10cSrcweir 
51cdf0e10cSrcweir struct CustomProperty;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 
54cdf0e10cSrcweir // class SfxDocumentInfoItem ---------------------------------------------
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxDocumentInfoItem : public SfxStringItem
57cdf0e10cSrcweir {
58cdf0e10cSrcweir private:
59cdf0e10cSrcweir     sal_Int32                           m_AutoloadDelay;
60cdf0e10cSrcweir     ::rtl::OUString                     m_AutoloadURL;
61cdf0e10cSrcweir     sal_Bool                            m_isAutoloadEnabled;
62cdf0e10cSrcweir     ::rtl::OUString                     m_DefaultTarget;
63cdf0e10cSrcweir     ::rtl::OUString                     m_TemplateName;
64cdf0e10cSrcweir     ::rtl::OUString                     m_Author;
65cdf0e10cSrcweir     ::com::sun::star::util::DateTime    m_CreationDate;
66cdf0e10cSrcweir     ::rtl::OUString                     m_ModifiedBy;
67cdf0e10cSrcweir     ::com::sun::star::util::DateTime    m_ModificationDate;
68cdf0e10cSrcweir     ::rtl::OUString                     m_PrintedBy;
69cdf0e10cSrcweir     ::com::sun::star::util::DateTime    m_PrintDate;
70cdf0e10cSrcweir     sal_Int16                           m_EditingCycles;
71cdf0e10cSrcweir     sal_Int32                           m_EditingDuration;
72cdf0e10cSrcweir     ::rtl::OUString                     m_Description;
73cdf0e10cSrcweir     ::rtl::OUString                     m_Keywords;
74cdf0e10cSrcweir     ::rtl::OUString                     m_Subject;
75cdf0e10cSrcweir     ::rtl::OUString                     m_Title;
76cdf0e10cSrcweir     sal_Bool                            m_bHasTemplate;
77cdf0e10cSrcweir     sal_Bool                            m_bDeleteUserData;
78cdf0e10cSrcweir     sal_Bool                            m_bUseUserData;
79cdf0e10cSrcweir     std::vector< CustomProperty* >      m_aCustomProperties;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir public:
82cdf0e10cSrcweir 	TYPEINFO();
83cdf0e10cSrcweir 	SfxDocumentInfoItem();
84cdf0e10cSrcweir 	SfxDocumentInfoItem( const String &rFileName,
85cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
86cdf0e10cSrcweir             ::com::sun::star::document::XDocumentProperties> & i_xDocProps,
87cdf0e10cSrcweir         sal_Bool bUseUserData );
88cdf0e10cSrcweir 	SfxDocumentInfoItem( const SfxDocumentInfoItem& );
89cdf0e10cSrcweir 	virtual ~SfxDocumentInfoItem();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     /// update i_xDocProps with the data in this object
92cdf0e10cSrcweir     void UpdateDocumentInfo(
93cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
94cdf0e10cSrcweir             ::com::sun::star::document::XDocumentProperties> & i_xDocProps,
95cdf0e10cSrcweir         bool i_bDoNotUpdateUserDefined = false)
96cdf0e10cSrcweir         const;
97cdf0e10cSrcweir 
isAutoloadEnabled() const98cdf0e10cSrcweir     sal_Bool    isAutoloadEnabled() const { return m_isAutoloadEnabled; }
setAutoloadEnabled(sal_Bool i_val)99cdf0e10cSrcweir     void        setAutoloadEnabled(sal_Bool i_val) { m_isAutoloadEnabled = i_val; }
getAutoloadDelay() const100cdf0e10cSrcweir     sal_Int32   getAutoloadDelay() const { return m_AutoloadDelay; }
setAutoloadDelay(sal_Int32 i_val)101cdf0e10cSrcweir     void        setAutoloadDelay(sal_Int32 i_val) { m_AutoloadDelay = i_val; }
getAutoloadURL() const102cdf0e10cSrcweir     ::rtl::OUString getAutoloadURL() const { return m_AutoloadURL; }
setAutoloadURL(::rtl::OUString i_val)103cdf0e10cSrcweir     void        setAutoloadURL(::rtl::OUString i_val) { m_AutoloadURL = i_val; }
getDefaultTarget() const104cdf0e10cSrcweir     ::rtl::OUString getDefaultTarget() const { return m_DefaultTarget; }
setDefaultTarget(::rtl::OUString i_val)105cdf0e10cSrcweir     void        setDefaultTarget(::rtl::OUString i_val) { m_DefaultTarget = i_val; }
getTemplateName() const106cdf0e10cSrcweir     ::rtl::OUString getTemplateName() const { return m_TemplateName; }
setTemplateName(::rtl::OUString i_val)107cdf0e10cSrcweir     void        setTemplateName(::rtl::OUString i_val) { m_TemplateName = i_val; }
getAuthor() const108cdf0e10cSrcweir     ::rtl::OUString getAuthor() const { return m_Author; }
setAuthor(::rtl::OUString i_val)109cdf0e10cSrcweir     void        setAuthor(::rtl::OUString i_val) { m_Author = i_val; }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     ::com::sun::star::util::DateTime
getCreationDate() const112cdf0e10cSrcweir                 getCreationDate() const { return m_CreationDate; }
setCreationDate(::com::sun::star::util::DateTime i_val)113cdf0e10cSrcweir     void        setCreationDate(::com::sun::star::util::DateTime i_val) {
114cdf0e10cSrcweir                     m_CreationDate = i_val;
115cdf0e10cSrcweir                 }
getModifiedBy() const116cdf0e10cSrcweir     ::rtl::OUString getModifiedBy() const { return m_ModifiedBy; }
setModifiedBy(::rtl::OUString i_val)117cdf0e10cSrcweir     void        setModifiedBy(::rtl::OUString i_val) { m_ModifiedBy = i_val; }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     ::com::sun::star::util::DateTime
getModificationDate() const120cdf0e10cSrcweir                 getModificationDate() const { return m_ModificationDate; }
setModificationDate(::com::sun::star::util::DateTime i_val)121cdf0e10cSrcweir     void        setModificationDate(::com::sun::star::util::DateTime i_val) {
122cdf0e10cSrcweir                     m_ModificationDate = i_val;
123cdf0e10cSrcweir                 }
getPrintedBy() const124cdf0e10cSrcweir     ::rtl::OUString getPrintedBy() const { return m_PrintedBy; }
setPrintedBy(::rtl::OUString i_val)125cdf0e10cSrcweir     void        setPrintedBy(::rtl::OUString i_val) { m_PrintedBy = i_val; }
126cdf0e10cSrcweir     ::com::sun::star::util::DateTime
getPrintDate() const127cdf0e10cSrcweir                 getPrintDate() const { return m_PrintDate; }
setPrintDate(::com::sun::star::util::DateTime i_val)128cdf0e10cSrcweir     void        setPrintDate(::com::sun::star::util::DateTime i_val) {
129cdf0e10cSrcweir                     m_PrintDate = i_val;
130cdf0e10cSrcweir                 }
getEditingCycles() const131cdf0e10cSrcweir     sal_Int16   getEditingCycles() const { return m_EditingCycles; }
setEditingCycles(sal_Int16 i_val)132cdf0e10cSrcweir     void        setEditingCycles(sal_Int16 i_val) { m_EditingCycles = i_val; }
getEditingDuration() const133cdf0e10cSrcweir     sal_Int32   getEditingDuration() const { return m_EditingDuration; }
setEditingDuration(sal_Int32 i_val)134cdf0e10cSrcweir     void        setEditingDuration(sal_Int32 i_val) { m_EditingDuration = i_val; }
getDescription() const135cdf0e10cSrcweir     ::rtl::OUString getDescription() const { return m_Description; }
setDescription(::rtl::OUString i_val)136cdf0e10cSrcweir     void        setDescription(::rtl::OUString i_val) { m_Description = i_val; }
getKeywords() const137cdf0e10cSrcweir     ::rtl::OUString getKeywords() const { return m_Keywords; }
setKeywords(::rtl::OUString i_val)138cdf0e10cSrcweir     void        setKeywords(::rtl::OUString i_val) { m_Keywords = i_val; }
getSubject() const139cdf0e10cSrcweir     ::rtl::OUString getSubject() const { return m_Subject; }
setSubject(::rtl::OUString i_val)140cdf0e10cSrcweir     void        setSubject(::rtl::OUString i_val) { m_Subject = i_val; }
getTitle() const141cdf0e10cSrcweir     ::rtl::OUString getTitle() const { return m_Title; }
setTitle(::rtl::OUString i_val)142cdf0e10cSrcweir     void        setTitle(::rtl::OUString i_val) { m_Title = i_val; }
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     /// reset user-specific data (author, modified-by, ...)
145cdf0e10cSrcweir     void        resetUserData(const ::rtl::OUString & i_rAuthor);
146cdf0e10cSrcweir 
SetTemplate(sal_Bool b)147cdf0e10cSrcweir     void        SetTemplate( sal_Bool b ) { m_bHasTemplate = b; }
HasTemplate() const148cdf0e10cSrcweir     sal_Bool    HasTemplate() const { return m_bHasTemplate; }
149cdf0e10cSrcweir     void        SetDeleteUserData( sal_Bool bSet );
150cdf0e10cSrcweir     void        SetUseUserData( sal_Bool bSet );
151cdf0e10cSrcweir     sal_Bool    IsDeleteUserData() const;
152cdf0e10cSrcweir     sal_Bool    IsUseUserData() const;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     std::vector< CustomProperty* >  GetCustomProperties() const;
155cdf0e10cSrcweir     void        ClearCustomProperties();
156cdf0e10cSrcweir     void        AddCustomProperty(  const ::rtl::OUString& sName,
157cdf0e10cSrcweir                                     const com::sun::star::uno::Any& rValue );
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	virtual SfxPoolItem*    Clone( SfxItemPool* pPool = NULL ) const;
160cdf0e10cSrcweir 	virtual int             operator==( const SfxPoolItem& ) const;
161cdf0e10cSrcweir 	virtual	sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
162cdf0e10cSrcweir 	virtual	sal_Bool		PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
163cdf0e10cSrcweir };
164cdf0e10cSrcweir 
165cdf0e10cSrcweir // class SfxDocumentPage -------------------------------------------------
166cdf0e10cSrcweir 
167cdf0e10cSrcweir class SfxDocumentPage : public SfxTabPage
168cdf0e10cSrcweir {
169cdf0e10cSrcweir private:
170cdf0e10cSrcweir     FixedImage                  aBmp1;
171cdf0e10cSrcweir     Edit                        aNameED;
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     FixedLine                   aLine1FL;
174cdf0e10cSrcweir     FixedText                   aTypeFT;
175cdf0e10cSrcweir     svt::SelectableFixedText    aShowTypeFT;
176cdf0e10cSrcweir     CheckBox                    aReadOnlyCB;
177cdf0e10cSrcweir     FixedText                   aFileFt;
178cdf0e10cSrcweir     svt::SelectableFixedText    aFileValFt;
179cdf0e10cSrcweir     FixedText                   aSizeFT;
180cdf0e10cSrcweir     svt::SelectableFixedText    aShowSizeFT;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     FixedLine                   aLine2FL;
183cdf0e10cSrcweir     FixedText                   aCreateFt;
184cdf0e10cSrcweir     svt::SelectableFixedText    aCreateValFt;
185cdf0e10cSrcweir     FixedText                   aChangeFt;
186cdf0e10cSrcweir     svt::SelectableFixedText    aChangeValFt;
187cdf0e10cSrcweir     FixedText                   aSignedFt;
188cdf0e10cSrcweir     svt::SelectableFixedText    aSignedValFt;
189cdf0e10cSrcweir     PushButton                  aSignatureBtn;
190cdf0e10cSrcweir     FixedText                   aPrintFt;
191cdf0e10cSrcweir     svt::SelectableFixedText    aPrintValFt;
192cdf0e10cSrcweir     FixedText                   aTimeLogFt;
193cdf0e10cSrcweir     svt::SelectableFixedText    aTimeLogValFt;
194cdf0e10cSrcweir     FixedText                   aDocNoFt;
195cdf0e10cSrcweir     svt::SelectableFixedText    aDocNoValFt;
196cdf0e10cSrcweir     CheckBox                    aUseUserDataCB;
197cdf0e10cSrcweir     PushButton                  aDeleteBtn;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     FixedLine                   aLine3FL;
200cdf0e10cSrcweir     FixedText                   aTemplFt;
201cdf0e10cSrcweir     svt::SelectableFixedText    aTemplValFt;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     String                      aUnknownSize;
204cdf0e10cSrcweir     String                      aMultiSignedStr;
205cdf0e10cSrcweir 
206cdf0e10cSrcweir     sal_Bool                        bEnableUseUserData  : 1,
207cdf0e10cSrcweir                                 bHandleDelete       : 1;
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     DECL_LINK(          DeleteHdl, PushButton * );
210cdf0e10cSrcweir     DECL_LINK(          SignatureHdl, PushButton * );
211cdf0e10cSrcweir     void                ImplUpdateSignatures();
212cdf0e10cSrcweir 
213cdf0e10cSrcweir protected:
214cdf0e10cSrcweir 	SfxDocumentPage( Window* pParent, const SfxItemSet& );
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 	virtual sal_Bool		FillItemSet( SfxItemSet& );
217cdf0e10cSrcweir 	virtual void		Reset( const SfxItemSet& );
218cdf0e10cSrcweir 
219cdf0e10cSrcweir public:
220cdf0e10cSrcweir 	static SfxTabPage*	Create( Window* pParent, const SfxItemSet& );
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 	void				EnableUseUserData();
223cdf0e10cSrcweir };
224cdf0e10cSrcweir 
225cdf0e10cSrcweir // class SfxDocumentDescPage ---------------------------------------------
226cdf0e10cSrcweir 
227cdf0e10cSrcweir class SfxDocumentDescPage : public SfxTabPage
228cdf0e10cSrcweir {
229cdf0e10cSrcweir private:
230cdf0e10cSrcweir 	FixedText				aTitleFt;
231cdf0e10cSrcweir 	Edit					aTitleEd;
232cdf0e10cSrcweir 	FixedText				aThemaFt;
233cdf0e10cSrcweir 	Edit					aThemaEd;
234cdf0e10cSrcweir 	FixedText				aKeywordsFt;
235cdf0e10cSrcweir 	Edit					aKeywordsEd;
236cdf0e10cSrcweir 	FixedText				aCommentFt;
237cdf0e10cSrcweir 	MultiLineEdit			aCommentEd;
238cdf0e10cSrcweir 	SfxDocumentInfoItem*	pInfoItem;
239cdf0e10cSrcweir 
240cdf0e10cSrcweir protected:
241cdf0e10cSrcweir 	SfxDocumentDescPage( Window* pParent, const SfxItemSet& );
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 	virtual sal_Bool        	FillItemSet( SfxItemSet& );
244cdf0e10cSrcweir 	virtual void        	Reset( const SfxItemSet& );
245cdf0e10cSrcweir 
246cdf0e10cSrcweir public:
247cdf0e10cSrcweir 	static SfxTabPage*		Create( Window* pParent, const SfxItemSet& );
248cdf0e10cSrcweir };
249cdf0e10cSrcweir 
250cdf0e10cSrcweir // class SfxInternetPage -------------------------------------------------
251cdf0e10cSrcweir 
252cdf0e10cSrcweir class TargetList;
253cdf0e10cSrcweir namespace sfx2
254cdf0e10cSrcweir {
255cdf0e10cSrcweir     class FileDialogHelper;
256cdf0e10cSrcweir }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir class SfxInternetPage : public SfxTabPage
259cdf0e10cSrcweir {
260cdf0e10cSrcweir private:
261cdf0e10cSrcweir 	RadioButton				aRBNoAutoUpdate;
262cdf0e10cSrcweir 	RadioButton				aRBReloadUpdate;
263cdf0e10cSrcweir 	RadioButton				aRBForwardUpdate;
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 	FixedText				aFTEvery;
266cdf0e10cSrcweir 	NumericField			aNFReload;
267cdf0e10cSrcweir 	FixedText				aFTReloadSeconds;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 	FixedText				aFTAfter;
270cdf0e10cSrcweir 	NumericField			aNFAfter;
271cdf0e10cSrcweir 	FixedText				aFTAfterSeconds;
272cdf0e10cSrcweir 	FixedText				aFTURL;
273cdf0e10cSrcweir 	Edit					aEDForwardURL;
274cdf0e10cSrcweir 	PushButton				aPBBrowseURL;
275cdf0e10cSrcweir 	FixedText				aFTFrame;
276cdf0e10cSrcweir 	ComboBox				aCBFrame;
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	String					aForwardErrorMessg;
279cdf0e10cSrcweir     String                  aBaseURL;
280cdf0e10cSrcweir 	SfxDocumentInfoItem*	pInfoItem;
281cdf0e10cSrcweir     sfx2::FileDialogHelper* pFileDlg;
282cdf0e10cSrcweir 
283cdf0e10cSrcweir     enum STATE              { S_Init, S_NoUpdate, S_Reload, S_Forward };
284cdf0e10cSrcweir 							// S_Init is only valid as initial value
285cdf0e10cSrcweir 	STATE					eState;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 	void					ChangeState( STATE eNewState );		// S_Init is not a valid value here
288cdf0e10cSrcweir 																// also checks corresponding radiobutton
289cdf0e10cSrcweir 	void					EnableNoUpdate( sal_Bool bEnable );
290cdf0e10cSrcweir 	void					EnableReload( sal_Bool bEnable );
291cdf0e10cSrcweir 	void					EnableForward( sal_Bool bEnable );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 	DECL_LINK( ClickHdlNoUpdate, Control* );
294cdf0e10cSrcweir 	DECL_LINK( ClickHdlReload, Control* );
295cdf0e10cSrcweir 	DECL_LINK( ClickHdlForward, Control* );
296cdf0e10cSrcweir     DECL_LINK( ClickHdlBrowseURL, PushButton* );
297cdf0e10cSrcweir     DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         using TabPage::DeactivatePage;
300cdf0e10cSrcweir 
301cdf0e10cSrcweir protected:
302cdf0e10cSrcweir     SfxInternetPage( Window* pParent, const SfxItemSet& );
303cdf0e10cSrcweir     ~SfxInternetPage();
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 	virtual sal_Bool			FillItemSet( SfxItemSet& );
306cdf0e10cSrcweir 	virtual void			Reset( const SfxItemSet& );
307cdf0e10cSrcweir 	virtual int                     DeactivatePage( SfxItemSet* pSet = 0 );
308cdf0e10cSrcweir 
309cdf0e10cSrcweir public:
310cdf0e10cSrcweir 	static SfxTabPage*	Create( Window* pParent, const SfxItemSet& );
311cdf0e10cSrcweir };
312cdf0e10cSrcweir 
313cdf0e10cSrcweir // class SfxDocumentInfoDialog -------------------------------------------
314cdf0e10cSrcweir 
315cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialog
316cdf0e10cSrcweir {
317cdf0e10cSrcweir protected:
318cdf0e10cSrcweir 	virtual void	PageCreated( sal_uInt16 nId, SfxTabPage& rPage );
319cdf0e10cSrcweir 
320cdf0e10cSrcweir public:
321cdf0e10cSrcweir 	SfxDocumentInfoDialog(	Window* pParent, const SfxItemSet& );
322cdf0e10cSrcweir };
323cdf0e10cSrcweir 
324cdf0e10cSrcweir // class CustomPropertiesRemoveButton ------------------------------------
325cdf0e10cSrcweir 
326cdf0e10cSrcweir struct CustomPropertyLine;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir class CustomPropertiesEdit : public Edit
329cdf0e10cSrcweir {
330cdf0e10cSrcweir private:
331cdf0e10cSrcweir     CustomPropertyLine*             m_pLine;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir public:
CustomPropertiesEdit(Window * pParent,const ResId & rResId,CustomPropertyLine * pLine)334cdf0e10cSrcweir     inline CustomPropertiesEdit(
335cdf0e10cSrcweir         Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
336cdf0e10cSrcweir             Edit( pParent, rResId ), m_pLine( pLine ) {}
337cdf0e10cSrcweir 
GetLine() const338cdf0e10cSrcweir     inline CustomPropertyLine*      GetLine() const { return m_pLine; }
339cdf0e10cSrcweir };
340cdf0e10cSrcweir 
341cdf0e10cSrcweir class CustomPropertiesTypeBox : public ListBox
342cdf0e10cSrcweir {
343cdf0e10cSrcweir private:
344cdf0e10cSrcweir     CustomPropertyLine*             m_pLine;
345cdf0e10cSrcweir 
346cdf0e10cSrcweir public:
CustomPropertiesTypeBox(Window * pParent,const ResId & rResId,CustomPropertyLine * pLine)347cdf0e10cSrcweir     inline CustomPropertiesTypeBox(
348cdf0e10cSrcweir         Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
349cdf0e10cSrcweir             ListBox( pParent, rResId ), m_pLine( pLine ) {}
350cdf0e10cSrcweir 
GetLine() const351cdf0e10cSrcweir     inline CustomPropertyLine*      GetLine() const { return m_pLine; }
352cdf0e10cSrcweir };
353cdf0e10cSrcweir 
354cdf0e10cSrcweir class CustomPropertiesDateField : public DateField
355cdf0e10cSrcweir {
356cdf0e10cSrcweir private:
357cdf0e10cSrcweir     CustomPropertyLine*             m_pLine;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir public:
CustomPropertiesDateField(Window * pParent,const ResId & rResId,CustomPropertyLine * pLine)360cdf0e10cSrcweir     inline CustomPropertiesDateField(
361cdf0e10cSrcweir         Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
362cdf0e10cSrcweir             DateField( pParent, rResId ), m_pLine( pLine ) {}
363cdf0e10cSrcweir 
GetLine() const364cdf0e10cSrcweir     inline CustomPropertyLine*      GetLine() const { return m_pLine; }
365cdf0e10cSrcweir };
366cdf0e10cSrcweir class CustomPropertiesTimeField : public TimeField
367cdf0e10cSrcweir {
368cdf0e10cSrcweir private:
369cdf0e10cSrcweir     CustomPropertyLine*             m_pLine;
370cdf0e10cSrcweir 
371cdf0e10cSrcweir public:
CustomPropertiesTimeField(Window * pParent,const ResId & rResId,CustomPropertyLine * pLine)372cdf0e10cSrcweir     inline CustomPropertiesTimeField(
373cdf0e10cSrcweir         Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
374cdf0e10cSrcweir             TimeField( pParent, rResId ), m_pLine( pLine ) {}
375cdf0e10cSrcweir 
GetLine() const376cdf0e10cSrcweir     inline CustomPropertyLine*      GetLine() const { return m_pLine; }
377cdf0e10cSrcweir };
378cdf0e10cSrcweir class CustomPropertiesDurationField : public Edit
379cdf0e10cSrcweir {
380cdf0e10cSrcweir     CustomPropertyLine*             m_pLine;
381cdf0e10cSrcweir     com::sun::star::util::Duration  m_aDuration;
382cdf0e10cSrcweir protected:
383cdf0e10cSrcweir     virtual void    RequestHelp(const HelpEvent& rEvt);
384cdf0e10cSrcweir public:
385cdf0e10cSrcweir     CustomPropertiesDurationField( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine );
386cdf0e10cSrcweir     ~CustomPropertiesDurationField();
387cdf0e10cSrcweir 
388cdf0e10cSrcweir     void SetDuration( const com::sun::star::util::Duration& rDuration );
GetDuration() const389cdf0e10cSrcweir     const com::sun::star::util::Duration& GetDuration() const { return m_aDuration; }
390cdf0e10cSrcweir };
391cdf0e10cSrcweir 
392cdf0e10cSrcweir class CustomPropertiesEditButton : public PushButton
393cdf0e10cSrcweir {
394cdf0e10cSrcweir     CustomPropertyLine*             m_pLine;
395cdf0e10cSrcweir 
396cdf0e10cSrcweir public:
397cdf0e10cSrcweir     CustomPropertiesEditButton( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine );
398cdf0e10cSrcweir     ~CustomPropertiesEditButton();
399cdf0e10cSrcweir 
400cdf0e10cSrcweir     DECL_LINK(ClickHdl, PushButton*);
401cdf0e10cSrcweir };
402cdf0e10cSrcweir 
403cdf0e10cSrcweir class CustomPropertiesRemoveButton : public ImageButton
404cdf0e10cSrcweir {
405cdf0e10cSrcweir private:
406cdf0e10cSrcweir     CustomPropertyLine*             m_pLine;
407cdf0e10cSrcweir 
408cdf0e10cSrcweir public:
CustomPropertiesRemoveButton(Window * pParent,const ResId & rResId,CustomPropertyLine * pLine)409cdf0e10cSrcweir     inline CustomPropertiesRemoveButton(
410cdf0e10cSrcweir         Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
411cdf0e10cSrcweir             ImageButton( pParent, rResId ), m_pLine( pLine ) {}
412cdf0e10cSrcweir 
GetLine() const413cdf0e10cSrcweir     inline CustomPropertyLine*      GetLine() const { return m_pLine; }
414cdf0e10cSrcweir };
415cdf0e10cSrcweir 
416cdf0e10cSrcweir class CustomPropertiesYesNoButton : public Control
417cdf0e10cSrcweir {
418cdf0e10cSrcweir private:
419cdf0e10cSrcweir     RadioButton                     m_aYesButton;
420cdf0e10cSrcweir     RadioButton                     m_aNoButton;
421cdf0e10cSrcweir 
422cdf0e10cSrcweir public:
423cdf0e10cSrcweir     CustomPropertiesYesNoButton( Window* pParent, const ResId& rResId );
424cdf0e10cSrcweir 
425cdf0e10cSrcweir     virtual void    Resize();
426cdf0e10cSrcweir 
CheckYes()427cdf0e10cSrcweir     inline void     CheckYes() { m_aYesButton.Check(); }
CheckNo()428cdf0e10cSrcweir     inline void     CheckNo() { m_aNoButton.Check(); }
IsYesChecked() const429cdf0e10cSrcweir     inline bool     IsYesChecked() const { return m_aYesButton.IsChecked() != sal_False; }
430cdf0e10cSrcweir };
431cdf0e10cSrcweir 
432cdf0e10cSrcweir // struct CustomPropertyLine ---------------------------------------------
433cdf0e10cSrcweir 
434cdf0e10cSrcweir struct CustomPropertyLine
435cdf0e10cSrcweir {
436cdf0e10cSrcweir     ComboBox                        m_aNameBox;
437cdf0e10cSrcweir     CustomPropertiesTypeBox         m_aTypeBox;
438cdf0e10cSrcweir     CustomPropertiesEdit            m_aValueEdit;
439cdf0e10cSrcweir     CustomPropertiesDateField       m_aDateField;
440cdf0e10cSrcweir     CustomPropertiesTimeField       m_aTimeField;
441cdf0e10cSrcweir     const String                    m_sDurationFormat;
442cdf0e10cSrcweir     CustomPropertiesDurationField   m_aDurationField;
443*c3916d03SAriel Constenla-Haile     CustomPropertiesEditButton      m_aEditButton;
444cdf0e10cSrcweir     CustomPropertiesYesNoButton     m_aYesNoButton;
445cdf0e10cSrcweir     CustomPropertiesRemoveButton    m_aRemoveButton;
446cdf0e10cSrcweir 
447cdf0e10cSrcweir     bool                            m_bIsRemoved;
448cdf0e10cSrcweir     bool                            m_bTypeLostFocus;
449cdf0e10cSrcweir 
450cdf0e10cSrcweir     CustomPropertyLine( Window* pParent );
451cdf0e10cSrcweir 
452cdf0e10cSrcweir     void    SetRemoved();
453cdf0e10cSrcweir };
454cdf0e10cSrcweir 
455cdf0e10cSrcweir // class CustomPropertiesWindow ------------------------------------------
456cdf0e10cSrcweir 
457cdf0e10cSrcweir class CustomPropertiesWindow : public Window
458cdf0e10cSrcweir {
459cdf0e10cSrcweir private:
460cdf0e10cSrcweir     ComboBox                            m_aNameBox;
461cdf0e10cSrcweir     ListBox                             m_aTypeBox;
462cdf0e10cSrcweir     Edit                                m_aValueEdit;
463cdf0e10cSrcweir     DateField                           m_aDateField;
464cdf0e10cSrcweir     TimeField                           m_aTimeField;
465cdf0e10cSrcweir     Edit                                m_aDurationField;
466cdf0e10cSrcweir     PushButton                          m_aEditButton;
467cdf0e10cSrcweir     CustomPropertiesYesNoButton         m_aYesNoButton;
468cdf0e10cSrcweir     ImageButton                         m_aRemoveButton;
469cdf0e10cSrcweir 
470*c3916d03SAriel Constenla-Haile     long                                m_nDatePosX;
471*c3916d03SAriel Constenla-Haile     long                                m_nTimePosX;
472*c3916d03SAriel Constenla-Haile 
473cdf0e10cSrcweir     sal_Int32                           m_nLineHeight;
474cdf0e10cSrcweir 	sal_Int32							m_nScrollPos;
475cdf0e10cSrcweir     SvtSysLocale                        m_aSysLocale;
476cdf0e10cSrcweir     std::vector< CustomPropertyLine* >  m_aCustomPropertiesLines;
477cdf0e10cSrcweir     CustomPropertyLine*                 m_pCurrentLine;
478cdf0e10cSrcweir     SvNumberFormatter                   m_aNumberFormatter;
479cdf0e10cSrcweir     Timer                               m_aEditLoseFocusTimer;
480cdf0e10cSrcweir     Timer                               m_aBoxLoseFocusTimer;
481cdf0e10cSrcweir 	Link								m_aRemovedHdl;
482cdf0e10cSrcweir 
483cdf0e10cSrcweir     DECL_LINK(  TypeHdl, CustomPropertiesTypeBox* );
484cdf0e10cSrcweir     DECL_LINK(  RemoveHdl, CustomPropertiesRemoveButton* );
485cdf0e10cSrcweir     DECL_LINK(  EditLoseFocusHdl, CustomPropertiesEdit* );
486cdf0e10cSrcweir     DECL_LINK(  BoxLoseFocusHdl, CustomPropertiesTypeBox* );
487cdf0e10cSrcweir     //add lose focus handlers of Date/TimeField?
488cdf0e10cSrcweir 
489cdf0e10cSrcweir     DECL_LINK(  EditTimeoutHdl, Timer* );
490cdf0e10cSrcweir     DECL_LINK(  BoxTimeoutHdl, Timer* );
491cdf0e10cSrcweir 
492cdf0e10cSrcweir     bool        IsLineValid( CustomPropertyLine* pLine ) const;
493cdf0e10cSrcweir     void        ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox );
494cdf0e10cSrcweir 
495cdf0e10cSrcweir public:
496cdf0e10cSrcweir     CustomPropertiesWindow( Window* pParent, const ResId& rResId );
497cdf0e10cSrcweir     ~CustomPropertiesWindow();
498cdf0e10cSrcweir 
499cdf0e10cSrcweir     void                InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
500cdf0e10cSrcweir     sal_uInt16              GetVisibleLineCount() const;
GetLineHeight() const501cdf0e10cSrcweir     inline sal_Int32    GetLineHeight() const { return m_nLineHeight; }
502cdf0e10cSrcweir     void                AddLine( const ::rtl::OUString& sName, com::sun::star::uno::Any& rAny );
503cdf0e10cSrcweir     bool                AreAllLinesValid() const;
504cdf0e10cSrcweir     void                ClearAllLines();
505cdf0e10cSrcweir     void                DoScroll( sal_Int32 nNewPos );
506cdf0e10cSrcweir 
507cdf0e10cSrcweir     bool                DoesCustomPropertyExist( const String& rName ) const;
508cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
509cdf0e10cSrcweir                         GetCustomProperties() const;
SetRemovedHdl(const Link & rLink)510cdf0e10cSrcweir 	void				SetRemovedHdl( const Link& rLink ) { m_aRemovedHdl = rLink; }
511cdf0e10cSrcweir };
512cdf0e10cSrcweir 
513cdf0e10cSrcweir // class CustomPropertiesControl -----------------------------------------
514cdf0e10cSrcweir 
515cdf0e10cSrcweir class CustomPropertiesControl : public Control
516cdf0e10cSrcweir {
517cdf0e10cSrcweir private:
518cdf0e10cSrcweir     HeaderBar               m_aHeaderBar;
519cdf0e10cSrcweir     CustomPropertiesWindow  m_aPropertiesWin;
520cdf0e10cSrcweir     ScrollBar               m_aVertScroll;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir     bool                    m_bIsInitialized;
523cdf0e10cSrcweir     sal_Int32               m_nThumbPos;
524cdf0e10cSrcweir 
525cdf0e10cSrcweir     void                    Initialize();
526cdf0e10cSrcweir 
527cdf0e10cSrcweir     DECL_LINK( ScrollHdl, ScrollBar* );
528cdf0e10cSrcweir     DECL_LINK( RemovedHdl, void* );
529cdf0e10cSrcweir 
530cdf0e10cSrcweir public:
531cdf0e10cSrcweir     CustomPropertiesControl( Window* pParent, const ResId& rResId );
532cdf0e10cSrcweir     ~CustomPropertiesControl();
533cdf0e10cSrcweir 
534cdf0e10cSrcweir     void            AddLine( const ::rtl::OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );
535cdf0e10cSrcweir 
AreAllLinesValid() const536cdf0e10cSrcweir     inline bool     AreAllLinesValid() const { return m_aPropertiesWin.AreAllLinesValid(); }
ClearAllLines()537cdf0e10cSrcweir     inline void     ClearAllLines() { m_aPropertiesWin.ClearAllLines(); }
DoesCustomPropertyExist(const String & rName) const538cdf0e10cSrcweir     inline bool     DoesCustomPropertyExist( const String& rName ) const
539cdf0e10cSrcweir                         { return m_aPropertiesWin.DoesCustomPropertyExist( rName ); }
540cdf0e10cSrcweir     inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
GetCustomProperties() const541cdf0e10cSrcweir                     GetCustomProperties() const
542cdf0e10cSrcweir                         { return m_aPropertiesWin.GetCustomProperties(); }
543cdf0e10cSrcweir };
544cdf0e10cSrcweir 
545cdf0e10cSrcweir // class SfxCustomPropertiesPage -----------------------------------------
546cdf0e10cSrcweir 
547cdf0e10cSrcweir class SfxCustomPropertiesPage : public SfxTabPage
548cdf0e10cSrcweir {
549cdf0e10cSrcweir private:
550cdf0e10cSrcweir     CustomPropertiesControl m_aPropertiesCtrl;
551cdf0e10cSrcweir     PushButton              m_aAddBtn;
552cdf0e10cSrcweir 	FixedText               m_aPropertiesFT;
553cdf0e10cSrcweir 
554cdf0e10cSrcweir     DECL_LINK(  AddHdl, PushButton* );
555cdf0e10cSrcweir 
556cdf0e10cSrcweir     using TabPage::DeactivatePage;
557cdf0e10cSrcweir 
558cdf0e10cSrcweir protected:
559cdf0e10cSrcweir     SfxCustomPropertiesPage( Window* pParent, const SfxItemSet& );
560cdf0e10cSrcweir 
561cdf0e10cSrcweir     virtual sal_Bool        FillItemSet( SfxItemSet& );
562cdf0e10cSrcweir     virtual void        Reset( const SfxItemSet& );
563cdf0e10cSrcweir     virtual int         DeactivatePage( SfxItemSet* pSet = NULL );
564cdf0e10cSrcweir 
565cdf0e10cSrcweir public:
566cdf0e10cSrcweir     static SfxTabPage*  Create( Window* pParent, const SfxItemSet& );
567cdf0e10cSrcweir };
568cdf0e10cSrcweir 
569cdf0e10cSrcweir #endif // #ifndef _SFX_DINFDLG_HXX
570cdf0e10cSrcweir 
571