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 __com_sun_star_frame_XUntitledNumbers_idl__
24#define __com_sun_star_frame_XUntitledNumbers_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
31#include <com/sun/star/lang/IllegalArgumentException.idl>
32#endif
33
34//=============================================================================
35
36 module com {  module sun {  module star {  module frame {
37
38constants UntitledNumbersConst
39{
40    const long INVALID_NUMBER = 0;
41};
42
43//=============================================================================
44/** knows all currently used and all free numbers for using with untitled
45    but counted objects.
46 */
47interface XUntitledNumbers : com::sun::star::uno::XInterface
48{
49    //-------------------------------------------------------------------------
50    /** calli has to lease a number befor he can use it within in its own title.
51
52        Such number must be freed after using e.g. while the object was closed or
53        get's another title (e.g. by saving a document to a real location on disc).
54
55        @param  xComponent
56                the component which has to be registered for the leased number.
57
58        @return the new number for these object or 0 if no further numbers are available.
59
60        @throws [IllegalArgumentException]
61                if an invalid object reference was provided to this method.
62     */
63    long leaseNumber ( [in] com::sun::star::uno::XInterface xComponent )
64        raises (com::sun::star::lang::IllegalArgumentException);
65
66    //-------------------------------------------------------------------------
67    /** has to be used to mark those number as "free for using".
68
69        If the reqistered component does not use such leased number any longer
70        it has to be released so it can be used for new components.
71
72        Note: calling this method with an unknown (but normaly valid number)
73              has to be ignored. No exceptions - no errors.
74
75        @param  nNumber
76                specify number for release.
77
78        @throws [IllegalArgumentException]
79                if the given number is the special value 0.
80     */
81    void releaseNumber ( [in] long nNumber )
82        raises (com::sun::star::lang::IllegalArgumentException);
83
84    //-------------------------------------------------------------------------
85    /** does the same then releaseNumber () but it searches the corresponding
86        number for the specified component and deregister it.
87
88        @param  xComponent
89                the component for deregistration.
90
91        @throws [IllegalArgumentException]
92                if an invalid object reference was provided to this method.
93     */
94    void releaseNumberForComponent ( [in] com::sun::star::uno::XInterface xComponent )
95        raises (com::sun::star::lang::IllegalArgumentException);
96
97    //-------------------------------------------------------------------------
98    /** returns the localized string value to be used for untitles objects in
99        combination with the leased number.
100
101        Note: Such string already contains leading spaces/tabs etcpp. !
102        The only thing which an outside code has todo then ... adding a leased number
103        to the string.
104
105        @return the localized string for untitled components.
106     */
107    string getUntitledPrefix ();
108};
109
110//=============================================================================
111
112}; }; }; };
113
114#endif
115