diff options
author | Peter Burow <pb@openoffice.org> | 2001-05-23 12:11:11 +0000 |
---|---|---|
committer | Peter Burow <pb@openoffice.org> | 2001-05-23 12:11:11 +0000 |
commit | 2289412cb39a8dd3dfee038e684f82952bd264a5 (patch) | |
tree | 03baf06a480bd34c9a1d5068bcd2f3574b35153a | |
parent | 9f7b1a4cbfd9e6eba3d6381bf87bdcc8a55fe53c (diff) |
fix: #85201# more doc info
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 174 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.hrc | 5 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.hxx | 6 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.src | 6 |
4 files changed, 115 insertions, 76 deletions
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 382f0a727615..ebdac602815a 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: templwin.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: pb $ $Date: 2001-05-21 11:15:30 $ + * last change: $Author: pb $ $Date: 2001-05-23 13:11:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -146,6 +146,9 @@ #ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX #include <unotools/localedatawrapper.hxx> #endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif #include <comphelper/processfactory.hxx> #include <tools/urlobj.hxx> @@ -155,6 +158,7 @@ #include <vcl/msgbox.hxx> using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ucb; @@ -162,6 +166,8 @@ using namespace ::com::sun::star::uno; //!using namespace ::com::sun::star::util; using namespace ::com::sun::star::view; +extern String CreateExactSizeText_Impl( ULONG nSize ); // fileview.cxx + #define SPLITSET_ID 0 #define COLSET_ID 1 #define ICONWIN_ID 2 @@ -189,6 +195,7 @@ static SvtDocInfoMapping_Impl __READONLY_DATA DocInfoMap_Impl[] = { "Title", DI_TITLE, STRING_TYPE, "Author", DI_FROM, STRING_TYPE, + "Size", DI_SIZE, SIZE_TYPE, "CreationDate", DI_DATE, DATE_TYPE, "Keywords", DI_KEYWORDS, STRING_TYPE, "Description", DI_DESCRIPTION, STRING_TYPE, @@ -566,97 +573,124 @@ SvtFrameWindow_Impl::~SvtFrameWindow_Impl() xFrame->dispose(); } -void SvtFrameWindow_Impl::Resize() -{ - Size aWinSize = GetOutputSizePixel(); - pEditWin->SetSizePixel( aWinSize ); - pTextWin->SetSizePixel( aWinSize ); -} -void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_Bool bAsTemplate ) +void SvtFrameWindow_Impl::ShowDocInfo( const String& rURL ) { - if ( bPreview ) - aCurrentURL = rURL; - - pEditWin->Clear(); - - String aText; - - if ( bPreview && xDocInfo.is() ) + try { - try - { - xDocInfo->read( rURL ); - Reference< XPropertySet > aPropSet( xDocInfo, UNO_QUERY ); + xDocInfo->read( rURL ); + Reference< XPropertySet > aPropSet( xDocInfo, UNO_QUERY ); - Reference< XMultiPropertySet > aMultiSet( xDocInfo, UNO_QUERY ); - if ( aMultiSet.is() ) + Reference< XMultiPropertySet > aMultiSet( xDocInfo, UNO_QUERY ); + if ( aMultiSet.is() ) + { + String aText; + Reference< XPropertySetInfo > aInfoSet = aMultiSet->getPropertySetInfo(); + if ( aInfoSet.is() ) { - Reference< XPropertySetInfo > aInfoSet = aMultiSet->getPropertySetInfo(); - if ( aInfoSet.is() ) - { - Sequence< Property > aProps = aInfoSet->getProperties(); - const Property* pProps = aProps.getConstArray(); - sal_uInt32 nCount = aProps.getLength(); + Sequence< Property > aProps = aInfoSet->getProperties(); + const Property* pProps = aProps.getConstArray(); + sal_uInt32 nCount = aProps.getLength(); - for ( sal_uInt32 i = 0; i < nCount; ++i ) - { - aText += String( pProps[i].Name ); - aText += '\n'; - } + for ( sal_uInt32 i = 0; i < nCount; ++i ) + { + aText += String( pProps[i].Name ); + aText += '\n'; } } + } - if ( aPropSet.is() ) + if ( aPropSet.is() ) + { + USHORT nIndex = 0; + rtl::OUString aStringValue; + ::com::sun::star::util::DateTime aDateValue; + while ( DocInfoMap_Impl[ nIndex ]._pPropName ) { - USHORT nIndex = 0; - rtl::OUString aStringValue; - ::com::sun::star::util::DateTime aDateValue; - while ( DocInfoMap_Impl[ nIndex ]._pPropName ) + SvtDocInfoType eInfoType = DocInfoMap_Impl[ nIndex ]._eType; + Any aValue; + if ( eInfoType != SIZE_TYPE ) + aValue = aPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( DocInfoMap_Impl[ nIndex ]._pPropName ) ); + + switch ( eInfoType ) { - Any aValue = aPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( DocInfoMap_Impl[ nIndex ]._pPropName ) ); - switch ( DocInfoMap_Impl[ nIndex ]._eType ) + case STRING_TYPE : { - case STRING_TYPE : - { - if ( ( aValue >>= aStringValue ) && aStringValue.getLength() > 0 ) - pEditWin->InsertEntry( aInfoTable.GetString( DocInfoMap_Impl[ nIndex ]._nStringId ), String( aStringValue ) ); - break; - } + if ( ( aValue >>= aStringValue ) && aStringValue.getLength() > 0 ) + pEditWin->InsertEntry( aInfoTable.GetString( DocInfoMap_Impl[ nIndex ]._nStringId ), String( aStringValue ) ); + break; + } - case DATE_TYPE : + case DATE_TYPE : + { + if ( aValue >>= aDateValue ) { - if ( aValue >>= aDateValue ) + DateTime aToolsDT = + DateTime( Date( aDateValue.Day, aDateValue.Month, aDateValue.Year ), + Time( aDateValue.Hours, aDateValue.Minutes, aDateValue.Seconds, aDateValue.HundredthSeconds ) ); + if ( aToolsDT.IsValid() ) { - DateTime aToolsDT = - DateTime( Date( aDateValue.Day, aDateValue.Month, aDateValue.Year ), - Time( aDateValue.Hours, aDateValue.Minutes, aDateValue.Seconds, aDateValue.HundredthSeconds ) ); - if ( aToolsDT.IsValid() ) - { - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - String aDateStr = aLocaleWrapper.getDate( aToolsDT ); - aDateStr += String::CreateFromAscii( ", " ); - aDateStr += aLocaleWrapper.getTime( aToolsDT ); - pEditWin->InsertEntry( aInfoTable.GetString( DocInfoMap_Impl[ nIndex ]._nStringId ), aDateStr ); - } + LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); + String aDateStr = aLocaleWrapper.getDate( aToolsDT ); + aDateStr += String::CreateFromAscii( ", " ); + aDateStr += aLocaleWrapper.getTime( aToolsDT ); + pEditWin->InsertEntry( aInfoTable.GetString( DocInfoMap_Impl[ nIndex ]._nStringId ), aDateStr ); } - break; - } - - case SIZE_TYPE : - { - break; } + break; } - ++nIndex; + case SIZE_TYPE : + { + // size + ULONG nDocSize = ::utl::UCBContentHelper::GetSize( rURL ); + pEditWin->InsertEntry( aInfoTable.GetString( DocInfoMap_Impl[ nIndex ]._nStringId ), CreateExactSizeText_Impl( nDocSize ) ); + break; + } } + + ++nIndex; + } + } + + // info fields + Reference< XNameContainer > aNameCnt( xDocInfo, UNO_QUERY ); + if ( aNameCnt.is() ) + { + Sequence< ::rtl::OUString > aNameList = aNameCnt->getElementNames(); + const ::rtl::OUString* pNames = aNameList.getConstArray(); + sal_uInt32 nCount = aNameList.getLength(); + + for ( sal_uInt32 i = 0; i < nCount; ++i ) + { + ::rtl::OUString aName = pNames[i], aStrVal; + Any aValue = aNameCnt->getByName( aName ); + if ( ( aValue >>= aStrVal ) && aStrVal.getLength() > 0 ) + pEditWin->InsertEntry( String( aName ), String( aStrVal ) ); } } - catch ( ::com::sun::star::io::IOException& ) {} - catch ( UnknownPropertyException& ) {} - catch ( Exception& ) {} } + catch ( ::com::sun::star::io::IOException& ) {} + catch ( UnknownPropertyException& ) {} + catch ( Exception& ) {} +} + +void SvtFrameWindow_Impl::Resize() +{ + Size aWinSize = GetOutputSizePixel(); + pEditWin->SetSizePixel( aWinSize ); + pTextWin->SetSizePixel( aWinSize ); +} + +void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_Bool bAsTemplate ) +{ + if ( bPreview ) + aCurrentURL = rURL; + + pEditWin->Clear(); + + if ( rURL.Len() > 0 && bPreview && xDocInfo.is() ) + ShowDocInfo( rURL ); if ( rURL.Len() == 0 ) { diff --git a/svtools/source/contnr/templwin.hrc b/svtools/source/contnr/templwin.hrc index 2c44622b6b74..8ac8c2c61d72 100644 --- a/svtools/source/contnr/templwin.hrc +++ b/svtools/source/contnr/templwin.hrc @@ -2,9 +2,9 @@ * * $RCSfile: templwin.hrc,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: pb $ $Date: 2001-05-21 11:15:30 $ + * last change: $Author: pb $ $Date: 2001-05-23 13:11:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,4 +85,5 @@ #define DI_PRINTDATE 9 #define DI_PRINTBY 10 #define DI_THEME 11 +#define DI_SIZE 12 diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx index 3e44a81b5d6a..447598d15fa5 100644 --- a/svtools/source/contnr/templwin.hxx +++ b/svtools/source/contnr/templwin.hxx @@ -2,9 +2,9 @@ * * $RCSfile: templwin.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: pb $ $Date: 2001-05-21 11:15:30 $ + * last change: $Author: pb $ $Date: 2001-05-23 13:11:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -180,6 +180,8 @@ private: SvtDocInfoTable_Impl aInfoTable; String aCurrentURL; + void ShowDocInfo( const String& rURL ); + public: SvtFrameWindow_Impl( Window* pParent ); ~SvtFrameWindow_Impl(); diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index c5418acfba8f..abe6df1b150f 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -2,9 +2,9 @@ * * $RCSfile: templwin.src,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: pb $ $Date: 2001-05-21 11:15:30 $ + * last change: $Author: pb $ $Date: 2001-05-23 13:11:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -489,6 +489,7 @@ StringArray STRARY_SVT_DOCINFO < "Druckdatum" ; DI_PRINTDATE ; > ; < "Gedruckt von" ; DI_PRINTBY ; > ; < "Thema" ; DI_THEME ; > ; + < "Größe" ; DI_SIZE ; > ; }; ItemList [ english_us ] = { @@ -503,6 +504,7 @@ StringArray STRARY_SVT_DOCINFO < "Druckdatum" ; DI_PRINTDATE ; > ; < "Gedruckt von" ; DI_PRINTBY ; > ; < "Theme" ; DI_THEME ; > ; + < "Size" ; DI_SIZE ; > ; }; }; |