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 #ifndef _UCBHELPER_CONTENT_HXX 24 #define _UCBHELPER_CONTENT_HXX 25 26 #include "rtl/ref.hxx" 27 #include <com/sun/star/ucb/ContentCreationException.hpp> 28 #include <com/sun/star/ucb/CommandAbortedException.hpp> 29 #include <com/sun/star/io/XStream.hpp> 30 #include <com/sun/star/uno/Reference.hxx> 31 #include <com/sun/star/uno/Sequence.hxx> 32 #include "ucbhelper/ucbhelperdllapi.h" 33 34 namespace com { namespace sun { namespace star { namespace beans { 35 class XPropertySetInfo; 36 } } } } 37 38 namespace com { namespace sun { namespace star { namespace io { 39 class XActiveDataSink; 40 class XOutputStream; 41 class XInputStream; 42 } } } } 43 44 namespace com { namespace sun { namespace star { namespace sdbc { 45 class XResultSet; 46 class XRow; 47 } } } } 48 49 namespace com { namespace sun { namespace star { namespace ucb { 50 class XCommandEnvironment; 51 class XCommandInfo; 52 class XContent; 53 class XContentIdentifier; 54 class XDynamicResultSet; 55 class XAnyCompareFactory; 56 struct ContentInfo; 57 struct NumberedSortingInfo; 58 } } } } 59 60 namespace ucbhelper 61 { 62 63 //========================================================================= 64 65 /** 66 * These are the possible values for the parameter eMode of method 67 * ucbhelper::Content::createCursor. 68 */ 69 enum ResultSetInclude 70 { 71 INCLUDE_FOLDERS_ONLY, 72 INCLUDE_DOCUMENTS_ONLY, 73 INCLUDE_FOLDERS_AND_DOCUMENTS 74 }; 75 76 /** 77 * These are the possible values for the parameter eOperation of method 78 * ucbhelper::Content::insertNewContent. 79 */ 80 enum InsertOperation 81 { 82 InsertOperation_COPY, // copy source data 83 InsertOperation_MOVE, // move source data 84 InsertOperation_LINK // create a link to source 85 }; 86 87 //========================================================================= 88 89 class Content_Impl; 90 91 /** 92 * This class simplifies access to UCB contents by providing a more 93 * convenient API for frequently used functionality then the "raw" 94 * UCB-API does. 95 */ 96 class UCBHELPER_DLLPUBLIC Content 97 { 98 rtl::Reference< Content_Impl > m_xImpl; 99 100 protected: 101 ::com::sun::star::uno::Any createCursorAny( const ::com::sun::star::uno::Sequence< 102 rtl::OUString >& rPropertyNames, 103 ResultSetInclude eMode ); 104 105 ::com::sun::star::uno::Any createCursorAny( const ::com::sun::star::uno::Sequence< 106 sal_Int32 >& rPropertyHandles, 107 ResultSetInclude eMode ); 108 109 public: 110 /** 111 * Constructor. 112 */ 113 Content(); 114 115 /** 116 * Constructor. 117 * 118 * @param rURL is the URL of the content to create. 119 * @param rEnv is the environment to use for commands executed by the 120 * content. The command environment is used by the content 121 * implementation to interact with the client and to propagate 122 * errors. 123 */ 124 Content( const rtl::OUString& rURL, 125 const ::com::sun::star::uno::Reference< 126 ::com::sun::star::ucb::XCommandEnvironment >& rEnv ); 127 /** 128 * Constructor. 129 * 130 * @param rId is the content identifier of the content to create. 131 * @param rEnv is the environment to use for commands executed by the 132 * content. The command environment is used by the content 133 * implementation to interact with the client and to propagate 134 * errors. 135 */ 136 Content( const ::com::sun::star::uno::Reference< 137 ::com::sun::star::ucb::XContentIdentifier >& rId, 138 const ::com::sun::star::uno::Reference< 139 ::com::sun::star::ucb::XCommandEnvironment >& rEnv ); 140 /** 141 * Constructor. 142 * 143 * @param rContent is the content object of the content to create. 144 * @param rEnv is the environment to use for commands executed by the 145 * content. The command environment is used by the content 146 * implementation to interact with the client and to propagate 147 * errors. 148 */ 149 Content( const ::com::sun::star::uno::Reference< 150 ::com::sun::star::ucb::XContent >& rContent, 151 const ::com::sun::star::uno::Reference< 152 ::com::sun::star::ucb::XCommandEnvironment >& rEnv ); 153 /** 154 * Copy Constructor. 155 * 156 * @param rContent is the content this content shall be a copy of. 157 */ 158 Content( const Content& rOther ); 159 160 /** 161 * Destructor. 162 */ 163 ~Content(); 164 165 /** 166 * Assignment operator. 167 * 168 * @param rContent is the content this content shall be a copy of. 169 */ 170 Content& operator=( const Content& rOther ); 171 172 /** 173 * Constructor. This method should be used, if the exception thrown 174 * by the direct ctors of this class are to 'expensive' for your 175 * application 176 * 177 * @param rURL is the URL of the content to create. 178 * @param rEnv is the environment to use for commands executed by the 179 * content. The command environment is used by the content 180 * implementation to interact with the client and to propagate 181 * errors. 182 * @param rContent will be filled by this method with the content created. 183 * @return true, if the operation was successful - false, otherwise. 184 */ 185 static sal_Bool 186 create( const rtl::OUString& rURL, 187 const ::com::sun::star::uno::Reference< 188 ::com::sun::star::ucb::XCommandEnvironment >& rEnv, 189 Content& rContent ); 190 191 /** 192 * Constructor. This method should be used, if the exception thrown 193 * by the direct ctors of this class are to 'expensive' for your 194 * application 195 * 196 * @param rId is the content identifier of the content to create. 197 * @param rEnv is the environment to use for commands executed by the 198 * content. The command environment is used by the content 199 * implementation to interact with the client and to propagate 200 * errors. 201 * @param rContent will be filled by this method with the content created. 202 * @return true, if the operation was successful - false, otherwise. 203 */ 204 static sal_Bool 205 create( const ::com::sun::star::uno::Reference< 206 ::com::sun::star::ucb::XContentIdentifier >& rId, 207 const ::com::sun::star::uno::Reference< 208 ::com::sun::star::ucb::XCommandEnvironment >& rEnv, 209 Content& rContent ); 210 211 /** 212 * Constructor. This method should be used, if the exception thrown 213 * by the direct ctors of this class are to 'expensive' for your 214 * application 215 * 216 * @param xContent is the content object of the content to create. 217 * @param rEnv is the environment to use for commands executed by the 218 * content. The command environment is used by the content 219 * implementation to interact with the client and to propagate 220 * errors. 221 * @param rContent will be filled by this method with the content created. 222 * @return true, if the operation was successful - false, otherwise. 223 */ 224 static sal_Bool 225 create( const ::com::sun::star::uno::Reference< 226 ::com::sun::star::ucb::XContent >& xContent, 227 const ::com::sun::star::uno::Reference< 228 ::com::sun::star::ucb::XCommandEnvironment >& rEnv, 229 Content& rContent ); 230 231 ////////////////////////////////////////////////////////////////////// 232 // Direct access to UCB content. 233 ////////////////////////////////////////////////////////////////////// 234 235 /** 236 * This method provides access to the "native" UCB content interface(s). 237 * This is useful in case the convenience methods provided by this 238 * class are insufficient for your needs. You may obtain all interfaces 239 * supported by the underlying UCB content by calling this method and 240 * after that doing a queryInterface call. 241 * 242 * @return the XContent interface of the underlying UCB content. 243 */ 244 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > 245 get() const; 246 247 ////////////////////////////////////////////////////////////////////// 248 // Object identity. 249 ////////////////////////////////////////////////////////////////////// 250 251 /** 252 * This method returns the URL of the content. 253 * 254 * @return the URL of the content. 255 */ 256 const ::rtl::OUString& getURL() const; 257 258 ////////////////////////////////////////////////////////////////////// 259 // Command environment. 260 ////////////////////////////////////////////////////////////////////// 261 262 /** 263 * This method returns the environment to use when executing commands. 264 * 265 * @return the command environment. 266 */ 267 const ::com::sun::star::uno::Reference< 268 ::com::sun::star::ucb::XCommandEnvironment >& 269 getCommandEnvironment() const; 270 271 /** 272 * This method sets a new command environment. 273 * 274 * @param xNewEnv is the new command environment. 275 */ 276 void setCommandEnvironment( 277 const ::com::sun::star::uno::Reference< 278 ::com::sun::star::ucb::XCommandEnvironment >& xNewEnv ); 279 280 ////////////////////////////////////////////////////////////////////// 281 // Access to supported commands/properties. 282 ////////////////////////////////////////////////////////////////////// 283 284 /** 285 * This methods provides access to meta data of the commands supported 286 * by this content. 287 * 288 * @return an XCommandInfo interface implementation, which can be used 289 * to obtain meta data of the commands supported by this content. 290 */ 291 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandInfo > 292 getCommands(); 293 /** 294 * This methods provides access to meta data of the properties supported 295 * by this content. 296 * 297 * @return an XPropertSetInfo interface implementation, which can be used 298 * to obtain meta data of the properties supported by this content. 299 */ 300 ::com::sun::star::uno::Reference< 301 ::com::sun::star::beans::XPropertySetInfo > 302 getProperties(); 303 304 ////////////////////////////////////////////////////////////////////// 305 // Access to property value(s). 306 ////////////////////////////////////////////////////////////////////// 307 308 /** 309 * This method can be used to read a single property value. 310 * 311 * @param rPropertyName is the name of the property for that the value 312 * shall be obtained. 313 * @return the property value. 314 */ 315 ::com::sun::star::uno::Any 316 getPropertyValue( const rtl::OUString& rPropertyName ); 317 /** 318 * This method can be used to read a single property value. 319 * 320 * @param nPropertyHande is the handle of the property for that the 321 * value shall be obtained. 322 * @return the property value. 323 */ 324 ::com::sun::star::uno::Any 325 getPropertyValue( sal_Int32 nPropertyHandle ); 326 /** 327 * This method can be used to set a single property value. 328 * 329 * @param rPropertyName is the name of the property for that the 330 * value shall be set. 331 * @return an any containing: 332 * - No value indicates, that the property value was set 333 * successfully. 334 * - com::sun::star::beans::UnknownPropertyException indicates, 335 * that the property is not known to the content implementation. 336 * - com::sun::star::beans::IllegalTypeException indicates, that 337 * the data type of the property value is not acceptable. 338 * - com::sun::star::lang::IllegalAccessException indicates, that 339 * the property is constant. 340 * - com::sun::star::lang::IllegalArgumentException indicates, 341 * that the property value is not acceptable. For instance, 342 * setting an empty title may be illegal. 343 * - Any other exception derived from 344 * com::sun::star::uno::Exception indicates, that the value was 345 * not set successfully. For example, this can be a 346 * com::sun:star::ucb::InteractiveAugmentedIOException 347 * transporting the error code 348 * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED. 349 */ 350 ::com::sun::star::uno::Any 351 setPropertyValue( const rtl::OUString& rPropertyName, 352 const ::com::sun::star::uno::Any& rValue ); 353 /** 354 * This method can be used to set a single property value. 355 * 356 * @param nPropertyHande is the handle of the property for that the 357 * value shall be set. 358 * @return an any containing: 359 * - No value indicates, that the property value was set 360 * successfully. 361 * - com::sun::star::beans::UnknownPropertyException indicates, 362 * that the property is not known to the content implementation. 363 * - com::sun::star::beans::IllegalTypeException indicates, that 364 * the data type of the property value is not acceptable. 365 * - com::sun::star::lang::IllegalAccessException indicates, that 366 * the property is constant. 367 * - com::sun::star::lang::IllegalArgumentException indicates, 368 * that the property value is not acceptable. For instance, 369 * setting an empty title may be illegal. 370 * - Any other exception derived from 371 * com::sun::star::uno::Exception indicates, that the value was 372 * not set successfully. For example, this can be a 373 * com::sun:star::ucb::InteractiveAugmentedIOException 374 * transporting the error code 375 * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED. 376 */ 377 ::com::sun::star::uno::Any 378 setPropertyValue( const sal_Int32 nPropertyHandle, 379 const ::com::sun::star::uno::Any& rValue ); 380 /** 381 * This method can be used to read multiple property values. 382 * 383 * @param rPropertyNames is a sequence of names of properties for 384 * that the values shall be obtained. 385 * @return the property values. 386 */ 387 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 388 getPropertyValues( const ::com::sun::star::uno::Sequence< 389 rtl::OUString >& rPropertyNames ); 390 /** 391 * This method can be used to read multiple property values. 392 * 393 * @param nPropertyHandles is a sequence of handles of properties for 394 * that the values shall be obtained. 395 * @return an XRow interface that can be used to obtain the property 396 * values. 397 */ 398 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 399 getPropertyValues( const ::com::sun::star::uno::Sequence< 400 sal_Int32 >& nPropertyHandles ); 401 /** 402 * This method can be used to read multiple property values. 403 * 404 * @param rPropertyNames is a sequence of names of properties for 405 * that the values shall be obtained. 406 * @return the property values. 407 */ 408 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 409 getPropertyValuesInterface( const ::com::sun::star::uno::Sequence< 410 rtl::OUString >& rPropertyNames ); 411 /** 412 * This method can be used to read multiple property values. 413 * 414 * @param nPropertyHandles is a sequence of handles of properties for 415 * that the values shall be obtained. 416 * @return an XRow interface that can be used to obtain the property 417 * values. 418 */ 419 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 420 getPropertyValuesInterface( const ::com::sun::star::uno::Sequence< 421 sal_Int32 >& nPropertyHandles ); 422 /** 423 * This method can be used to set multiple property values. 424 * 425 * @param rPropertyNames is a sequence of names of properties for 426 * that values shall be set. 427 * @return a sequence of any's which has exactly the same number 428 * of elements as the number of properties to set. Every 429 * sequence element contains the status for a property. The 430 * first sequence elements corresponds to the first element in 431 * the sequence of property names and so on. 432 * 433 * An any containing: 434 * - No value indicates, that the property value was set 435 * successfully. 436 * - com::sun::star::beans::UnknownPropertyException indicates, 437 * that the property is not known to the content implementation. 438 * - com::sun::star::beans::IllegalTypeException indicates, that 439 * the data type of the property value is not acceptable. 440 * - com::sun::star::lang::IllegalAccessException indicates, that 441 * the property is constant. 442 * - com::sun::star::lang::IllegalArgumentException indicates, 443 * that the property value is not acceptable. For instance, 444 * setting an empty title may be illegal. 445 * - Any other exception derived from 446 * com::sun::star::uno::Exception indicates, that the value was 447 * not set successfully. For example, this can be a 448 * com::sun:star::ucb::InteractiveAugmentedIOException 449 * transporting the error code 450 * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED. 451 */ 452 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 453 setPropertyValues( const ::com::sun::star::uno::Sequence< 454 rtl::OUString >& rPropertyNames, 455 const ::com::sun::star::uno::Sequence< 456 ::com::sun::star::uno::Any >& rValues ); 457 /** 458 * This method can be used to set multiple property values. 459 * 460 * @param nPropertyHandles is a sequence of handles of properties for 461 * that values shall be set. 462 * @return a sequence of any's which has exactly the same number 463 * of elements as the number of properties to set. Every 464 * sequence element contains the status for a property. The 465 * first sequence elements corresponds to the first element in 466 * the sequence of property names and so on. 467 * 468 * An any containing: 469 * - No value indicates, that the property value was set 470 * successfully. 471 * - com::sun::star::beans::UnknownPropertyException indicates, 472 * that the property is not known to the content implementation. 473 * - com::sun::star::beans::IllegalTypeException indicates, that 474 * the data type of the property value is not acceptable. 475 * - com::sun::star::lang::IllegalAccessException indicates, that 476 * the property is constant. 477 * - com::sun::star::lang::IllegalArgumentException indicates, 478 * that the property value is not acceptable. For instance, 479 * setting an empty title may be illegal. 480 * - Any other exception derived from 481 * com::sun::star::uno::Exception indicates, that the value was 482 * not set successfully. For example, this can be a 483 * com::sun:star::ucb::InteractiveAugmentedIOException 484 * transporting the error code 485 * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED. 486 */ 487 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 488 setPropertyValues( const ::com::sun::star::uno::Sequence< 489 sal_Int32 >& nPropertyHandles, 490 const ::com::sun::star::uno::Sequence< 491 ::com::sun::star::uno::Any >& rValues ); 492 493 ////////////////////////////////////////////////////////////////////// 494 // General command execution. 495 ////////////////////////////////////////////////////////////////////// 496 497 /** 498 * This method can be used to execute any command supported by the 499 * content. 500 * 501 * @param rCommandName is the name of the command to execute. 502 * @param rCommandArgument is the argument for the command. Type and 503 * values of this parameter must correspond to the command 504 * specification. 505 * @return the result of the command according to its specification. 506 */ 507 ::com::sun::star::uno::Any 508 executeCommand( const rtl::OUString& rCommandName, 509 const ::com::sun::star::uno::Any& rCommandArgument ); 510 ::com::sun::star::uno::Any 511 /** 512 * This method can be used to execute any command supported by the 513 * content. 514 * 515 * @param rCommandHandle is the handle of the command to execute. 516 * @param rCommandArgument is the argument for the command. Type and 517 * values of this parameter must correspond to the command 518 * specification. 519 * @return the result of the command according to its specification. 520 */ 521 executeCommand( sal_Int32 nCommandHandle, 522 const ::com::sun::star::uno::Any& rCommandArgument ); 523 /** 524 * This method can be used to abort the command currently executed by 525 * a content. Note that a content can only process one command per 526 * thread at a time. The implementation of the content is responsible 527 * for determining the command to abort when this method is called. 528 */ 529 void 530 abortCommand(); 531 532 ////////////////////////////////////////////////////////////////////// 533 // Special commands. 534 ////////////////////////////////////////////////////////////////////// 535 536 /** 537 * This methods gives access to the children of a folder content. 538 * Additionally, the result set returned provides efficient access to 539 * preselected property values of the children. 540 * Internally it executes the command "open" at the content. 541 * 542 * @param rPropertyNames is a sequence of names of properties for 543 * that the values should be accessible via the resultset 544 * returned by this method. 545 * @param eMode is a very simple filter for the children contained 546 * in the resultset. 547 * @return an implementation of the service 548 * com.cun.star.ucb.ContentResultSet, which can be used to 549 * get access to the children of a content. 550 */ 551 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > 552 createCursor( const ::com::sun::star::uno::Sequence< 553 rtl::OUString >& rPropertyNames, 554 ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS ); 555 /** 556 * This methods gives access to the children of a folder content. 557 * Additionally, the result set returned provides efficient access to 558 * preselected property values of the children. 559 * Internally it executes the command "open" at the content. 560 * 561 * @param nPropertyHandles is a sequence of handles of properties for 562 * that the values should be accessible via the resultset 563 * returned by this method. 564 * @param eMode is a very simple filter for the children contained 565 * in the resultset. 566 * @return an implementation of the service 567 * com.cun.star.ucb.ContentResultSet, which can be used to 568 * get access to the children of a content. 569 */ 570 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > 571 createCursor( const ::com::sun::star::uno::Sequence< 572 sal_Int32 >& rPropertyHandles, 573 ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS ); 574 /** 575 * This methods gives access to the children of a folder content. 576 * Additionally, the result set returned provides efficient access to 577 * preselected property values of the children. 578 * Internally it executes the command "open" at the content. 579 * 580 * @param rPropertyNames is a sequence of names of properties for 581 * that the values should be accessible via the resultset 582 * returned by this method. 583 * @param eMode is a very simple filter for the children contained 584 * in the resultset. 585 * @return an implementation of the service 586 * com.cun.star.ucb.DynamicResultSet, which can be used to 587 * get access to the children of a content. 588 */ 589 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > 590 createDynamicCursor( const ::com::sun::star::uno::Sequence< 591 rtl::OUString >& rPropertyNames, 592 ResultSetInclude eMode 593 = INCLUDE_FOLDERS_AND_DOCUMENTS ); 594 /** 595 * This methods gives access to the children of a folder content. 596 * Additionally, the result set returned provides efficient access to 597 * preselected property values of the children. 598 * Internally it executes the command "open" at the content. 599 * 600 * @param nPropertyHandes is a sequence of handles of properties for 601 * that the values should be accessible via the resultset 602 * returned by this method. 603 * @param eMode is a very simple filter for the children contained 604 * in the resultset. 605 * @return an implementation of the service 606 * com.cun.star.ucb.DynamicResultSet, which can be used to 607 * get access to the children of a content. 608 */ 609 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > 610 createDynamicCursor( const ::com::sun::star::uno::Sequence< 611 sal_Int32 >& rPropertyHandles, 612 ResultSetInclude eMode 613 = INCLUDE_FOLDERS_AND_DOCUMENTS ); 614 615 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > 616 createSortedDynamicCursor( const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, 617 const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo, 618 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory, 619 ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS ); 620 621 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > 622 createSortedDynamicCursor( const ::com::sun::star::uno::Sequence< sal_Int32 >& rPropertyHandles, 623 const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo, 624 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory, 625 ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS ); 626 627 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > 628 createSortedCursor( const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, 629 const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo, 630 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory, 631 ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS ); 632 633 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > 634 createSortedCursor( const ::com::sun::star::uno::Sequence< sal_Int32 >& rPropertyHandles, 635 const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo, 636 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory, 637 ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS ); 638 639 /** 640 * This methods gives read access to the content stream of a content (i.e 641 * the content of a file located at the local file system). 642 * Internally it executes the command "open" at the content. 643 * 644 * @return an implementation of the interface XInputStream, which can 645 * be used to read the content's data. 646 */ 647 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > 648 openStream(); 649 /** 650 * This methods gives read access to the content stream of a content (i.e 651 * the content of a file located at the local file system). 652 * Internally it executes the command "open" at the content. 653 * The method requests opening without locking. 654 * 655 * @return an implementation of the interface XInputStream, which can 656 * be used to read the content's data. 657 */ 658 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > 659 openStreamNoLock(); 660 661 /** 662 * This methods gives read/write access to the content stream of a content (i.e 663 * the content of a file located at the local file system). 664 * Internally it executes the command "open" at the content. 665 * 666 * @return an implementation of the interface XStream, which can 667 * be used to read/write the content's data. 668 */ 669 ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > 670 openWriteableStream(); 671 /** 672 * This methods gives read/write access to the content stream of a content (i.e 673 * the content of a file located at the local file system). 674 * Internally it executes the command "open" at the content. 675 * The method requests opening without locking. 676 * 677 * @return an implementation of the interface XStream, which can 678 * be used to read/write the content's data. 679 */ 680 ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > 681 openWriteableStreamNoLock(); 682 683 /** 684 * This methods gives read access to the content stream of a content (i.e 685 * the content of a file located at the local file system). 686 * Internally it executes the command "open" at the content. 687 * 688 * @param rSink is the implementation of an XActiveDataSink interface, 689 * which shall be used by the content to deliver the data. 690 */ 691 sal_Bool 692 openStream( const ::com::sun::star::uno::Reference< 693 ::com::sun::star::io::XActiveDataSink >& rSink ); 694 /** 695 * This methods gives read access to the content stream of a content (i.e 696 * the content of a file located at the local file system). 697 * Internally it executes the command "open" at the content. 698 * 699 * @param rStream is the implementation of an XOutputStream interface, 700 * which shall be used by the content to deliver the data. 701 */ 702 sal_Bool 703 openStream( const ::com::sun::star::uno::Reference< 704 ::com::sun::star::io::XOutputStream >& rStream ); 705 /** 706 * This methods gives write access to the content stream of a content (i.e 707 * the content of a file located at the local file system). 708 * Internally it executes the command "insert" at the content. 709 * 710 * @param rStream is the implementation of an XInputStream interface, 711 * which contains the content data to write. 712 * @param bReplaceExisting specifies, whether any existing content data 713 * shall be overwritten. 714 */ 715 void 716 writeStream( const ::com::sun::star::uno::Reference< 717 ::com::sun::star::io::XInputStream >& rStream, 718 sal_Bool bReplaceExisting ); 719 720 /** 721 * This method returns the different types of contents this content 722 * can create. 723 * 724 * @return the content types or an empty sequence if no contents can be 725 * created by this content. 726 */ 727 ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::ContentInfo > 728 queryCreatableContentsInfo(); 729 730 /** 731 * This method creates, initializes and inserts ( commits ) a new content 732 * (i.e. it could be used to create a new file system folder). 733 * Internally this method does a 734 * XCommandProcessor::execute( "createNewContent", ... ); 735 * XCommandProcessor::execute( "setPropertyValues", ... ); 736 * XCommandProcessor::execute( "insert", ... ); calling sequence. 737 * 738 * @param rContentType is the type for the new UCB content. Each content 739 * provider implementation may introduce own types for its content 740 * objects (See queryCreatableContentsInfo()). 741 * @param rPropertyNames is a sequence of names of properties for that 742 * values are to set at the new content before it will be inserted 743 * ( committed ). 744 * The order of the names must correspond to the order of the 745 * property values. 746 * @param rPropertyValues is a sequence of property values that are to 747 * set at the new content before it will be inserted ( committed ). 748 * The order of the values must correspond to the order of the 749 * property names. 750 * @param rNewContent will be filled by the implementation of this method 751 * with the new content. 752 */ 753 sal_Bool 754 insertNewContent( const ::rtl::OUString& rContentType, 755 const ::com::sun::star::uno::Sequence< 756 rtl::OUString >& rPropertyNames, 757 const ::com::sun::star::uno::Sequence< 758 ::com::sun::star::uno::Any >& rPropertyValues, 759 Content& rNewContent ); 760 /** 761 * This method creates, initializes and inserts ( commits ) a new content 762 * (i.e. it could be used to create a new file system folder). 763 * Internally this method does a 764 * XCommandProcessor::execute( "createNewContent", ... ); 765 * XCommandProcessor::execute( "setPropertyValues", ... ); 766 * XCommandProcessor::execute( "insert", ... ); calling sequence. 767 * 768 * @param rContentType is the type for the new UCB content. Each content 769 * provider implementation may introduce own types for its content 770 * objects (See queryCreatableContentsInfo()). 771 * @param nPropertyHandes is a sequence of handles of properties for that 772 * values are to set at the new content before it will be inserted 773 * ( committed ). 774 * The order of the handles must correspond to the order of the 775 * property values. 776 * @param rPropertyValues is a sequence of property values that are to 777 * set at the new content before it will be inserted ( committed ). 778 * The order of the values must correspond to the order of the 779 * property handles. 780 * @param rNewContent will be filled by the implementation of this method 781 * with the new content. 782 */ 783 sal_Bool 784 insertNewContent( const ::rtl::OUString& rContentType, 785 const ::com::sun::star::uno::Sequence< 786 sal_Int32 >& nPropertyHandles, 787 const ::com::sun::star::uno::Sequence< 788 ::com::sun::star::uno::Any >& rPropertyValues, 789 Content& rNewContent ); 790 /** 791 * This method creates, initializes and inserts (commits) a new content 792 * inside this (the target folder) content. For example, it can be used to 793 * create a new file system file. 794 * Internally this method does a 795 * XCommandProcessor::execute( "createNewContent", ... ); 796 * XCommandProcessor::execute( "setPropertyValues", ... ); 797 * XCommandProcessor::execute( "insert", ... ); calling sequence. 798 * 799 * @param rContentType is the type for the new UCB content. Each content 800 * provider implementation may introduce own types for its content 801 * objects (See queryCreatableContentsInfo()). 802 * @param rPropertyNames is a sequence of names of properties for that 803 * values are to set at the new content before it will be inserted 804 * ( committed ). 805 * The order of the names must correspond to the order of the 806 * property values. 807 * @param rPropertyValues is a sequence of property values that are to 808 * set at the new content before it will be inserted ( committed ). 809 * The order of the values must correspond to the order of the 810 * property names. 811 * @param rStream is a stream containing the content data for the new 812 * content (i.e. the content of a file to create) 813 * @param rNewContent will be filled by the implementation of this method 814 * with the new content. 815 */ 816 sal_Bool 817 insertNewContent( const ::rtl::OUString& rContentType, 818 const ::com::sun::star::uno::Sequence< 819 rtl::OUString >& rPropertyNames, 820 const ::com::sun::star::uno::Sequence< 821 ::com::sun::star::uno::Any >& rPropertyValues, 822 const ::com::sun::star::uno::Reference< 823 ::com::sun::star::io::XInputStream >& rStream, 824 Content& rNewContent ); 825 /** 826 * This method creates, initializes and inserts (commits) a new content 827 * inside this (the target folder) content. For example, it can be used to 828 * create a new file system file. 829 * Internally this method does a 830 * XCommandProcessor::execute( "createNewContent", ... ); 831 * XCommandProcessor::execute( "setPropertyValues", ... ); 832 * XCommandProcessor::execute( "insert", ... ); calling sequence. 833 * 834 * @param rContentType is the type for the new UCB content. Each content 835 * provider implementation may introduce own types for its content 836 * objects (See queryCreatableContentsInfo()). 837 * @param nPropertyHandes is a sequence of handles of properties for that 838 * values are to set at the new content before it will be inserted 839 * ( committed ). 840 * The order of the handles must correspond to the order of the 841 * property values. 842 * @param rPropertyValues is a sequence of property values that are to 843 * set at the new content before it will be inserted ( committed ). 844 * The order of the values must correspond to the order of the 845 * property handles. 846 * @param rStream is a stream containing the content data for the new 847 * content (i.e. the content of a file to create) 848 * @param rNewContent will be filled by the implementation of this method 849 * with the new content. 850 */ 851 sal_Bool 852 insertNewContent( const ::rtl::OUString& rContentType, 853 const ::com::sun::star::uno::Sequence< 854 sal_Int32 >& nPropertyHandles, 855 const ::com::sun::star::uno::Sequence< 856 ::com::sun::star::uno::Any >& rPropertyValues, 857 const ::com::sun::star::uno::Reference< 858 ::com::sun::star::io::XInputStream >& rStream, 859 Content& rNewContent ); 860 /** 861 * This method transfers (copies/moves) a content. It creates a new 862 * resource inside this (the target folder) content. 863 * The implementation is able to do cross-provider transfers (like copying 864 * a file from the local file system to a directory located on an HTTP 865 * server). 866 * Internally this method executes the command "globalTransfer" at the UCB. 867 * 868 * @param rSourceContent is the content that contains the data for the 869 * new UCB content. 870 * @param eOperation defines what shall be done with the source data 871 * ( COPY, MOVE, LINK ). 872 * @param rTitle contains a title for the new content. If this is an empty 873 * string, the new content will have the same title as the source 874 * content. 875 * @param rNameClashAction describes how the implementation shall behave 876 * in case a content with a clashing name exists in the target 877 * folder. 878 * NameClash::ERROR will abort the operation, NameClash::OVERWRITE 879 * will overwrite the clashing content and all its data, 880 * NameClash::RENAME will generate and supply a non-clashing title. 881 * @see com/sun/star/ucb/NameClash.idl 882 */ 883 sal_Bool 884 transferContent( const Content& rSourceContent, 885 InsertOperation eOperation, 886 const ::rtl::OUString & rTitle, 887 const sal_Int32 nNameClashAction ); 888 889 ////////////////////////////////////////////////////////////////////// 890 // Required properties. 891 ////////////////////////////////////////////////////////////////////// 892 893 /** 894 * This method returns the value of the content's property "IsFolder". 895 * 896 * @return true, if the content is a folder ( it can contain other 897 * UCB contents). false, otherwise. 898 */ 899 sal_Bool 900 isFolder(); 901 /** 902 * This method returns the value of the content's property "IsDocument". 903 * 904 * @return true, if the content is a document ( it has a content stream ). 905 * false, otherwise. 906 */ 907 sal_Bool 908 isDocument(); 909 //->i126305 910 /** lock the resource 911 * 912 * 913 */ 914 void 915 lock(); 916 917 /** ulock the resource 918 * 919 * 920 */ 921 void 922 unlock(); 923 //<-i126305 924 }; 925 926 } /* namespace ucbhelper */ 927 928 #endif /* !_UCBHELPER_CONTENT_HXX */ 929