summaryrefslogtreecommitdiff
path: root/ucbhelper/source/provider/contentinfo.cxx
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2001-03-27 13:02:48 +0000
committerKai Sommerfeld <kso@openoffice.org>2001-03-27 13:02:48 +0000
commit61e4a6331998bde4bc2734fb5b81644523b8debd (patch)
tree9b4c8664e46bd6060f5339a47e4c96a0bc9406f8 /ucbhelper/source/provider/contentinfo.cxx
parent38db8874f9d9a01d503765c9c7713d275ecf387b (diff)
#85225# - Added ctors taking XCommandEnvironment.
Diffstat (limited to 'ucbhelper/source/provider/contentinfo.cxx')
-rw-r--r--ucbhelper/source/provider/contentinfo.cxx134
1 files changed, 43 insertions, 91 deletions
diff --git a/ucbhelper/source/provider/contentinfo.cxx b/ucbhelper/source/provider/contentinfo.cxx
index 588eabbf6e22..592c20548166 100644
--- a/ucbhelper/source/provider/contentinfo.cxx
+++ b/ucbhelper/source/provider/contentinfo.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: contentinfo.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ * last change: $Author: kso $ $Date: 2001-03-27 14:02:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,8 +99,10 @@ using namespace ucb;
PropertySetInfo::PropertySetInfo(
const Reference< XMultiServiceFactory >& rxSMgr,
+ const Reference< XCommandEnvironment >& rxEnv,
ContentImplHelper* pContent )
: m_xSMgr( rxSMgr ),
+ m_xEnv( rxEnv ),
m_pProps( 0 ),
m_pContent( pContent )
{
@@ -143,73 +145,46 @@ XTYPEPROVIDER_IMPL_2( PropertySetInfo,
Sequence< Property > SAL_CALL PropertySetInfo::getProperties()
throw( RuntimeException )
{
- vos::OGuard aGuard( m_aMutex );
-
if ( !m_pProps )
{
- m_pProps = new Sequence< Property >( 128 );
- Property* pProps = m_pProps->getArray();
- sal_Int32 nPos = 0;
- sal_Int32 nSize = m_pProps->getLength();
-
- //////////////////////////////////////////////////////////////////
- // Get info for core ( native) properties.
- //////////////////////////////////////////////////////////////////
-
- const ::ucb::PropertyInfoTableEntry& rCoreProps
- = m_pContent->getPropertyInfoTable();
- const ::ucb::PropertyInfoTableEntry* pCurr = &rCoreProps;
- while ( pCurr->pName )
+ vos::OGuard aGuard( m_aMutex );
+ if ( !m_pProps )
{
- if ( nSize <= nPos )
- {
- m_pProps->realloc( 128 );
- nSize += 128;
- }
-
- Property& rProp = pProps[ nPos ];
+ //////////////////////////////////////////////////////////////
+ // Get info for core ( native) properties.
+ //////////////////////////////////////////////////////////////
- VOS_ENSURE( pCurr->pType,
- "PropertySetInfo::getProperties - No type!" );
-
- rProp.Name = OUString::createFromAscii( pCurr->pName );
- rProp.Handle = pCurr->nHandle;
- rProp.Type = *pCurr->pType;
- rProp.Attributes = pCurr->nAttributes;
-
- nPos++;
- pCurr++;
- }
-
- if ( nPos > 0 )
- {
- m_pProps->realloc( nPos );
- nSize = m_pProps->getLength();
- }
+ Sequence< Property > aProps = m_pContent->getProperties( m_xEnv );
+ m_pProps = new Sequence< Property >( aProps );
- //////////////////////////////////////////////////////////////////
- // Get info for additional properties.
- //////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////
+ // Get info for additional properties.
+ //////////////////////////////////////////////////////////////
- Reference< XPersistentPropertySet > xSet (
+ Reference< XPersistentPropertySet > xSet (
m_pContent->getAdditionalPropertySet( sal_False ) );
- if ( xSet.is() )
- {
- // Get property set info.
- Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
- if ( xInfo.is() )
+ if ( xSet.is() )
{
- const Sequence< Property >& rAddProps = xInfo->getProperties();
- sal_Int32 nAddProps = rAddProps.getLength();
- if ( nAddProps > 0 )
+ // Get property set info.
+ Reference< XPropertySetInfo > xInfo(
+ xSet->getPropertySetInfo() );
+ if ( xInfo.is() )
{
- m_pProps->realloc( nSize + nAddProps );
- pProps = m_pProps->getArray();
-
- const Property* pAddProps = rAddProps.getConstArray();
- for ( sal_Int32 n = 0; n < nAddProps; ++n, ++nPos )
- pProps[ nPos ] = pAddProps[ n ];
+ const Sequence< Property >& rAddProps
+ = xInfo->getProperties();
+ sal_Int32 nAddProps = rAddProps.getLength();
+ if ( nAddProps > 0 )
+ {
+ sal_Int32 nPos = m_pProps->getLength();
+ m_pProps->realloc( nPos + nAddProps );
+
+ Property* pProps = m_pProps->getArray();
+ const Property* pAddProps = rAddProps.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nAddProps; ++n, ++nPos )
+ pProps[ nPos ] = pAddProps[ n ];
+ }
}
}
}
@@ -284,8 +259,10 @@ sal_Bool PropertySetInfo::queryProperty(
CommandProcessorInfo::CommandProcessorInfo(
const Reference< XMultiServiceFactory >& rxSMgr,
+ const Reference< XCommandEnvironment >& rxEnv,
ContentImplHelper* pContent )
: m_xSMgr( rxSMgr ),
+ m_xEnv( rxEnv ),
m_pCommands( 0 ),
m_pContent( pContent )
{
@@ -328,43 +305,18 @@ XTYPEPROVIDER_IMPL_2( CommandProcessorInfo,
Sequence< CommandInfo > SAL_CALL CommandProcessorInfo::getCommands()
throw( RuntimeException )
{
- vos::OGuard aGuard( m_aMutex );
-
if ( !m_pCommands )
{
- m_pCommands = new Sequence< CommandInfo >( 128 );
- CommandInfo* pCommands = m_pCommands->getArray();
- sal_Int32 nPos = 0;
- sal_Int32 nSize = m_pCommands->getLength();
-
- //////////////////////////////////////////////////////////////////
- // Get info for commands.
- //////////////////////////////////////////////////////////////////
-
- const ::ucb::CommandInfoTableEntry& rCommands
- = m_pContent->getCommandInfoTable();
- const ::ucb::CommandInfoTableEntry* pCurr = &rCommands;
- while ( pCurr->pName )
+ vos::OGuard aGuard( m_aMutex );
+ if ( !m_pCommands )
{
- if ( nSize <= nPos )
- {
- m_pCommands->realloc( 128 );
- nSize += 128;
- }
-
- CommandInfo& rCommand = pCommands[ nPos ];
+ //////////////////////////////////////////////////////////////
+ // Get info for commands.
+ //////////////////////////////////////////////////////////////
- rCommand.Name = OUString::createFromAscii( pCurr->pName );
- rCommand.Handle = pCurr->nHandle;
- if ( pCurr->pArgType )
- rCommand.ArgType = *pCurr->pArgType;
-
- nPos++;
- pCurr++;
+ Sequence< CommandInfo > aCmds = m_pContent->getCommands( m_xEnv );
+ m_pCommands = new Sequence< CommandInfo >( aCmds );
}
-
- if ( nPos > 0 )
- m_pCommands->realloc( nPos );
}
return *m_pCommands;
}