#95512# creation of sorted cursors

This commit is contained in:
Mikhail Voitenko 2002-01-11 17:12:03 +00:00
parent bc182b7155
commit c901886768

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: doctempl.cxx,v $ * $RCSfile: doctempl.cxx,v $
* *
* $Revision: 1.45 $ * $Revision: 1.46 $
* *
* last change: $Author: mba $ $Date: 2001-12-17 14:20:42 $ * last change: $Author: mav $ $Date: 2002-01-11 18:12:03 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -177,6 +177,16 @@
#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_ #ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_
#include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/ucb/XContentAccess.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UCB_XANYCOMPAREFACTORY_HPP_
#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_XANYCOMPARE_HPP_
#include <com/sun/star/ucb/XAnyCompare.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_NUMBEREDSORTINGINFO_HPP_
#include <com/sun/star/ucb/NumberedSortingInfo.hpp>
#endif
using namespace ::com::sun::star::beans; using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame; using namespace ::com::sun::star::frame;
@ -332,6 +342,8 @@ class SfxDocTemplate_Impl : public SvRefBase
RegionList_Impl maRegions; RegionList_Impl maRegions;
sal_Bool mbConstructed; sal_Bool mbConstructed;
Reference< XAnyCompareFactory > m_rCompareFactory;
private: private:
void Clear(); void Clear();
@ -2181,7 +2193,10 @@ void SfxDocTemplate_Impl::AddRegion( const OUString& rTitle,
try try
{ {
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY; ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
xResultSet = rContent.createCursor( aProps, eInclude ); Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = sal_True;
xResultSet = rContent.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
} }
catch ( Exception& ) {} catch ( Exception& ) {}
@ -2214,7 +2229,10 @@ void SfxDocTemplate_Impl::CreateFromHierarchy( Content &rTemplRoot )
try try
{ {
ResultSetInclude eInclude = INCLUDE_FOLDERS_ONLY; ResultSetInclude eInclude = INCLUDE_FOLDERS_ONLY;
xResultSet = rTemplRoot.createCursor( aProps, eInclude ); Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = sal_True;
xResultSet = rTemplRoot.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
} }
catch ( Exception& ) {} catch ( Exception& ) {}
@ -2270,6 +2288,13 @@ sal_Bool SfxDocTemplate_Impl::Construct( )
xLocalizable->setLocale( aLocale ); xLocalizable->setLocale( aLocale );
Sequence< Any > aCompareArg(1);
*(aCompareArg.getArray()) <<= aLocale;
m_rCompareFactory = Reference< XAnyCompareFactory >(
xFactory->createInstanceWithArguments( OUString::createFromAscii( "com.sun.star.ucb.AnyCompareFactory" ),
aCompareArg ),
UNO_QUERY );
Reference < XContent > aRootContent = xTemplates->getContent(); Reference < XContent > aRootContent = xTemplates->getContent();
Reference < XCommandEnvironment > aCmdEnv; Reference < XCommandEnvironment > aCmdEnv;
@ -2304,7 +2329,10 @@ void SfxDocTemplate_Impl::GetTemplates( Content& rTargetFolder,
try try
{ {
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY; ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
xResultSet = rTargetFolder.createCursor( aProps, eInclude ); Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = sal_True;
xResultSet = rTargetFolder.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
} }
catch ( Exception& ) {} catch ( Exception& ) {}