Kaydet (Commit) cda4febf authored tarafından Rafael Dominguez's avatar Rafael Dominguez

Display template information like author,type,keywords,etc.

Change-Id: I541ba1e40bd320701fac5d75615c8c9486dfebb9
üst 0c03f794
...@@ -25,6 +25,8 @@ public: ...@@ -25,6 +25,8 @@ public:
~SfxTemplateInfoDlg (); ~SfxTemplateInfoDlg ();
void loadDocument (const OUString &rURL);
private: private:
PushButton maBtnClose; PushButton maBtnClose;
......
...@@ -9,19 +9,68 @@ ...@@ -9,19 +9,68 @@
#include <sfx2/templateinfodlg.hxx> #include <sfx2/templateinfodlg.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/sfxresid.hxx> #include <sfx2/sfxresid.hxx>
#include <svtools/DocumentInfoPreview.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" #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) SfxTemplateInfoDlg::SfxTemplateInfoDlg (Window *pParent)
: ModalDialog(pParent,SfxResId(DLG_TEMPLATE_INFORMATION)), : 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() 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -947,7 +947,10 @@ void SfxTemplateManagerDlg::OnTemplateEdit () ...@@ -947,7 +947,10 @@ void SfxTemplateManagerDlg::OnTemplateEdit ()
void SfxTemplateManagerDlg::OnTemplateProperties () void SfxTemplateManagerDlg::OnTemplateProperties ()
{ {
const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*maSelTemplates.begin());
SfxTemplateInfoDlg aDlg; SfxTemplateInfoDlg aDlg;
aDlg.loadDocument(pItem->getPath());
aDlg.Execute(); aDlg.Execute();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment