xref: /trunk/main/basic/inc/basic/vbahelper.hxx (revision 7fef15a0)
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 #ifndef BASIC_VBAHELPR_HXX
25 #define BASIC_VBAHELPR_HXX
26 
27 #include <com/sun/star/container/XEnumeration.hpp>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <rtl/ustring.hxx>
30 #include "basic/basicdllapi.h"
31 
32 namespace basic {
33 namespace vba {
34 
35 /*  This header contains public helper functions for VBA used from this module
36     and from other VBA implementation modules such as vbahelper.
37  */
38 
39 // ============================================================================
40 
41 /** Creates and returns an enumeration of all open documents of the same type
42     as the specified document.
43 
44     First, the global module manager (com.sun.star.frame.ModuleManager) is
45     asked for the type of the passed model, and all open documents with the
46     same type will be stored in an enumeration object.
47 
48     @param rxModel
49         A document model determining the type of the documents.
50  */
51 BASIC_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > createDocumentsEnumeration(
52     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
53 
54 // ============================================================================
55 
56 /** Locks or unlocks the controllers of all documents that have the same type
57     as the specified document.
58 
59     First, the global module manager (com.sun.star.frame.ModuleManager) is
60     asked for the type of the passed model, and all open documents with the
61     same type will be locked or unlocked.
62 
63     @param rxModel
64         A document model determining the type of the documents to be locked or
65         unlocked.
66 
67     @param bLockControllers
68         Passing true will lock all controllers, passing false will unlock them.
69  */
70 BASIC_DLLPUBLIC void lockControllersOfAllDocuments(
71     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
72     sal_Bool bLockControllers );
73 
74 // ============================================================================
75 
76 /** Enables or disables the container windows of all controllers of all
77     documents that have the same type as the specified document.
78 
79     First, the global module manager (com.sun.star.frame.ModuleManager) is
80     asked for the type of the passed model, and the container windows of all
81     open documents with the same type will be enabled or disabled.
82 
83     @param rxModel
84         A document model determining the type of the documents to be enabled or
85         disabled.
86 
87     @param bEnableWindows
88         Passing true will enable all container windows of all controllers,
89         passing false will disable them.
90  */
91 BASIC_DLLPUBLIC void enableContainerWindowsOfAllDocuments(
92     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
93     sal_Bool bEnableWindows );
94 
95 // ============================================================================
96 
97 /** Registers the passed path as working directory for the application the
98     passed document belongs to.
99 
100     @param rxModel
101         A document model determining the type of the application whose working
102         directory has been changed.
103 
104     @param rPath
105         The new working directory.
106  */
107 BASIC_DLLPUBLIC void registerCurrentDirectory(
108     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
109     const ::rtl::OUString& rPath );
110 
111 // ============================================================================
112 
113 /** Returns the working directory of the application the passed document
114     belongs to.
115 
116     @param rxModel
117         A document model determining the type of the application whose working
118         directory is querried.
119 
120     @return
121         The working directory of the specified application, or an empty string
122         on error (e.g. if the passed document reference is empty).
123  */
124 BASIC_DLLPUBLIC ::rtl::OUString getCurrentDirectory(
125     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
126 
127 // ============================================================================
128 
129 } // namespace vba
130 } // namespace basic
131 
132 #endif
133