Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_BASCTL_SOURCE_INC_LOCALIZATIONMGR_HXX
21 : #define INCLUDED_BASCTL_SOURCE_INC_LOCALIZATIONMGR_HXX
22 :
23 : #include "scriptdocument.hxx"
24 :
25 : #include <com/sun/star/resource/XStringResourceManager.hpp>
26 :
27 : namespace basctl
28 : {
29 :
30 : class Shell;
31 : class DlgEditor;
32 :
33 0 : class LocalizationMgr
34 : {
35 : ::com::sun::star::uno::Reference
36 : < ::com::sun::star::resource::XStringResourceManager > m_xStringResourceManager;
37 :
38 : Shell* m_pShell;
39 :
40 : ScriptDocument m_aDocument;
41 : OUString m_aLibName;
42 :
43 : ::com::sun::star::lang::Locale m_aLocaleBeforeBasicStart;
44 :
45 : enum HandleResourceMode
46 : {
47 : SET_IDS,
48 : RESET_IDS,
49 : RENAME_DIALOG_IDS,
50 : RENAME_CONTROL_IDS,
51 : REMOVE_IDS_FROM_RESOURCE,
52 : MOVE_RESOURCES,
53 : COPY_RESOURCES
54 : };
55 : static sal_Int32 implHandleControlResourceProperties( ::com::sun::star::uno::Any aControlAny,
56 : const OUString& aDialogName, const OUString& aCtrlName,
57 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >
58 : xStringResourceManager, ::com::sun::star::uno::Reference< ::com::sun::star::resource::
59 : XStringResourceResolver > xSourceStringResolver, HandleResourceMode eMode );
60 :
61 0 : void enableResourceForAllLibraryDialogs( void )
62 : {
63 0 : implEnableDisableResourceForAllLibraryDialogs( SET_IDS );
64 0 : }
65 0 : void disableResourceForAllLibraryDialogs( void )
66 : {
67 0 : implEnableDisableResourceForAllLibraryDialogs( RESET_IDS );
68 0 : }
69 : void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode );
70 :
71 : public:
72 : LocalizationMgr(Shell*, ScriptDocument const&, OUString const& aLibName,
73 : const ::com::sun::star::uno::Reference
74 : < ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager );
75 : ::com::sun::star::uno::Reference
76 0 : < ::com::sun::star::resource::XStringResourceManager >getStringResourceManager( void )
77 : {
78 0 : return m_xStringResourceManager;
79 : }
80 :
81 : bool isLibraryLocalized( void );
82 :
83 : void handleTranslationbar( void );
84 :
85 : void handleAddLocales( const ::com::sun::star::uno::Sequence
86 : < ::com::sun::star::lang::Locale >& aLocaleSeq );
87 :
88 : void handleRemoveLocales( const ::com::sun::star::uno::Sequence
89 : < ::com::sun::star::lang::Locale >& aLocaleSeq );
90 :
91 : void handleSetDefaultLocale( ::com::sun::star::lang::Locale aLocale );
92 :
93 : void handleSetCurrentLocale( ::com::sun::star::lang::Locale aLocale );
94 :
95 : void handleBasicStarted( void );
96 :
97 : void handleBasicStopped( void );
98 :
99 : static void setControlResourceIDsForNewEditorObject( DlgEditor* pEditor,
100 : ::com::sun::star::uno::Any aControlAny, const OUString& aCtrlName );
101 :
102 : static void renameControlResourceIDsForEditorObject( DlgEditor* pEditor,
103 : ::com::sun::star::uno::Any aControlAny, const OUString& aNewCtrlName );
104 :
105 : static void deleteControlResourceIDsForDeletedEditorObject( DlgEditor* pEditor,
106 : ::com::sun::star::uno::Any aControlAny, const OUString& aCtrlName );
107 :
108 : static void setStringResourceAtDialog( const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aDlgName,
109 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel );
110 :
111 : static void renameStringResourceIDs( const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aDlgName,
112 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel );
113 :
114 : static void removeResourceForDialog( const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aDlgName,
115 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel );
116 :
117 : static ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >
118 : getStringResourceFromDialogLibrary( ::com::sun::star::uno::Reference
119 : < ::com::sun::star::container::XNameContainer > xDialogLib );
120 :
121 : // Clipboard / Drag & Drop
122 : static void resetResourceForDialog(
123 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel,
124 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > xStringResourceManager );
125 :
126 : static void setResourceIDsForDialog(
127 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel,
128 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > xStringResourceManager );
129 :
130 : static void copyResourcesForPastedEditorObject( DlgEditor* pEditor,
131 : ::com::sun::star::uno::Any aControlAny, const OUString& aCtrlName,
132 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::
133 : XStringResourceResolver > xSourceStringResolver );
134 :
135 : static void copyResourceForDroppedDialog(
136 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel,
137 : const OUString& aDialogName,
138 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > xStringResourceManager,
139 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > xSourceStringResolver );
140 :
141 : static void copyResourceForDialog(
142 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xDialogModel,
143 : const ::com::sun::star::uno::Reference< ::com::sun::star::resource::
144 : XStringResourceResolver >& xSourceStringResolver,
145 : const ::com::sun::star::uno::Reference< ::com::sun::star::resource::
146 : XStringResourceManager >& xTargetStringResourceManager );
147 : };
148 :
149 : } // namespace basctl
150 :
151 : #endif // INCLUDED_BASCTL_SOURCE_INC_LOCALIZATIONMGR_HXX
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|