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_SFX2_DINFDLG_HXX 20 #define INCLUDED_SFX2_DINFDLG_HXX 21 22 #include <config_options.h> 23 #include <sal/config.h> 24 #include <sfx2/dllapi.h> 25 26 #include <com/sun/star/beans/PropertyValue.hpp> 27 #include <com/sun/star/util/DateTime.hpp> 28 #include <com/sun/star/util/Duration.hpp> 29 #include <com/sun/star/document/CmisProperty.hpp> 30 31 #include <svl/numformat.hxx> 32 #include <svl/stritem.hxx> 33 #include <svtools/ctrlbox.hxx> 34 35 #include <vcl/idle.hxx> 36 #include <vcl/weldutils.hxx> 37 38 #include <sfx2/tabdlg.hxx> 39 40 #include <optional> 41 #include <memory> 42 #include <vcl/abstdlg.hxx> 43 44 namespace com::sun::star::beans { struct PropertyValue; } 45 46 namespace com::sun::star { 47 namespace document { 48 class XDocumentProperties; 49 } 50 } 51 52 struct CustomProperty; 53 54 // class SfxDocumentInfoItem --------------------------------------------- 55 56 class UNLESS_MERGELIBS(SFX2_DLLPUBLIC) SfxDocumentInfoItem final : public SfxStringItem 57 { 58 private: 59 sal_Int32 m_AutoloadDelay; 60 OUString m_AutoloadURL; 61 bool m_isAutoloadEnabled; 62 OUString m_DefaultTarget; 63 OUString m_TemplateName; 64 OUString m_Author; 65 css::util::DateTime m_CreationDate; 66 OUString m_ModifiedBy; 67 css::util::DateTime m_ModificationDate; 68 OUString m_PrintedBy; 69 css::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_Contributor; 75 OUString m_Coverage; 76 OUString m_Identifier; 77 OUString m_Publisher; 78 OUString m_Relation; 79 OUString m_Rights; 80 OUString m_Source; 81 OUString m_Type; 82 OUString m_Subject; 83 OUString m_Title; 84 sal_Int64 m_nFileSize; 85 bool m_bHasTemplate; 86 bool m_bDeleteUserData; 87 bool m_bUseUserData; 88 bool m_bUseThumbnailSave; 89 std::vector< std::unique_ptr<CustomProperty> > m_aCustomProperties; 90 css::uno::Sequence< css::document::CmisProperty > m_aCmisProperties; 91 92 public: 93 static SfxPoolItem* CreateDefault(); 94 DECLARE_ITEM_TYPE_FUNCTION(SfxDocumentInfoItem) 95 SfxDocumentInfoItem(); 96 SfxDocumentInfoItem( const OUString &rFileName, 97 const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps, 98 const css::uno::Sequence< css::document::CmisProperty> & i_cmisProps, 99 bool bUseUserData, bool bUseThumbnailSave, sal_Int64 nFileSize ); 100 SfxDocumentInfoItem( const SfxDocumentInfoItem& ); 101 virtual ~SfxDocumentInfoItem() override; 102 103 /// update i_xDocProps with the data in this object 104 void UpdateDocumentInfo( 105 const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps, 106 bool i_bDoNotUpdateUserDefined = false) 107 const; 108 bool isCmisDocument() const { return m_aCmisProperties.hasElements();} 109 110 bool isAutoloadEnabled() const { return m_isAutoloadEnabled; } 111 sal_Int32 getAutoloadDelay() const { return m_AutoloadDelay; } 112 const OUString& getAutoloadURL() const { return m_AutoloadURL; } 113 const OUString& getDefaultTarget() const { return m_DefaultTarget; } 114 const OUString& getTemplateName() const { return m_TemplateName; } 115 const OUString& getAuthor() const { return m_Author; } 116 117 const css::util::DateTime& 118 getCreationDate() const { return m_CreationDate; } 119 const OUString& getModifiedBy() const { return m_ModifiedBy; } 120 121 const css::util::DateTime& 122 getModificationDate() const { return m_ModificationDate; } 123 const OUString& getPrintedBy() const { return m_PrintedBy; } 124 const css::util::DateTime& 125 getPrintDate() const { return m_PrintDate; } 126 sal_Int16 getEditingCycles() const { return m_EditingCycles; } 127 sal_Int32 getEditingDuration() const { return m_EditingDuration; } 128 const OUString& getDescription() const { return m_Description; } 129 void setDescription(const OUString& i_val) { m_Description = i_val; } 130 const OUString& getKeywords() const { return m_Keywords; } 131 void setKeywords(const OUString& i_val) { m_Keywords = i_val; } 132 const OUString& getContributor() const { return m_Contributor; } 133 void setContributor(const OUString& i_val) { m_Contributor = i_val; } 134 const OUString& getCoverage() const { return m_Coverage; } 135 void setCoverage(const OUString& i_val) { m_Coverage = i_val; } 136 const OUString& getIdentifier() const { return m_Identifier; } 137 void setIdentifier(const OUString& i_val) { m_Identifier = i_val; } 138 const OUString& getPublisher() const { return m_Publisher; } 139 void setPublisher(const OUString& i_val) { m_Publisher = i_val; } 140 const OUString& getRelation() const { return m_Relation; } 141 void setRelation(const OUString& i_val) { m_Relation = i_val; } 142 const OUString& getRights() const { return m_Rights; } 143 void setRights(const OUString& i_val) { m_Rights = i_val; } 144 const OUString& getSource() const { return m_Source; } 145 void setSource(const OUString& i_val) { m_Source = i_val; } 146 const OUString& getType() const { return m_Type; } 147 void setType(const OUString& i_val) { m_Type = i_val; } 148 const OUString& getSubject() const { return m_Subject; } 149 void setSubject(const OUString& i_val) { m_Subject = i_val; } 150 const OUString& getTitle() const { return m_Title; } 151 void setTitle(const OUString& i_val) { m_Title = i_val; } 152 sal_Int64 getFileSize() const { return m_nFileSize; } 153 154 /// reset user-specific data (author, modified-by, ...) 155 void resetUserData(const OUString & i_rAuthor); 156 157 void SetTemplate( bool b ) { m_bHasTemplate = b; } 158 bool HasTemplate() const { return m_bHasTemplate; } 159 void SetDeleteUserData( bool bSet ); 160 void SetUseUserData( bool bSet ); 161 void SetUseThumbnailSave( bool bSet ); 162 bool IsUseUserData() const { return m_bUseUserData;} 163 bool IsUseThumbnailSave() const { return m_bUseThumbnailSave;} 164 165 166 std::vector< std::unique_ptr<CustomProperty> > GetCustomProperties() const; 167 void ClearCustomProperties(); 168 void AddCustomProperty( const OUString& sName, 169 const css::uno::Any& rValue ); 170 171 const css::uno::Sequence< css::document::CmisProperty >& 172 GetCmisProperties() const { return m_aCmisProperties;} 173 174 void SetCmisProperties(const css::uno::Sequence< css::document::CmisProperty >& cmisProps ); 175 virtual SfxDocumentInfoItem* Clone( SfxItemPool* pPool = nullptr ) const override; 176 virtual bool operator==( const SfxPoolItem& ) const override; 177 // Marked as false since the SfxStringItem superclass supports hashing, but 178 // this class has not been checked for safety under hashing yet. 179 virtual bool supportsHashCode() const override { return false; } 180 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; 181 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; 182 }; 183 184 // class SfxDocumentPage ------------------------------------------------- 185 186 class SfxDocumentPage final : public SfxTabPage 187 { 188 private: 189 OUString m_aUnknownSize; 190 OUString m_aMultiSignedStr; 191 192 bool bEnableUseUserData : 1, 193 bHandleDelete : 1; 194 195 std::unique_ptr<weld::Image> m_xBmp; 196 std::unique_ptr<weld::Label> m_xNameED; 197 std::unique_ptr<weld::Button> m_xChangePassBtn; 198 199 std::unique_ptr<weld::Label> m_xShowTypeFT; 200 std::unique_ptr<weld::LinkButton> m_xFileValEd; 201 std::unique_ptr<weld::Label> m_xShowSizeFT; 202 203 std::unique_ptr<weld::Label> m_xCreateValFt; 204 std::unique_ptr<weld::Label> m_xChangeValFt; 205 std::unique_ptr<weld::Label> m_xSignedValFt; 206 std::unique_ptr<weld::Button> m_xSignatureBtn; 207 std::unique_ptr<weld::Label> m_xPrintValFt; 208 std::unique_ptr<weld::Label> m_xTimeLogValFt; 209 std::unique_ptr<weld::Label> m_xDocNoValFt; 210 211 std::unique_ptr<weld::CheckButton> m_xUseUserDataCB; 212 std::unique_ptr<weld::Button> m_xDeleteBtn; 213 std::unique_ptr<weld::CheckButton> m_xUseThumbnailSaveCB; 214 215 std::unique_ptr<weld::Label> m_xTemplFt; 216 std::unique_ptr<weld::Label> m_xTemplValFt; 217 std::unique_ptr<weld::CheckButton> m_xImagePreferredDpiCheckButton; 218 std::unique_ptr<weld::ComboBox> m_xImagePreferredDpiComboBox; 219 220 DECL_LINK(DeleteHdl, weld::Button&, void); 221 DECL_LINK(SignatureHdl, weld::Button&, void); 222 DECL_LINK(ChangePassHdl, weld::Button&, void); 223 DECL_LINK(ImagePreferredDPICheckBoxClicked, weld::Toggleable&, void); 224 225 void ImplUpdateSignatures(); 226 void ImplCheckPasswordState(); 227 228 virtual bool FillItemSet( SfxItemSet* ) override; 229 virtual void Reset( const SfxItemSet* ) override; 230 VclPtr<AbstractPasswordToOpenModifyDialog> m_xPasswordDialog; 231 232 public: 233 SfxDocumentPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); 234 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); 235 virtual ~SfxDocumentPage() override; 236 237 void EnableUseUserData(); 238 }; 239 240 // class SfxDocumentDescPage --------------------------------------------- 241 242 class SfxDocumentDescPage final : public SfxTabPage 243 { 244 private: 245 SfxDocumentInfoItem* m_pInfoItem; 246 std::unique_ptr<weld::Entry> m_xTitleEd; 247 std::unique_ptr<weld::Entry> m_xThemaEd; 248 std::unique_ptr<weld::Entry> m_xKeywordsEd; 249 std::unique_ptr<weld::Entry> m_xContributorEd; 250 std::unique_ptr<weld::Entry> m_xCoverageEd; 251 std::unique_ptr<weld::Entry> m_xIdentifierEd; 252 std::unique_ptr<weld::Entry> m_xPublisherEd; 253 std::unique_ptr<weld::Entry> m_xRelationEd; 254 std::unique_ptr<weld::Entry> m_xRightsEd; 255 std::unique_ptr<weld::Entry> m_xSourceEd; 256 std::unique_ptr<weld::Entry> m_xTypeEd; 257 std::unique_ptr<weld::TextView> m_xCommentEd; 258 259 virtual bool FillItemSet( SfxItemSet* ) override; 260 virtual void Reset( const SfxItemSet* ) override; 261 262 public: 263 SfxDocumentDescPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); 264 virtual ~SfxDocumentDescPage() override; 265 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); 266 }; 267 268 // class SfxDocumentInfoDialog ------------------------------------------- 269 270 class SFX2_DLLPUBLIC SfxDocumentInfoDialog final : public SfxTabDialogController 271 { 272 virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; 273 274 public: 275 SfxDocumentInfoDialog(weld::Window* pParent, const SfxItemSet&); 276 void AddFontTabPage(); 277 }; 278 279 class CustomPropertiesDateField 280 { 281 private: 282 std::unique_ptr<SvtCalendarBox> m_xDateField; 283 public: 284 ::std::optional<sal_Int16> m_TZ; 285 286 CustomPropertiesDateField(SvtCalendarBox* pDateField); 287 void set_visible(bool bVisible); 288 Date get_date() const; 289 void set_date(const Date& rDate); 290 ~CustomPropertiesDateField(); 291 }; 292 293 class CustomPropertiesTimeField 294 { 295 public: 296 std::unique_ptr<weld::FormattedSpinButton> m_xTimeField; 297 std::unique_ptr<weld::TimeFormatter> m_xFormatter; 298 bool m_isUTC; 299 300 CustomPropertiesTimeField(std::unique_ptr<weld::FormattedSpinButton> xTimeField); 301 void set_visible(bool bVisible) { m_xTimeField->set_visible(bVisible); } 302 tools::Time get_value() const; 303 void set_value(const tools::Time& rTime); 304 305 ~CustomPropertiesTimeField(); 306 }; 307 308 class DurationDialog_Impl final : public weld::GenericDialogController 309 { 310 std::unique_ptr<weld::CheckButton> m_xNegativeCB; 311 std::unique_ptr<weld::SpinButton> m_xYearNF; 312 std::unique_ptr<weld::SpinButton> m_xMonthNF; 313 std::unique_ptr<weld::SpinButton> m_xDayNF; 314 std::unique_ptr<weld::SpinButton> m_xHourNF; 315 std::unique_ptr<weld::SpinButton> m_xMinuteNF; 316 std::unique_ptr<weld::SpinButton> m_xSecondNF; 317 std::unique_ptr<weld::SpinButton> m_xMSecondNF; 318 319 public: 320 DurationDialog_Impl(weld::Widget* pParent, const css::util::Duration& rDuration); 321 css::util::Duration GetDuration() const; 322 }; 323 324 class CustomPropertiesDurationField 325 { 326 css::util::Duration m_aDuration; 327 std::unique_ptr<weld::Entry> m_xEntry; 328 std::unique_ptr<weld::Button> m_xEditButton; 329 std::shared_ptr<DurationDialog_Impl> m_xDurationDialog; 330 331 DECL_LINK(ClickHdl, weld::Button&, void); 332 public: 333 CustomPropertiesDurationField(std::unique_ptr<weld::Entry> xEntry, 334 std::unique_ptr<weld::Button> xEditButton); 335 336 void SetDuration( const css::util::Duration& rDuration ); 337 const css::util::Duration& GetDuration() const { return m_aDuration; } 338 339 void set_visible(bool bVisible); 340 341 ~CustomPropertiesDurationField(); 342 }; 343 344 class CustomPropertiesYesNoButton 345 { 346 private: 347 std::unique_ptr<weld::Widget> m_xTopLevel; 348 std::unique_ptr<weld::RadioButton> m_xYesButton; 349 std::unique_ptr<weld::RadioButton> m_xNoButton; 350 351 public: 352 CustomPropertiesYesNoButton(std::unique_ptr<weld::Widget>, 353 std::unique_ptr<weld::RadioButton> xYesButton, 354 std::unique_ptr<weld::RadioButton> xNoButton); 355 ~CustomPropertiesYesNoButton(); 356 357 void CheckYes() { m_xYesButton->set_active(true); } 358 void CheckNo() { m_xNoButton->set_active(true); } 359 bool IsYesChecked() const { return m_xYesButton->get_active(); } 360 void set_visible(bool bVisible) { m_xTopLevel->set_visible(bVisible); } 361 }; 362 363 class CustomPropertiesWindow; 364 365 // struct CustomPropertyLine --------------------------------------------- 366 struct CustomPropertyLine 367 { 368 CustomPropertiesWindow* m_pParent; 369 370 std::unique_ptr<weld::Builder> m_xBuilder; 371 std::unique_ptr<weld::Container> m_xLine; 372 std::unique_ptr<weld::ComboBox> m_xNameBox; 373 std::unique_ptr<weld::ComboBox> m_xTypeBox; 374 std::unique_ptr<weld::Entry> m_xValueEdit; 375 std::unique_ptr<weld::Widget> m_xDateTimeBox; 376 std::unique_ptr<CustomPropertiesDateField> m_xDateField; 377 std::unique_ptr<CustomPropertiesTimeField> m_xTimeField; 378 std::unique_ptr<weld::Widget> m_xDurationBox; 379 std::unique_ptr<CustomPropertiesDurationField> m_xDurationField; 380 std::unique_ptr<CustomPropertiesYesNoButton> m_xYesNoButton; 381 std::unique_ptr<weld::Button> m_xRemoveButton; 382 383 bool m_bTypeLostFocus; 384 385 CustomPropertyLine(CustomPropertiesWindow* pParent, weld::Widget* pContainer); 386 DECL_LINK(TypeHdl, weld::ComboBox&, void); 387 DECL_LINK(RemoveHdl, weld::Button&, void); 388 DECL_LINK(EditLoseFocusHdl, weld::Widget&, void); 389 DECL_LINK(BoxLoseFocusHdl, weld::Widget&, void); 390 391 void DoTypeHdl(const weld::ComboBox& rBox); 392 393 void Clear(); 394 void Hide(); 395 }; 396 397 // class CustomPropertiesWindow ------------------------------------------ 398 399 class CustomPropertiesWindow 400 { 401 private: 402 sal_Int32 m_nHeight; 403 sal_Int32 m_nLineHeight; 404 sal_Int32 m_nScrollPos; 405 std::vector<std::unique_ptr<CustomProperty>> m_aCustomProperties; 406 std::vector<std::unique_ptr<CustomPropertyLine>> m_aCustomPropertiesLines; 407 CustomPropertyLine* m_pCurrentLine; 408 SvNumberFormatter m_aNumberFormatter; 409 Idle m_aEditLoseFocusIdle; 410 Idle m_aBoxLoseFocusIdle; 411 Link<void*,void> m_aRemovedHdl; 412 413 weld::Container& m_rBody; 414 weld::Label& m_rHeaderAccName; 415 weld::Label& m_rHeaderAccType; 416 weld::Label& m_rHeaderAccValue; 417 418 DECL_LINK(EditTimeoutHdl, Timer *, void); 419 DECL_LINK(BoxTimeoutHdl, Timer *, void); 420 421 bool IsLineValid( CustomPropertyLine* pLine ) const; 422 void ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox ); 423 void CreateNewLine(); 424 void StoreCustomProperties(); 425 sal_uInt32 GetCurrentDataModelPosition() const { return -1 * m_nScrollPos / m_nLineHeight; } 426 427 public: 428 CustomPropertiesWindow(weld::Container& rParent, weld::Label& rHeaderAccName, 429 weld::Label& rHeaderAccType, weld::Label& rHeaderAccValue); 430 ~CustomPropertiesWindow(); 431 432 sal_uInt16 GetExistingLineCount() const { return m_aCustomPropertiesLines.size(); } 433 sal_uInt16 GetTotalLineCount() const { return m_aCustomProperties.size(); } 434 void SetVisibleLineCount(sal_uInt32 nCount); 435 sal_Int32 GetHeight() const { return m_nHeight; } 436 void SetHeight(int nHeight) { m_nHeight = nHeight; } 437 sal_Int32 GetLineHeight() const { return m_nLineHeight; } 438 void SetLineHeight(sal_Int32 nLineHeight) { m_nLineHeight = nLineHeight; } 439 void AddLine( const OUString& sName, css::uno::Any const & rAny ); 440 bool AreAllLinesValid() const; 441 void ClearAllLines(); 442 void DoScroll( sal_Int32 nNewPos ); 443 void ReloadLinesContent(); 444 445 css::uno::Sequence< css::beans::PropertyValue > 446 GetCustomProperties(); 447 void SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties); 448 void SetRemovedHdl( const Link<void*,void>& rLink ) { m_aRemovedHdl = rLink; } 449 450 void BoxLoseFocus(CustomPropertyLine* pLine); 451 void EditLoseFocus(CustomPropertyLine* pLine); 452 void Remove(const CustomPropertyLine* pLine); 453 }; 454 455 // class CustomPropertiesControl ----------------------------------------- 456 457 class CustomPropertiesControl 458 { 459 private: 460 sal_Int32 m_nThumbPos; 461 462 std::unique_ptr<weld::Widget> m_xBox; 463 std::unique_ptr<weld::Container> m_xBody; 464 std::unique_ptr<weld::ScrolledWindow> m_xVertScroll; 465 std::unique_ptr<CustomPropertiesWindow> m_xPropertiesWin; 466 std::unique_ptr<weld::Label> m_xName; 467 std::unique_ptr<weld::Label> m_xType; 468 std::unique_ptr<weld::Label> m_xValue; 469 470 DECL_LINK( ResizeHdl, const Size&, void ); 471 DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void ); 472 DECL_LINK( RemovedHdl, void*, void ); 473 474 public: 475 CustomPropertiesControl(); 476 ~CustomPropertiesControl(); 477 478 void AddLine(css::uno::Any const & rAny); 479 480 bool AreAllLinesValid() const { return m_xPropertiesWin->AreAllLinesValid(); } 481 void ClearAllLines() { m_xPropertiesWin->ClearAllLines(); } 482 483 css::uno::Sequence<css::beans::PropertyValue> 484 GetCustomProperties() const 485 { return m_xPropertiesWin->GetCustomProperties(); } 486 void SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties); 487 488 void Init(weld::Builder& rParent); 489 }; 490 491 // class SfxCustomPropertiesPage ----------------------------------------- 492 493 class SfxCustomPropertiesPage final : public SfxTabPage 494 { 495 private: 496 DECL_LINK(AddHdl, weld::Button&, void); 497 498 std::unique_ptr<CustomPropertiesControl> m_xPropertiesCtrl; 499 std::unique_ptr<weld::Button> m_xAdd; 500 501 virtual bool FillItemSet( SfxItemSet* ) override; 502 virtual void Reset( const SfxItemSet* ) override; 503 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; 504 505 public: 506 SfxCustomPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); 507 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); 508 virtual ~SfxCustomPropertiesPage() override; 509 }; 510 511 struct CmisValue 512 { 513 std::unique_ptr<weld::Builder> m_xBuilder; 514 std::unique_ptr<weld::Frame> m_xFrame; 515 std::unique_ptr<weld::Entry> m_xValueEdit; 516 517 CmisValue(weld::Widget* pParent, const OUString& rStr); 518 }; 519 520 struct CmisDateTime 521 { 522 std::unique_ptr<weld::Builder> m_xBuilder; 523 std::unique_ptr<weld::Frame> m_xFrame; 524 std::unique_ptr<SvtCalendarBox> m_xDateField; 525 std::unique_ptr<weld::FormattedSpinButton> m_xTimeField; 526 std::unique_ptr<weld::TimeFormatter> m_xFormatter; 527 528 CmisDateTime(weld::Widget* pParent, const css::util::DateTime& rDateTime); 529 }; 530 531 struct CmisYesNo 532 { 533 std::unique_ptr<weld::Builder> m_xBuilder; 534 std::unique_ptr<weld::Frame> m_xFrame; 535 std::unique_ptr<weld::RadioButton> m_xYesButton; 536 std::unique_ptr<weld::RadioButton> m_xNoButton; 537 538 CmisYesNo(weld::Widget* pParent, bool bValue); 539 }; 540 541 // struct CmisPropertyLine --------------------------------------------- 542 543 struct CmisPropertyLine 544 { 545 std::unique_ptr<weld::Builder> m_xBuilder; 546 OUString m_sId; 547 OUString m_sType; 548 bool m_bUpdatable; 549 bool m_bRequired; 550 bool m_bMultiValued; 551 bool m_bOpenChoice; 552 std::unique_ptr<weld::Frame> m_xFrame; 553 std::unique_ptr<weld::Label> m_xName; 554 std::unique_ptr<weld::Label> m_xType; 555 std::vector< std::unique_ptr<CmisValue> > m_aValues; 556 std::vector< std::unique_ptr<CmisDateTime> > m_aDateTimes; 557 std::vector< std::unique_ptr<CmisYesNo> > m_aYesNos; 558 CmisPropertyLine(weld::Widget* pParent); 559 ~CmisPropertyLine(); 560 }; 561 562 // class CmisPropertiesWindow ------------------------------------------ 563 564 class CmisPropertiesWindow 565 { 566 private: 567 std::unique_ptr<weld::Container> m_xBox; 568 SvNumberFormatter m_aNumberFormatter; 569 std::vector< std::unique_ptr<CmisPropertyLine> > m_aCmisPropertiesLines; 570 public: 571 CmisPropertiesWindow(std::unique_ptr<weld::Container> xParent); 572 ~CmisPropertiesWindow(); 573 574 void AddLine( const OUString& sId, const OUString& sName, 575 const OUString& sType, const bool bUpdatable, 576 const bool bRequired, const bool bMultiValued, 577 const bool bOpenChoice, 578 css::uno::Any& aChoices, 579 css::uno::Any const & rAny ); 580 void ClearAllLines(); 581 582 css::uno::Sequence< css::document::CmisProperty > 583 GetCmisProperties() const; 584 }; 585 586 // class CmisPropertiesControl ----------------------------------------- 587 588 class CmisPropertiesControl 589 { 590 private: 591 CmisPropertiesWindow m_aPropertiesWin; 592 std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow; 593 594 public: 595 CmisPropertiesControl(weld::Builder& rBuilder); 596 597 void AddLine( const OUString& sId, const OUString& sName, 598 const OUString& sType, const bool bUpdatable, 599 const bool bRequired, const bool bMultiValude, 600 const bool bOpenChoice, 601 css::uno::Any& aChoices, 602 css::uno::Any const & rAny ); 603 604 void ClearAllLines(); 605 css::uno::Sequence< css::document::CmisProperty > 606 GetCmisProperties() const 607 { return m_aPropertiesWin.GetCmisProperties(); } 608 }; 609 610 // class SfxCmisPropertiesPage ------------------------------------------------- 611 612 class SfxCmisPropertiesPage final : public SfxTabPage 613 { 614 private: 615 std::unique_ptr<CmisPropertiesControl> m_xPropertiesCtrl; 616 617 virtual bool FillItemSet( SfxItemSet* ) override; 618 virtual void Reset( const SfxItemSet* ) override; 619 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; 620 621 public: 622 SfxCmisPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); 623 virtual ~SfxCmisPropertiesPage() override; 624 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*); 625 }; 626 627 #endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX 628 629 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 630
