LibreOffice Module sfx2 (master) 1
dinfdlg.cxx
Go to the documentation of this file.
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
20#include <svl/eitem.hxx>
21#include <tools/datetime.hxx>
22#include <tools/duration.hxx>
23#include <tools/debug.hxx>
24#include <tools/urlobj.hxx>
25#include <utility>
26#include <vcl/svapp.hxx>
27#include <vcl/weld.hxx>
28#include <vcl/weldutils.hxx>
29#include <unotools/datetime.hxx>
37#include <svtools/ctrlbox.hxx>
38#include <svtools/imagemgr.hxx>
39#include <sal/log.hxx>
40#include <osl/diagnose.h>
41#include <osl/file.hxx>
42#include <comphelper/lok.hxx>
43#include <LibreOfficeKit/LibreOfficeKitEnums.h>
44#include <tools/json_writer.hxx>
45
46#include <memory>
47
49#include <comphelper/string.hxx>
50#include <com/sun/star/security/DocumentSignatureInformation.hpp>
51#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
53#include <rtl/math.hxx>
54#include <com/sun/star/beans/PropertyAttribute.hpp>
55#include <com/sun/star/beans/XPropertyContainer.hpp>
56#include <com/sun/star/beans/XPropertySet.hpp>
57#include <com/sun/star/util/DateTime.hpp>
58#include <com/sun/star/util/Date.hpp>
59#include <com/sun/star/util/DateTimeWithTimezone.hpp>
60#include <com/sun/star/util/DateWithTimezone.hpp>
61#include <com/sun/star/util/Duration.hpp>
62#include <com/sun/star/document/XDocumentProperties.hpp>
63#include <com/sun/star/document/CmisProperty.hpp>
64#include <com/sun/star/lang/XMultiServiceFactory.hpp>
65
66#include <vcl/timer.hxx>
67#include <vcl/settings.hxx>
68#include <sfx2/sfxresid.hxx>
69#include <sfx2/frame.hxx>
71#include <sfx2/dinfdlg.hxx>
72#include <sfx2/sfxsids.hrc>
73#include <helper.hxx>
74#include <sfx2/objsh.hxx>
75#include <sfx2/docfile.hxx>
76#include <vcl/abstdlg.hxx>
77#include <sfx2/viewsh.hxx>
78
80#include <dinfdlg.hrc>
81#include <sfx2/strings.hrc>
82#include <strings.hxx>
84#include "securitypage.hxx"
85
86#include <algorithm>
87
88using namespace ::com::sun::star;
89using namespace ::com::sun::star::uno;
90
92{
93 OUString m_sName;
94 css::uno::Any m_aValue;
95
96 CustomProperty( OUString sName, css::uno::Any aValue ) :
97 m_sName(std::move( sName )), m_aValue(std::move( aValue )) {}
98
99 bool operator==(const CustomProperty& rProp) const
100 {
101 return m_sName == rProp.m_sName && m_aValue == rProp.m_aValue;
102 }
103};
104
105SfxPoolItem* SfxDocumentInfoItem::CreateDefault() { return new SfxDocumentInfoItem; }
106
107namespace {
108
109OUString CreateSizeText( sal_Int64 nSize )
110{
111 OUString aUnitStr = " " + SfxResId(STR_BYTES);
112 sal_Int64 nSize1 = nSize;
113 sal_Int64 nSize2 = nSize1;
114 sal_Int64 nMega = 1024 * 1024;
115 sal_Int64 nGiga = nMega * 1024;
116 double fSize = nSize;
117 int nDec = 0;
118
119 if ( nSize1 >= 10000 && nSize1 < nMega )
120 {
121 nSize1 /= 1024;
122 aUnitStr = " " + SfxResId(STR_KB);
123 fSize /= 1024;
124 nDec = 0;
125 }
126 else if ( nSize1 >= nMega && nSize1 < nGiga )
127 {
128 nSize1 /= nMega;
129 aUnitStr = " " + SfxResId(STR_MB);
130 fSize /= nMega;
131 nDec = 2;
132 }
133 else if ( nSize1 >= nGiga )
134 {
135 nSize1 /= nGiga;
136 aUnitStr = " " + SfxResId(STR_GB);
137 fSize /= nGiga;
138 nDec = 3;
139 }
140 const SvtSysLocale aSysLocale;
141 const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
142 OUString aSizeStr = rLocaleWrapper.getNum( nSize1, 0 ) + aUnitStr;
143 if ( nSize1 < nSize2 )
144 {
145 aSizeStr = ::rtl::math::doubleToUString( fSize,
146 rtl_math_StringFormat_F, nDec,
147 rLocaleWrapper.getNumDecimalSep()[0] )
148 + aUnitStr
149 + " ("
150 + rLocaleWrapper.getNum( nSize2, 0 )
151 + " "
152 + SfxResId(STR_BYTES)
153 + ")";
154 }
155 return aSizeStr;
156}
157
158OUString ConvertDateTime_Impl( std::u16string_view rName,
159 const util::DateTime& uDT, const LocaleDataWrapper& rWrapper )
160{
161 Date aD(uDT);
162 tools::Time aT(uDT);
163 static constexpr OUStringLiteral aDelim( u", " );
164 OUString aStr = rWrapper.getDate( aD )
165 + aDelim
166 + rWrapper.getTime( aT );
167 std::u16string_view aAuthor = comphelper::string::stripStart(rName, ' ');
168 if (!aAuthor.empty())
169 {
170 aStr += aDelim + aAuthor;
171 }
172 return aStr;
173}
174
175}
176
177
178SfxDocumentInfoItem::SfxDocumentInfoItem()
179 : m_AutoloadDelay(0)
180 , m_isAutoloadEnabled(false)
181 , m_EditingCycles(0)
182 , m_EditingDuration(0)
183 , m_bHasTemplate( true )
184 , m_bDeleteUserData( false )
185 , m_bUseUserData( true )
186 , m_bUseThumbnailSave( true )
187{
188}
189
190SfxDocumentInfoItem::SfxDocumentInfoItem( const OUString& rFile,
191 const uno::Reference<document::XDocumentProperties>& i_xDocProps,
192 const uno::Sequence<document::CmisProperty>& i_cmisProps,
193 bool bIs, bool _bIs )
194 : SfxStringItem( SID_DOCINFO, rFile )
195 , m_AutoloadDelay( i_xDocProps->getAutoloadSecs() )
196 , m_AutoloadURL( i_xDocProps->getAutoloadURL() )
197 , m_isAutoloadEnabled( (m_AutoloadDelay > 0) || !m_AutoloadURL.isEmpty() )
198 , m_DefaultTarget( i_xDocProps->getDefaultTarget() )
199 , m_TemplateName( i_xDocProps->getTemplateName() )
200 , m_Author( i_xDocProps->getAuthor() )
201 , m_CreationDate( i_xDocProps->getCreationDate() )
202 , m_ModifiedBy( i_xDocProps->getModifiedBy() )
203 , m_ModificationDate( i_xDocProps->getModificationDate() )
204 , m_PrintedBy( i_xDocProps->getPrintedBy() )
205 , m_PrintDate( i_xDocProps->getPrintDate() )
206 , m_EditingCycles( i_xDocProps->getEditingCycles() )
207 , m_EditingDuration( i_xDocProps->getEditingDuration() )
208 , m_Description( i_xDocProps->getDescription() )
209 , m_Keywords( ::comphelper::string::convertCommaSeparated(
210 i_xDocProps->getKeywords()) )
211 , m_Subject( i_xDocProps->getSubject() )
212 , m_Title( i_xDocProps->getTitle() )
213 , m_bHasTemplate( true )
214 , m_bDeleteUserData( false )
215 , m_bUseUserData( bIs )
216 , m_bUseThumbnailSave( _bIs )
217{
218 try
219 {
220 Reference< beans::XPropertyContainer > xContainer = i_xDocProps->getUserDefinedProperties();
221 if ( xContainer.is() )
222 {
223 Reference < beans::XPropertySet > xSet( xContainer, UNO_QUERY );
224 const Sequence< beans::Property > lProps = xSet->getPropertySetInfo()->getProperties();
225 for ( const beans::Property& rProp : lProps )
226 {
227 // "fix" property? => not a custom property => ignore it!
228 if (!(rProp.Attributes & css::beans::PropertyAttribute::REMOVABLE))
229 {
230 SAL_WARN( "sfx.dialog", "non-removable user-defined property?");
231 continue;
232 }
233
234 uno::Any aValue = xSet->getPropertyValue(rProp.Name);
235 AddCustomProperty( rProp.Name, aValue );
236 }
237 }
238
239 // get CMIS properties
240 m_aCmisProperties = i_cmisProps;
241 }
242 catch ( Exception& ) {}
243}
244
245
246SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem )
247 : SfxStringItem( rItem )
248 , m_AutoloadDelay( rItem.getAutoloadDelay() )
249 , m_AutoloadURL( rItem.getAutoloadURL() )
250 , m_isAutoloadEnabled( rItem.isAutoloadEnabled() )
251 , m_DefaultTarget( rItem.getDefaultTarget() )
252 , m_TemplateName( rItem.getTemplateName() )
253 , m_Author( rItem.getAuthor() )
254 , m_CreationDate( rItem.getCreationDate() )
255 , m_ModifiedBy( rItem.getModifiedBy() )
256 , m_ModificationDate( rItem.getModificationDate() )
257 , m_PrintedBy( rItem.getPrintedBy() )
258 , m_PrintDate( rItem.getPrintDate() )
259 , m_EditingCycles( rItem.getEditingCycles() )
260 , m_EditingDuration( rItem.getEditingDuration() )
261 , m_Description( rItem.getDescription() )
262 , m_Keywords( rItem.getKeywords() )
263 , m_Subject( rItem.getSubject() )
264 , m_Title( rItem.getTitle() )
265 , m_bHasTemplate( rItem.m_bHasTemplate )
266 , m_bDeleteUserData( rItem.m_bDeleteUserData )
267 , m_bUseUserData( rItem.m_bUseUserData )
268 , m_bUseThumbnailSave( rItem.m_bUseThumbnailSave )
269{
270 for (auto const & pOtherProp : rItem.m_aCustomProperties)
271 {
272 AddCustomProperty( pOtherProp->m_sName, pOtherProp->m_aValue );
273 }
274
275 m_aCmisProperties = rItem.m_aCmisProperties;
276}
277
278SfxDocumentInfoItem::~SfxDocumentInfoItem()
279{
280 ClearCustomProperties();
281}
282
283SfxDocumentInfoItem* SfxDocumentInfoItem::Clone( SfxItemPool * ) const
284{
285 return new SfxDocumentInfoItem( *this );
286}
287
288bool SfxDocumentInfoItem::operator==( const SfxPoolItem& rItem) const
289{
290 if (!SfxStringItem::operator==(rItem))
291 return false;
292 const SfxDocumentInfoItem& rInfoItem(static_cast<const SfxDocumentInfoItem&>(rItem));
293
294 return
295 m_AutoloadDelay == rInfoItem.m_AutoloadDelay &&
296 m_AutoloadURL == rInfoItem.m_AutoloadURL &&
297 m_isAutoloadEnabled == rInfoItem.m_isAutoloadEnabled &&
298 m_DefaultTarget == rInfoItem.m_DefaultTarget &&
299 m_Author == rInfoItem.m_Author &&
300 m_CreationDate == rInfoItem.m_CreationDate &&
301 m_ModifiedBy == rInfoItem.m_ModifiedBy &&
302 m_ModificationDate == rInfoItem.m_ModificationDate &&
303 m_PrintedBy == rInfoItem.m_PrintedBy &&
304 m_PrintDate == rInfoItem.m_PrintDate &&
305 m_EditingCycles == rInfoItem.m_EditingCycles &&
306 m_EditingDuration == rInfoItem.m_EditingDuration &&
307 m_Description == rInfoItem.m_Description &&
308 m_Keywords == rInfoItem.m_Keywords &&
309 m_Subject == rInfoItem.m_Subject &&
310 m_Title == rInfoItem.m_Title &&
311 comphelper::ContainerUniquePtrEquals(m_aCustomProperties, rInfoItem.m_aCustomProperties) &&
312 m_aCmisProperties.getLength() == rInfoItem.m_aCmisProperties.getLength();
313}
314
315
316void SfxDocumentInfoItem::resetUserData(const OUString & i_rAuthor)
317{
318 m_Author = i_rAuthor;
320 m_CreationDate = now.GetUNODateTime();
321 m_ModifiedBy = OUString();
322 m_PrintedBy = OUString();
323 m_ModificationDate = util::DateTime();
324 m_PrintDate = util::DateTime();
325 m_EditingDuration = 0;
326 m_EditingCycles = 1;
327}
328
329
330void SfxDocumentInfoItem::UpdateDocumentInfo(
331 const uno::Reference<document::XDocumentProperties>& i_xDocProps,
332 bool i_bDoNotUpdateUserDefined) const
333{
334 if (isAutoloadEnabled()) {
335 i_xDocProps->setAutoloadSecs(getAutoloadDelay());
336 i_xDocProps->setAutoloadURL(getAutoloadURL());
337 } else {
338 i_xDocProps->setAutoloadSecs(0);
339 i_xDocProps->setAutoloadURL(OUString());
340 }
341 i_xDocProps->setDefaultTarget(getDefaultTarget());
342 i_xDocProps->setAuthor(getAuthor());
343 i_xDocProps->setCreationDate(getCreationDate());
344 i_xDocProps->setModifiedBy(getModifiedBy());
345 i_xDocProps->setModificationDate(getModificationDate());
346 i_xDocProps->setPrintedBy(getPrintedBy());
347 i_xDocProps->setPrintDate(getPrintDate());
348 i_xDocProps->setEditingCycles(getEditingCycles());
349 i_xDocProps->setEditingDuration(getEditingDuration());
350 i_xDocProps->setDescription(getDescription());
351 i_xDocProps->setKeywords(
352 ::comphelper::string::convertCommaSeparated(getKeywords()));
353 i_xDocProps->setSubject(getSubject());
354 i_xDocProps->setTitle(getTitle());
355
356 // this is necessary in case of replaying a recorded macro:
357 // in this case, the macro may contain the 4 old user-defined DocumentInfo
358 // fields, but not any of the DocumentInfo properties;
359 // as a consequence, most of the UserDefined properties of the
360 // DocumentProperties would be summarily deleted here, which does not
361 // seem like a good idea.
362 if (i_bDoNotUpdateUserDefined)
363 return;
364
365 try
366 {
367 Reference< beans::XPropertyContainer > xContainer = i_xDocProps->getUserDefinedProperties();
368 Reference < beans::XPropertySet > xSet( xContainer, UNO_QUERY );
369 Reference< beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
370 const Sequence< beans::Property > lProps = xSetInfo->getProperties();
371 for ( const beans::Property& rProp : lProps )
372 {
373 if (rProp.Attributes & css::beans::PropertyAttribute::REMOVABLE)
374 {
375 xContainer->removeProperty( rProp.Name );
376 }
377 }
378
379 for (auto const & pProp : m_aCustomProperties)
380 {
381 try
382 {
383 xContainer->addProperty( pProp->m_sName,
384 beans::PropertyAttribute::REMOVABLE, pProp->m_aValue );
385 }
386 catch ( Exception const & )
387 {
388 TOOLS_WARN_EXCEPTION( "sfx.dialog", "SfxDocumentInfoItem::updateDocumentInfo(): exception while adding custom properties" );
389 }
390 }
391 }
392 catch ( Exception const & )
393 {
394 TOOLS_WARN_EXCEPTION( "sfx.dialog", "SfxDocumentInfoItem::updateDocumentInfo(): exception while removing custom properties" );
395 }
396}
397
398
399void SfxDocumentInfoItem::SetDeleteUserData( bool bSet )
400{
401 m_bDeleteUserData = bSet;
402}
403
404
405void SfxDocumentInfoItem::SetUseUserData( bool bSet )
406{
407 m_bUseUserData = bSet;
408}
409
410void SfxDocumentInfoItem::SetUseThumbnailSave( bool bSet )
411{
412 m_bUseThumbnailSave = bSet;
413}
414
415std::vector< std::unique_ptr<CustomProperty> > SfxDocumentInfoItem::GetCustomProperties() const
416{
417 std::vector< std::unique_ptr<CustomProperty> > aRet;
418 for (auto const & pOtherProp : m_aCustomProperties)
419 {
420 std::unique_ptr<CustomProperty> pProp(new CustomProperty( pOtherProp->m_sName,
421 pOtherProp->m_aValue ));
422 aRet.push_back( std::move(pProp) );
423 }
424
425 return aRet;
426}
427
428void SfxDocumentInfoItem::ClearCustomProperties()
429{
430 m_aCustomProperties.clear();
431}
432
433void SfxDocumentInfoItem::AddCustomProperty( const OUString& sName, const Any& rValue )
434{
435 std::unique_ptr<CustomProperty> pProp(new CustomProperty( sName, rValue ));
436 m_aCustomProperties.push_back( std::move(pProp) );
437}
438
439
440void SfxDocumentInfoItem::SetCmisProperties( const Sequence< document::CmisProperty >& cmisProps)
441{
442 m_aCmisProperties = cmisProps;
443}
444
445bool SfxDocumentInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
446{
447 OUString aValue;
448 sal_Int32 nValue = 0;
449 bool bValue = false;
450 bool bIsInt = false;
451 bool bIsString = false;
452 nMemberId &= ~CONVERT_TWIPS;
453 switch ( nMemberId )
454 {
456 bValue = IsUseUserData();
457 break;
459 bValue = IsUseThumbnailSave();
460 break;
462 bValue = m_bDeleteUserData;
463 break;
465 bValue = isAutoloadEnabled();
466 break;
468 bIsInt = true;
469 nValue = getAutoloadDelay();
470 break;
472 bIsString = true;
473 aValue = getAutoloadURL();
474 break;
476 bIsString = true;
477 aValue = getDefaultTarget();
478 break;
480 bIsString = true;
481 aValue = getDescription();
482 break;
484 bIsString = true;
485 aValue = getKeywords();
486 break;
488 bIsString = true;
489 aValue = getSubject();
490 break;
492 bIsString = true;
493 aValue = getTitle();
494 break;
495 default:
496 OSL_FAIL("Wrong MemberId!");
497 return false;
498 }
499
500 if ( bIsString )
501 rVal <<= aValue;
502 else if ( bIsInt )
503 rVal <<= nValue;
504 else
505 rVal <<= bValue;
506 return true;
507}
508
509bool SfxDocumentInfoItem::PutValue( const Any& rVal, sal_uInt8 nMemberId )
510{
511 OUString aValue;
512 sal_Int32 nValue=0;
513 bool bValue = false;
514 bool bRet = false;
515 nMemberId &= ~CONVERT_TWIPS;
516 switch ( nMemberId )
517 {
519 bRet = (rVal >>= bValue);
520 if ( bRet )
521 SetUseUserData( bValue );
522 break;
524 bRet = (rVal >>=bValue);
525 if ( bRet )
526 SetUseThumbnailSave( bValue );
527 break;
529 // QUESTION: deleting user data was done here; seems to be superfluous!
530 bRet = (rVal >>= bValue);
531 if ( bRet )
532 SetDeleteUserData( bValue );
533 break;
535 bRet = (rVal >>= bValue);
536 if ( bRet )
537 m_isAutoloadEnabled = bValue;
538 break;
540 bRet = (rVal >>= nValue);
541 if ( bRet )
542 m_AutoloadDelay = nValue;
543 break;
545 bRet = (rVal >>= aValue);
546 if ( bRet )
547 m_AutoloadURL = aValue;
548 break;
550 bRet = (rVal >>= aValue);
551 if ( bRet )
552 m_DefaultTarget = aValue;
553 break;
555 bRet = (rVal >>= aValue);
556 if ( bRet )
557 setDescription(aValue);
558 break;
560 bRet = (rVal >>= aValue);
561 if ( bRet )
562 setKeywords(aValue);
563 break;
565 bRet = (rVal >>= aValue);
566 if ( bRet )
567 setSubject(aValue);
568 break;
570 bRet = (rVal >>= aValue);
571 if ( bRet )
572 setTitle(aValue);
573 break;
574 default:
575 OSL_FAIL("Wrong MemberId!");
576 return false;
577 }
578
579 return bRet;
580}
581
583 : SfxTabPage(pPage, pController, "sfx/ui/descriptioninfopage.ui", "DescriptionInfoPage", &rItemSet)
584 , m_pInfoItem(nullptr)
585 , m_xTitleEd(m_xBuilder->weld_entry("title"))
586 , m_xThemaEd(m_xBuilder->weld_entry("subject"))
587 , m_xKeywordsEd(m_xBuilder->weld_entry("keywords"))
588 , m_xCommentEd(m_xBuilder->weld_text_view("comments"))
589{
590 m_xCommentEd->set_size_request(m_xKeywordsEd->get_preferred_size().Width(),
591 m_xCommentEd->get_height_rows(16));
592}
593
595{
596}
597
598std::unique_ptr<SfxTabPage> SfxDocumentDescPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rItemSet)
599{
600 return std::make_unique<SfxDocumentDescPage>(pPage, pController, *rItemSet);
601}
602
604{
605 // Test whether a change is present
606 const bool bTitleMod = m_xTitleEd->get_value_changed_from_saved();
607 const bool bThemeMod = m_xThemaEd->get_value_changed_from_saved();
608 const bool bKeywordsMod = m_xKeywordsEd->get_value_changed_from_saved();
609 const bool bCommentMod = m_xCommentEd->get_value_changed_from_saved();
610 if ( !( bTitleMod || bThemeMod || bKeywordsMod || bCommentMod ) )
611 {
612 return false;
613 }
614
615 // Generating the output data
616 const SfxDocumentInfoItem* pItem = nullptr;
617 SfxDocumentInfoItem* pInfo = nullptr;
618 const SfxItemSet* pExSet = GetDialogExampleSet();
619
620 if ( pExSet && !(pItem = pExSet->GetItemIfSet( SID_DOCINFO )) )
621 pInfo = m_pInfoItem;
622 else if ( pItem )
623 pInfo = new SfxDocumentInfoItem( *pItem );
624
625 if ( !pInfo )
626 {
627 SAL_WARN( "sfx.dialog", "SfxDocumentDescPage::FillItemSet(): no item found" );
628 return false;
629 }
630
631 if ( bTitleMod )
632 {
633 pInfo->setTitle( m_xTitleEd->get_text() );
634 }
635 if ( bThemeMod )
636 {
637 pInfo->setSubject( m_xThemaEd->get_text() );
638 }
639 if ( bKeywordsMod )
640 {
641 pInfo->setKeywords( m_xKeywordsEd->get_text() );
642 }
643 if ( bCommentMod )
644 {
645 pInfo->setDescription( m_xCommentEd->get_text() );
646 }
647 rSet->Put( *pInfo );
648 if ( pInfo != m_pInfoItem )
649 {
650 delete pInfo;
651 }
652
653 return true;
654}
655
657{
658 m_pInfoItem = const_cast<SfxDocumentInfoItem*>(&rSet->Get(SID_DOCINFO));
659
660 m_xTitleEd->set_text(m_pInfoItem->getTitle());
661 m_xThemaEd->set_text(m_pInfoItem->getSubject());
662 m_xKeywordsEd->set_text(m_pInfoItem->getKeywords());
663 m_xCommentEd->set_text(m_pInfoItem->getDescription());
664
665 m_xTitleEd->save_value();
666 m_xThemaEd->save_value();
667 m_xKeywordsEd->save_value();
668 m_xCommentEd->save_value();
669
670 const SfxBoolItem* pROItem = SfxItemSet::GetItem<SfxBoolItem>(rSet, SID_DOC_READONLY, false);
671 if (pROItem && pROItem->GetValue())
672 {
673 m_xTitleEd->set_editable(false);
674 m_xThemaEd->set_editable(false);
675 m_xKeywordsEd->set_editable(false);
676 m_xCommentEd->set_editable(false);
677 }
678}
679
681 : SfxTabPage(pPage, pController, "sfx/ui/documentinfopage.ui", "DocumentInfoPage", &rItemSet)
682 , bEnableUseUserData( false )
683 , bHandleDelete( false )
684 , m_xBmp(m_xBuilder->weld_image("icon"))
685 , m_xNameED(m_xBuilder->weld_label("nameed"))
686 , m_xChangePassBtn(m_xBuilder->weld_button("changepass"))
687 , m_xShowTypeFT(m_xBuilder->weld_label("showtype"))
688 , m_xFileValEd(m_xBuilder->weld_link_button("showlocation"))
689 , m_xShowSizeFT(m_xBuilder->weld_label("showsize"))
690 , m_xCreateValFt(m_xBuilder->weld_label("showcreate"))
691 , m_xChangeValFt(m_xBuilder->weld_label("showmodify"))
692 , m_xSignedValFt(m_xBuilder->weld_label("showsigned"))
693 , m_xSignatureBtn(m_xBuilder->weld_button("signature"))
694 , m_xPrintValFt(m_xBuilder->weld_label("showprint"))
695 , m_xTimeLogValFt(m_xBuilder->weld_label("showedittime"))
696 , m_xDocNoValFt(m_xBuilder->weld_label("showrevision"))
697 , m_xUseUserDataCB(m_xBuilder->weld_check_button("userdatacb"))
698 , m_xDeleteBtn(m_xBuilder->weld_button("reset"))
699 , m_xUseThumbnailSaveCB(m_xBuilder->weld_check_button("thumbnailsavecb"))
700 , m_xTemplFt(m_xBuilder->weld_label("templateft"))
701 , m_xTemplValFt(m_xBuilder->weld_label("showtemplate"))
702 , m_xImagePreferredDpiCheckButton(m_xBuilder->weld_check_button("image-preferred-dpi-checkbutton"))
703 , m_xImagePreferredDpiComboBox(m_xBuilder->weld_combo_box("image-preferred-dpi-combobox"))
704{
705 m_xUseUserDataCB->set_accessible_description(SfxResId(STR_A11Y_DESC_USERDATA));
706
707 m_aUnknownSize = m_xShowSizeFT->get_label();
708 m_xShowSizeFT->set_label(OUString());
709
710 m_aMultiSignedStr = m_xSignedValFt->get_label();
711 m_xSignedValFt->set_label(OUString());
712
715 m_xChangePassBtn->connect_clicked( LINK( this, SfxDocumentPage, ChangePassHdl ) );
716 m_xSignatureBtn->connect_clicked( LINK( this, SfxDocumentPage, SignatureHdl ) );
718 m_xSignatureBtn->hide();
719 m_xDeleteBtn->connect_clicked( LINK( this, SfxDocumentPage, DeleteHdl ) );
720 m_xImagePreferredDpiCheckButton->connect_toggled(LINK(this, SfxDocumentPage, ImagePreferredDPICheckBoxClicked));
721
722 // [i96288] Check if the document signature command is enabled
723 // on the main list enable/disable the pushbutton accordingly
724 SvtCommandOptions aCmdOptions;
725 if ( aCmdOptions.LookupDisabled( "Signature" ) )
726 m_xSignatureBtn->set_sensitive(false);
727}
728
730{
732 {
733 m_xPasswordDialog->Response(RET_CANCEL);
735 }
736}
737
739{
740 OUString aName;
741 if (bEnableUseUserData && m_xUseUserDataCB->get_active())
742 aName = SvtUserOptions().GetFullName();
745 util::DateTime uDT( now.GetUNODateTime() );
746 m_xCreateValFt->set_label( ConvertDateTime_Impl( aName, uDT, rLocaleWrapper ) );
747 m_xChangeValFt->set_label( "" );
748 m_xPrintValFt->set_label( "" );
749 m_xTimeLogValFt->set_label( rLocaleWrapper.getDuration( tools::Duration() ) );
750 m_xDocNoValFt->set_label(OUString('1'));
751 bHandleDelete = true;
752}
753
755{
757 if( pDoc )
758 {
760
761 ImplUpdateSignatures();
762 }
763}
764
765IMPL_LINK_NOARG(SfxDocumentPage, ImagePreferredDPICheckBoxClicked, weld::Toggleable&, void)
766{
767 bool bEnabled = m_xImagePreferredDpiCheckButton->get_state() == TRISTATE_TRUE;
768 m_xImagePreferredDpiComboBox->set_sensitive(bEnabled);
769}
770
772{
774 do
775 {
776 if (!pShell)
777 break;
778 SfxItemSet& rMedSet = pShell->GetMedium()->GetItemSet();
779 std::shared_ptr<const SfxFilter> pFilter = pShell->GetMedium()->GetFilter();
780 if (!pFilter)
781 break;
783 {
784 // MS Types support max len of 15 characters while OOXML is "unlimited"
785 const sal_uInt16 maxPwdLen = sfx2::IsMSType(pFilter) && !sfx2::IsOOXML(pFilter) ? 15 : 0;
786 // handle the pwd dialog asynchronously
788 m_xPasswordDialog = pFact->CreatePasswordToOpenModifyDialog(GetFrameWeld(), maxPwdLen, false);
789 m_xPasswordDialog->AllowEmpty(); // needed to remove password
790 m_xPasswordDialog->StartExecuteAsync([this, pFilter, &rMedSet, pShell](sal_Int32 nResult)
791 {
792 if (nResult == RET_OK)
793 {
794 sfx2::SetPassword(pFilter, &rMedSet, m_xPasswordDialog->GetPasswordToOpen(),
795 m_xPasswordDialog->GetPasswordToOpen(), true);
796 tools::JsonWriter payloadJson;
797 payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen());
798 payloadJson.put("isToModify", false);
800 LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, payloadJson.finishAndGetAsOString());
801 pShell->SetModified();
802 }
803 m_xPasswordDialog->disposeOnce();
804 });
805 } else {
806 sfx2::RequestPassword(pFilter, OUString(), &rMedSet, GetFrameWeld()->GetXWindow());
807 pShell->SetModified();
808 }
809 }
810 while (false);
811}
812
814{
816 if ( !pDoc )
817 return;
818
819 SfxMedium* pMedium = pDoc->GetMedium();
820 if ( !pMedium || pMedium->GetName().isEmpty() || !pMedium->GetStorage().is() )
821 return;
822
823 Reference< security::XDocumentDigitalSignatures > xD;
824 try
825 {
826 xD = security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext());
827 xD->setParentWindow(GetDialogController()->getDialog()->GetXWindow());
828 }
829 catch ( const css::uno::DeploymentException& )
830 {
831 }
832 OUString s;
833 Sequence< security::DocumentSignatureInformation > aInfos;
834
835 if ( xD.is() )
836 aInfos = xD->verifyDocumentContentSignatures( pMedium->GetZipStorageToSign_Impl(),
837 uno::Reference< io::XInputStream >() );
838 if ( aInfos.getLength() > 1 )
840 else if ( aInfos.getLength() == 1 )
841 {
842 const security::DocumentSignatureInformation& rInfo = aInfos[ 0 ];
843 s = utl::GetDateTimeString( rInfo.SignatureDate, rInfo.SignatureTime ) + ", " +
844 comphelper::xmlsec::GetContentPart(rInfo.Signer->getSubjectName(), rInfo.Signer->getCertificateKind());
845 }
846 m_xSignedValFt->set_label(s);
847}
848
850{
852 do
853 {
854 if (!pShell)
855 break;
856 const SfxUnoAnyItem* pEncryptionDataItem = pShell->GetMedium()->GetItemSet().GetItem(SID_ENCRYPTIONDATA, false);
857 uno::Sequence< beans::NamedValue > aEncryptionData;
858 if (pEncryptionDataItem)
859 pEncryptionDataItem->GetValue() >>= aEncryptionData;
860 else
861 break;
862
863 if (!aEncryptionData.hasElements())
864 break;
865 m_xChangePassBtn->set_sensitive(true);
866 return;
867 }
868 while (false);
870}
871
872std::unique_ptr<SfxTabPage> SfxDocumentPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rItemSet)
873{
874 return std::make_unique<SfxDocumentPage>(pPage, pController, *rItemSet);
875}
876
878{
879 bEnableUseUserData = true;
880 m_xUseUserDataCB->show();
881 m_xDeleteBtn->show();
882}
883
885{
886 bool bRet = false;
887
889 m_xUseUserDataCB->get_state_changed_from_saved() )
890 {
891 const SfxItemSet* pExpSet = GetDialogExampleSet();
892 const SfxDocumentInfoItem* pInfoItem;
893
894 if ( pExpSet && (pInfoItem = pExpSet->GetItemIfSet( SID_DOCINFO ) ) )
895 {
896 bool bUseData = ( TRISTATE_TRUE == m_xUseUserDataCB->get_state() );
897 const_cast<SfxDocumentInfoItem*>(pInfoItem)->SetUseUserData( bUseData );
898 rSet->Put( *pInfoItem );
899 bRet = true;
900 }
901 }
902
903 if ( bHandleDelete )
904 {
905 const SfxItemSet* pExpSet = GetDialogExampleSet();
906 const SfxDocumentInfoItem* pInfoItem;
907 if ( pExpSet && (pInfoItem = pExpSet->GetItemIfSet( SID_DOCINFO )) )
908 {
909 bool bUseAuthor = bEnableUseUserData && m_xUseUserDataCB->get_active();
910 SfxDocumentInfoItem newItem( *pInfoItem );
911 newItem.resetUserData( bUseAuthor
912 ? SvtUserOptions().GetFullName()
913 : OUString() );
914 const_cast<SfxDocumentInfoItem*>(pInfoItem)->SetUseUserData( TRISTATE_TRUE == m_xUseUserDataCB->get_state() );
915 newItem.SetUseUserData( TRISTATE_TRUE == m_xUseUserDataCB->get_state() );
916
917 newItem.SetDeleteUserData( true );
918 rSet->Put( newItem );
919 bRet = true;
920 }
921 }
922
923 if ( m_xUseThumbnailSaveCB->get_state_changed_from_saved() )
924 {
925 const SfxItemSet* pExpSet = GetDialogExampleSet();
926 const SfxDocumentInfoItem* pInfoItem;
927
928 if ( pExpSet && (pInfoItem = pExpSet->GetItemIfSet( SID_DOCINFO )) )
929 {
930 bool bUseThumbnail = ( TRISTATE_TRUE == m_xUseThumbnailSaveCB->get_state() );
931 const_cast<SfxDocumentInfoItem*>(pInfoItem)->SetUseThumbnailSave( bUseThumbnail );
932 rSet->Put( *pInfoItem );
933 bRet = true;
934 }
935 }
936
938 if (pDocSh)
939 {
940 uno::Reference<lang::XMultiServiceFactory> xFac(pDocSh->GetModel(), uno::UNO_QUERY);
941 if (xFac.is())
942 {
943 uno::Reference<beans::XPropertySet> xProps(xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
944 if (xProps.is())
945 {
946 sal_Int32 nImagePreferredDPI = 0;
948 {
949 OUString aImagePreferredDPIString = m_xImagePreferredDpiComboBox->get_active_text();
950 nImagePreferredDPI = aImagePreferredDPIString.toInt32();
951 }
952 xProps->setPropertyValue("ImagePreferredDPI", uno::Any(nImagePreferredDPI));
953 }
954 }
955 }
956
957 return bRet;
958}
959
961{
962 // Determine the document information
963 const SfxDocumentInfoItem& rInfoItem = rSet->Get(SID_DOCINFO);
964
965 // template data
966 if (rInfoItem.HasTemplate())
967 {
968 const OUString& rName = rInfoItem.getTemplateName();
969 if (rName.getLength() > SAL_MAX_INT16) // tdf#122780 pick some ~arbitrary max size
970 m_xTemplValFt->set_label(rName.copy(0, SAL_MAX_INT16));
971 else
972 m_xTemplValFt->set_label(rName);
973 }
974 else
975 {
976 m_xTemplFt->hide();
977 m_xTemplValFt->hide();
978 }
979
980 // determine file name
981 OUString aFile( rInfoItem.GetValue() );
982 OUString aFactory( aFile );
983 if ( aFile.getLength() > 2 && aFile[0] == '[' )
984 {
985 sal_Int32 nPos = aFile.indexOf( ']' );
986 aFactory = aFile.copy( 1, nPos-1 );
987 aFile = aFile.copy( nPos+1 );
988 }
989
990 // determine name
991 INetURLObject aURL(aFile);
993 if ( aName.isEmpty() || aURL.GetProtocol() == INetProtocol::PrivSoffice )
994 aName = SfxResId( STR_NONAME );
995 m_xNameED->set_label( aName );
996
997 // determine context symbol
998 aURL.SetSmartProtocol( INetProtocol::File );
999 aURL.SetSmartURL( aFactory);
1000 const OUString& rMainURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
1001 OUString aImage = SvFileInformationManager::GetImageId( aURL, true );
1002 m_xBmp->set_from_icon_name(aImage);
1003
1004 // determine size and type
1005 OUString aSizeText( m_aUnknownSize );
1006 if ( aURL.GetProtocol() == INetProtocol::File ||
1007 aURL.isAnyKnownWebDAVScheme() )
1008 aSizeText = CreateSizeText( SfxContentHelper::GetSize( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ) );
1009 m_xShowSizeFT->set_label( aSizeText );
1010
1011 OUString aDescription = SvFileInformationManager::GetDescription( INetURLObject(rMainURL) );
1012 if ( aDescription.isEmpty() )
1013 aDescription = SfxResId( STR_SFX_NEWOFFICEDOC );
1014 m_xShowTypeFT->set_label( aDescription );
1015
1016 // determine location
1017 // online we don't know file location so we just set it as the name
1019 {
1020 m_xFileValEd->set_label(aName);
1021 m_xFileValEd->set_uri(aName);
1022
1023 // Disable setting/changing password on text files.
1024 // Perhaps this needs to be done for both Online and Desktop.
1025 OUString sExtension(INetURLObject(rMainURL).getExtension());
1026 if (!sExtension.isEmpty())
1027 {
1028 sExtension = sExtension.toAsciiLowerCase();
1029 if (sExtension == "txt" || sExtension == "csv")
1030 m_xChangePassBtn->set_sensitive(false);
1031 }
1032 }
1033 else
1034 {
1035 aURL.SetSmartURL( aFile);
1036 if ( aURL.GetProtocol() == INetProtocol::File )
1037 {
1038 INetURLObject aPath( aURL );
1039 aPath.setFinalSlash();
1040 aPath.removeSegment();
1041 // we know it's a folder -> don't need the final slash, but it's better for WB_PATHELLIPSIS
1042 aPath.removeFinalSlash();
1043 OUString aText( aPath.PathToFileName() );
1044 m_xFileValEd->set_label(aText);
1045 OUString aURLStr;
1046 osl::FileBase::getFileURLFromSystemPath(aText, aURLStr);
1047 m_xFileValEd->set_uri(aURLStr);
1048 }
1049 else if (aURL.GetProtocol() != INetProtocol::PrivSoffice)
1050 {
1051 m_xFileValEd->set_label(aURL.GetPartBeforeLastName());
1052 m_xFileValEd->set_uri(m_xFileValEd->get_label());
1053 }
1054 }
1055
1056
1057 // handle access data
1058 bool bUseUserData = rInfoItem.IsUseUserData();
1060 m_xCreateValFt->set_label( ConvertDateTime_Impl( rInfoItem.getAuthor(),
1061 rInfoItem.getCreationDate(), rLocaleWrapper ) );
1062 util::DateTime aTime( rInfoItem.getModificationDate() );
1063 if ( aTime.Month > 0 )
1064 m_xChangeValFt->set_label( ConvertDateTime_Impl(
1065 rInfoItem.getModifiedBy(), aTime, rLocaleWrapper ) );
1066 aTime = rInfoItem.getPrintDate();
1067 if ( aTime.Month > 0 )
1068 m_xPrintValFt->set_label( ConvertDateTime_Impl( rInfoItem.getPrintedBy(),
1069 aTime, rLocaleWrapper ) );
1070 const tools::Long nTime = rInfoItem.getEditingDuration();
1071 if ( bUseUserData )
1072 {
1073 assert(SAL_MIN_INT32 <= nTime/86400 && nTime/86400 <= SAL_MAX_INT32);
1074 const tools::Duration aD( static_cast<sal_Int32>(nTime)/86400,
1075 (nTime%86400)/3600, (nTime%3600)/60, nTime%60, 0);
1076 m_xTimeLogValFt->set_label( rLocaleWrapper.getDuration( aD ) );
1077 m_xDocNoValFt->set_label( OUString::number(
1078 rInfoItem.getEditingCycles() ) );
1079 }
1080
1081 bool bUseThumbnailSave = rInfoItem.IsUseThumbnailSave();
1082
1083 // Check for cmis properties where otherwise unavailable
1084 if ( rInfoItem.isCmisDocument( ) )
1085 {
1086 const uno::Sequence< document::CmisProperty > aCmisProps = rInfoItem.GetCmisProperties();
1087 for ( const auto& rCmisProp : aCmisProps )
1088 {
1089 if ( rCmisProp.Id == "cmis:contentStreamLength" &&
1090 aSizeText == m_aUnknownSize )
1091 {
1092 Sequence< sal_Int64 > seqValue;
1093 rCmisProp.Value >>= seqValue;
1094 SvNumberFormatter aNumberFormatter( ::comphelper::getProcessComponentContext(),
1095 Application::GetSettings().GetLanguageTag().getLanguageType() );
1096 sal_uInt32 nIndex = aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
1097 if ( seqValue.hasElements() )
1098 {
1099 OUString sValue;
1100 aNumberFormatter.GetInputLineString( seqValue[0], nIndex, sValue );
1101 m_xShowSizeFT->set_label( CreateSizeText( sValue.toInt64( ) ) );
1102 }
1103 }
1104
1105 util::DateTime uDT;
1106 OUString emptyDate = ConvertDateTime_Impl( u"", uDT, rLocaleWrapper );
1107 if ( rCmisProp.Id == "cmis:creationDate" &&
1108 (m_xCreateValFt->get_label() == emptyDate ||
1109 m_xCreateValFt->get_label().isEmpty()))
1110 {
1111 Sequence< util::DateTime > seqValue;
1112 rCmisProp.Value >>= seqValue;
1113 if ( seqValue.hasElements() )
1114 {
1115 m_xCreateValFt->set_label( ConvertDateTime_Impl( u"", seqValue[0], rLocaleWrapper ) );
1116 }
1117 }
1118 if ( rCmisProp.Id == "cmis:lastModificationDate" &&
1119 (m_xChangeValFt->get_label() == emptyDate ||
1120 m_xChangeValFt->get_label().isEmpty()))
1121 {
1122 Sequence< util::DateTime > seqValue;
1123 rCmisProp.Value >>= seqValue;
1124 if ( seqValue.hasElements() )
1125 {
1126 m_xChangeValFt->set_label( ConvertDateTime_Impl( u"", seqValue[0], rLocaleWrapper ) );
1127 }
1128 }
1129 }
1130 }
1131
1132 m_xUseUserDataCB->set_active(bUseUserData);
1133 m_xUseUserDataCB->save_state();
1134 m_xUseUserDataCB->set_sensitive( bEnableUseUserData );
1135 bHandleDelete = false;
1136 m_xDeleteBtn->set_sensitive( bEnableUseUserData );
1137 m_xUseThumbnailSaveCB->set_active(bUseThumbnailSave);
1138 m_xUseThumbnailSaveCB->save_state();
1139
1141 sal_Int32 nImagePreferredDPI = 0;
1142 if (pDocSh)
1143 {
1144 try
1145 {
1146 uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
1147 uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY_THROW );
1148
1149 xProps->getPropertyValue("ImagePreferredDPI") >>= nImagePreferredDPI;
1150 }
1151 catch( uno::Exception& )
1152 {
1153 }
1154 }
1155 if (nImagePreferredDPI > 0)
1156 {
1158 m_xImagePreferredDpiComboBox->set_sensitive(true);
1159 m_xImagePreferredDpiComboBox->set_entry_text(OUString::number(nImagePreferredDPI));
1160 }
1161 else
1162 {
1164 m_xImagePreferredDpiComboBox->set_sensitive(false);
1165 m_xImagePreferredDpiComboBox->set_entry_text("");
1166 }
1167
1168}
1169
1171 : SfxTabDialogController(pParent, "sfx/ui/documentpropertiesdialog.ui",
1172 "DocumentPropertiesDialog", &rItemSet)
1173{
1174 const SfxDocumentInfoItem& rInfoItem = rItemSet.Get( SID_DOCINFO );
1175
1176#ifdef DBG_UTIL
1177 const SfxStringItem* pURLItem = rItemSet.GetItem<SfxStringItem>(SID_BASEURL, false);
1178 DBG_ASSERT( pURLItem, "No BaseURL provided for InternetTabPage!" );
1179#endif
1180
1181 // Determine the Titles
1182 OUString aTitle(m_xDialog->get_title());
1183 const SfxStringItem* pItem = rItemSet.GetItemIfSet( SID_EXPLORER_PROPS_START, false );
1184 if ( !pItem )
1185 {
1186 // File name
1187 const OUString& aFile( rInfoItem.GetValue() );
1188
1190 aURL.SetSmartProtocol( INetProtocol::File );
1191 aURL.SetSmartURL( aFile);
1192 if ( INetProtocol::PrivSoffice != aURL.GetProtocol() )
1193 {
1194 OUString aLastName( aURL.GetLastName() );
1195 if ( !aLastName.isEmpty() )
1196 aTitle = aTitle.replaceFirst("%1", aLastName);
1197 else
1198 aTitle = aTitle.replaceFirst("%1", aFile);
1199 }
1200 else
1201 aTitle = aTitle.replaceFirst("%1", SfxResId( STR_NONAME ));
1202 }
1203 else
1204 {
1205 aTitle = aTitle.replaceFirst("%1", pItem->GetValue());
1206 }
1207 m_xDialog->set_title(aTitle);
1208
1209 // Property Pages
1210 AddTabPage("general", SfxDocumentPage::Create, nullptr);
1211 AddTabPage("description", SfxDocumentDescPage::Create, nullptr);
1212
1214 AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr);
1215 else
1216 RemoveTabPage("customprops");
1217
1218 if (rInfoItem.isCmisDocument())
1219 AddTabPage("cmisprops", SfxCmisPropertiesPage::Create, nullptr);
1220 else
1221 RemoveTabPage("cmisprops");
1222 // Disable security page for online as not fully asynced yet
1224 AddTabPage("security", SfxSecurityPage::Create, nullptr);
1225 else
1226 RemoveTabPage("security");
1227}
1228
1229void SfxDocumentInfoDialog::PageCreated(const OUString& rId, SfxTabPage &rPage)
1230{
1231 if (rId == "general")
1232 static_cast<SfxDocumentPage&>(rPage).EnableUseUserData();
1233}
1234
1236{
1237 AddTabPage("font", SfxResId(STR_FONT_TABPAGE), SfxDocumentFontsPage::Create);
1238}
1239
1240// class CustomPropertiesYesNoButton -------------------------------------
1241
1242CustomPropertiesYesNoButton::CustomPropertiesYesNoButton(std::unique_ptr<weld::Widget> xTopLevel,
1243 std::unique_ptr<weld::RadioButton> xYesButton,
1244 std::unique_ptr<weld::RadioButton> xNoButton)
1245 : m_xTopLevel(std::move(xTopLevel))
1246 , m_xYesButton(std::move(xYesButton))
1247 , m_xNoButton(std::move(xNoButton))
1248{
1249 CheckNo();
1250}
1251
1253{
1254}
1255
1256
1257DurationDialog_Impl::DurationDialog_Impl(weld::Widget* pParent, const util::Duration& rDuration)
1258 : GenericDialogController(pParent, "sfx/ui/editdurationdialog.ui", "EditDurationDialog")
1259 , m_xNegativeCB(m_xBuilder->weld_check_button("negative"))
1260 , m_xYearNF(m_xBuilder->weld_spin_button("years"))
1261 , m_xMonthNF(m_xBuilder->weld_spin_button("months"))
1262 , m_xDayNF(m_xBuilder->weld_spin_button("days"))
1263 , m_xHourNF(m_xBuilder->weld_spin_button("hours"))
1264 , m_xMinuteNF(m_xBuilder->weld_spin_button("minutes"))
1265 , m_xSecondNF(m_xBuilder->weld_spin_button("seconds"))
1266 , m_xMSecondNF(m_xBuilder->weld_spin_button("milliseconds"))
1267{
1268 m_xNegativeCB->set_active(rDuration.Negative);
1269 m_xYearNF->set_value(rDuration.Years);
1270 m_xMonthNF->set_value(rDuration.Months);
1271 m_xDayNF->set_value(rDuration.Days);
1272 m_xHourNF->set_value(rDuration.Hours);
1273 m_xMinuteNF->set_value(rDuration.Minutes);
1274 m_xSecondNF->set_value(rDuration.Seconds);
1275 m_xMSecondNF->set_value(rDuration.NanoSeconds);
1276}
1277
1279{
1280 util::Duration aRet;
1281 aRet.Negative = m_xNegativeCB->get_active();
1282 aRet.Years = m_xYearNF->get_value();
1283 aRet.Months = m_xMonthNF->get_value();
1284 aRet.Days = m_xDayNF->get_value();
1285 aRet.Hours = m_xHourNF->get_value();
1286 aRet.Minutes = m_xMinuteNF->get_value();
1287 aRet.Seconds = m_xSecondNF->get_value();
1288 aRet.NanoSeconds = m_xMSecondNF->get_value();
1289 return aRet;
1290}
1291
1293 std::unique_ptr<weld::Button> xEditButton)
1294 : m_xEntry(std::move(xEntry))
1295 , m_xEditButton(std::move(xEditButton))
1296{
1297 m_xEditButton->connect_clicked(LINK(this, CustomPropertiesDurationField, ClickHdl));
1298 SetDuration( util::Duration(false, 0, 0, 0, 0, 0, 0, 0) );
1299}
1300
1302{
1303 m_xEntry->set_visible(bVisible);
1304 m_xEditButton->set_visible(bVisible);
1305}
1306
1307void CustomPropertiesDurationField::SetDuration( const util::Duration& rDuration )
1308{
1309 m_aDuration = rDuration;
1310 OUString sText = (rDuration.Negative ? OUString('-') : OUString('+')) +
1311 SfxResId(SFX_ST_DURATION_FORMAT);
1312 sText = sText.replaceFirst( "%1", OUString::number( rDuration.Years ) );
1313 sText = sText.replaceFirst( "%2", OUString::number( rDuration.Months ) );
1314 sText = sText.replaceFirst( "%3", OUString::number( rDuration.Days ) );
1315 sText = sText.replaceFirst( "%4", OUString::number( rDuration.Hours ) );
1316 sText = sText.replaceFirst( "%5", OUString::number( rDuration.Minutes) );
1317 sText = sText.replaceFirst( "%6", OUString::number( rDuration.Seconds) );
1318 m_xEntry->set_text(sText);
1319}
1320
1322{
1323 m_xDurationDialog = std::make_shared<DurationDialog_Impl>(&rButton, GetDuration());
1324 weld::DialogController::runAsync(m_xDurationDialog, [&](sal_Int32 response)
1325 {
1326 if (response == RET_OK)
1327 {
1328 SetDuration(m_xDurationDialog->GetDuration());
1329 }
1330 });
1331}
1332
1334{
1336 m_xDurationDialog->response(RET_CANCEL);
1337}
1338
1339namespace
1340{
1341 void fillNameBox(weld::ComboBox& rNameBox)
1342 {
1343 for (size_t i = 0; i < SAL_N_ELEMENTS(SFX_CB_PROPERTY_STRINGARRAY); ++i)
1344 rNameBox.append_text(SfxResId(SFX_CB_PROPERTY_STRINGARRAY[i]));
1345 Size aSize(rNameBox.get_preferred_size());
1346 rNameBox.set_size_request(aSize.Width(), aSize.Height());
1347 }
1348
1349 void fillTypeBox(weld::ComboBox& rTypeBox)
1350 {
1351 for (size_t i = 0; i < SAL_N_ELEMENTS(SFX_LB_PROPERTY_STRINGARRAY); ++i)
1352 {
1353 OUString sId(OUString::number(SFX_LB_PROPERTY_STRINGARRAY[i].second));
1354 rTypeBox.append(sId, SfxResId(SFX_LB_PROPERTY_STRINGARRAY[i].first));
1355 }
1356 rTypeBox.set_active(0);
1357 Size aSize(rTypeBox.get_preferred_size());
1358 rTypeBox.set_size_request(aSize.Width(), aSize.Height());
1359 }
1360}
1361
1362// struct CustomPropertyLine ---------------------------------------------
1364 : m_pParent(pParent)
1365 , m_xBuilder(Application::CreateBuilder(pContainer, "sfx/ui/linefragment.ui"))
1366 , m_xLine(m_xBuilder->weld_container("lineentry"))
1367 , m_xNameBox(m_xBuilder->weld_combo_box("namebox"))
1368 , m_xTypeBox(m_xBuilder->weld_combo_box("typebox"))
1369 , m_xValueEdit(m_xBuilder->weld_entry("valueedit"))
1370 , m_xDateTimeBox(m_xBuilder->weld_widget("datetimebox"))
1371 , m_xDateField(new CustomPropertiesDateField(new SvtCalendarBox(m_xBuilder->weld_menu_button("date"))))
1372 , m_xTimeField(new CustomPropertiesTimeField(m_xBuilder->weld_formatted_spin_button("time")))
1373 , m_xDurationBox(m_xBuilder->weld_widget("durationbox"))
1374 , m_xDurationField(new CustomPropertiesDurationField(m_xBuilder->weld_entry("duration"),
1375 m_xBuilder->weld_button("durationbutton")))
1376 , m_xYesNoButton(new CustomPropertiesYesNoButton(m_xBuilder->weld_widget("yesno"),
1377 m_xBuilder->weld_radio_button("yes"),
1378 m_xBuilder->weld_radio_button("no")))
1379 , m_xRemoveButton(m_xBuilder->weld_button("remove"))
1380 , m_bTypeLostFocus( false )
1381{
1382 fillNameBox(*m_xNameBox);
1383 fillTypeBox(*m_xTypeBox);
1384
1385 m_xTypeBox->connect_changed(LINK(this, CustomPropertyLine, TypeHdl));
1386 m_xRemoveButton->connect_clicked(LINK(this, CustomPropertyLine, RemoveHdl));
1387 m_xValueEdit->connect_focus_out(LINK(this, CustomPropertyLine, EditLoseFocusHdl));
1388 //add lose focus handlers of date/time fields
1389 m_xTypeBox->connect_focus_out(LINK(this, CustomPropertyLine, BoxLoseFocusHdl));
1390}
1391
1393{
1394 m_xNameBox->set_active(-1);
1395 m_xValueEdit->set_text(OUString());
1396
1397}
1398
1400{
1401 m_xLine->hide();
1402}
1403
1405 weld::Label& rHeaderAccType, weld::Label& rHeaderAccValue)
1406 : m_nHeight(0)
1407 , m_nLineHeight(0)
1408 , m_nScrollPos(0)
1409 , m_pCurrentLine(nullptr)
1410 , m_aNumberFormatter(::comphelper::getProcessComponentContext(),
1411 Application::GetSettings().GetLanguageTag().getLanguageType())
1412 , m_aEditLoseFocusIdle("sfx2 CustomPropertiesWindow loseFocusIdle")
1413 , m_aBoxLoseFocusIdle("sfx2 CustomPropertiesWindow m_aBoxLoseFocusIdle")
1414 , m_rBody(rParent)
1415 , m_rHeaderAccName(rHeaderAccName)
1416 , m_rHeaderAccType(rHeaderAccType)
1417 , m_rHeaderAccValue(rHeaderAccValue)
1418{
1419 m_aEditLoseFocusIdle.SetPriority( TaskPriority::LOWEST );
1421 m_aBoxLoseFocusIdle.SetPriority( TaskPriority::LOWEST );
1423}
1424
1426{
1429
1430 m_pCurrentLine = nullptr;
1431}
1432
1434{
1435 auto nType = rBox.get_active_id().toInt32();
1436 m_xValueEdit->set_visible( (Custom_Type_Text == nType) || (Custom_Type_Number == nType) );
1437 m_xDateTimeBox->set_visible( (Custom_Type_Date == nType) || (Custom_Type_Datetime == nType) );
1438 m_xDateField->set_visible( (Custom_Type_Date == nType) || (Custom_Type_Datetime == nType) );
1439 m_xTimeField->set_visible( Custom_Type_Datetime == nType );
1440 m_xDurationBox->set_visible( Custom_Type_Duration == nType );
1441 m_xDurationField->set_visible( Custom_Type_Duration == nType );
1442 m_xYesNoButton->set_visible( Custom_Type_Boolean == nType );
1443}
1444
1446{
1447 DoTypeHdl(rBox);
1448}
1449
1451{
1453
1454 auto pFound = std::find_if( m_aCustomPropertiesLines.begin(), m_aCustomPropertiesLines.end(),
1455 [&] (const std::unique_ptr<CustomPropertyLine>& p) { return p.get() == pLine; });
1456 if ( pFound != m_aCustomPropertiesLines.end() )
1457 {
1458 sal_uInt32 nLineNumber = pFound - m_aCustomPropertiesLines.begin();
1459 sal_uInt32 nDataModelIndex = GetCurrentDataModelPosition() + nLineNumber;
1460 m_aCustomProperties.erase(m_aCustomProperties.begin() + nDataModelIndex);
1461
1463 }
1464
1465 m_aRemovedHdl.Call(nullptr);
1466}
1467
1469{
1470 m_pParent->Remove(this);
1471}
1472
1474{
1475 m_pCurrentLine = pLine;
1477}
1478
1480{
1481 if (!m_bTypeLostFocus)
1482 m_pParent->EditLoseFocus(this);
1483 else
1484 m_bTypeLostFocus = false;
1485}
1486
1488{
1489 m_pCurrentLine = pLine;
1491}
1492
1494{
1495 m_pParent->BoxLoseFocus(this);
1496}
1497
1499{
1500 ValidateLine( m_pCurrentLine, false );
1501}
1502
1504{
1505 ValidateLine( m_pCurrentLine, true );
1506}
1507
1509{
1510 bool bIsValid = true;
1511 pLine->m_bTypeLostFocus = false;
1512 auto nType = pLine->m_xTypeBox->get_active_id().toInt32();
1513 OUString sValue = pLine->m_xValueEdit->get_text();
1514 if ( sValue.isEmpty() )
1515 return true;
1516
1518 if ( Custom_Type_Number == nType )
1519 // tdf#116214 Scientific format allows to use also standard numbers
1520 nIndex = const_cast< SvNumberFormatter& >(
1521 m_aNumberFormatter ).GetFormatIndex( NF_SCIENTIFIC_000E00 );
1522 else if ( Custom_Type_Date == nType )
1523 nIndex = const_cast< SvNumberFormatter& >(
1524 m_aNumberFormatter).GetFormatIndex( NF_DATE_SYS_DDMMYYYY );
1525
1527 {
1528 sal_uInt32 nTemp = nIndex;
1529 double fDummy = 0.0;
1530 bIsValid = const_cast< SvNumberFormatter& >(
1531 m_aNumberFormatter ).IsNumberFormat( sValue, nIndex, fDummy );
1532 if ( bIsValid && nTemp != nIndex )
1533 // sValue is a number but the format doesn't match the index
1534 bIsValid = false;
1535 }
1536
1537 return bIsValid;
1538}
1539
1541{
1542 if (pLine && !IsLineValid(pLine))
1543 {
1544 if ( bIsFromTypeBox ) // LoseFocus of TypeBox
1545 pLine->m_bTypeLostFocus = true;
1546 std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(&m_rBody,
1547 VclMessageType::Question, VclButtonsType::OkCancel, SfxResId(STR_SFX_QUERY_WRONG_TYPE)));
1548 if (xMessageBox->run() == RET_OK)
1549 pLine->m_xTypeBox->set_active_id(OUString::number(Custom_Type_Text));
1550 else
1551 pLine->m_xValueEdit->grab_focus();
1552 }
1553}
1554
1556{
1557 while (GetExistingLineCount() < nCount)
1558 {
1559 CreateNewLine();
1560 }
1561}
1562
1563void CustomPropertiesWindow::AddLine(const OUString& sName, Any const & rAny)
1564{
1565 m_aCustomProperties.push_back(std::unique_ptr<CustomProperty>(new CustomProperty(sName, rAny)));
1567}
1568
1570{
1571 CustomPropertyLine* pNewLine = new CustomPropertyLine(this, &m_rBody);
1572 pNewLine->m_xNameBox->set_accessible_relation_labeled_by(&m_rHeaderAccName);
1573 pNewLine->m_xNameBox->set_accessible_name(m_rHeaderAccName.get_label());
1574 pNewLine->m_xTypeBox->set_accessible_relation_labeled_by(&m_rHeaderAccType);
1575 pNewLine->m_xTypeBox->set_accessible_name(m_rHeaderAccType.get_label());
1576 pNewLine->m_xValueEdit->set_accessible_relation_labeled_by(&m_rHeaderAccValue);
1577 pNewLine->m_xValueEdit->set_accessible_name(m_rHeaderAccValue.get_label());
1578
1579 m_aCustomPropertiesLines.emplace_back( pNewLine );
1580
1581 // this breaks online's jsdialogbuilder
1583 // for ui-testing. Distinguish the elements in the lines
1584 sal_uInt16 nSize = m_aCustomPropertiesLines.size();
1585 pNewLine->m_xNameBox->set_buildable_name(
1586 pNewLine->m_xNameBox->get_buildable_name() + OUString::number(nSize));
1587 pNewLine->m_xTypeBox->set_buildable_name(
1588 pNewLine->m_xTypeBox->get_buildable_name() + OUString::number(nSize));
1589 pNewLine->m_xValueEdit->set_buildable_name(
1590 pNewLine->m_xValueEdit->get_buildable_name() + OUString::number(nSize));
1591 pNewLine->m_xRemoveButton->set_buildable_name(
1592 pNewLine->m_xRemoveButton->get_buildable_name() + OUString::number(nSize));
1593 }
1594
1595 pNewLine->DoTypeHdl(*pNewLine->m_xTypeBox);
1596}
1597
1599{
1600 bool bRet = true;
1601 for ( std::unique_ptr<CustomPropertyLine> const & pLine : m_aCustomPropertiesLines )
1602 {
1603 if ( !IsLineValid( pLine.get() ) )
1604 {
1605 bRet = false;
1606 break;
1607 }
1608 }
1609
1610 return bRet;
1611}
1612
1614{
1615 for (auto& pLine : m_aCustomPropertiesLines)
1616 {
1617 pLine->Clear();
1618 }
1619 m_pCurrentLine = nullptr;
1620 m_aCustomProperties.clear();
1621 m_nScrollPos = 0;
1622}
1623
1624void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
1625{
1627 m_nScrollPos += nNewPos;
1629}
1630
1631Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties()
1632{
1634
1635 Sequence< beans::PropertyValue > aPropertiesSeq(GetTotalLineCount());
1636 std::transform(
1637 m_aCustomProperties.begin(), m_aCustomProperties.end(), aPropertiesSeq.getArray(),
1638 [](const auto& el) { return comphelper::makePropertyValue(el->m_sName, el->m_aValue); });
1639
1640 return aPropertiesSeq;
1641}
1642
1643CustomPropertiesTimeField::CustomPropertiesTimeField(std::unique_ptr<weld::FormattedSpinButton> xTimeField)
1644 : m_xTimeField(std::move(xTimeField))
1645 , m_xFormatter(new weld::TimeFormatter(*m_xTimeField))
1646 , m_isUTC(false)
1647{
1648 m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
1649 m_xFormatter->EnableEmptyField(false);
1650}
1651
1653{
1654 return m_xFormatter->GetTime();
1655}
1656
1658{
1659 m_xFormatter->SetTime(rTime);
1660}
1661
1663{
1664}
1665
1667 : m_xDateField(pDateField)
1668{
1669 DateTime aDateTime(DateTime::SYSTEM);
1670 m_xDateField->set_date(aDateTime);
1671}
1672
1674{
1675 m_xDateField->set_visible(bVisible);
1676}
1677
1679{
1680 return m_xDateField->get_date();
1681}
1682
1684{
1685 m_xDateField->set_date(rDate);
1686}
1687
1689{
1690}
1691
1693{
1694 sal_uInt32 nDataModelPos = GetCurrentDataModelPosition();
1695
1696 for (sal_uInt32 i = 0; nDataModelPos + i < GetTotalLineCount() && i < GetExistingLineCount(); i++)
1697 {
1699
1700 OUString sPropertyName = pLine->m_xNameBox->get_active_text();
1701 if (!sPropertyName.isEmpty())
1702 {
1703 m_aCustomProperties[nDataModelPos + i]->m_sName = sPropertyName;
1704 auto nType = pLine->m_xTypeBox->get_active_id().toInt32();
1705 if (Custom_Type_Number == nType)
1706 {
1707 double nValue = 0;
1709 bool bIsNum = m_aNumberFormatter.
1710 IsNumberFormat(pLine->m_xValueEdit->get_text(), nIndex, nValue);
1711 if (bIsNum)
1712 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= nValue;
1713 }
1714 else if (Custom_Type_Boolean == nType)
1715 {
1716 bool bValue = pLine->m_xYesNoButton->IsYesChecked();
1717 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= bValue;
1718 }
1719 else if (Custom_Type_Datetime == nType)
1720 {
1721 Date aTmpDate = pLine->m_xDateField->get_date();
1722 tools::Time aTmpTime = pLine->m_xTimeField->get_value();
1723 util::DateTime const aDateTime(aTmpTime.GetNanoSec(),
1724 aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
1725 aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(),
1726 pLine->m_xTimeField->m_isUTC);
1727 if (pLine->m_xDateField->m_TZ)
1728 {
1729 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= util::DateTimeWithTimezone(
1730 aDateTime, *pLine->m_xDateField->m_TZ);
1731 }
1732 else
1733 {
1734 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= aDateTime;
1735 }
1736 }
1737 else if (Custom_Type_Date == nType)
1738 {
1739 Date aTmpDate = pLine->m_xDateField->get_date();
1740 util::Date const aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(),
1741 aTmpDate.GetYear());
1742 if (pLine->m_xDateField->m_TZ)
1743 {
1744 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= util::DateWithTimezone(
1745 aDate, *pLine->m_xDateField->m_TZ);
1746 }
1747 else
1748 {
1749 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= aDate;
1750 }
1751 }
1752 else if (Custom_Type_Duration == nType)
1753 {
1754 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= pLine->m_xDurationField->GetDuration();
1755 }
1756 else
1757 {
1758 OUString sValue(pLine->m_xValueEdit->get_text());
1759 m_aCustomProperties[nDataModelPos + i]->m_aValue <<= sValue;
1760 }
1761 }
1762 }
1763}
1764
1765void CustomPropertiesWindow::SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties)
1766{
1767 m_aCustomProperties = std::move(rProperties);
1769}
1770
1772{
1773 double nTmpValue = 0;
1774 bool bTmpValue = false;
1775 OUString sTmpValue;
1776 util::DateTime aTmpDateTime;
1777 util::Date aTmpDate;
1778 util::DateTimeWithTimezone aTmpDateTimeTZ;
1779 util::DateWithTimezone aTmpDateTZ;
1780 util::Duration aTmpDuration;
1781 SvtSysLocale aSysLocale;
1782 const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
1783 CustomProperties nType = Custom_Type_Unknown;
1784 OUString sValue;
1785
1786 sal_uInt32 nDataModelPos = GetCurrentDataModelPosition();
1787 sal_uInt32 i = 0;
1788
1789 for (; nDataModelPos + i < GetTotalLineCount() && i < GetExistingLineCount(); i++)
1790 {
1791 const OUString& rName = m_aCustomProperties[nDataModelPos + i]->m_sName;
1792 const css::uno::Any& rAny = m_aCustomProperties[nDataModelPos + i]->m_aValue;
1793
1795 pLine->Clear();
1796
1797 pLine->m_xNameBox->set_entry_text(rName);
1798 pLine->m_xLine->show();
1799
1800 if (!rAny.hasValue())
1801 {
1802 pLine->m_xValueEdit->set_text(OUString());
1803 }
1804 else if (rAny >>= nTmpValue)
1805 {
1807 m_aNumberFormatter.GetInputLineString(nTmpValue, nIndex, sValue);
1808 pLine->m_xValueEdit->set_text(sValue);
1809 nType = Custom_Type_Number;
1810 }
1811 else if (rAny >>= bTmpValue)
1812 {
1813 sValue = (bTmpValue ? rLocaleWrapper.getTrueWord() : rLocaleWrapper.getFalseWord());
1814 nType = Custom_Type_Boolean;
1815 }
1816 else if (rAny >>= sTmpValue)
1817 {
1818 pLine->m_xValueEdit->set_text(sTmpValue);
1819 nType = Custom_Type_Text;
1820 }
1821 else if (rAny >>= aTmpDate)
1822 {
1823 pLine->m_xDateField->set_date(Date(aTmpDate));
1824 nType = Custom_Type_Date;
1825 }
1826 else if (rAny >>= aTmpDateTime)
1827 {
1828 pLine->m_xDateField->set_date(Date(aTmpDateTime));
1829 pLine->m_xTimeField->set_value(tools::Time(aTmpDateTime));
1830 pLine->m_xTimeField->m_isUTC = aTmpDateTime.IsUTC;
1831 nType = Custom_Type_Datetime;
1832 }
1833 else if (rAny >>= aTmpDateTZ)
1834 {
1835 pLine->m_xDateField->set_date(Date(aTmpDateTZ.DateInTZ.Day,
1836 aTmpDateTZ.DateInTZ.Month, aTmpDateTZ.DateInTZ.Year));
1837 pLine->m_xDateField->m_TZ = aTmpDateTZ.Timezone;
1838 nType = Custom_Type_Date;
1839 }
1840
1841 else if (rAny >>= aTmpDateTimeTZ)
1842 {
1843 util::DateTime const& rDT(aTmpDateTimeTZ.DateTimeInTZ);
1844 pLine->m_xDateField->set_date(Date(rDT));
1845 pLine->m_xTimeField->set_value(tools::Time(rDT));
1846 pLine->m_xTimeField->m_isUTC = rDT.IsUTC;
1847 pLine->m_xDateField->m_TZ = aTmpDateTimeTZ.Timezone;
1848 nType = Custom_Type_Datetime;
1849 }
1850 else if (rAny >>= aTmpDuration)
1851 {
1852 nType = Custom_Type_Duration;
1853 pLine->m_xDurationField->SetDuration(aTmpDuration);
1854 }
1855
1856 if (Custom_Type_Boolean == nType)
1857 {
1858 if (bTmpValue)
1859 pLine->m_xYesNoButton->CheckYes();
1860 else
1861 pLine->m_xYesNoButton->CheckNo();
1862 }
1863 pLine->m_xTypeBox->set_active_id(OUString::number(nType));
1864
1865 pLine->DoTypeHdl(*pLine->m_xTypeBox);
1866 }
1867
1868 // tdf#132667 - grab focus on the last inserted property
1869 if (i > 0 && m_aCustomProperties[nDataModelPos + i - 1]->m_sName.isEmpty())
1870 {
1871 CustomPropertyLine* pLine = m_aCustomPropertiesLines[i - 1].get();
1872 pLine->m_xNameBox->grab_focus();
1873 }
1874
1875 while (nDataModelPos + i >= GetTotalLineCount() && i < GetExistingLineCount())
1876 {
1878 pLine->Hide();
1879 i++;
1880 }
1881}
1882
1884 : m_nThumbPos(0)
1885{
1886}
1887
1889{
1890 m_xBox = rBuilder.weld_widget("box");
1891 m_xBody = rBuilder.weld_container("properties");
1892
1893 m_xName = rBuilder.weld_label("name");
1894 m_xType = rBuilder.weld_label("type");
1895 m_xValue = rBuilder.weld_label("value");
1896 m_xVertScroll = rBuilder.weld_scrolled_window("scroll", true);
1898
1899 m_xBox->set_stack_background();
1900 m_xVertScroll->show();
1901
1902 std::unique_ptr<CustomPropertyLine> xNewLine(new CustomPropertyLine(m_xPropertiesWin.get(), m_xBody.get()));
1903 Size aLineSize(xNewLine->m_xLine->get_preferred_size());
1904 m_xPropertiesWin->SetLineHeight(aLineSize.Height() + 6);
1905 m_xBody->set_size_request(aLineSize.Width() + 6, -1);
1906 auto nHeight = aLineSize.Height() * 8;
1907 m_xVertScroll->set_size_request(-1, nHeight + 6);
1908
1909 m_xPropertiesWin->SetHeight(nHeight);
1910 m_xVertScroll->connect_size_allocate(LINK(this, CustomPropertiesControl, ResizeHdl));
1911
1912 m_xName->set_size_request(xNewLine->m_xNameBox->get_preferred_size().Width(), -1);
1913 m_xType->set_size_request(xNewLine->m_xTypeBox->get_preferred_size().Width(), -1);
1914 m_xValue->set_size_request(xNewLine->m_xValueEdit->get_preferred_size().Width(), -1);
1915
1916 m_xBody->move(xNewLine->m_xLine.get(), nullptr);
1917 xNewLine.reset();
1918
1919 m_xPropertiesWin->SetRemovedHdl( LINK( this, CustomPropertiesControl, RemovedHdl ) );
1920
1921 m_xVertScroll->vadjustment_set_lower(0);
1922 m_xVertScroll->vadjustment_set_upper(0);
1923 m_xVertScroll->vadjustment_set_page_size(0xFFFF);
1924
1925 Link<weld::ScrolledWindow&,void> aScrollLink = LINK( this, CustomPropertiesControl, ScrollHdl );
1926 m_xVertScroll->connect_vadjustment_changed(aScrollLink);
1927
1928 ResizeHdl(Size(-1, nHeight));
1929}
1930
1931IMPL_LINK(CustomPropertiesControl, ResizeHdl, const Size&, rSize, void)
1932{
1933 int nHeight = rSize.Height() - 6;
1934 if (nHeight == m_xPropertiesWin->GetHeight())
1935 return;
1936 m_xPropertiesWin->SetHeight(nHeight);
1937 sal_Int32 nScrollOffset = m_xPropertiesWin->GetLineHeight();
1938 sal_Int32 nVisibleEntries = nHeight / nScrollOffset;
1939 m_xPropertiesWin->SetVisibleLineCount( nVisibleEntries );
1940 m_xVertScroll->vadjustment_set_page_increment( nVisibleEntries - 1 );
1941 m_xVertScroll->vadjustment_set_page_size( nVisibleEntries );
1942 m_xPropertiesWin->ReloadLinesContent();
1943}
1944
1946{
1947}
1948
1950{
1951 sal_Int32 nOffset = m_xPropertiesWin->GetLineHeight();
1952 int nThumbPos = rScrollBar.vadjustment_get_value();
1953 nOffset *= ( m_nThumbPos - nThumbPos );
1954 m_nThumbPos = nThumbPos;
1955 m_xPropertiesWin->DoScroll( nOffset );
1956}
1957
1959{
1960 auto nLineCount = m_xPropertiesWin->GetTotalLineCount();
1961 m_xVertScroll->vadjustment_set_upper(nLineCount + 1);
1962 if (m_xPropertiesWin->GetTotalLineCount() > m_xPropertiesWin->GetExistingLineCount())
1963 {
1964 m_xVertScroll->vadjustment_set_value(nLineCount - 1);
1965 ScrollHdl(*m_xVertScroll);
1966 }
1967}
1968
1969void CustomPropertiesControl::AddLine( Any const & rAny )
1970{
1971 m_xPropertiesWin->AddLine( OUString(), rAny );
1972 auto nLineCount = m_xPropertiesWin->GetTotalLineCount();
1973 m_xVertScroll->vadjustment_set_upper(nLineCount + 1);
1974 if (m_xPropertiesWin->GetHeight() < nLineCount * m_xPropertiesWin->GetLineHeight())
1975 {
1976 m_xVertScroll->vadjustment_set_value(nLineCount + 1);
1977 ScrollHdl(*m_xVertScroll);
1978 }
1979}
1980
1981void CustomPropertiesControl::SetCustomProperties(std::vector< std::unique_ptr<CustomProperty> >&& rProperties)
1982{
1983 m_xPropertiesWin->SetCustomProperties(std::move(rProperties));
1984 auto nLineCount = m_xPropertiesWin->GetTotalLineCount();
1985 m_xVertScroll->vadjustment_set_upper(nLineCount + 1);
1986}
1987
1988// class SfxCustomPropertiesPage -----------------------------------------
1990 : SfxTabPage(pPage, pController, "sfx/ui/custominfopage.ui", "CustomInfoPage", &rItemSet)
1991 , m_xPropertiesCtrl(new CustomPropertiesControl)
1992 , m_xAdd(m_xBuilder->weld_button("add"))
1993{
1995 m_xAdd->connect_clicked(LINK(this, SfxCustomPropertiesPage, AddHdl));
1996}
1997
1999{
2000 m_xPropertiesCtrl.reset();
2001}
2002
2004{
2005 // tdf#115853: reload current lines before adding a brand new one
2006 // indeed the info are deleted by ClearCustomProperties
2007 // each time SfxDocumentInfoItem destructor is called
2008 SfxDocumentInfoItem pInfo;
2009 const Sequence< beans::PropertyValue > aPropertySeq = m_xPropertiesCtrl->GetCustomProperties();
2010 for ( const auto& rProperty : aPropertySeq )
2011 {
2012 if ( !rProperty.Name.isEmpty() )
2013 {
2014 pInfo.AddCustomProperty( rProperty.Name, rProperty.Value );
2015 }
2016 }
2017
2018 Any aAny;
2019 m_xPropertiesCtrl->AddLine(aAny);
2020}
2021
2023{
2024 const SfxDocumentInfoItem* pItem = nullptr;
2025 SfxDocumentInfoItem* pInfo = nullptr;
2026 bool bMustDelete = false;
2027
2028 if (const SfxItemSet* pItemSet = GetDialogExampleSet())
2029 {
2030 pItem = pItemSet->GetItemIfSet(SID_DOCINFO);
2031 if (!pItem)
2032 pInfo = const_cast<SfxDocumentInfoItem*>(&rSet->Get( SID_DOCINFO ));
2033 else
2034 {
2035 bMustDelete = true;
2036 pInfo = new SfxDocumentInfoItem( *pItem );
2037 }
2038 }
2039
2040 if ( pInfo )
2041 {
2042 // If it's a CMIS document, we can't save custom properties
2043 if ( pInfo->isCmisDocument( ) )
2044 {
2045 if ( bMustDelete )
2046 delete pInfo;
2047 return false;
2048 }
2049
2050 pInfo->ClearCustomProperties();
2051 const Sequence< beans::PropertyValue > aPropertySeq = m_xPropertiesCtrl->GetCustomProperties();
2052 for ( const auto& rProperty : aPropertySeq )
2053 {
2054 if ( !rProperty.Name.isEmpty() )
2055 pInfo->AddCustomProperty( rProperty.Name, rProperty.Value );
2056 }
2057 }
2058
2059 if (pInfo)
2060 {
2061 rSet->Put(*pInfo);
2062 if ( bMustDelete )
2063 delete pInfo;
2064 }
2065 return true;
2066}
2067
2069{
2070 m_xPropertiesCtrl->ClearAllLines();
2071 const SfxDocumentInfoItem& rInfoItem = rItemSet->Get(SID_DOCINFO);
2072 std::vector< std::unique_ptr<CustomProperty> > aCustomProps = rInfoItem.GetCustomProperties();
2073 // tdf#123919 - sort custom document properties
2076 Application::GetSettings().GetLanguageTag().getLocale());
2077 std::sort(aCustomProps.begin(), aCustomProps.end(),
2078 [&sort](const std::unique_ptr<CustomProperty>& rLHS,
2079 const std::unique_ptr<CustomProperty>& rRHS) {
2080 return sort.compare(rLHS->m_sName, rRHS->m_sName) < 0;
2081 });
2082 m_xPropertiesCtrl->SetCustomProperties(std::move(aCustomProps));
2083}
2084
2086{
2088 if ( !m_xPropertiesCtrl->AreAllLinesValid() )
2090 return nRet;
2091}
2092
2093std::unique_ptr<SfxTabPage> SfxCustomPropertiesPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rItemSet)
2094{
2095 return std::make_unique<SfxCustomPropertiesPage>(pPage, pController, *rItemSet);
2096}
2097
2098CmisValue::CmisValue(weld::Widget* pParent, const OUString& aStr)
2099 : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui"))
2100 , m_xFrame(m_xBuilder->weld_frame("CmisFrame"))
2101 , m_xValueEdit(m_xBuilder->weld_entry("value"))
2102{
2103 m_xValueEdit->show();
2104 m_xValueEdit->set_text(aStr);
2105}
2106
2107CmisDateTime::CmisDateTime(weld::Widget* pParent, const util::DateTime& aDateTime)
2108 : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui"))
2109 , m_xFrame(m_xBuilder->weld_frame("CmisFrame"))
2110 , m_xDateField(new SvtCalendarBox(m_xBuilder->weld_menu_button("date")))
2111 , m_xTimeField(m_xBuilder->weld_formatted_spin_button("time"))
2112 , m_xFormatter(new weld::TimeFormatter(*m_xTimeField))
2113{
2114 m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
2115 m_xFormatter->EnableEmptyField(false);
2116
2117 m_xDateField->show();
2118 m_xTimeField->show();
2119 m_xDateField->set_date(Date(aDateTime));
2120 m_xFormatter->SetTime(tools::Time(aDateTime));
2121}
2122
2124 : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui"))
2125 , m_xFrame(m_xBuilder->weld_frame("CmisFrame"))
2126 , m_xYesButton(m_xBuilder->weld_radio_button("yes"))
2127 , m_xNoButton(m_xBuilder->weld_radio_button("no"))
2128{
2129 m_xYesButton->show();
2130 m_xNoButton->show();
2131 if (bValue)
2132 m_xYesButton->set_active(true);
2133 else
2134 m_xNoButton->set_active(true);
2135}
2136
2137// struct CmisPropertyLine ---------------------------------------------
2139 : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui"))
2140 , m_sType(CMIS_TYPE_STRING)
2141 , m_bUpdatable(false)
2142 , m_bRequired(false)
2143 , m_bMultiValued(false)
2144 , m_bOpenChoice(false)
2145 , m_xFrame(m_xBuilder->weld_frame("CmisFrame"))
2146 , m_xName(m_xBuilder->weld_label("name"))
2147 , m_xType(m_xBuilder->weld_label("type"))
2148{
2149 m_xFrame->set_sensitive(true);
2150}
2151
2153{
2154}
2155
2156// class CmisPropertiesWindow -----------------------------------------
2157
2158CmisPropertiesWindow::CmisPropertiesWindow(std::unique_ptr<weld::Container> xParent)
2159 : m_xBox(std::move(xParent))
2160 , m_aNumberFormatter(::comphelper::getProcessComponentContext(),
2161 Application::GetSettings().GetLanguageTag().getLanguageType())
2162{
2163}
2164
2166{
2167}
2168
2170{
2171 m_aCmisPropertiesLines.clear();
2172}
2173
2174void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
2175 const OUString& sType, const bool bUpdatable,
2176 const bool bRequired, const bool bMultiValued,
2177 const bool bOpenChoice, Any& /*aChoices*/, Any const & rAny )
2178{
2179 std::unique_ptr<CmisPropertyLine> pNewLine(new CmisPropertyLine(m_xBox.get()));
2180
2181 pNewLine->m_sId = sId;
2182 pNewLine->m_sType = sType;
2183 pNewLine->m_bUpdatable = bUpdatable;
2184 pNewLine->m_bRequired = bRequired;
2185 pNewLine->m_bMultiValued = bMultiValued;
2186 pNewLine->m_bOpenChoice = bOpenChoice;
2187
2188 if ( sType == CMIS_TYPE_INTEGER )
2189 {
2190 Sequence< sal_Int64 > seqValue;
2191 rAny >>= seqValue;
2193 for ( const auto& rValue : std::as_const(seqValue) )
2194 {
2195 OUString sValue;
2196 m_aNumberFormatter.GetInputLineString( rValue, nIndex, sValue );
2197 std::unique_ptr<CmisValue> pValue(new CmisValue(m_xBox.get(), sValue));
2198 pValue->m_xValueEdit->set_editable(bUpdatable);
2199 pNewLine->m_aValues.push_back( std::move(pValue) );
2200 }
2201 }
2202 else if ( sType == CMIS_TYPE_DECIMAL )
2203 {
2204 Sequence< double > seqValue;
2205 rAny >>= seqValue;
2207 for ( const auto& rValue : std::as_const(seqValue) )
2208 {
2209 OUString sValue;
2210 m_aNumberFormatter.GetInputLineString( rValue, nIndex, sValue );
2211 std::unique_ptr<CmisValue> pValue(new CmisValue(m_xBox.get(), sValue));
2212 pValue->m_xValueEdit->set_editable(bUpdatable);
2213 pNewLine->m_aValues.push_back( std::move(pValue) );
2214 }
2215
2216 }
2217 else if ( sType == CMIS_TYPE_BOOL )
2218 {
2219 Sequence<sal_Bool> seqValue;
2220 rAny >>= seqValue;
2221 for ( const auto& rValue : std::as_const(seqValue) )
2222 {
2223 std::unique_ptr<CmisYesNo> pYesNo(new CmisYesNo(m_xBox.get(), rValue));
2224 pYesNo->m_xYesButton->set_sensitive( bUpdatable );
2225 pYesNo->m_xNoButton->set_sensitive( bUpdatable );
2226 pNewLine->m_aYesNos.push_back( std::move(pYesNo) );
2227 }
2228 }
2229 else if ( sType == CMIS_TYPE_STRING )
2230 {
2231 Sequence< OUString > seqValue;
2232 rAny >>= seqValue;
2233 for ( const auto& rValue : std::as_const(seqValue) )
2234 {
2235 std::unique_ptr<CmisValue> pValue(new CmisValue(m_xBox.get(), rValue));
2236 pValue->m_xValueEdit->set_editable(bUpdatable);
2237 pNewLine->m_aValues.push_back( std::move(pValue) );
2238 }
2239 }
2240 else if ( sType == CMIS_TYPE_DATETIME )
2241 {
2242 Sequence< util::DateTime > seqValue;
2243 rAny >>= seqValue;
2244 for ( const auto& rValue : std::as_const(seqValue) )
2245 {
2246 std::unique_ptr<CmisDateTime> pDateTime(new CmisDateTime(m_xBox.get(), rValue));
2247 pDateTime->m_xDateField->set_sensitive(bUpdatable);
2248 pDateTime->m_xTimeField->set_sensitive(bUpdatable);
2249 pNewLine->m_aDateTimes.push_back( std::move(pDateTime) );
2250 }
2251 }
2252 pNewLine->m_xName->set_label( sName );
2253 pNewLine->m_xName->show();
2254 pNewLine->m_xType->set_label( sType );
2255 pNewLine->m_xType->show();
2256
2257 m_aCmisPropertiesLines.push_back( std::move(pNewLine) );
2258}
2259
2260Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() const
2261{
2262 Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisPropertiesLines.size() );
2263 auto aPropertiesSeqRange = asNonConstRange(aPropertiesSeq);
2264 sal_Int32 i = 0;
2265 for ( auto& rxLine : m_aCmisPropertiesLines )
2266 {
2267 CmisPropertyLine* pLine = rxLine.get();
2268
2269 aPropertiesSeqRange[i].Id = pLine->m_sId;
2270 aPropertiesSeqRange[i].Type = pLine->m_sType;
2271 aPropertiesSeqRange[i].Updatable = pLine->m_bUpdatable;
2272 aPropertiesSeqRange[i].Required = pLine->m_bRequired;
2273 aPropertiesSeqRange[i].OpenChoice = pLine->m_bOpenChoice;
2274 aPropertiesSeqRange[i].MultiValued = pLine->m_bMultiValued;
2275
2276 OUString sPropertyName = pLine->m_xName->get_label();
2277 if ( !sPropertyName.isEmpty() )
2278 {
2279 aPropertiesSeqRange[i].Name = sPropertyName;
2280 OUString sType = pLine->m_xType->get_label();
2281 if ( CMIS_TYPE_DECIMAL == sType )
2282 {
2283 sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
2284 m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
2285 Sequence< double > seqValue( pLine->m_aValues.size( ) );
2286 auto seqValueRange = asNonConstRange(seqValue);
2287 sal_Int32 k = 0;
2288 for ( const auto& rxValue : pLine->m_aValues )
2289 {
2290 double dValue = 0.0;
2291 OUString sValue( rxValue->m_xValueEdit->get_text() );
2292 bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
2293 IsNumberFormat( sValue, nIndex, dValue );
2294 if ( bIsNum )
2295 seqValueRange[k] = dValue;
2296 ++k;
2297 }
2298 aPropertiesSeqRange[i].Value <<= seqValue;
2299 }
2300 else if ( CMIS_TYPE_INTEGER == sType )
2301 {
2302 sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
2303 m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
2304 Sequence< sal_Int64 > seqValue( pLine->m_aValues.size( ) );
2305 auto seqValueRange = asNonConstRange(seqValue);
2306 sal_Int32 k = 0;
2307 for ( const auto& rxValue : pLine->m_aValues )
2308 {
2309 double dValue = 0;
2310 OUString sValue( rxValue->m_xValueEdit->get_text() );
2311 bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
2312 IsNumberFormat( sValue, nIndex, dValue );
2313 if ( bIsNum )
2314 seqValueRange[k] = static_cast<sal_Int64>(dValue);
2315 ++k;
2316 }
2317 aPropertiesSeqRange[i].Value <<= seqValue;
2318 }
2319 else if ( CMIS_TYPE_BOOL == sType )
2320 {
2321 Sequence<sal_Bool> seqValue( pLine->m_aYesNos.size( ) );
2322 sal_Bool* pseqValue = seqValue.getArray();
2323 sal_Int32 k = 0;
2324 for ( const auto& rxYesNo : pLine->m_aYesNos )
2325 {
2326 bool bValue = rxYesNo->m_xYesButton->get_active();
2327 pseqValue[k] = bValue;
2328 ++k;
2329 }
2330 aPropertiesSeqRange[i].Value <<= seqValue;
2331
2332 }
2333 else if ( CMIS_TYPE_DATETIME == sType )
2334 {
2335 Sequence< util::DateTime > seqValue( pLine->m_aDateTimes.size( ) );
2336 auto seqValueRange = asNonConstRange(seqValue);
2337 sal_Int32 k = 0;
2338 for ( const auto& rxDateTime : pLine->m_aDateTimes )
2339 {
2340 Date aTmpDate = rxDateTime->m_xDateField->get_date();
2341 tools::Time aTmpTime = rxDateTime->m_xFormatter->GetTime();
2342 util::DateTime aDateTime( aTmpTime.GetNanoSec(), aTmpTime.GetSec(),
2343 aTmpTime.GetMin(), aTmpTime.GetHour(),
2344 aTmpDate.GetDay(), aTmpDate.GetMonth(),
2345 aTmpDate.GetYear(), true );
2346 seqValueRange[k] = aDateTime;
2347 ++k;
2348 }
2349 aPropertiesSeqRange[i].Value <<= seqValue;
2350 }
2351 else
2352 {
2353 Sequence< OUString > seqValue( pLine->m_aValues.size( ) );
2354 auto seqValueRange = asNonConstRange(seqValue);
2355 sal_Int32 k = 0;
2356 for ( const auto& rxValue : pLine->m_aValues )
2357 {
2358 OUString sValue( rxValue->m_xValueEdit->get_text() );
2359 seqValueRange[k] = sValue;
2360 ++k;
2361 }
2362 aPropertiesSeqRange[i].Value <<= seqValue;
2363 }
2364 }
2365 ++i;
2366 }
2367
2368 return aPropertiesSeq;
2369}
2370
2372 : m_aPropertiesWin(rBuilder.weld_container("CmisWindow"))
2373 , m_xScrolledWindow(rBuilder.weld_scrolled_window("CmisScroll"))
2374{
2375 // set height to something small and force it to take the size
2376 // dictated by the other pages
2377 m_xScrolledWindow->set_size_request(-1, 42);
2378}
2379
2381{
2383}
2384
2385void CmisPropertiesControl::AddLine( const OUString& sId, const OUString& sName,
2386 const OUString& sType, const bool bUpdatable,
2387 const bool bRequired, const bool bMultiValued,
2388 const bool bOpenChoice, Any& aChoices, Any const & rAny
2389 )
2390{
2391 m_aPropertiesWin.AddLine( sId, sName, sType, bUpdatable, bRequired, bMultiValued,
2392 bOpenChoice, aChoices, rAny );
2393}
2394
2395// class SfxCmisPropertiesPage -----------------------------------------
2397 : SfxTabPage(pPage, pController, "sfx/ui/cmisinfopage.ui", "CmisInfoPage", &rItemSet)
2398 , m_xPropertiesCtrl(new CmisPropertiesControl(*m_xBuilder))
2399{
2400}
2401
2403{
2404 m_xPropertiesCtrl.reset();
2405}
2406
2408{
2409 const SfxDocumentInfoItem* pItem = nullptr;
2410 SfxDocumentInfoItem* pInfo = nullptr;
2411 bool bMustDelete = false;
2412
2413 if (const SfxItemSet* pItemSet = GetDialogExampleSet())
2414 {
2415 pItem = pItemSet->GetItemIfSet(SID_DOCINFO);
2416 if (!pItem)
2417 pInfo = const_cast<SfxDocumentInfoItem*>(&rSet->Get( SID_DOCINFO ));
2418 else
2419 {
2420 bMustDelete = true;
2421 pInfo = new SfxDocumentInfoItem( *pItem );
2422 }
2423 }
2424
2425 sal_Int32 modifiedNum = 0;
2426 if ( pInfo )
2427 {
2428 Sequence< document::CmisProperty > aOldProps = pInfo->GetCmisProperties( );
2429 Sequence< document::CmisProperty > aNewProps = m_xPropertiesCtrl->GetCmisProperties();
2430
2431 std::vector< document::CmisProperty > changedProps;
2432 for ( sal_Int32 i = 0; i< aNewProps.getLength( ); ++i )
2433 {
2434 if ( aOldProps[i].Updatable && !aNewProps[i].Id.isEmpty( ) )
2435 {
2436 if ( aOldProps[i].Type == CMIS_TYPE_DATETIME )
2437 {
2438 Sequence< util::DateTime > oldValue;
2439 aOldProps[i].Value >>= oldValue;
2440 // We only edit hours and minutes
2441 // don't compare NanoSeconds and Seconds
2442 for ( auto& rDateTime : asNonConstRange(oldValue) )
2443 {
2444 rDateTime.NanoSeconds = 0;
2445 rDateTime.Seconds = 0;
2446 }
2447 Sequence< util::DateTime > newValue;
2448 aNewProps[i].Value >>= newValue;
2449 if ( oldValue != newValue )
2450 {
2451 modifiedNum++;
2452 changedProps.push_back( aNewProps[i] );
2453 }
2454 }
2455 else if ( aOldProps[i].Value != aNewProps[i].Value )
2456 {
2457 modifiedNum++;
2458 changedProps.push_back( aNewProps[i] );
2459 }
2460 }
2461 }
2462 Sequence< document::CmisProperty> aModifiedProps( comphelper::containerToSequence(changedProps) );
2463 pInfo->SetCmisProperties( aModifiedProps );
2464 rSet->Put( *pInfo );
2465 if ( bMustDelete )
2466 delete pInfo;
2467 }
2468
2469 return modifiedNum;
2470}
2471
2473{
2474 m_xPropertiesCtrl->ClearAllLines();
2475 const SfxDocumentInfoItem& rInfoItem = rItemSet->Get(SID_DOCINFO);
2476 uno::Sequence< document::CmisProperty > aCmisProps = rInfoItem.GetCmisProperties();
2477 for ( auto& rCmisProp : asNonConstRange(aCmisProps) )
2478 {
2479 m_xPropertiesCtrl->AddLine(rCmisProp.Id,
2480 rCmisProp.Name,
2481 rCmisProp.Type,
2482 rCmisProp.Updatable,
2483 rCmisProp.Required,
2484 rCmisProp.MultiValued,
2485 rCmisProp.OpenChoice,
2486 rCmisProp.Choices,
2487 rCmisProp.Value);
2488 }
2489}
2490
2492{
2494}
2495
2496std::unique_ptr<SfxTabPage> SfxCmisPropertiesPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rItemSet)
2497{
2498 return std::make_unique<SfxCmisPropertiesPage>(pPage, pController, *rItemSet);
2499}
2500
2501/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
css::uno::Reference< css::lang::XComponent > m_xFrame
static const AllSettings & GetSettings()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
std::unique_ptr< weld::Builder > m_xBuilder
void AddLine(const OUString &sId, const OUString &sName, const OUString &sType, const bool bUpdatable, const bool bRequired, const bool bMultiValude, const bool bOpenChoice, css::uno::Any &aChoices, css::uno::Any const &rAny)
Definition: dinfdlg.cxx:2385
CmisPropertiesWindow m_aPropertiesWin
Definition: dinfdlg.hxx:562
std::unique_ptr< weld::ScrolledWindow > m_xScrolledWindow
Definition: dinfdlg.hxx:563
CmisPropertiesControl(weld::Builder &rBuilder)
Definition: dinfdlg.cxx:2371
std::unique_ptr< weld::Container > m_xBox
Definition: dinfdlg.hxx:538
std::vector< std::unique_ptr< CmisPropertyLine > > m_aCmisPropertiesLines
Definition: dinfdlg.hxx:540
SvNumberFormatter m_aNumberFormatter
Definition: dinfdlg.hxx:539
CmisPropertiesWindow(std::unique_ptr< weld::Container > xParent)
Definition: dinfdlg.cxx:2158
css::uno::Sequence< css::document::CmisProperty > GetCmisProperties() const
Definition: dinfdlg.cxx:2260
void AddLine(const OUString &sId, const OUString &sName, const OUString &sType, const bool bUpdatable, const bool bRequired, const bool bMultiValued, const bool bOpenChoice, css::uno::Any &aChoices, css::uno::Any const &rAny)
Definition: dinfdlg.cxx:2174
const OUString & GetValue() const
void SetCustomProperties(std::vector< std::unique_ptr< CustomProperty > > &&rProperties)
Definition: dinfdlg.cxx:1981
std::unique_ptr< CustomPropertiesWindow > m_xPropertiesWin
Definition: dinfdlg.hxx:436
void Init(weld::Builder &rParent)
Definition: dinfdlg.cxx:1888
std::unique_ptr< weld::Container > m_xBody
Definition: dinfdlg.hxx:434
void AddLine(css::uno::Any const &rAny)
Definition: dinfdlg.cxx:1969
std::unique_ptr< weld::Label > m_xName
Definition: dinfdlg.hxx:437
std::unique_ptr< weld::Widget > m_xBox
Definition: dinfdlg.hxx:433
std::unique_ptr< weld::Label > m_xValue
Definition: dinfdlg.hxx:439
std::unique_ptr< weld::ScrolledWindow > m_xVertScroll
Definition: dinfdlg.hxx:435
std::unique_ptr< weld::Label > m_xType
Definition: dinfdlg.hxx:438
std::unique_ptr< SvtCalendarBox > m_xDateField
Definition: dinfdlg.hxx:248
CustomPropertiesDateField(SvtCalendarBox *pDateField)
Definition: dinfdlg.cxx:1666
void set_date(const Date &rDate)
Definition: dinfdlg.cxx:1683
void set_visible(bool bVisible)
Definition: dinfdlg.cxx:1673
std::unique_ptr< weld::Entry > m_xEntry
Definition: dinfdlg.hxx:298
void SetDuration(const css::util::Duration &rDuration)
Definition: dinfdlg.cxx:1307
css::util::Duration m_aDuration
Definition: dinfdlg.hxx:297
void set_visible(bool bVisible)
Definition: dinfdlg.cxx:1301
CustomPropertiesDurationField(std::unique_ptr< weld::Entry > xEntry, std::unique_ptr< weld::Button > xEditButton)
Definition: dinfdlg.cxx:1292
std::shared_ptr< DurationDialog_Impl > m_xDurationDialog
Definition: dinfdlg.hxx:300
std::unique_ptr< weld::Button > m_xEditButton
Definition: dinfdlg.hxx:299
CustomPropertiesTimeField(std::unique_ptr< weld::FormattedSpinButton > xTimeField)
Definition: dinfdlg.cxx:1643
std::unique_ptr< weld::TimeFormatter > m_xFormatter
Definition: dinfdlg.hxx:268
void set_value(const tools::Time &rTime)
Definition: dinfdlg.cxx:1657
tools::Time get_value() const
Definition: dinfdlg.cxx:1652
Link< void *, void > m_aRemovedHdl
Definition: dinfdlg.hxx:382
css::uno::Sequence< css::beans::PropertyValue > GetCustomProperties()
Definition: dinfdlg.cxx:1631
void SetVisibleLineCount(sal_uInt32 nCount)
Definition: dinfdlg.cxx:1555
std::vector< std::unique_ptr< CustomPropertyLine > > m_aCustomPropertiesLines
Definition: dinfdlg.hxx:377
sal_uInt16 GetTotalLineCount() const
Definition: dinfdlg.hxx:404
weld::Label & m_rHeaderAccType
Definition: dinfdlg.hxx:386
SvNumberFormatter m_aNumberFormatter
Definition: dinfdlg.hxx:379
void AddLine(const OUString &sName, css::uno::Any const &rAny)
Definition: dinfdlg.cxx:1563
CustomPropertyLine * m_pCurrentLine
Definition: dinfdlg.hxx:378
sal_Int32 m_nScrollPos
Definition: dinfdlg.hxx:375
void Remove(const CustomPropertyLine *pLine)
Definition: dinfdlg.cxx:1450
weld::Label & m_rHeaderAccValue
Definition: dinfdlg.hxx:387
weld::Label & m_rHeaderAccName
Definition: dinfdlg.hxx:385
sal_uInt16 GetExistingLineCount() const
Definition: dinfdlg.hxx:403
bool IsLineValid(CustomPropertyLine *pLine) const
Definition: dinfdlg.cxx:1508
bool AreAllLinesValid() const
Definition: dinfdlg.cxx:1598
void SetCustomProperties(std::vector< std::unique_ptr< CustomProperty > > &&rProperties)
Definition: dinfdlg.cxx:1765
weld::Container & m_rBody
Definition: dinfdlg.hxx:384
void BoxLoseFocus(CustomPropertyLine *pLine)
Definition: dinfdlg.cxx:1487
void ValidateLine(CustomPropertyLine *pLine, bool bIsFromTypeBox)
Definition: dinfdlg.cxx:1540
void EditLoseFocus(CustomPropertyLine *pLine)
Definition: dinfdlg.cxx:1473
sal_uInt32 GetCurrentDataModelPosition() const
Definition: dinfdlg.hxx:396
std::vector< std::unique_ptr< CustomProperty > > m_aCustomProperties
Definition: dinfdlg.hxx:376
CustomPropertiesWindow(weld::Container &rParent, weld::Label &rHeaderAccName, weld::Label &rHeaderAccType, weld::Label &rHeaderAccValue)
Definition: dinfdlg.cxx:1404
void DoScroll(sal_Int32 nNewPos)
Definition: dinfdlg.cxx:1624
CustomPropertiesYesNoButton(std::unique_ptr< weld::Widget >, std::unique_ptr< weld::RadioButton > xYesButton, std::unique_ptr< weld::RadioButton > xNoButton)
Definition: dinfdlg.cxx:1242
css::util::DateTime GetUNODateTime() const
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
sal_uInt16 GetMonth() const
std::unique_ptr< weld::SpinButton > m_xHourNF
Definition: dinfdlg.hxx:285
std::unique_ptr< weld::CheckButton > m_xNegativeCB
Definition: dinfdlg.hxx:281
std::unique_ptr< weld::SpinButton > m_xMinuteNF
Definition: dinfdlg.hxx:286
std::unique_ptr< weld::SpinButton > m_xMSecondNF
Definition: dinfdlg.hxx:288
std::unique_ptr< weld::SpinButton > m_xDayNF
Definition: dinfdlg.hxx:284
DurationDialog_Impl(weld::Widget *pParent, const css::util::Duration &rDuration)
Definition: dinfdlg.cxx:1257
css::util::Duration GetDuration() const
Definition: dinfdlg.cxx:1278
std::unique_ptr< weld::SpinButton > m_xSecondNF
Definition: dinfdlg.hxx:287
std::unique_ptr< weld::SpinButton > m_xYearNF
Definition: dinfdlg.hxx:282
std::unique_ptr< weld::SpinButton > m_xMonthNF
Definition: dinfdlg.hxx:283
bool removeFinalSlash()
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
bool setFinalSlash()
OUString PathToFileName() const
virtual void Start(bool bStartTimer=true) override
OUString getDuration(const tools::Duration &rDuration, bool bSec=true, bool b100Sec=false) const
OUString getDate(const Date &rDate) const
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
const OUString & getFalseWord() const
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
const OUString & getTrueWord() const
const OUString & getNumDecimalSep() const
bool GetValue() const
SfxCmisPropertiesPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &)
Definition: dinfdlg.cxx:2396
std::unique_ptr< CmisPropertiesControl > m_xPropertiesCtrl
Definition: dinfdlg.hxx:586
virtual ~SfxCmisPropertiesPage() override
Definition: dinfdlg.cxx:2402
virtual bool FillItemSet(SfxItemSet *) override
Definition: dinfdlg.cxx:2407
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: dinfdlg.cxx:2496
virtual void Reset(const SfxItemSet *) override
Definition: dinfdlg.cxx:2472
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: dinfdlg.cxx:2491
static sal_Int64 GetSize(std::u16string_view rContent)
Definition: helper.cxx:212
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: dinfdlg.cxx:2085
virtual bool FillItemSet(SfxItemSet *) override
Definition: dinfdlg.cxx:2022
std::unique_ptr< weld::Button > m_xAdd
Definition: dinfdlg.hxx:470
virtual ~SfxCustomPropertiesPage() override
Definition: dinfdlg.cxx:1998
virtual void Reset(const SfxItemSet *) override
Definition: dinfdlg.cxx:2068
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: dinfdlg.cxx:2093
SfxCustomPropertiesPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &)
Definition: dinfdlg.cxx:1989
std::unique_ptr< CustomPropertiesControl > m_xPropertiesCtrl
Definition: dinfdlg.hxx:469
std::unique_ptr< weld::Entry > m_xKeywordsEd
Definition: dinfdlg.hxx:219
std::unique_ptr< weld::TextView > m_xCommentEd
Definition: dinfdlg.hxx:220
SfxDocumentInfoItem * m_pInfoItem
Definition: dinfdlg.hxx:216
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: dinfdlg.cxx:598
virtual ~SfxDocumentDescPage() override
Definition: dinfdlg.cxx:594
std::unique_ptr< weld::Entry > m_xThemaEd
Definition: dinfdlg.hxx:218
virtual void Reset(const SfxItemSet *) override
Definition: dinfdlg.cxx:656
SfxDocumentDescPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &)
Definition: dinfdlg.cxx:582
std::unique_ptr< weld::Entry > m_xTitleEd
Definition: dinfdlg.hxx:217
virtual bool FillItemSet(SfxItemSet *) override
Definition: dinfdlg.cxx:603
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *set)
virtual void PageCreated(const OUString &rId, SfxTabPage &rPage) override
Definition: dinfdlg.cxx:1229
SfxDocumentInfoDialog(weld::Window *pParent, const SfxItemSet &)
Definition: dinfdlg.cxx:1170
SfxDocumentPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &)
Definition: dinfdlg.cxx:680
std::unique_ptr< weld::Label > m_xNameED
Definition: dinfdlg.hxx:167
bool bEnableUseUserData
Definition: dinfdlg.hxx:163
std::unique_ptr< weld::Label > m_xChangeValFt
Definition: dinfdlg.hxx:175
std::unique_ptr< weld::LinkButton > m_xFileValEd
Definition: dinfdlg.hxx:171
std::unique_ptr< weld::Button > m_xSignatureBtn
Definition: dinfdlg.hxx:177
bool bHandleDelete
Definition: dinfdlg.hxx:164
std::unique_ptr< weld::ComboBox > m_xImagePreferredDpiComboBox
Definition: dinfdlg.hxx:189
std::unique_ptr< weld::Label > m_xShowTypeFT
Definition: dinfdlg.hxx:170
VclPtr< AbstractPasswordToOpenModifyDialog > m_xPasswordDialog
Definition: dinfdlg.hxx:201
std::unique_ptr< weld::Image > m_xBmp
Definition: dinfdlg.hxx:166
virtual ~SfxDocumentPage() override
Definition: dinfdlg.cxx:729
std::unique_ptr< weld::Label > m_xCreateValFt
Definition: dinfdlg.hxx:174
void ImplCheckPasswordState()
Definition: dinfdlg.cxx:849
void EnableUseUserData()
Definition: dinfdlg.cxx:877
std::unique_ptr< weld::Label > m_xShowSizeFT
Definition: dinfdlg.hxx:172
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: dinfdlg.cxx:872
std::unique_ptr< weld::CheckButton > m_xUseUserDataCB
Definition: dinfdlg.hxx:182
std::unique_ptr< weld::Label > m_xTemplValFt
Definition: dinfdlg.hxx:187
OUString m_aUnknownSize
Definition: dinfdlg.hxx:160
virtual bool FillItemSet(SfxItemSet *) override
Definition: dinfdlg.cxx:884
virtual void Reset(const SfxItemSet *) override
Definition: dinfdlg.cxx:960
std::unique_ptr< weld::Label > m_xDocNoValFt
Definition: dinfdlg.hxx:180
std::unique_ptr< weld::Button > m_xDeleteBtn
Definition: dinfdlg.hxx:183
OUString m_aMultiSignedStr
Definition: dinfdlg.hxx:161
std::unique_ptr< weld::Button > m_xChangePassBtn
Definition: dinfdlg.hxx:168
std::unique_ptr< weld::CheckButton > m_xUseThumbnailSaveCB
Definition: dinfdlg.hxx:184
std::unique_ptr< weld::Label > m_xTemplFt
Definition: dinfdlg.hxx:186
std::unique_ptr< weld::Label > m_xSignedValFt
Definition: dinfdlg.hxx:176
void ImplUpdateSignatures()
Definition: dinfdlg.cxx:813
std::unique_ptr< weld::Label > m_xPrintValFt
Definition: dinfdlg.hxx:178
std::unique_ptr< weld::CheckButton > m_xImagePreferredDpiCheckButton
Definition: dinfdlg.hxx:188
std::unique_ptr< weld::Label > m_xTimeLogValFt
Definition: dinfdlg.hxx:179
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const std::shared_ptr< const SfxFilter > & GetFilter() const
Definition: docfile.cxx:3111
SfxItemSet & GetItemSet() const
Definition: docfile.cxx:3647
const OUString & GetName() const
Definition: docfile.cxx:3592
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
Definition: docfile.cxx:1703
SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > const & GetZipStorageToSign_Impl(bool bReadOnly=true)
Definition: docfile.cxx:1878
bool SignDocumentContent(weld::Window *pDialogParent)
Definition: objserv.cxx:2075
SfxMedium * GetMedium() const
Definition: objsh.hxx:261
css::uno::Reference< css::frame::XModel3 > GetModel() const
Definition: objxtor.cxx:838
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
Definition: objxtor.cxx:481
virtual void SetModified(bool bModified=true)
Definition: objmisc.cxx:301
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
Definition: shell.cxx:129
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void RemoveTabPage(const OUString &rName)
SfxOkDialogController * GetDialogController() const
Definition: tabdlg.cxx:284
const SfxItemSet * GetDialogExampleSet() const
Definition: tabdlg.cxx:303
const css::uno::Any & GetValue() const
Definition: frame.hxx:175
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
Invokes the registered callback, if there are any.
Definition: viewsh.cxx:2244
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static SVT_DLLPUBLIC OUString GetDescription(const INetURLObject &rObject)
static SVT_DLLPUBLIC OUString GetImageId(const INetURLObject &rURL, bool bBig=false)
void GetInputLineString(const double &fOutNumber, sal_uInt32 nFIndex, OUString &rOutString, bool bFiltering=false, bool bForceSystemLocale=false)
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
bool LookupDisabled(const OUString &aCommandURL) const
const LocaleDataWrapper & GetLocaleData() const
void SetPriority(TaskPriority ePriority)
void Stop()
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual VclPtr< AbstractPasswordToOpenModifyDialog > CreatePasswordToOpenModifyDialog(weld::Window *pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify)=0
static VclAbstractDialogFactory * Create()
void clear()
void put(std::u16string_view pPropName, const OUString &rPropValue)
OString finishAndGetAsOString()
sal_uInt16 GetSec() const
sal_Int64 GetTime() const
sal_uInt16 GetMin() const
sal_uInt16 GetHour() const
sal_uInt32 GetNanoSec() const
virtual std::unique_ptr< ScrolledWindow > weld_scrolled_window(const OUString &id, bool bUserManagedScrolling=false)=0
virtual std::unique_ptr< Container > weld_container(const OUString &id)=0
virtual std::unique_ptr< Label > weld_label(const OUString &id)=0
virtual std::unique_ptr< Widget > weld_widget(const OUString &id)=0
virtual OUString get_active_id() const=0
void append(const weld::ComboBoxEntry &rItem)
virtual void set_active(int pos)=0
void append_text(const OUString &rStr)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
std::shared_ptr< weld::Dialog > m_xDialog
virtual OUString get_label() const=0
virtual void set_size_request(int nWidth, int nHeight)=0
virtual Size get_preferred_size() const=0
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
IMPL_LINK(CustomPropertiesDurationField, ClickHdl, weld::Button &, rButton, void)
Definition: dinfdlg.cxx:1321
IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl, weld::Button &, void)
Definition: dinfdlg.cxx:738
URL aURL
OUString m_sName
float u
sal_Int16 nValue
OUString sName
TRISTATE_FALSE
TRISTATE_TRUE
sal_Int32 nIndex
OUString aName
void * p
sal_uInt16 nPos
Definition: linksrc.cxx:118
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
DateTime now
#define MID_DOCINFO_DELETEUSERDATA
#define MID_DOCINFO_AUTOLOADSECS
#define MID_DOCINFO_TITLE
#define MID_DOCINFO_KEYWORDS
#define MID_DOCINFO_SUBJECT
#define MID_DOCINFO_DEFAULTTARGET
#define MID_DOCINFO_AUTOLOADENABLED
#define MID_DOCINFO_USEUSERDATA
#define MID_DOCINFO_AUTOLOADURL
#define MID_DOCINFO_USETHUMBNAILSAVE
#define MID_DOCINFO_DESCRIPTION
aStr
Definition: mgetempl.cxx:407
const LanguageTag & getLocale()
OUString convertCommaSeparated(uno::Sequence< OUString > const &i_rSeq)
OString stripStart(const OString &rIn, char c)
OUString GetContentPart(const OUString &_rRawString, const css::security::CertificateKind &rKind)
bool ContainerUniquePtrEquals(C< std::unique_ptr< T >, Etc... > const &lhs, C< std::unique_ptr< T >, Etc... > const &rhs)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
Type
std::u16string_view getTitle(std::u16string_view aPath)
Value
int i
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
bool IsMSType(const std::shared_ptr< const SfxFilter > &pCurrentFilter)
bool IsOOXML(const std::shared_ptr< const SfxFilter > &pCurrentFilter)
ErrCode SetPassword(const std::shared_ptr< const SfxFilter > &pCurrentFilter, SfxItemSet *pSet, const OUString &rPasswordToOpen, std::u16string_view rPasswordToModify, bool bAllowPasswordReset)
ErrCode RequestPassword(const std::shared_ptr< const SfxFilter > &pCurrentFilter, OUString const &aURL, SfxItemSet *pSet, const css::uno::Reference< css::awt::XWindow > &rParent)
long Long
OUString GetDateTimeString(const css::util::DateTime &_rDT)
const char GetDuration[]
Sequence< Property > aInfos
QPRO_FUNC_TYPE nType
sal_uInt32 Id
OUString SfxResId(TranslateId aId)
Definition: sfxresid.cxx:22
static SfxItemSet & rSet
Definition: shell.cxx:534
#define CMIS_TYPE_DATETIME
Definition: strings.hxx:55
#define CMIS_TYPE_BOOL
Definition: strings.hxx:56
constexpr OUStringLiteral CMIS_TYPE_STRING
Definition: strings.hxx:52
#define CMIS_TYPE_INTEGER
Definition: strings.hxx:53
#define CMIS_TYPE_DECIMAL
Definition: strings.hxx:54
CmisDateTime(weld::Widget *pParent, const css::util::DateTime &rDateTime)
Definition: dinfdlg.cxx:2107
std::unique_ptr< weld::FormattedSpinButton > m_xTimeField
Definition: dinfdlg.hxx:496
std::unique_ptr< weld::TimeFormatter > m_xFormatter
Definition: dinfdlg.hxx:497
std::unique_ptr< SvtCalendarBox > m_xDateField
Definition: dinfdlg.hxx:495
std::vector< std::unique_ptr< CmisYesNo > > m_aYesNos
Definition: dinfdlg.hxx:528
CmisPropertyLine(weld::Widget *pParent)
Definition: dinfdlg.cxx:2138
std::vector< std::unique_ptr< CmisValue > > m_aValues
Definition: dinfdlg.hxx:526
OUString m_sType
Definition: dinfdlg.hxx:518
std::unique_ptr< weld::Label > m_xType
Definition: dinfdlg.hxx:525
std::unique_ptr< weld::Frame > m_xFrame
Definition: dinfdlg.hxx:523
OUString m_sId
Definition: dinfdlg.hxx:517
std::vector< std::unique_ptr< CmisDateTime > > m_aDateTimes
Definition: dinfdlg.hxx:527
std::unique_ptr< weld::Label > m_xName
Definition: dinfdlg.hxx:524
std::unique_ptr< weld::Entry > m_xValueEdit
Definition: dinfdlg.hxx:486
CmisValue(weld::Widget *pParent, const OUString &rStr)
Definition: dinfdlg.cxx:2098
CmisYesNo(weld::Widget *pParent, bool bValue)
Definition: dinfdlg.cxx:2123
std::unique_ptr< weld::RadioButton > m_xNoButton
Definition: dinfdlg.hxx:507
std::unique_ptr< weld::RadioButton > m_xYesButton
Definition: dinfdlg.hxx:506
std::unique_ptr< CustomPropertiesYesNoButton > m_xYesNoButton
Definition: dinfdlg.hxx:351
std::unique_ptr< CustomPropertiesTimeField > m_xTimeField
Definition: dinfdlg.hxx:348
std::unique_ptr< weld::Button > m_xRemoveButton
Definition: dinfdlg.hxx:352
std::unique_ptr< weld::Widget > m_xDateTimeBox
Definition: dinfdlg.hxx:346
std::unique_ptr< weld::Container > m_xLine
Definition: dinfdlg.hxx:342
CustomPropertyLine(CustomPropertiesWindow *pParent, weld::Widget *pContainer)
Definition: dinfdlg.cxx:1363
std::unique_ptr< weld::Entry > m_xValueEdit
Definition: dinfdlg.hxx:345
std::unique_ptr< weld::ComboBox > m_xNameBox
Definition: dinfdlg.hxx:343
std::unique_ptr< weld::Widget > m_xDurationBox
Definition: dinfdlg.hxx:349
std::unique_ptr< CustomPropertiesDurationField > m_xDurationField
Definition: dinfdlg.hxx:350
std::unique_ptr< CustomPropertiesDateField > m_xDateField
Definition: dinfdlg.hxx:347
std::unique_ptr< weld::ComboBox > m_xTypeBox
Definition: dinfdlg.hxx:344
void DoTypeHdl(const weld::ComboBox &rBox)
Definition: dinfdlg.cxx:1433
css::uno::Any m_aValue
Definition: dinfdlg.cxx:94
CustomProperty(OUString sName, css::uno::Any aValue)
Definition: dinfdlg.cxx:96
bool operator==(const CustomProperty &rProp) const
Definition: dinfdlg.cxx:99
OUString m_sName
Definition: dinfdlg.cxx:93
DeactivateRC
Definition: tabdlg.hxx:173
bool bVisible
unsigned char sal_uInt8
#define SAL_MAX_INT32
unsigned char sal_Bool
#define SAL_MAX_INT16
#define SAL_MIN_INT32
OUString sId
RET_OK
RET_CANCEL
NF_SCIENTIFIC_000E00
NF_NUMBER_SYSTEM
NF_DATE_SYS_DDMMYYYY
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND