summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-08-14 14:19:21 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-08-14 16:07:04 -0430
commitcda4febfcf81473e7c0d4f8fe52212d282fa14d1 (patch)
treebd5a94bae54f4204cfda93dfbf67d5d801cd2178 /sfx2
parent0c03f7945e89e52a473a21267a4bd18970da52d3 (diff)
Display template information like author,type,keywords,etc.
Change-Id: I541ba1e40bd320701fac5d75615c8c9486dfebb9
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/templateinfodlg.hxx2
-rw-r--r--sfx2/source/dialog/templateinfodlg.cxx51
-rw-r--r--sfx2/source/doc/templatedlg.cxx3
3 files changed, 55 insertions, 1 deletions
diff --git a/sfx2/inc/sfx2/templateinfodlg.hxx b/sfx2/inc/sfx2/templateinfodlg.hxx
index e827531dab9a..dd031bebcbc8 100644
--- a/sfx2/inc/sfx2/templateinfodlg.hxx
+++ b/sfx2/inc/sfx2/templateinfodlg.hxx
@@ -25,6 +25,8 @@ public:
~SfxTemplateInfoDlg ();
+ void loadDocument (const OUString &rURL);
+
private:
PushButton maBtnClose;
diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx
index a1535d2162eb..2ed6794ac9c3 100644
--- a/sfx2/source/dialog/templateinfodlg.cxx
+++ b/sfx2/source/dialog/templateinfodlg.cxx
@@ -9,19 +9,68 @@
#include <sfx2/templateinfodlg.hxx>
+#include <comphelper/processfactory.hxx>
#include <sfx2/sfxresid.hxx>
#include <svtools/DocumentInfoPreview.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
#include "templateinfodlg.hrc"
+#define DLG_BORDER_SIZE 12
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::task;
+
SfxTemplateInfoDlg::SfxTemplateInfoDlg (Window *pParent)
: ModalDialog(pParent,SfxResId(DLG_TEMPLATE_INFORMATION)),
- maBtnClose(this,SfxResId(BTN_TEMPLATE_INFO_CLOSE))
+ maBtnClose(this,SfxResId(BTN_TEMPLATE_INFO_CLOSE)),
+ mpInfoView(new svtools::ODocumentInfoPreview(this,WB_LEFT | WB_VSCROLL | WB_READONLY | WB_BORDER | WB_3DLOOK))
{
+ Size aWinSize = GetOutputSizePixel();
+ aWinSize.setHeight( aWinSize.getHeight() - 3*DLG_BORDER_SIZE - maBtnClose.GetOutputHeightPixel() );
+ aWinSize.setWidth( (aWinSize.getWidth() - 3*DLG_BORDER_SIZE)/2 );
+ mpInfoView->SetPosSizePixel(Point(DLG_BORDER_SIZE,DLG_BORDER_SIZE),aWinSize);
+ mpInfoView->Show();
}
SfxTemplateInfoDlg::~SfxTemplateInfoDlg()
{
+ delete mpInfoView;
+}
+
+void SfxTemplateInfoDlg::loadDocument(const OUString &rURL)
+{
+ uno::Reference<lang::XMultiServiceFactory> xContext(comphelper::getProcessServiceFactory());
+
+ try
+ {
+ uno::Reference<task::XInteractionHandler> xInteractionHandler(
+ xContext->createInstance("com.sun.star.task.InteractionHandler"), uno::UNO_QUERY );
+
+ uno::Sequence<beans::PropertyValue> aProps(1);
+ aProps[0].Name = "InteractionHandler";
+ aProps[0].Value <<= xInteractionHandler;
+
+ uno::Reference<document::XDocumentProperties> xDocProps(
+ xContext->createInstance("com.sun.star.document.DocumentProperties"), uno::UNO_QUERY );
+
+ xDocProps->loadFromMedium( rURL, aProps );
+
+ mpInfoView->fill( xDocProps, rURL );
+ }
+ catch ( beans::UnknownPropertyException& )
+ {
+ }
+ catch ( uno::Exception& )
+ {
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 80aa1a91b632..04bbddcc623d 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -947,7 +947,10 @@ void SfxTemplateManagerDlg::OnTemplateEdit ()
void SfxTemplateManagerDlg::OnTemplateProperties ()
{
+ const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*maSelTemplates.begin());
+
SfxTemplateInfoDlg aDlg;
+ aDlg.loadDocument(pItem->getPath());
aDlg.Execute();
}