summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-16 09:12:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-16 12:45:56 +0100
commit52bce8fadde39e32c0008babadc2c22cc501f753 (patch)
treec238b858401b18edaa27d62cd909a276ee76db73 /sfx2
parent84e5cdce3ed58c663109bb557b75cd6e45bb2dbc (diff)
convert versions of dialog to .ui
Change-Id: I1be2211b5c936e6e00f2fe81883b8fb1e67ef550
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/UIConfig_sfx.mk1
-rw-r--r--sfx2/source/dialog/dialog.hrc2
-rw-r--r--sfx2/source/dialog/dialoghelper.cxx17
-rw-r--r--sfx2/source/dialog/versdlg.cxx277
-rw-r--r--sfx2/source/dialog/versdlg.hrc40
-rw-r--r--sfx2/source/dialog/versdlg.src111
-rw-r--r--sfx2/source/inc/versdlg.hxx48
-rw-r--r--sfx2/uiconfig/ui/versionsofdialog.ui321
8 files changed, 514 insertions, 303 deletions
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index b865a7161d59..f2cc39d50927 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/querysavedialog \
sfx2/uiconfig/ui/securityinfopage \
sfx2/uiconfig/ui/singletabdialog \
+ sfx2/uiconfig/ui/versionsofdialog \
sfx2/uiconfig/ui/versioncommentdialog \
))
diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc
index 51c85a4a3bb5..1e36560a4374 100644
--- a/sfx2/source/dialog/dialog.hrc
+++ b/sfx2/source/dialog/dialog.hrc
@@ -47,8 +47,6 @@
#define MN_CONTEXT_TEMPLDLG ( RC_DIALOG_BEGIN + 46)
-#define DLG_VERSIONS ( RC_DIALOG_BEGIN + 69 )
-
#define STR_VIEWVERSIONCOMMENT ( RC_DIALOG_BEGIN + 71 )
#define MSG_ERROR_WRONG_CONFIRM ( RC_DIALOG_BEGIN + 76 )
diff --git a/sfx2/source/dialog/dialoghelper.cxx b/sfx2/source/dialog/dialoghelper.cxx
index 89fd3adbabad..e0ac93107780 100644
--- a/sfx2/source/dialog/dialoghelper.cxx
+++ b/sfx2/source/dialog/dialoghelper.cxx
@@ -8,6 +8,7 @@
*/
#include <sfx2/dialoghelper.hxx>
+#include <tools/datetime.hxx>
#include <vcl/builder.hxx>
#include <vcl/layout.hxx>
#include <vector>
@@ -56,4 +57,20 @@ Size getParagraphPreviewOptimalSize(const Window *pReference)
return pReference->LogicToPixel(Size(68 , 112), MAP_APPFONT);
}
+OUString SFX2_DLLPUBLIC getWidestTime(const LocaleDataWrapper& rWrapper)
+{
+ Date aDate(22, 12, 2000);
+ Time aTime(22, 59, 59);
+ DateTime aDateTime(aDate, aTime);
+ return formatTime(aDateTime, rWrapper);
+}
+
+OUString SFX2_DLLPUBLIC formatTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper)
+{
+ OUString sString = rWrapper.getDate(rDateTime);
+ sString += OUString(' ');
+ sString += rWrapper.getTime(rDateTime, false);
+ return sString;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index d4976c4a2186..a0215806b327 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -24,13 +24,15 @@
#include <svl/stritem.hxx>
#include <svl/itemset.hxx>
#include <unotools/useroptions.hxx>
+#include <vcl/layout.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <tools/datetime.hxx>
#include "svtools/treelistentry.hxx"
-#include "versdlg.hrc"
#include "versdlg.hxx"
+#include "dialog.hrc"
+#include <sfx2/dialoghelper.hxx>
#include <sfx2/viewfrm.hxx>
#include "sfx2/sfxresid.hxx"
#include <sfx2/docfile.hxx>
@@ -136,82 +138,131 @@ SfxVersionInfo::SfxVersionInfo()
{
}
-static String ConvertDateTime_Impl(const DateTime& rTime, const LocaleDataWrapper& rWrapper)
-{
- const String pDelim (", ");
- String aStr(rWrapper.getDate(rTime));
- aStr += pDelim;
- aStr += rWrapper.getTime(rTime, sal_True, sal_False);
- return aStr;
-}
-
-// Caution in the code this array si indexed directly (0, 1, ...)
-static long nTabs_Impl[] =
-{
- 3, // Number of Tabs
- 0, 62, 124
-};
-
-void SfxVersionsTabListBox_Impl::KeyInput( const KeyEvent& rKeyEvent )
+void SfxVersionsTabListBox_Impl::KeyInput(const KeyEvent& rKeyEvent)
{
const KeyCode& rCode = rKeyEvent.GetKeyCode();
- switch ( rCode.GetCode() )
+ switch (rCode.GetCode())
{
case KEY_RETURN :
case KEY_ESCAPE :
case KEY_TAB :
- Window::GetParent()->KeyInput( rKeyEvent );
+ {
+ Dialog *pParent = GetParentDialog();
+ if (pParent)
+ pParent->KeyInput(rKeyEvent);
+ else
+ SvSimpleTable::KeyInput(rKeyEvent);
break;
+ }
default:
- SvTabListBox::KeyInput( rKeyEvent );
+ SvSimpleTable::KeyInput( rKeyEvent );
break;
}
}
-SfxVersionsTabListBox_Impl::SfxVersionsTabListBox_Impl( Window* pParent, const ResId& rResId )
- : SvTabListBox( pParent, rResId )
+void SfxVersionsTabListBox_Impl::Resize()
+{
+ SvSimpleTable::Resize();
+ if (isInitialLayout(this))
+ setColSizes();
+}
+
+void SfxVersionsTabListBox_Impl::setColSizes()
{
+ HeaderBar &rBar = GetTheHeaderBar();
+ if (rBar.GetItemCount() < 3)
+ return;
+
+ // recalculate the datetime column width
+ long nWidestTime(GetTextWidth(getWidestTime(Application::GetSettings().GetLocaleDataWrapper())));
+ long nW1 = rBar.GetTextWidth(rBar.GetItemText(1));
+
+ long nMax = std::max(nWidestTime, nW1) + 12; // max width + a little offset
+ const long nRest = GetSizePixel().Width() - nMax;
+
+ std::set<OUString> aAuthors;
+ SfxVersionInfo aInfo;
+ aAuthors.insert(SvtUserOptions().GetFullName());
+
+ for (SvTreeListEntry* pEntry = First(); pEntry; pEntry = Next(pEntry))
+ {
+ aAuthors.insert(((SfxVersionInfo*)pEntry->GetUserData())->aAuthor);
+ }
+
+ long nMaxAuthorWidth = nRest/4;
+ for (std::set<OUString>::iterator aI = aAuthors.begin(), aEnd = aAuthors.end(); aI != aEnd; ++aI)
+ {
+ nMaxAuthorWidth = std::max(nMaxAuthorWidth, GetTextWidth(*aI));
+ if (nMaxAuthorWidth > nRest/2)
+ {
+ nMaxAuthorWidth = nRest/2;
+ break;
+ }
+ }
+
+ long aStaticTabs[] = { 3, 0, 0, 0 };
+ aStaticTabs[2] = nMax;
+ aStaticTabs[3] = nMax + nMaxAuthorWidth;
+ SvSimpleTable::SetTabs(aStaticTabs, MAP_PIXEL);
}
SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, sal_Bool bIsSaveVersionOnClose )
- : SfxModalDialog( NULL, SfxResId( DLG_VERSIONS ) )
- , aNewGroup( this, SfxResId( GB_NEWVERSIONS ) )
- , aSaveButton( this, SfxResId( PB_SAVE ) )
- , aSaveCheckBox( this, SfxResId( CB_SAVEONCLOSE ) )
- , aExistingGroup( this, SfxResId( GB_OLDVERSIONS ) )
- , aDateTimeText( this, SfxResId( FT_DATETIME ) )
- , aSavedByText( this, SfxResId( FT_SAVEDBY ) )
- , aCommentText( this, SfxResId( FT_COMMENTS ) )
- , aVersionBox( this, SfxResId( TLB_VERSIONS ) )
- , aCloseButton( this, SfxResId( PB_CLOSE ) )
- , aOpenButton( this, SfxResId( PB_OPEN ) )
- , aViewButton( this, SfxResId( PB_VIEW ) )
- , aDeleteButton( this, SfxResId( PB_DELETE ) )
- , aCompareButton( this, SfxResId( PB_COMPARE ) )
- , aHelpButton( this, SfxResId( PB_HELP ) )
- , pViewFrame( pVwFrame )
- , mpTable( NULL )
- , mbIsSaveVersionOnClose( bIsSaveVersionOnClose )
+ : SfxModalDialog(NULL, "VersionsOfDialog", "sfx/ui/versionsofdialog.ui")
+ , pViewFrame(pVwFrame)
+ , m_pTable(NULL)
+ , m_bIsSaveVersionOnClose(bIsSaveVersionOnClose)
{
- FreeResource();
+ get(m_pSaveButton, "save");
+ get(m_pSaveCheckBox, "always");
+ get(m_pOpenButton, "open");
+ get(m_pViewButton, "show");
+ get(m_pDeleteButton, "delete");
+ get(m_pCompareButton, "compare");
+
+ SvSimpleTableContainer *pContainer = get<SvSimpleTableContainer>("versions");
+ Size aControlSize(260, 114);
+ aControlSize = pContainer->LogicToPixel(aControlSize, MAP_APPFONT);
+ pContainer->set_width_request(aControlSize.Width());
+ pContainer->set_height_request(aControlSize.Height());
+
+ m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
Link aClickLink = LINK( this, SfxVersionDialog, ButtonHdl_Impl );
- aViewButton.SetClickHdl ( aClickLink );
- aSaveButton.SetClickHdl ( aClickLink );
- aDeleteButton.SetClickHdl ( aClickLink );
- aCompareButton.SetClickHdl ( aClickLink );
- aOpenButton.SetClickHdl ( aClickLink );
- aSaveCheckBox.SetClickHdl ( aClickLink );
-
- aVersionBox.SetSelectHdl( LINK( this, SfxVersionDialog, SelectHdl_Impl ) );
- aVersionBox.SetDoubleClickHdl( LINK( this, SfxVersionDialog, DClickHdl_Impl ) );
-
- aVersionBox.GrabFocus();
- aVersionBox.SetStyle( aVersionBox.GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
- aVersionBox.SetSelectionMode( SINGLE_SELECTION );
- aVersionBox.SetTabs( &nTabs_Impl[0], MAP_APPFONT );
- aVersionBox.Resize(); // OS: Hack for correct selection
- RecalcDateColumn();
+ m_pViewButton->SetClickHdl ( aClickLink );
+ m_pSaveButton->SetClickHdl ( aClickLink );
+ m_pDeleteButton->SetClickHdl ( aClickLink );
+ m_pCompareButton->SetClickHdl ( aClickLink );
+ m_pOpenButton->SetClickHdl ( aClickLink );
+ m_pSaveCheckBox->SetClickHdl ( aClickLink );
+
+ m_pVersionBox->SetSelectHdl( LINK( this, SfxVersionDialog, SelectHdl_Impl ) );
+ m_pVersionBox->SetDoubleClickHdl( LINK( this, SfxVersionDialog, DClickHdl_Impl ) );
+
+ m_pVersionBox->GrabFocus();
+ m_pVersionBox->SetStyle( m_pVersionBox->GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
+ m_pVersionBox->SetSelectionMode( SINGLE_SELECTION );
+
+ long nTabs_Impl[] = { 3, 0, 0, 0 };
+
+
+ m_pVersionBox->SvSimpleTable::SetTabs(&nTabs_Impl[0]);
+ OUString sHeader1(get<FixedText>("datetime")->GetText());
+ OUString sHeader2(get<FixedText>("savedby")->GetText());
+ OUString sHeader3(get<FixedText>("comments")->GetText());
+ OUStringBuffer sHeader;
+ sHeader.append(sHeader1).append("\t").append(sHeader2)
+ .append("\t ").append(sHeader3);
+ m_pVersionBox->InsertHeaderEntry(sHeader.makeStringAndClear());
+
+ HeaderBar &rBar = m_pVersionBox->GetTheHeaderBar();
+ HeaderBarItemBits nBits = rBar.GetItemBits(1) | HIB_FIXEDPOS | HIB_FIXED;
+ nBits &= ~HIB_CLICKABLE;
+ rBar.SetItemBits(1, nBits);
+ rBar.SetItemBits(2, nBits);
+ rBar.SetItemBits(3, nBits);
+
+ m_pVersionBox->Resize(); // OS: Hack for correct selection
+
// set dialog title (filename or docinfo title)
String sText = GetText();
@@ -219,6 +270,8 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, sal_Bool bIsSaveVer
SetText( sText );
Init_Impl();
+
+ m_pVersionBox->setColSizes();
}
String ConvertWhiteSpaces_Impl( const String& rText )
@@ -250,47 +303,48 @@ void SfxVersionDialog::Init_Impl()
SfxObjectShell *pObjShell = pViewFrame->GetObjectShell();
SfxMedium* pMedium = pObjShell->GetMedium();
uno::Sequence < util::RevisionTag > aVersions = pMedium->GetVersionList( true );
- delete mpTable;
- mpTable = new SfxVersionTableDtor( aVersions );
+ delete m_pTable;
+ m_pTable = new SfxVersionTableDtor( aVersions );
{
- for ( size_t n = 0; n < mpTable->size(); ++n )
+ for ( size_t n = 0; n < m_pTable->size(); ++n )
{
- SfxVersionInfo *pInfo = mpTable->at( n );
- String aEntry = ConvertDateTime_Impl( pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper() );
+ SfxVersionInfo *pInfo = m_pTable->at( n );
+ String aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper());
aEntry += '\t';
aEntry += pInfo->aAuthor;
aEntry += '\t';
aEntry += ConvertWhiteSpaces_Impl( pInfo->aComment );
- SvTreeListEntry *pEntry = aVersionBox.InsertEntry( aEntry );
+ SvTreeListEntry *pEntry = m_pVersionBox->InsertEntry( aEntry );
pEntry->SetUserData( pInfo );
}
}
- aSaveCheckBox.Check( mbIsSaveVersionOnClose );
+ m_pSaveCheckBox->Check( m_bIsSaveVersionOnClose );
sal_Bool bEnable = !pObjShell->IsReadOnly();
- aSaveButton.Enable( bEnable );
- aSaveCheckBox.Enable( bEnable );
+ m_pSaveButton->Enable( bEnable );
+ m_pSaveCheckBox->Enable( bEnable );
- aOpenButton.Disable();
- aViewButton.Disable();
- aDeleteButton.Disable();
- aCompareButton.Disable();
+ m_pOpenButton->Disable();
+ m_pViewButton->Disable();
+ m_pDeleteButton->Disable();
+ m_pCompareButton->Disable();
- SelectHdl_Impl( &aVersionBox );
+ SelectHdl_Impl(m_pVersionBox);
}
-SfxVersionDialog::~SfxVersionDialog ()
+SfxVersionDialog::~SfxVersionDialog()
{
- delete mpTable;
+ delete m_pTable;
+ delete m_pVersionBox;
}
void SfxVersionDialog::Open_Impl()
{
SfxObjectShell *pObjShell = pViewFrame->GetObjectShell();
- SvTreeListEntry *pEntry = aVersionBox.FirstSelected();
- sal_uIntPtr nPos = aVersionBox.GetModel()->GetRelPos( pEntry );
+ SvTreeListEntry *pEntry = m_pVersionBox->FirstSelected();
+ sal_uIntPtr nPos = m_pVersionBox->GetModel()->GetRelPos( pEntry );
SfxInt16Item aItem( SID_VERSION, (short)nPos+1 );
SfxStringItem aTarget( SID_TARGETNAME, "_blank" );
SfxStringItem aReferer( SID_REFERER, "private:user" );
@@ -311,35 +365,6 @@ void SfxVersionDialog::Open_Impl()
Close();
}
-void SfxVersionDialog::RecalcDateColumn()
-{
- // recalculate the datetime column width
- DateTime aNow( DateTime::SYSTEM );
- String sDateTime = ConvertDateTime_Impl( aNow, Application::GetSettings().GetLocaleDataWrapper() );
- long nWidth = aVersionBox.GetTextWidth( sDateTime );
- nWidth += 15; // a little offset
- long nTab = aVersionBox.GetTab(1);
- if ( nWidth > nTab )
- {
- // resize columns
- long nDelta = nWidth - nTab;
- aVersionBox.SetTab( 1, nTab + nDelta, MAP_PIXEL );
- nTab = aVersionBox.GetTab(2);
- aVersionBox.SetTab( 2, nTab + nDelta, MAP_PIXEL );
-
- // resize and move header
- Size aSize = aDateTimeText.GetSizePixel();
- aSize.Width() += nDelta;
- aDateTimeText.SetSizePixel( aSize );
- Point aPos = aSavedByText.GetPosPixel();
- aPos.X() += nDelta;
- aSavedByText.SetPosPixel( aPos );
- aPos = aCommentText.GetPosPixel();
- aPos.X() += nDelta;
- aCommentText.SetPosPixel( aPos );
- }
-}
-
IMPL_LINK_NOARG(SfxVersionDialog, DClickHdl_Impl)
{
Open_Impl();
@@ -348,16 +373,16 @@ IMPL_LINK_NOARG(SfxVersionDialog, DClickHdl_Impl)
IMPL_LINK_NOARG(SfxVersionDialog, SelectHdl_Impl)
{
- bool bEnable = ( aVersionBox.FirstSelected() != NULL );
+ bool bEnable = ( m_pVersionBox->FirstSelected() != NULL );
SfxObjectShell* pObjShell = pViewFrame->GetObjectShell();
- aDeleteButton.Enable( bEnable!= false && !pObjShell->IsReadOnly() );
- aOpenButton.Enable( bEnable!= false );
- aViewButton.Enable( bEnable!= false );
+ m_pDeleteButton->Enable( bEnable!= false && !pObjShell->IsReadOnly() );
+ m_pOpenButton->Enable( bEnable!= false );
+ m_pViewButton->Enable( bEnable!= false );
const SfxPoolItem *pDummy=NULL;
SfxItemState eState = pViewFrame->GetDispatcher()->QueryState( SID_DOCUMENT_MERGE, pDummy );
eState = pViewFrame->GetDispatcher()->QueryState( SID_DOCUMENT_COMPARE, pDummy );
- aCompareButton.Enable( bEnable!= false && eState >= SFX_ITEM_AVAILABLE );
+ m_pCompareButton->Enable( bEnable!= false && eState >= SFX_ITEM_AVAILABLE );
return 0L;
}
@@ -365,13 +390,13 @@ IMPL_LINK_NOARG(SfxVersionDialog, SelectHdl_Impl)
IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
{
SfxObjectShell *pObjShell = pViewFrame->GetObjectShell();
- SvTreeListEntry *pEntry = aVersionBox.FirstSelected();
+ SvTreeListEntry *pEntry = m_pVersionBox->FirstSelected();
- if ( pButton == &aSaveCheckBox )
+ if (pButton == m_pSaveCheckBox)
{
- mbIsSaveVersionOnClose = aSaveCheckBox.IsChecked();
+ m_bIsSaveVersionOnClose = m_pSaveCheckBox->IsChecked();
}
- else if ( pButton == &aSaveButton )
+ else if (pButton == m_pSaveButton)
{
SfxVersionInfo aInfo;
aInfo.aAuthor = SvtUserOptions().GetFullName();
@@ -385,38 +410,38 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
aItems[0] = &aComment;
aItems[1] = NULL;
pViewFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, aItems, 0 );
- aVersionBox.SetUpdateMode( sal_False );
- aVersionBox.Clear();
+ m_pVersionBox->SetUpdateMode( sal_False );
+ m_pVersionBox->Clear();
Init_Impl();
- aVersionBox.SetUpdateMode( sal_True );
+ m_pVersionBox->SetUpdateMode( sal_True );
}
delete pDlg;
}
- if ( pButton == &aDeleteButton && pEntry )
+ if (pButton == m_pDeleteButton && pEntry)
{
pObjShell->GetMedium()->RemoveVersion_Impl( ((SfxVersionInfo*) pEntry->GetUserData())->aName );
pObjShell->SetModified( sal_True );
- aVersionBox.SetUpdateMode( sal_False );
- aVersionBox.Clear();
+ m_pVersionBox->SetUpdateMode( sal_False );
+ m_pVersionBox->Clear();
Init_Impl();
- aVersionBox.SetUpdateMode( sal_True );
+ m_pVersionBox->SetUpdateMode( sal_True );
}
- else if ( pButton == &aOpenButton && pEntry )
+ else if (pButton == m_pOpenButton && pEntry)
{
Open_Impl();
}
- else if ( pButton == &aViewButton && pEntry )
+ else if (pButton == m_pViewButton && pEntry)
{
SfxVersionInfo* pInfo = (SfxVersionInfo*) pEntry->GetUserData();
SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, *pInfo, false);
pDlg->Execute();
delete pDlg;
}
- else if ( pEntry && pButton == &aCompareButton )
+ else if (pEntry && pButton == m_pCompareButton)
{
SfxAllItemSet aSet( pObjShell->GetPool() );
- sal_uIntPtr nPos = aVersionBox.GetModel()->GetRelPos( pEntry );
+ sal_uIntPtr nPos = m_pVersionBox->GetModel()->GetRelPos( pEntry );
aSet.Put( SfxInt16Item( SID_VERSION, (short)nPos+1 ) );
aSet.Put( SfxStringItem( SID_FILE_NAME, pObjShell->GetMedium()->GetName() ) );
@@ -447,7 +472,7 @@ SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(Window *pParent, SfxVersion
get(m_pCloseButton, "close");
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
- m_pDateTimeText->SetText(m_pDateTimeText->GetText() + ConvertDateTime_Impl(rInfo.aCreationDate, rLocaleWrapper));
+ m_pDateTimeText->SetText(m_pDateTimeText->GetText() + formatTime(rInfo.aCreationDate, rLocaleWrapper));
m_pSavedByText->SetText(m_pSavedByText->GetText() + rInfo.aAuthor);
m_pEdit->SetText(rInfo.aComment);
m_pEdit->set_height_request(7 * m_pEdit->GetTextHeight());
diff --git a/sfx2/source/dialog/versdlg.hrc b/sfx2/source/dialog/versdlg.hrc
deleted file mode 100644
index 3745a586b56b..000000000000
--- a/sfx2/source/dialog/versdlg.hrc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <dialog.hrc>
-
-#define GB_NEWVERSIONS 1
-#define PB_SAVE 2
-#define CB_SAVEONCLOSE 3
-#define TLB_VERSIONS 4
-#define PB_DELETE 5
-#define PB_OPEN 6
-#define PB_HELP 7
-#define PB_CLOSE 8
-#define GB_OLDVERSIONS 9
-#define FT_DATETIME 10
-#define FT_SAVEDBY 11
-#define FT_COMMENTS 12
-#define PB_VIEW 13
-#define ME_VERSIONS 14
-#define PB_OK 15
-#define PB_CANCEL 16
-#define PB_COMPARE 17
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/versdlg.src b/sfx2/source/dialog/versdlg.src
index 5b02a4b90a9b..63471ac02c89 100644
--- a/sfx2/source/dialog/versdlg.src
+++ b/sfx2/source/dialog/versdlg.src
@@ -17,115 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "versdlg.hrc"
-ModalDialog DLG_VERSIONS
-{
- HelpID = "sfx2:ModalDialog:DLG_VERSIONS";
- OutputSize = TRUE ;
- Size = MAP_APPFONT ( 340 , 184 ) ;
- SvLook = TRUE ;
- Moveable = TRUE ;
- FixedLine GB_NEWVERSIONS
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 272 , 8 ) ;
- Text [ en-US ] = "New versions" ;
- };
- PushButton PB_SAVE
- {
- HelpID = "sfx2:PushButton:DLG_VERSIONS:PB_SAVE";
- Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 90 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Save ~New Version" ;
- };
- CheckBox CB_SAVEONCLOSE
- {
- HelpID = "sfx2:CheckBox:DLG_VERSIONS:CB_SAVEONCLOSE";
- Pos = MAP_APPFONT ( 108 , 16 ) ;
- Size = MAP_APPFONT ( 164 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Always save a version on closing" ;
- };
- FixedLine GB_OLDVERSIONS
- {
- Pos = MAP_APPFONT ( 6 , 34 ) ;
- Size = MAP_APPFONT ( 272 , 8 ) ;
- Text [ en-US ] = "Existing versions" ;
- };
- FixedText FT_DATETIME
- {
- Pos = MAP_APPFONT ( 15 , 45 ) ;
- Size = MAP_APPFONT ( 60 , 10 ) ;
- Text [ en-US ] = "Date and time" ;
- };
- FixedText FT_SAVEDBY
- {
- Pos = MAP_APPFONT ( 76 , 45 ) ;
- Size = MAP_APPFONT ( 60 , 10 ) ;
- Text [ en-US ] = "Saved by" ;
- };
- FixedText FT_COMMENTS
- {
- Pos = MAP_APPFONT ( 138 , 45 ) ;
- Size = MAP_APPFONT ( 60 , 10 ) ;
- Text [ en-US ] = "Comments" ;
- };
- Control TLB_VERSIONS
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 58 ) ;
- Size = MAP_APPFONT ( 260 , 114 ) ;
- TabStop = TRUE ;
- };
- CancelButton PB_CLOSE
- {
- Pos = MAP_APPFONT ( 284 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Close" ;
- };
- PushButton PB_OPEN
- {
- HelpID = "sfx2:PushButton:DLG_VERSIONS:PB_OPEN";
- Pos = MAP_APPFONT ( 284 , 26 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Open" ;
- };
- PushButton PB_VIEW
- {
- HelpID = "sfx2:PushButton:DLG_VERSIONS:PB_VIEW";
- Pos = MAP_APPFONT ( 284 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- Text [ en-US ] = "~Show..." ;
- };
- PushButton PB_DELETE
- {
- HelpID = "sfx2:PushButton:DLG_VERSIONS:PB_DELETE";
- Pos = MAP_APPFONT ( 284 , 60 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Delete" ;
- };
- PushButton PB_COMPARE
- {
- HelpID = "sfx2:PushButton:DLG_VERSIONS:PB_COMPARE";
- Pos = MAP_APPFONT ( 284 , 77 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Compare" ;
- };
- HelpButton PB_HELP
- {
- Pos = MAP_APPFONT ( 284 , 97 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- Text [ en-US ] = "Versions of" ;
-};
+#include "dialog.hrc"
+
String STR_VIEWVERSIONCOMMENT
{
Text [ en-US ] = "View Version Comment" ;
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index 1853a3d864ed..bdb30c2c0170 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -20,56 +20,52 @@
#ifndef _VERSDLG_HXX
#define _VERSDLG_HXX
+#include <sfx2/basedlgs.hxx>
+#include <svtools/simptabl.hxx>
+#include <svtools/svmedit.hxx>
+#include <svtools/svtabbx.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
-#include <svtools/svtabbx.hxx>
-#include <svtools/svmedit.hxx>
-#include <sfx2/basedlgs.hxx>
class SfxViewFrame;
struct SfxVersionInfo;
-class SfxVersionsTabListBox_Impl : public SvTabListBox
+class SfxVersionsTabListBox_Impl : public SvSimpleTable
{
- virtual void KeyInput( const KeyEvent& rKeyEvent );
-
public:
- SfxVersionsTabListBox_Impl(
- Window* pParent, const ResId& );
+ SfxVersionsTabListBox_Impl(SvSimpleTableContainer& rParent, WinBits nBits)
+ : SvSimpleTable(rParent, nBits)
+ {
+ }
+ void setColSizes();
+ virtual void Resize();
+ virtual void KeyInput(const KeyEvent& rKeyEvent);
};
class SfxVersionTableDtor;
class SfxVersionDialog : public SfxModalDialog
{
- FixedLine aNewGroup;
- PushButton aSaveButton;
- CheckBox aSaveCheckBox;
- FixedLine aExistingGroup;
- FixedText aDateTimeText;
- FixedText aSavedByText;
- FixedText aCommentText;
- SfxVersionsTabListBox_Impl aVersionBox;
- CancelButton aCloseButton;
- PushButton aOpenButton;
- PushButton aViewButton;
- PushButton aDeleteButton;
- PushButton aCompareButton;
- HelpButton aHelpButton;
+ PushButton* m_pSaveButton;
+ CheckBox* m_pSaveCheckBox;
+ SfxVersionsTabListBox_Impl* m_pVersionBox;
+ PushButton* m_pOpenButton;
+ PushButton* m_pViewButton;
+ PushButton* m_pDeleteButton;
+ PushButton* m_pCompareButton;
SfxViewFrame* pViewFrame;
- SfxVersionTableDtor* mpTable;
- sal_Bool mbIsSaveVersionOnClose;
+ SfxVersionTableDtor* m_pTable;
+ bool m_bIsSaveVersionOnClose;
DECL_LINK(DClickHdl_Impl, void *);
DECL_LINK(SelectHdl_Impl, void *);
DECL_LINK( ButtonHdl_Impl, Button* );
void Init_Impl();
void Open_Impl();
- void RecalcDateColumn();
public:
SfxVersionDialog ( SfxViewFrame* pFrame, sal_Bool );
virtual ~SfxVersionDialog ();
- sal_Bool IsSaveVersionOnClose() const { return mbIsSaveVersionOnClose; }
+ bool IsSaveVersionOnClose() const { return m_bIsSaveVersionOnClose; }
};
class SfxViewVersionDialog_Impl : public SfxModalDialog
diff --git a/sfx2/uiconfig/ui/versionsofdialog.ui b/sfx2/uiconfig/ui/versionsofdialog.ui
new file mode 100644
index 000000000000..00d197f374af
--- /dev/null
+++ b/sfx2/uiconfig/ui/versionsofdialog.ui
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.6 -->
+ <!-- interface-requires LibreOffice 1.0 -->
+ <object class="GtkDialog" id="VersionsOfDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="close">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="open">
+ <property name="label">gtk-open</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="show">
+ <property name="label" translatable="yes">_Show...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="delete">
+ <property name="label">gtk-delete</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="compare">
+ <property name="label" translatable="yes">_Compare</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkButton" id="save">
+ <property name="label" translatable="yes">Save _New Version</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="always">
+ <property name="label" translatable="yes">_Always save a new version on closing</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">New versions</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">12</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="datetime">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Date and time</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="savedby">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Saved by</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="comments">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Comments</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="svtlo-SvSimpleTableContainer" id="versions">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Simple Table Container-selection1"/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Existing versions</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">close</action-widget>
+ <action-widget response="0">open</action-widget>
+ <action-widget response="0">show</action-widget>
+ <action-widget response="0">delete</action-widget>
+ <action-widget response="0">compare</action-widget>
+ <action-widget response="0">help</action-widget>
+ </action-widgets>
+ </object>
+</interface>