1*89dcb3daSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*89dcb3daSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*89dcb3daSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*89dcb3daSAndrew Rist * distributed with this work for additional information 6*89dcb3daSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*89dcb3daSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*89dcb3daSAndrew Rist * "License"); you may not use this file except in compliance 9*89dcb3daSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*89dcb3daSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*89dcb3daSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*89dcb3daSAndrew Rist * software distributed under the License is distributed on an 15*89dcb3daSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*89dcb3daSAndrew Rist * KIND, either express or implied. See the License for the 17*89dcb3daSAndrew Rist * specific language governing permissions and limitations 18*89dcb3daSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*89dcb3daSAndrew Rist *************************************************************/ 21*89dcb3daSAndrew Rist 22*89dcb3daSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmlhelp.hxx" 26cdf0e10cSrcweir #include <com/sun/star/beans/Property.hpp> 27cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 29cdf0e10cSrcweir #include <com/sun/star/ucb/CommandInfo.hpp> 30cdf0e10cSrcweir #include <com/sun/star/ucb/OpenCommandArgument2.hpp> 31cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include "content.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir using namespace com::sun; 36cdf0e10cSrcweir using namespace com::sun::star; 37cdf0e10cSrcweir 38cdf0e10cSrcweir using namespace chelp; 39cdf0e10cSrcweir 40cdf0e10cSrcweir // virtual 41cdf0e10cSrcweir uno::Sequence< beans::Property > Content::getProperties( 42cdf0e10cSrcweir const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ ) 43cdf0e10cSrcweir { 44cdf0e10cSrcweir bool withMediaType = m_aURLParameter.isFile() || m_aURLParameter.isRoot(); 45cdf0e10cSrcweir bool isModule = m_aURLParameter.isModule(); 46cdf0e10cSrcweir bool isFile = m_aURLParameter.isFile(); 47cdf0e10cSrcweir 48cdf0e10cSrcweir sal_Int32 num = withMediaType ? 7 : 6; 49cdf0e10cSrcweir if( isModule ) num+=6; 50cdf0e10cSrcweir if( isFile ) num++; 51cdf0e10cSrcweir 52cdf0e10cSrcweir uno::Sequence< beans::Property > props(num); 53cdf0e10cSrcweir 54cdf0e10cSrcweir sal_Int32 idx = 0; 55cdf0e10cSrcweir props[idx++] = 56cdf0e10cSrcweir beans::Property( 57cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ), 58cdf0e10cSrcweir -1, 59cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 60cdf0e10cSrcweir beans::PropertyAttribute::BOUND 61cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 62cdf0e10cSrcweir 63cdf0e10cSrcweir props[idx++] = 64cdf0e10cSrcweir beans::Property( 65cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ), 66cdf0e10cSrcweir -1, 67cdf0e10cSrcweir getCppuBooleanType(), 68cdf0e10cSrcweir beans::PropertyAttribute::BOUND 69cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 70cdf0e10cSrcweir 71cdf0e10cSrcweir props[idx++] = 72cdf0e10cSrcweir beans::Property( 73cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsErrorDocument" ) ), 74cdf0e10cSrcweir -1, 75cdf0e10cSrcweir getCppuBooleanType(), 76cdf0e10cSrcweir beans::PropertyAttribute::BOUND 77cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir props[idx++] = 80cdf0e10cSrcweir beans::Property( 81cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ), 82cdf0e10cSrcweir -1, 83cdf0e10cSrcweir getCppuBooleanType(), 84cdf0e10cSrcweir beans::PropertyAttribute::BOUND 85cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 86cdf0e10cSrcweir 87cdf0e10cSrcweir props[idx++] = 88cdf0e10cSrcweir beans::Property( 89cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ), 90cdf0e10cSrcweir -1, 91cdf0e10cSrcweir getCppuBooleanType(), 92cdf0e10cSrcweir beans::PropertyAttribute::BOUND 93cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir props[idx++] = 96cdf0e10cSrcweir beans::Property( 97cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), 98cdf0e10cSrcweir -1, 99cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 100cdf0e10cSrcweir beans::PropertyAttribute::BOUND 101cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir if( withMediaType ) 104cdf0e10cSrcweir props[idx++] = 105cdf0e10cSrcweir beans::Property( 106cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ), 107cdf0e10cSrcweir -1, 108cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 109cdf0e10cSrcweir beans::PropertyAttribute::BOUND 110cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir if( isModule ) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir props[idx++] = 115cdf0e10cSrcweir beans::Property( 116cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Order" ) ), 117cdf0e10cSrcweir -1, 118cdf0e10cSrcweir getCppuType( static_cast< sal_Int32* >( 0 ) ), 119cdf0e10cSrcweir beans::PropertyAttribute::BOUND 120cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir props[idx++] = 123cdf0e10cSrcweir beans::Property( 124cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordList" ) ), 125cdf0e10cSrcweir -1, 126cdf0e10cSrcweir getCppuType( 127cdf0e10cSrcweir static_cast< const uno::Sequence< rtl::OUString >* >( 128cdf0e10cSrcweir 0 ) ), 129cdf0e10cSrcweir beans::PropertyAttribute::BOUND 130cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir props[idx++] = 133cdf0e10cSrcweir beans::Property( 134cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordRef" ) ), 135cdf0e10cSrcweir -1, 136cdf0e10cSrcweir getCppuType( 137cdf0e10cSrcweir static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ), 138cdf0e10cSrcweir beans::PropertyAttribute::BOUND 139cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir props[idx++] = 142cdf0e10cSrcweir beans::Property( 143cdf0e10cSrcweir rtl::OUString( 144cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "KeywordTitleForRef" ) ), 145cdf0e10cSrcweir -1, 146cdf0e10cSrcweir getCppuType( 147cdf0e10cSrcweir static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ), 148cdf0e10cSrcweir beans::PropertyAttribute::BOUND 149cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 150cdf0e10cSrcweir 151cdf0e10cSrcweir props[idx++] = 152cdf0e10cSrcweir beans::Property( 153cdf0e10cSrcweir rtl::OUString( 154cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "KeywordAnchorForRef" ) ), 155cdf0e10cSrcweir -1, 156cdf0e10cSrcweir getCppuType( 157cdf0e10cSrcweir static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ), 158cdf0e10cSrcweir beans::PropertyAttribute::BOUND 159cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 160cdf0e10cSrcweir 161cdf0e10cSrcweir props[idx++] = 162cdf0e10cSrcweir beans::Property( 163cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SearchScopes" ) ), 164cdf0e10cSrcweir -1, 165cdf0e10cSrcweir getCppuType( 166cdf0e10cSrcweir static_cast< const uno::Sequence< rtl::OUString >* >( 0 ) ), 167cdf0e10cSrcweir beans::PropertyAttribute::BOUND 168cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir if( isFile ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir props[idx++] = 174cdf0e10cSrcweir beans::Property( 175cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnchorName" ) ), 176cdf0e10cSrcweir -1, 177cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 178cdf0e10cSrcweir beans::PropertyAttribute::BOUND 179cdf0e10cSrcweir | beans::PropertyAttribute::READONLY ); 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir return props; 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir 186cdf0e10cSrcweir 187cdf0e10cSrcweir //========================================================================= 188cdf0e10cSrcweir // virtual 189cdf0e10cSrcweir uno::Sequence< star::ucb::CommandInfo > Content::getCommands( 190cdf0e10cSrcweir const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ ) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir // osl::MutexGuard aGuard( m_aMutex ); 193cdf0e10cSrcweir 194cdf0e10cSrcweir //================================================================= 195cdf0e10cSrcweir // 196cdf0e10cSrcweir // Supported commands 197cdf0e10cSrcweir // 198cdf0e10cSrcweir //================================================================= 199cdf0e10cSrcweir 200cdf0e10cSrcweir #define COMMAND_COUNT 5 201cdf0e10cSrcweir 202cdf0e10cSrcweir static const star::ucb::CommandInfo aCommandInfoTable[] = 203cdf0e10cSrcweir { 204cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 205cdf0e10cSrcweir // Required commands 206cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 207cdf0e10cSrcweir star::ucb::CommandInfo( 208cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ), 209cdf0e10cSrcweir -1, 210cdf0e10cSrcweir getCppuVoidType() 211cdf0e10cSrcweir ), 212cdf0e10cSrcweir star::ucb::CommandInfo( 213cdf0e10cSrcweir rtl::OUString( 214cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ), 215cdf0e10cSrcweir -1, 216cdf0e10cSrcweir getCppuVoidType() 217cdf0e10cSrcweir ), 218cdf0e10cSrcweir star::ucb::CommandInfo( 219cdf0e10cSrcweir rtl::OUString( 220cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ), 221cdf0e10cSrcweir -1, 222cdf0e10cSrcweir getCppuType( 223cdf0e10cSrcweir static_cast< uno::Sequence< beans::Property > * >( 0 ) ) 224cdf0e10cSrcweir ), 225cdf0e10cSrcweir star::ucb::CommandInfo( 226cdf0e10cSrcweir rtl::OUString( 227cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ), 228cdf0e10cSrcweir -1, 229cdf0e10cSrcweir getCppuType( 230cdf0e10cSrcweir static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) ) 231cdf0e10cSrcweir ), 232cdf0e10cSrcweir star::ucb::CommandInfo( 233cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), 234cdf0e10cSrcweir -1, 235cdf0e10cSrcweir getCppuType( 236cdf0e10cSrcweir static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) ) 237cdf0e10cSrcweir ) 238cdf0e10cSrcweir }; 239cdf0e10cSrcweir 240cdf0e10cSrcweir return uno::Sequence< star::ucb::CommandInfo >( 241cdf0e10cSrcweir aCommandInfoTable, COMMAND_COUNT ); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir 244