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