21#include <osl/security.hxx>
22#include <osl/diagnose.h>
31#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
32#include <com/sun/star/document/XDocumentProperties.hpp>
44 const int nAccessWidth = m_xLbUsers->get_pixel_size(sWidestAccessString).Width() * 2;
45 std::vector<int> aWidths
47 o3tl::narrowing<int>(rSize.Width() - nAccessWidth)
49 m_xLbUsers->set_column_fixed_widths(aWidths);
54 : GenericDialogController(pParent,
"modules/scalc/ui/sharedocumentdlg.ui",
55 "ShareDocumentDialog")
56 , m_aStrNoUserData(
ScResId(STR_NO_USER_DATA_AVAILABLE))
57 , m_aStrUnknownUser(
ScResId(STR_UNKNOWN_USER_CONFLICT))
58 , m_aStrExclusiveAccess(
ScResId(STR_EXCLUSIVE_ACCESS))
60 , m_xCbShare(m_xBuilder->weld_check_button(
"share"))
61 , m_xFtWarning(m_xBuilder->weld_label(
"warning"))
62 , m_xLbUsers(m_xBuilder->weld_tree_view(
"users"))
65 OSL_ENSURE( pViewData,
"ScShareDocumentDlg CTOR: mpViewData is null!" );
67 OSL_ENSURE(
mpDocShell,
"ScShareDocumentDlg CTOR: mpDocShell is null!" );
69 std::vector<int> aWidths
71 o3tl::narrowing<int>(
m_xLbUsers->get_approximate_digit_width() * 25)
83 m_xLbUsers->set_selection_mode(SelectionMode::NONE);
94 m_xFtWarning->set_sensitive(m_xCbShare->get_active());
114 std::vector<LockFileEntry> aUsersData = aControlFile.
GetUsersData();
115 sal_Int32
nLength = aUsersData.size();
119 sal_Int32 nUnknownUser = 1;
123 if ( !aUsersData[
i][LockFileComponent::EDITTIME].isEmpty() )
126 if ( !aUsersData[
i][LockFileComponent::OOOUSERNAME].isEmpty() )
128 aUser = aUsersData[
i][LockFileComponent::OOOUSERNAME];
130 else if ( !aUsersData[
i][LockFileComponent::SYSUSERNAME].isEmpty() )
132 aUser = aUsersData[
i][LockFileComponent::SYSUSERNAME];
140 OUString aDateTimeStr = aUsersData[
i][LockFileComponent::EDITTIME];
151 Date aDate( nDay, nMonth, nYear );
167 catch ( uno::Exception& )
179 if ( !aUser.isEmpty() )
184 if ( aUser.isEmpty() )
188 ::osl::Security aSecurity;
189 aSecurity.getUserName( aUserName );
192 if ( aUser.isEmpty() )
201 util::DateTime uDT(xDocProps->getModificationDate());
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
ScModelObj * GetModel() const
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
OUString m_aStrExclusiveAccess
OUString m_aStrUnknownUser
ScShareDocumentDlg(weld::Window *pParent, const ScViewData *pViewData)
bool IsShareDocumentChecked() const
OUString m_aStrNoUserData
std::unique_ptr< weld::Label > m_xFtWarning
virtual ~ScShareDocumentDlg() override
std::unique_ptr< weld::CheckButton > m_xCbShare
std::unique_ptr< weld::TreeView > m_xLbUsers
ScDocShell * GetDocShell() const
virtual css::uno::Reference< css::document::XDocumentProperties > SAL_CALL getDocumentProperties() override
OUString GetSharedFileURL() const
OUString GetFirstName() const
OUString GetLastName() const
std::vector< LockFileEntry > GetUsersData()
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString SFX2_DLLPUBLIC formatDateTime(const DateTime &rDateTime, const LocaleDataWrapper &rWrapper, bool bWithSec)
OUString SFX2_DLLPUBLIC getWidestDateTime(const LocaleDataWrapper &rWrapper, bool bWithSec)
#define LINK(Instance, Class, Member)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OUString ScResId(TranslateId aId)
IMPL_LINK_NOARG(ScShareDocumentDlg, ToggleHandle, weld::Toggleable &, void)
IMPL_LINK(ScShareDocumentDlg, SizeAllocated, const Size &, rSize, void)