diff options
Diffstat (limited to 'svtools/source/contnr/templwin.cxx')
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 190 |
1 files changed, 1 insertions, 189 deletions
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index d23862db2ce5..3bdb0f7ee7c6 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -43,7 +43,6 @@ #include <svtools/svtools.hrc> #include "templwin.hrc" #include <svtools/helpid.hrc> -#include <unotools/pathoptions.hxx> #include <unotools/viewoptions.hxx> #include <unotools/ucbhelper.hxx> #include "unotools/configmgr.hxx" @@ -97,7 +96,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::view; using namespace svtools; -extern ::rtl::OUString CreateExactSizeText_Impl( sal_Int64 nSize ); // fileview.cxx #define aSeparatorStr "----------------------------------" #define SPLITSET_ID 0 @@ -129,163 +127,6 @@ struct FolderHistory typedef ::std::vector< ::rtl::OUString* > NewDocList_Impl; -ODocumentInfoPreview::ODocumentInfoPreview( Window* pParent ,WinBits _nBits) : Window(pParent,WB_DIALOGCONTROL) -{ - m_pEditWin = new SvtExtendedMultiLineEdit_Impl(this,_nBits); - m_pEditWin->Show(); - m_pEditWin->EnableCursor( sal_False ); - m_pInfoTable = new SvtDocInfoTable_Impl(); - // detect application language - m_aLocale = SvtPathOptions().GetLocale(); -} -// ----------------------------------------------------------------------------- -ODocumentInfoPreview::~ODocumentInfoPreview() -{ - delete m_pEditWin; - delete m_pInfoTable; -} -// ----------------------------------------------------------------------------- -void ODocumentInfoPreview::Resize() -{ - Size aOutputSize( GetOutputSize() ); - m_pEditWin->SetPosSizePixel( Point(0,0),aOutputSize); -} -// ----------------------------------------------------------------------------- -void ODocumentInfoPreview::Clear() -{ - m_pEditWin->Clear(); -} -// ----------------------------------------------------------------------------- - -void lcl_insertDateTimeEntry(SvtExtendedMultiLineEdit_Impl* i_pEditWin, - const ::rtl::OUString & i_rName, const util::DateTime & i_rUDT) -{ - DateTime aToolsDT = - DateTime( Date( i_rUDT.Day, i_rUDT.Month, i_rUDT.Year ), - Time( i_rUDT.Hours, i_rUDT.Minutes, - i_rUDT.Seconds, i_rUDT.HundredthSeconds ) ); - if ( aToolsDT.IsValidAndGregorian() ) - { - LocaleDataWrapper aLocaleWrapper( - ::comphelper::getProcessServiceFactory(), - Application::GetSettings().GetLocale() ); - String aDateStr = aLocaleWrapper.getDate( aToolsDT ); - aDateStr += String( RTL_CONSTASCII_USTRINGPARAM(", ") ); - aDateStr += aLocaleWrapper.getTime( aToolsDT ); - i_pEditWin->InsertEntry( i_rName, aDateStr ); - } -} - -void ODocumentInfoPreview::fill( - const Reference< XDocumentProperties >& i_xDocProps, const String& i_rURL) -{ - if (!i_xDocProps.is()) throw RuntimeException(); - - ::rtl::OUString aStr; - m_pEditWin->SetAutoScroll( sal_False ); - - aStr = i_xDocProps->getTitle(); - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString( DI_TITLE ), aStr ); - } - - aStr = i_xDocProps->getAuthor(); - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString( DI_FROM ), aStr ); - } - - lcl_insertDateTimeEntry(m_pEditWin, - m_pInfoTable->GetString( DI_DATE ), - i_xDocProps->getCreationDate()); - - aStr = i_xDocProps->getModifiedBy(); - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString(DI_MODIFIEDBY), aStr ); - } - - lcl_insertDateTimeEntry(m_pEditWin, - m_pInfoTable->GetString( DI_MODIFIEDDATE ), - i_xDocProps->getModificationDate()); - - aStr = i_xDocProps->getPrintedBy(); - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString( DI_PRINTBY ), aStr ); - } - - lcl_insertDateTimeEntry(m_pEditWin, - m_pInfoTable->GetString( DI_PRINTDATE ), - i_xDocProps->getPrintDate()); - - aStr = i_xDocProps->getSubject(); - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString( DI_THEME ), aStr ); - } - - aStr = - ::comphelper::string::convertCommaSeparated(i_xDocProps->getKeywords()); - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString( DI_KEYWORDS ), aStr ); - } - - aStr = i_xDocProps->getDescription(); - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString( DI_DESCRIPTION ), - aStr ); - } - - // size - if ( i_rURL.Len() > 0 ) - { - m_pEditWin->InsertEntry( - m_pInfoTable->GetString( DI_SIZE ), - CreateExactSizeText_Impl( utl::UCBContentHelper::GetSize( i_rURL ) ) ); - } - - // MIMEType - if ( i_rURL.Len() > 0 ) - { - INetContentType eTypeID = - INetContentTypes::GetContentTypeFromURL( i_rURL ); - if ( eTypeID != CONTENT_TYPE_APP_OCTSTREAM ) { - aStr = INetContentTypes::GetPresentation( eTypeID, m_aLocale ); - } else { - aStr = SvFileInformationManager::GetDescription( - INetURLObject(i_rURL) ); - } - if (!aStr.isEmpty()) { - m_pEditWin->InsertEntry( m_pInfoTable->GetString( DI_MIMETYPE ), - aStr ); - } - } - - // user-defined (custom) properties - Reference< XPropertySet > xUserDefined( - i_xDocProps->getUserDefinedProperties(), UNO_QUERY_THROW ); - Reference< XPropertySetInfo > xUDInfo = xUserDefined->getPropertySetInfo(); - Sequence< Property > props = xUDInfo->getProperties(); - for (sal_Int32 i = 0; i < props.getLength(); ++i) { - const ::rtl::OUString name = props[i].Name; - uno::Any aAny; - try { - aAny = xUserDefined->getPropertyValue(name); - uno::Reference < script::XTypeConverter > xConverter( - comphelper::getProcessServiceFactory()->createInstance( - ASCII_STR("com.sun.star.script.Converter")), - UNO_QUERY ); - uno::Any aNew; - aNew = xConverter->convertToSimpleType( aAny, TypeClass_STRING ); - if ((aNew >>= aStr) && !aStr.isEmpty()) { - m_pEditWin->InsertEntry( name, aStr); - } - } catch (uno::Exception &) { - // ignore - } - } - - m_pEditWin->SetSelection( Selection( 0, 0 ) ); - m_pEditWin->SetAutoScroll( sal_True ); -} - // class SvtDummyHeaderBar_Impl ------------------------------------------ void SvtDummyHeaderBar_Impl::UpdateBackgroundColor() @@ -760,35 +601,6 @@ SvtDocInfoTable_Impl::SvtDocInfoTable_Impl() : { } -// ----------------------------------------------------------------------------- -// class SvtExtendedMultiLineEdit_Impl -------------------------------------------- -SvtExtendedMultiLineEdit_Impl::SvtExtendedMultiLineEdit_Impl( Window* pParent,WinBits _nBits ) : - - ExtMultiLineEdit( pParent, _nBits ) - -{ - SetLeftMargin( 10 ); -} -// ----------------------------------------------------------------------------- -void SvtExtendedMultiLineEdit_Impl::InsertEntry( const String& rTitle, const String& rValue ) -{ - String aText( '\n' ); - aText += rTitle; - aText += ':'; - InsertText( aText ); - sal_uLong nPara = GetParagraphCount() - 1; - SetAttrib( TextAttribFontWeight( WEIGHT_BOLD ), nPara, 0, aText.Len() ); - - aText = '\n'; - aText += rValue; - InsertText( aText ); - nPara = GetParagraphCount() - 1; - SetAttrib( TextAttribFontWeight( WEIGHT_NORMAL ), nPara, 0, aText.Len() ); - - InsertText( String( '\n' ) ); -} -// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------- const String& SvtDocInfoTable_Impl::GetString( long nId ) const @@ -896,7 +708,7 @@ void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_B aCurrentURL = rURL; ViewNonEmptyWin(); - pEditWin->Clear(); + pEditWin->clear(); if ( rURL.Len() > 0 && bPreview && m_xDocProps.is() ) ShowDocInfo( rURL ); |