1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef BASCTL_LOCALIZATIONMGR_HXX
21 #define BASCTL_LOCALIZATIONMGR_HXX
23 #include "scriptdocument.hxx"
25 #include <com/sun/star/resource/XStringResourceManager.hpp>
35 ::com::sun::star::uno::Reference
36 < ::com::sun::star::resource::XStringResourceManager
> m_xStringResourceManager
;
40 ScriptDocument m_aDocument
;
43 ::com::sun::star::lang::Locale m_aLocaleBeforeBasicStart
;
45 enum HandleResourceMode
51 REMOVE_IDS_FROM_RESOURCE
,
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
);
61 void enableResourceForAllLibraryDialogs( void )
63 implEnableDisableResourceForAllLibraryDialogs( SET_IDS
);
65 void disableResourceForAllLibraryDialogs( void )
67 implEnableDisableResourceForAllLibraryDialogs( RESET_IDS
);
69 void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode
);
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 < ::com::sun::star::resource::XStringResourceManager
>getStringResourceManager( void )
78 return m_xStringResourceManager
;
81 bool isLibraryLocalized( void );
83 void handleTranslationbar( void );
85 void handleAddLocales( ::com::sun::star::uno::Sequence
86 < ::com::sun::star::lang::Locale
> aLocaleSeq
);
88 void handleRemoveLocales( ::com::sun::star::uno::Sequence
89 < ::com::sun::star::lang::Locale
> aLocaleSeq
);
91 void handleSetDefaultLocale( ::com::sun::star::lang::Locale aLocale
);
93 void handleSetCurrentLocale( ::com::sun::star::lang::Locale aLocale
);
95 void handleBasicStarted( void );
97 void handleBasicStopped( void );
99 static void setControlResourceIDsForNewEditorObject( DlgEditor
* pEditor
,
100 ::com::sun::star::uno::Any aControlAny
, const OUString
& aCtrlName
);
102 static void renameControlResourceIDsForEditorObject( DlgEditor
* pEditor
,
103 ::com::sun::star::uno::Any aControlAny
, const OUString
& aNewCtrlName
);
105 static void deleteControlResourceIDsForDeletedEditorObject( DlgEditor
* pEditor
,
106 ::com::sun::star::uno::Any aControlAny
, const OUString
& aCtrlName
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
149 } // namespace basctl
151 #endif // BASCTL_LOCALIZATIONMGR_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */