diff options
author | Oliver Bolte <obo@openoffice.org> | 2008-02-26 14:07:23 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2008-02-26 14:07:23 +0000 |
commit | 08543366e5612362993cc7f569c1c186c47c55af (patch) | |
tree | 9195bc527e39d5da94d41ac9109e34000bb82a84 | |
parent | 32c1fbf5ec9dd72920eeb98f87c5161539eb66b9 (diff) |
INTEGRATION: CWS custommeta (1.62.60); FILE MERGED
2008/01/22 09:33:44 mst 1.62.60.1: - sfx2/source/inc/cfg.hxx, sfx2/source/dialog/cfg.cxx:
+ remove method SfxConfigGroupListBox_Impl::xModelToDocTitle;
call ::comphelper::DocumentInfo::getDocumentTitle instead
-rw-r--r-- | sfx2/source/dialog/cfg.cxx | 64 |
1 files changed, 4 insertions, 60 deletions
diff --git a/sfx2/source/dialog/cfg.cxx b/sfx2/source/dialog/cfg.cxx index aa827ec93f7c..a4991a92594f 100644 --- a/sfx2/source/dialog/cfg.cxx +++ b/sfx2/source/dialog/cfg.cxx @@ -4,9 +4,9 @@ * * $RCSfile: cfg.cxx,v $ * - * $Revision: 1.62 $ + * $Revision: 1.63 $ * - * last change: $Author: kz $ $Date: 2007-10-09 15:32:01 $ + * last change: $Author: obo $ $Date: 2008-02-26 15:07:23 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -137,7 +137,6 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumeration.hpp> -#include <com/sun/star/document/XDocumentInfoSupplier.hpp> #ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> @@ -1215,7 +1214,8 @@ SfxConfigGroupListBox_Impl::getDocumentModel( Reference< XComponentContext >& xC components->nextElement(), UNO_QUERY ); if ( model.is() ) { - ::rtl::OUString sTdocUrl = xModelToDocTitle( model ); + ::rtl::OUString sTdocUrl = + ::comphelper::DocumentInfo::getDocumentTitle( model ); if( sTdocUrl.equals( docName ) ) { xModel = model; @@ -1226,62 +1226,6 @@ SfxConfigGroupListBox_Impl::getDocumentModel( Reference< XComponentContext >& xC return xModel; } -::rtl::OUString SfxConfigGroupListBox_Impl::xModelToDocTitle( const Reference< frame::XModel >& xModel ) -{ - // Set a default name, this should never be seen. - ::rtl::OUString docNameOrURL = - ::rtl::OUString::createFromAscii("Unknown"); - if ( xModel.is() ) - { - ::rtl::OUString tempName; - try - { - Reference< beans::XPropertySet > propSet( xModel->getCurrentController()->getFrame(), UNO_QUERY ); - if ( propSet.is() ) - { - if ( sal_True == ( propSet->getPropertyValue(::rtl::OUString::createFromAscii( "Title" ) ) >>= tempName ) ) - { - docNameOrURL = tempName; - if ( xModel->getURL().getLength() == 0 ) - { - // process "UntitledX - YYYYYYYY" - // to get UntitledX - sal_Int32 pos = 0; - docNameOrURL = tempName.getToken(0,' ',pos); - OSL_TRACE("xModelToDocTitle() Title for document is %s.", - ::rtl::OUStringToOString( docNameOrURL, - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - else - { - Reference< document::XDocumentInfoSupplier > xDIS( xModel, UNO_QUERY_THROW ); - Reference< beans::XPropertySet > xProp (xDIS->getDocumentInfo(), UNO_QUERY_THROW ); - Any aTitle = xProp->getPropertyValue(::rtl::OUString::createFromAscii( "Title" ) ); - - aTitle >>= docNameOrURL; - if ( docNameOrURL.getLength() == 0 ) - { - docNameOrURL = parseLocationName( xModel->getURL() ); - } - } - } - } - } - catch ( Exception& e ) - { - OSL_TRACE("MiscUtils::xModelToDocTitle() exception thrown: !!! %s", - ::rtl::OUStringToOString( e.Message, - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - - } - else - { - OSL_TRACE("MiscUtils::xModelToDocTitle() doc model is null" ); - } - return docNameOrURL; -} - ::rtl::OUString SfxConfigGroupListBox_Impl::parseLocationName( const ::rtl::OUString& location ) { // strip out the last leaf of location name |