summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2008-02-26 14:10:20 +0000
committerOliver Bolte <obo@openoffice.org>2008-02-26 14:10:20 +0000
commit18f6ad7d1f55aeb923b57ab149376456956a1cf4 (patch)
tree693ce9d4d491476880685072d83406dbeded3e5f /sfx2/source
parent18b233e6e7b5a1a2bc05131bde408f7dd9ec2a47 (diff)
INTEGRATION: CWS custommeta (1.198.18); FILE MERGED
2008/02/26 10:41:25 mst 1.198.18.7: RESYNC: (1.200-1.202); FILE MERGED 2008/02/01 16:23:32 mst 1.198.18.6: interface change: SfxObjectShell::GetPreviewMetaFile - sfx2/inc/sfx2/objsh.hxx, sfx2/source/doc/{objcont.cxx,objstor.cxx,sfxbasemodel.cxx}: + SfxObjectShell::GetPreviewMetaFile returns a boost::shared_ptr; likewise SfxObjectShell::CreatePreviewMetaFile_Impl - sfx2/source/inc/preview.hxx, sfx2/source/doc/new.cxx: + SfxPreviewBase_Impl stores its GDIMetaFile member in a boost::shared_ptr 2008/02/01 16:03:04 mst 1.198.18.5: - sfx2/source/doc/{objmisc.cxx,objstor.cxx}: + fix merged junk from cwsresync 2008/02/01 10:39:04 mst 1.198.18.4: RESYNC: (1.198-1.200); FILE MERGED 2008/01/29 12:54:56 mst 1.198.18.3: interface change: convertCommaSeparated - sfx2/inc/sfx2/docinf.hxx, sfx2/source/doc/docinf.cxx: + remove functions convertCommaSeparated (moved to comphelper/string.hxx) - sfx2/source/doc/{objserv.cxx,objstor.cxx,objuno.cxx}, sfx2/source/dialog/dinfdlg.cxx, sfx2/source/bastyp/{frmhtmlw.cxx,sfxhtml.cxx}: + adapt to convertCommaSeparated change (moved to comphelper) 2008/01/25 16:13:43 mst 1.198.18.2: interface change: SfxObjectShell::GetDocInfo - sfx2/inc/sfx2/objsh.hxx, sfx2/source/inc/objshimp.hxx, sfx2/source/doc/{objcont.cxx,objmisc.cxx,objserv.cxx,objxtor.cxx}: + remove SfxDocumentInfo member + remove method SfxObjectShell::GetDocInfo + add method SfxObjectShell::getDocProperties + use XDocumentProperties instead of SfxDocumentInfo + adapt to new SfxDocumentInfoItem - sfx2/source/doc/sfxbasemodel.cxx: + move creation of backup of document meta-data in case of saveTo from SfxObjectShell::APISaveAs_Impl to SfxBaseModel::impl_store + adapt to new SfxDocumentInfoItem 2008/01/16 15:34:08 mst 1.198.18.1: - sfx2/source/doc/objstor.cxx: + refactor DoLoad to use XDocumentProperties instead of SfxDocumentInfo to delay initialization of the latter
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/doc/objstor.cxx77
1 files changed, 51 insertions, 26 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 006c797ff6df..3753f0d8b6cc 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: objstor.cxx,v $
*
- * $Revision: 1.202 $
+ * $Revision: 1.203 $
*
- * last change: $Author: vg $ $Date: 2008-02-12 13:15:50 $
+ * last change: $Author: obo $ $Date: 2008-02-26 15:10:20 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -156,6 +156,8 @@
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#endif
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
@@ -202,6 +204,7 @@
#include <comphelper/storagehelper.hxx>
#include <comphelper/seqstream.hxx>
#include <comphelper/documentconstants.hxx>
+#include <comphelper/string.hxx>
#include <vcl/bitmapex.hxx>
#include <svtools/embedhlp.hxx>
#include <rtl/logfile.hxx>
@@ -216,7 +219,6 @@
#include <sfx2/docfile.hxx>
#include "fltfnc.hxx"
#include <sfx2/docfilt.hxx>
-#include <sfx2/docinf.hxx>
#include <sfx2/docfac.hxx>
#include "objshimp.hxx"
#include "sfxtypes.hxx"
@@ -852,24 +854,30 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
::rtl::OUString aSubject( RTL_CONSTASCII_USTRINGPARAM("Subject") );
Any aAny;
::rtl::OUString aValue;
- SfxDocumentInfo& rInfo = GetDocInfo();
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
if ( xProps->hasPropertyByName( aAuthor ) )
{
aAny = aContent.getPropertyValue( aAuthor );
if ( ( aAny >>= aValue ) )
- rInfo.SetCreated( String( aValue ) );
+ xDocProps->setAuthor(aValue);
}
if ( xProps->hasPropertyByName( aKeywords ) )
{
aAny = aContent.getPropertyValue( aKeywords );
if ( ( aAny >>= aValue ) )
- rInfo.SetKeywords( aValue );
+ xDocProps->setKeywords(
+ ::comphelper::string::convertCommaSeparated(aValue));
+;
}
if ( xProps->hasPropertyByName( aSubject ) )
{
aAny = aContent.getPropertyValue( aSubject );
- if ( ( aAny >>= aValue ) )
- rInfo.SetTheme( aValue );
+ if ( ( aAny >>= aValue ) ) {
+ xDocProps->setSubject(aValue);
+ }
}
}
}
@@ -938,12 +946,27 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
if ( pMedium->GetInteractionHandler().is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater )
{
// scan the generator string (within meta.xml)
- SfxDocumentInfo aDocInfo( this );
- uno::Reference< beans::XPropertySet > xSet( aDocInfo.GetInfo(), UNO_QUERY );
- if ( xSet.is() )
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ if ( xDocProps.is() )
{
+ uno::Reference<beans::XPropertySet> xUserDefinedProps(
+ xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
+ //FIXME: this should be removed before 3.0!
// the new property "ODFVersion" is a temporary solution for OOo2.4
- uno::Any aAny = xSet->getPropertyValue( DEFINE_CONST_UNICODE("ODFVersion") );
+ uno::Any aAny;
+ try
+ {
+ aAny = xUserDefinedProps->getPropertyValue(
+ DEFINE_CONST_UNICODE("ODFVersion"));
+ }
+ catch( const uno::Exception& )
+ {
+ // Custom Property "ODFVersion" does not exist
+ }
+
::rtl::OUString sTemp;
if ( (aAny >>= sTemp) && sTemp.getLength() )
{
@@ -1736,19 +1759,26 @@ sal_Bool SfxObjectShell::SaveTo_Impl
::rtl::OUString aKeywords( RTL_CONSTASCII_USTRINGPARAM("Keywords") );
::rtl::OUString aSubject( RTL_CONSTASCII_USTRINGPARAM("Subject") );
Any aAny;
+
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+
if ( xProps->hasPropertyByName( aAuthor ) )
{
- aAny <<= ::rtl::OUString( GetDocInfo().GetAuthor() );
+ aAny <<= xDocProps->getAuthor();
aContent.setPropertyValue( aAuthor, aAny );
}
if ( xProps->hasPropertyByName( aKeywords ) )
{
- aAny <<= ::rtl::OUString( GetDocInfo().GetKeywords() );
+ aAny <<= ::comphelper::string::convertCommaSeparated(
+ xDocProps->getKeywords());
aContent.setPropertyValue( aKeywords, aAny );
}
if ( xProps->hasPropertyByName( aSubject ) )
{
- aAny <<= ::rtl::OUString( GetDocInfo().GetTheme() );
+ aAny <<= xDocProps->getSubject();
aContent.setPropertyValue( aSubject, aAny );
}
}
@@ -1961,14 +1991,8 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed )
if( pNewMed->GetName().Len() )
bHasName = sal_True;
Broadcast( SfxSimpleHint(SFX_HINT_NAMECHANGED) );
- try
- {
- uno::Reference< beans::XPropertySet > xProps( GetDocInfo().GetInfo(), uno::UNO_QUERY_THROW );
- xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Generator" ) ),
- uno::makeAny( ::utl::DocInfoHelper::GetGeneratorString() ) );
- }
- catch( uno::Exception& )
- {}
+ getDocProperties()->setGenerator(
+ ::utl::DocInfoHelper::GetGeneratorString() );
}
uno::Reference< embed::XStorage > xStorage;
@@ -3797,11 +3821,12 @@ sal_Bool SfxObjectShell::WriteThumbnail( sal_Bool bEncrypted,
}
else
{
- GDIMetaFile* pMetaFile = GetPreviewMetaFile( sal_False );
+ ::boost::shared_ptr<GDIMetaFile> pMetaFile =
+ GetPreviewMetaFile( sal_False );
if ( pMetaFile )
{
- bResult = GraphicHelper::getThumbnailFormatFromGDI_Impl( pMetaFile, bSigned, xStream );
- delete pMetaFile;
+ bResult = GraphicHelper::getThumbnailFormatFromGDI_Impl(
+ pMetaFile.get(), bSigned, xStream );
}
}
}