fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / sfx2 / dinfdlg.hxx
blobc0758b56bc00bea750d621f171ab1f5472306483
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _SFX_DINFDLG_HXX
20 #define _SFX_DINFDLG_HXX
22 #include "sal/config.h"
23 #include "sfx2/dllapi.h"
25 #include <com/sun/star/util/DateTime.hpp>
26 #include <com/sun/star/util/Duration.hpp>
28 #include <svl/stritem.hxx>
29 #include <svl/zforlist.hxx>
31 #include <svtools/headbar.hxx>
32 #include <svtools/stdctrl.hxx>
33 #include <svtools/svmedit.hxx>
35 #include <unotools/syslocale.hxx>
37 #include <vcl/edit.hxx>
38 #include <vcl/field.hxx>
39 #include <vcl/layout.hxx>
40 #include <vcl/lstbox.hxx>
41 #include <vcl/scrbar.hxx>
43 #include "tabdlg.hxx"
45 namespace com { namespace sun { namespace star {
46 namespace document {
47 class XDocumentProperties;
49 } } }
51 struct CustomProperty;
54 // class SfxDocumentInfoItem ---------------------------------------------
56 class SFX2_DLLPUBLIC SfxDocumentInfoItem : public SfxStringItem
58 private:
59 sal_Int32 m_AutoloadDelay;
60 OUString m_AutoloadURL;
61 sal_Bool m_isAutoloadEnabled;
62 OUString m_DefaultTarget;
63 OUString m_TemplateName;
64 OUString m_Author;
65 ::com::sun::star::util::DateTime m_CreationDate;
66 OUString m_ModifiedBy;
67 ::com::sun::star::util::DateTime m_ModificationDate;
68 OUString m_PrintedBy;
69 ::com::sun::star::util::DateTime m_PrintDate;
70 sal_Int16 m_EditingCycles;
71 sal_Int32 m_EditingDuration;
72 OUString m_Description;
73 OUString m_Keywords;
74 OUString m_Subject;
75 OUString m_Title;
76 sal_Bool m_bHasTemplate;
77 sal_Bool m_bDeleteUserData;
78 sal_Bool m_bUseUserData;
79 std::vector< CustomProperty* > m_aCustomProperties;
81 public:
82 TYPEINFO();
83 SfxDocumentInfoItem();
84 SfxDocumentInfoItem( const String &rFileName,
85 const ::com::sun::star::uno::Reference<
86 ::com::sun::star::document::XDocumentProperties> & i_xDocProps,
87 sal_Bool bUseUserData );
88 SfxDocumentInfoItem( const SfxDocumentInfoItem& );
89 virtual ~SfxDocumentInfoItem();
91 /// update i_xDocProps with the data in this object
92 void UpdateDocumentInfo(
93 const ::com::sun::star::uno::Reference<
94 ::com::sun::star::document::XDocumentProperties> & i_xDocProps,
95 bool i_bDoNotUpdateUserDefined = false)
96 const;
98 sal_Bool isAutoloadEnabled() const { return m_isAutoloadEnabled; }
99 void setAutoloadEnabled(sal_Bool i_val) { m_isAutoloadEnabled = i_val; }
100 sal_Int32 getAutoloadDelay() const { return m_AutoloadDelay; }
101 void setAutoloadDelay(sal_Int32 i_val) { m_AutoloadDelay = i_val; }
102 OUString getAutoloadURL() const { return m_AutoloadURL; }
103 void setAutoloadURL(OUString i_val) { m_AutoloadURL = i_val; }
104 OUString getDefaultTarget() const { return m_DefaultTarget; }
105 void setDefaultTarget(OUString i_val) { m_DefaultTarget = i_val; }
106 OUString getTemplateName() const { return m_TemplateName; }
107 void setTemplateName(OUString i_val) { m_TemplateName = i_val; }
108 OUString getAuthor() const { return m_Author; }
109 void setAuthor(OUString i_val) { m_Author = i_val; }
111 ::com::sun::star::util::DateTime
112 getCreationDate() const { return m_CreationDate; }
113 void setCreationDate(::com::sun::star::util::DateTime i_val) {
114 m_CreationDate = i_val;
116 OUString getModifiedBy() const { return m_ModifiedBy; }
117 void setModifiedBy(OUString i_val) { m_ModifiedBy = i_val; }
119 ::com::sun::star::util::DateTime
120 getModificationDate() const { return m_ModificationDate; }
121 void setModificationDate(::com::sun::star::util::DateTime i_val) {
122 m_ModificationDate = i_val;
124 OUString getPrintedBy() const { return m_PrintedBy; }
125 void setPrintedBy(OUString i_val) { m_PrintedBy = i_val; }
126 ::com::sun::star::util::DateTime
127 getPrintDate() const { return m_PrintDate; }
128 void setPrintDate(::com::sun::star::util::DateTime i_val) {
129 m_PrintDate = i_val;
131 sal_Int16 getEditingCycles() const { return m_EditingCycles; }
132 void setEditingCycles(sal_Int16 i_val) { m_EditingCycles = i_val; }
133 sal_Int32 getEditingDuration() const { return m_EditingDuration; }
134 void setEditingDuration(sal_Int32 i_val) { m_EditingDuration = i_val; }
135 OUString getDescription() const { return m_Description; }
136 void setDescription(OUString i_val) { m_Description = i_val; }
137 OUString getKeywords() const { return m_Keywords; }
138 void setKeywords(OUString i_val) { m_Keywords = i_val; }
139 OUString getSubject() const { return m_Subject; }
140 void setSubject(OUString i_val) { m_Subject = i_val; }
141 OUString getTitle() const { return m_Title; }
142 void setTitle(OUString i_val) { m_Title = i_val; }
144 /// reset user-specific data (author, modified-by, ...)
145 void resetUserData(const OUString & i_rAuthor);
147 void SetTemplate( sal_Bool b ) { m_bHasTemplate = b; }
148 sal_Bool HasTemplate() const { return m_bHasTemplate; }
149 void SetDeleteUserData( sal_Bool bSet );
150 void SetUseUserData( sal_Bool bSet );
151 sal_Bool IsDeleteUserData() const;
152 sal_Bool IsUseUserData() const;
154 std::vector< CustomProperty* > GetCustomProperties() const;
155 void ClearCustomProperties();
156 void AddCustomProperty( const OUString& sName,
157 const com::sun::star::uno::Any& rValue );
159 virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
160 virtual int operator==( const SfxPoolItem& ) const;
161 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
162 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
165 // class SfxDocumentPage -------------------------------------------------
167 class SfxDocumentPage : public SfxTabPage
169 private:
170 FixedImage* m_pBmp;
171 Edit* m_pNameED;
172 PushButton* m_pChangePassBtn;
174 SelectableFixedText* m_pShowTypeFT;
175 CheckBox* m_pReadOnlyCB;
176 SelectableFixedText* m_pFileValFt;
177 SelectableFixedText* m_pShowSizeFT;
179 SelectableFixedText* m_pCreateValFt;
180 SelectableFixedText* m_pChangeValFt;
181 SelectableFixedText* m_pSignedValFt;
182 PushButton* m_pSignatureBtn;
183 SelectableFixedText* m_pPrintValFt;
184 SelectableFixedText* m_pTimeLogValFt;
185 SelectableFixedText* m_pDocNoValFt;
187 CheckBox* m_pUseUserDataCB;
188 PushButton* m_pDeleteBtn;
190 FixedText* m_pTemplFt;
191 SelectableFixedText* m_pTemplValFt;
193 OUString m_aUnknownSize;
194 OUString m_aMultiSignedStr;
196 sal_Bool bEnableUseUserData : 1,
197 bHandleDelete : 1;
199 DECL_LINK(DeleteHdl, void *);
200 DECL_LINK(SignatureHdl, void *);
201 DECL_LINK(ChangePassHdl, void *);
202 void ImplUpdateSignatures();
203 void ImplCheckPasswordState();
205 protected:
206 SfxDocumentPage( Window* pParent, const SfxItemSet& );
208 virtual sal_Bool FillItemSet( SfxItemSet& );
209 virtual void Reset( const SfxItemSet& );
211 public:
212 static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
214 void EnableUseUserData();
217 // class SfxDocumentDescPage ---------------------------------------------
219 class SfxDocumentDescPage : public SfxTabPage
221 private:
222 Edit* m_pTitleEd;
223 Edit* m_pThemaEd;
224 Edit* m_pKeywordsEd;
225 VclMultiLineEdit* m_pCommentEd;
226 SfxDocumentInfoItem* m_pInfoItem;
228 protected:
229 SfxDocumentDescPage( Window* pParent, const SfxItemSet& );
231 virtual sal_Bool FillItemSet( SfxItemSet& );
232 virtual void Reset( const SfxItemSet& );
234 public:
235 static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
238 // class SfxDocumentInfoDialog -------------------------------------------
240 class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialog
242 private:
243 sal_uInt16 m_nDocInfoId;
244 protected:
245 virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage );
247 public:
248 SfxDocumentInfoDialog( Window* pParent, const SfxItemSet& );
249 void AddFontTabPage();
252 // class CustomPropertiesRemoveButton ------------------------------------
254 struct CustomPropertyLine;
256 class CustomPropertiesEdit : public Edit
258 private:
259 CustomPropertyLine* m_pLine;
261 public:
262 inline CustomPropertiesEdit(
263 Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
264 Edit( pParent, rResId ), m_pLine( pLine ) {}
266 inline CustomPropertyLine* GetLine() const { return m_pLine; }
269 class CustomPropertiesTypeBox : public ListBox
271 private:
272 CustomPropertyLine* m_pLine;
274 public:
275 inline CustomPropertiesTypeBox(
276 Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
277 ListBox( pParent, rResId ), m_pLine( pLine ) {}
279 inline CustomPropertyLine* GetLine() const { return m_pLine; }
282 class CustomPropertiesDateField : public DateField
284 private:
285 CustomPropertyLine* m_pLine;
287 public:
288 inline CustomPropertiesDateField(
289 Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
290 DateField( pParent, rResId ), m_pLine( pLine ) {}
292 inline CustomPropertyLine* GetLine() const { return m_pLine; }
294 class CustomPropertiesTimeField : public TimeField
296 private:
297 CustomPropertyLine* m_pLine;
299 public:
300 inline CustomPropertiesTimeField(
301 Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
302 TimeField( pParent, rResId ), m_pLine( pLine ) {}
304 inline CustomPropertyLine* GetLine() const { return m_pLine; }
306 class CustomPropertiesDurationField : public Edit
308 CustomPropertyLine* m_pLine;
309 com::sun::star::util::Duration m_aDuration;
310 protected:
311 virtual void RequestHelp(const HelpEvent& rEvt);
312 public:
313 CustomPropertiesDurationField( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine );
314 ~CustomPropertiesDurationField();
316 void SetDuration( const com::sun::star::util::Duration& rDuration );
317 const com::sun::star::util::Duration& GetDuration() const { return m_aDuration; }
320 class CustomPropertiesEditButton : public PushButton
322 CustomPropertyLine* m_pLine;
324 public:
325 CustomPropertiesEditButton( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine );
326 ~CustomPropertiesEditButton();
328 DECL_LINK(ClickHdl, void *);
331 class CustomPropertiesRemoveButton : public ImageButton
333 private:
334 CustomPropertyLine* m_pLine;
336 public:
337 inline CustomPropertiesRemoveButton(
338 Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
339 ImageButton( pParent, rResId ), m_pLine( pLine ) {}
341 inline CustomPropertyLine* GetLine() const { return m_pLine; }
344 class CustomPropertiesYesNoButton : public Control
346 private:
347 RadioButton m_aYesButton;
348 RadioButton m_aNoButton;
350 public:
351 CustomPropertiesYesNoButton( Window* pParent, const ResId& rResId );
353 virtual void Resize();
355 inline void CheckYes() { m_aYesButton.Check(); }
356 inline void CheckNo() { m_aNoButton.Check(); }
357 inline bool IsYesChecked() const { return m_aYesButton.IsChecked() != sal_False; }
360 // struct CustomPropertyLine ---------------------------------------------
362 struct CustomPropertyLine
364 ComboBox m_aNameBox;
365 CustomPropertiesTypeBox m_aTypeBox;
366 CustomPropertiesEdit m_aValueEdit;
367 CustomPropertiesDateField m_aDateField;
368 CustomPropertiesTimeField m_aTimeField;
369 const String m_sDurationFormat;
370 CustomPropertiesDurationField m_aDurationField;
371 CustomPropertiesEditButton m_aEditButton;
372 CustomPropertiesYesNoButton m_aYesNoButton;
373 CustomPropertiesRemoveButton m_aRemoveButton;
375 Point m_aDatePos;
376 Point m_aTimePos;
377 Size m_aDateTimeSize;
379 bool m_bIsRemoved;
380 bool m_bTypeLostFocus;
382 CustomPropertyLine( Window* pParent );
384 void SetRemoved();
387 // class CustomPropertiesWindow ------------------------------------------
389 class CustomPropertiesWindow : public Window
391 private:
392 ComboBox m_aNameBox;
393 ListBox m_aTypeBox;
394 Edit m_aValueEdit;
395 DateField m_aDateField;
396 TimeField m_aTimeField;
397 Edit m_aDurationField;
398 PushButton m_aEditButton;
399 CustomPropertiesYesNoButton m_aYesNoButton;
400 ImageButton m_aRemoveButton;
402 sal_Int32 m_nLineHeight;
403 sal_Int32 m_nScrollPos;
404 SvtSysLocale m_aSysLocale;
405 std::vector< CustomPropertyLine* > m_aCustomPropertiesLines;
406 CustomPropertyLine* m_pCurrentLine;
407 SvNumberFormatter m_aNumberFormatter;
408 Timer m_aEditLoseFocusTimer;
409 Timer m_aBoxLoseFocusTimer;
410 Link m_aRemovedHdl;
412 DECL_LINK( TypeHdl, CustomPropertiesTypeBox* );
413 DECL_LINK( RemoveHdl, CustomPropertiesRemoveButton* );
414 DECL_LINK( EditLoseFocusHdl, CustomPropertiesEdit* );
415 DECL_LINK( BoxLoseFocusHdl, CustomPropertiesTypeBox* );
416 //add lose focus handlers of Date/TimeField?
418 DECL_LINK(EditTimeoutHdl, void *);
419 DECL_LINK(BoxTimeoutHdl, void *);
421 bool IsLineValid( CustomPropertyLine* pLine ) const;
422 void ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox );
424 public:
425 CustomPropertiesWindow(Window* pParent,
426 const OUString &rHeaderAccName,
427 const OUString &rHeaderAccType,
428 const OUString &rHeaderAccValue);
429 ~CustomPropertiesWindow();
431 void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
432 sal_uInt16 GetVisibleLineCount() const;
433 inline sal_Int32 GetLineHeight() const { return m_nLineHeight; }
434 void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny );
435 bool AreAllLinesValid() const;
436 void ClearAllLines();
437 void DoScroll( sal_Int32 nNewPos );
439 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
440 GetCustomProperties() const;
441 void SetRemovedHdl( const Link& rLink ) { m_aRemovedHdl = rLink; }
443 void InitRemoveButton(const ScrollBar &rScrollBar);
444 void updateLineWidth();
447 // class CustomPropertiesControl -----------------------------------------
449 class CustomPropertiesControl : public VclVBox
451 private:
452 HeaderBar* m_pHeaderBar;
453 VclHBox* m_pBody;
454 CustomPropertiesWindow* m_pPropertiesWin;
455 ScrollBar* m_pVertScroll;
457 sal_Int32 m_nThumbPos;
459 DECL_LINK( ScrollHdl, ScrollBar* );
460 DECL_LINK( RemovedHdl, void* );
462 public:
463 CustomPropertiesControl(Window* pParent);
464 ~CustomPropertiesControl();
466 void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );
468 inline bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); }
469 inline void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); }
470 inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
471 GetCustomProperties() const
472 { return m_pPropertiesWin->GetCustomProperties(); }
473 void Init(VclBuilderContainer& rParent);
474 virtual void setAllocation(const Size &rAllocation);
477 // class SfxCustomPropertiesPage -----------------------------------------
479 class SfxCustomPropertiesPage : public SfxTabPage
481 private:
482 CustomPropertiesControl* m_pPropertiesCtrl;
484 DECL_LINK(AddHdl, void *);
486 using TabPage::DeactivatePage;
488 protected:
489 SfxCustomPropertiesPage( Window* pParent, const SfxItemSet& );
491 virtual sal_Bool FillItemSet( SfxItemSet& );
492 virtual void Reset( const SfxItemSet& );
493 virtual int DeactivatePage( SfxItemSet* pSet = NULL );
495 public:
496 static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
499 #endif // #ifndef _SFX_DINFDLG_HXX
501 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */