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