22#include <com/sun/star/document/XCmisDocument.hpp>
23#include <com/sun/star/frame/XModel.hpp>
24#include <com/sun/star/util/RevisionTag.hpp>
25#include <com/sun/star/beans/NamedValue.hpp>
27#include <officecfg/Office/Common.hxx>
35#include <tools/datetime.hxx>
38#include <sfx2/strings.hrc>
44#include <sfx2/sfxsids.hrc>
82 for (
const auto& rItem : rInfo )
85 pInfo->aName = rItem.Identifier;
86 pInfo->aComment = rItem.Comment;
87 pInfo->aAuthor = rItem.Author;
89 pInfo->aCreationDate =
DateTime( rItem.TimeStamp );
96 for (
const auto& rItem : rInfo )
99 pInfo->aName = rItem.Id;
100 pInfo->aComment = rItem.Comment;
101 pInfo->aAuthor = rItem.Author;
103 pInfo->aCreationDate =
DateTime( rItem.TimeStamp );
121 int nMax = std::max(nWidestTime, nW1) + 12;
124 std::set<OUString> aAuthors;
129 aAuthors.insert(weld::fromId<SfxVersionInfo*>(rVersionBox.
get_id(i))->aAuthor);
132 int nMaxAuthorWidth = nRest/4;
133 for (
auto const& author : aAuthors)
135 nMaxAuthorWidth = std::max<int>(nMaxAuthorWidth, rVersionBox.
get_pixel_size(author).
Width());
136 if (nMaxAuthorWidth > nRest/2)
138 nMaxAuthorWidth = nRest/2;
149 , m_pViewFrame(pVwFrame)
150 , m_bIsSaveVersionOnClose(bIsSaveVersionOnClose)
151 , m_xSaveButton(m_xBuilder->weld_button(
"save"))
152 , m_xSaveCheckBox(m_xBuilder->weld_check_button(
"always"))
153 , m_xOpenButton(m_xBuilder->weld_button(
"open"))
154 , m_xViewButton(m_xBuilder->weld_button(
"show"))
155 , m_xDeleteButton(m_xBuilder->weld_button(
"delete"))
156 , m_xCompareButton(m_xBuilder->weld_button(
"compare"))
157 , m_xCmisButton(m_xBuilder->weld_button(
"cmis"))
158 , m_xVersionBox(m_xBuilder->weld_tree_view(
"versions"))
179 OUString sText =
m_xDialog->get_title() +
189 OUStringBuffer sConverted;
197 sConverted.append(
' ');
201 sConverted.append(*pChars);
207 return sConverted.makeStringAndClear();
214 uno::Sequence < util::RevisionTag > aVersions = pMedium->
GetVersionList(
true );
242 if ( !officecfg::Office::Common::Misc::ExperimentalMode::get() )
244 uno::Reference<document::XCmisDocument> xCmisDoc(pObjShell->
GetModel(), uno::UNO_QUERY);
245 if (xCmisDoc && xCmisDoc->isVersionable())
267 uno::Sequence< beans::NamedValue > aEncryptionData;
274 { &aFile, &aItem, &aTarget, &aReferer, &aEncryptionDataItem });
280 { &aFile, &aItem, &aTarget, &aReferer });
294 bool bEnable = m_xVersionBox->get_selected_index() != -1;
296 m_xDeleteButton->set_sensitive(bEnable && !pObjShell->
IsReadOnly());
297 m_xOpenButton->set_sensitive(bEnable);
298 m_xViewButton->set_sensitive(bEnable);
301 m_pViewFrame->GetDispatcher()->QueryState( SID_DOCUMENT_MERGE, pDummy );
302 SfxItemState eState = m_pViewFrame->GetDispatcher()->QueryState( SID_DOCUMENT_COMPARE, pDummy );
303 m_xCompareButton->set_sensitive(bEnable && eState >= SfxItemState::DEFAULT);
310 int nEntry = m_xVersionBox->get_selected_index();
312 if (&rButton == m_xSaveButton.get())
317 short nRet = aDlg.
run();
323 aItems[0] = &aComment;
325 m_pViewFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, aItems );
326 m_xVersionBox->freeze();
327 m_xVersionBox->clear();
328 m_xVersionBox->thaw();
332 else if (&rButton == m_xDeleteButton.get() && nEntry != -1)
334 SfxVersionInfo* pInfo = weld::fromId<SfxVersionInfo*>(m_xVersionBox->get_id(nEntry));
337 m_xVersionBox->freeze();
338 m_xVersionBox->clear();
339 m_xVersionBox->thaw();
342 else if (&rButton == m_xOpenButton.get() && nEntry != -1)
346 else if (&rButton == m_xViewButton.get() && nEntry != -1)
348 SfxVersionInfo* pInfo = weld::fromId<SfxVersionInfo*>(m_xVersionBox->get_id(nEntry));
352 else if (&rButton == m_xCompareButton.get() && nEntry != -1)
362 aSet.
Put( *pFilterItem );
363 if ( pFilterOptItem )
364 aSet.
Put( *pFilterOptItem );
369 else if (&rButton == m_xCmisButton.get())
378 if (&rButton == m_xSaveCheckBox.get())
380 m_bIsSaveVersionOnClose = m_xSaveCheckBox->get_active();
387 , m_xDateTimeText(m_xBuilder->weld_label(
"timestamp"))
388 , m_xSavedByText(m_xBuilder->weld_label(
"author"))
389 , m_xEdit(m_xBuilder->weld_text_view(
"textview"))
391 , m_xCancelButton(m_xBuilder->weld_button(
"cancel"))
392 , m_xCloseButton(m_xBuilder->weld_button(
"close"))
400 m_xEdit->set_size_request(40 *
m_xEdit->get_approximate_digit_width(),
401 7 *
m_xEdit->get_text_height());
424 m_rInfo.aComment = m_xEdit->get_text();
430 , m_pViewFrame(pVwFrame)
431 , m_xVersionBox(m_xBuilder->weld_tree_view(
"versions"))
439 OUString sText =
m_xDialog->get_title() +
453 uno::Sequence < document::CmisVersion > aVersions = pObjShell->
GetCmisVersions( );
Reference< XExecutableDialog > m_xDialog
const LocaleDataWrapper & GetLocaleDataWrapper() const
static const AllSettings & GetSettings()
virtual ~SfxCmisVersionsDialog() override
std::unique_ptr< weld::TreeView > m_xVersionBox
SfxViewFrame * m_pViewFrame
std::unique_ptr< SfxVersionTableDtor > m_pTable
SfxCmisVersionsDialog(weld::Window *pParent, SfxViewFrame *pFrame)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
Method to execute a <SfxSlot>s over the Slot-Id.
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxItemSet & GetItemSet() const
const css::uno::Sequence< css::util::RevisionTag > & GetVersionList(bool _bNoReload=false)
const OUString & GetName() const
SAL_DLLPRIVATE void RemoveVersion_Impl(const OUString &rVersion)
virtual SfxObjectShell * GetObjectShell() override
SfxMedium * GetMedium() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
SAL_DLLPRIVATE css::uno::Sequence< css::document::CmisVersion > GetCmisVersions() const
virtual void SetModified(bool bModified=true)
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
std::unique_ptr< weld::Button > m_xCompareButton
std::unique_ptr< weld::CheckButton > m_xSaveCheckBox
bool m_bIsSaveVersionOnClose
std::unique_ptr< weld::TreeView > m_xVersionBox
std::unique_ptr< weld::Button > m_xDeleteButton
SfxVersionDialog(weld::Window *pParent, SfxViewFrame *pFrame, bool)
std::unique_ptr< SfxVersionTableDtor > m_pTable
SfxViewFrame * m_pViewFrame
std::unique_ptr< weld::Button > m_xViewButton
std::unique_ptr< weld::Button > m_xSaveButton
std::unique_ptr< weld::Button > m_xOpenButton
std::unique_ptr< weld::Button > m_xCmisButton
virtual ~SfxVersionDialog() override
SfxVersionTableDtor(const uno::Sequence< util::RevisionTag > &rInfo)
SfxVersionInfo * at(size_t i) const
SfxVersionTableDtor(const SfxVersionTableDtor &)=delete
SfxVersionTableDtor & operator=(const SfxVersionTableDtor &)=delete
std::vector< std::unique_ptr< SfxVersionInfo > > aTableList
SfxDispatcher * GetDispatcher()
virtual SfxObjectShell * GetObjectShell() override
std::unique_ptr< weld::TextView > m_xEdit
std::unique_ptr< weld::Button > m_xCancelButton
std::unique_ptr< weld::Button > m_xOKButton
std::unique_ptr< weld::Label > m_xSavedByText
std::unique_ptr< weld::Button > m_xCloseButton
std::unique_ptr< weld::Label > m_xDateTimeText
SfxViewVersionDialog_Impl(weld::Window *pParent, SfxVersionInfo &rInfo, bool bEdit)
constexpr tools::Long Width() const
std::shared_ptr< weld::Dialog > m_xDialog
virtual int n_children() const=0
virtual OUString get_column_title(int nColumn) const=0
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual OUString get_id(int pos) const=0
OUString getWidestDateTime(const LocaleDataWrapper &rWrapper, bool bWithSec)
OUString formatDateTime(const DateTime &rDateTime, const LocaleDataWrapper &rWrapper, bool bWithSec)
std::unique_ptr< weld::Button > m_xOKButton
#define LINK(Instance, Class, Member)
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
constexpr OUStringLiteral EMPTY
OUString toId(const void *pValue)
bool GetEncryptionData_Impl(const SfxItemSet *pSet, uno::Sequence< beans::NamedValue > &o_rEncryptionData)
OUString SfxResId(TranslateId aId)
IMPL_LINK_NOARG(SfxVersionDialog, DClickHdl_Impl, weld::TreeView &, bool)
IMPL_LINK(SfxVersionDialog, ButtonHdl_Impl, weld::Button &, rButton, void)
static OUString ConvertWhiteSpaces_Impl(const OUString &rText)