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 INCLUDED_BASCTL_SOURCE_INC_LOCALIZATIONMGR_HXX
21 #define INCLUDED_BASCTL_SOURCE_INC_LOCALIZATIONMGR_HXX
23 #include "scriptdocument.hxx"
25 #include <com/sun/star/resource/XStringResourceManager.hpp>
35 css::uno::Reference
< css::resource::XStringResourceManager
> m_xStringResourceManager
;
39 ScriptDocument m_aDocument
;
42 css::lang::Locale m_aLocaleBeforeBasicStart
;
44 enum HandleResourceMode
50 REMOVE_IDS_FROM_RESOURCE
,
54 static sal_Int32
implHandleControlResourceProperties(const css::uno::Any
& rControlAny
,
55 const OUString
& aDialogName
,
56 const OUString
& aCtrlName
,
57 const css::uno::Reference
< css::resource::XStringResourceManager
>& xStringResourceManager
,
58 const css::uno::Reference
< css::resource::XStringResourceResolver
>& xSourceStringResolver
,
59 HandleResourceMode eMode
);
61 void enableResourceForAllLibraryDialogs()
63 implEnableDisableResourceForAllLibraryDialogs( SET_IDS
);
65 void disableResourceForAllLibraryDialogs()
67 implEnableDisableResourceForAllLibraryDialogs( RESET_IDS
);
69 void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode
);
72 LocalizationMgr(Shell
*, ScriptDocument
const&, OUString
const& aLibName
,
73 const css::uno::Reference
< css::resource::XStringResourceManager
>& xStringResourceManager
);
75 const css::uno::Reference
< css::resource::XStringResourceManager
>& getStringResourceManager()
77 return m_xStringResourceManager
;
80 bool isLibraryLocalized();
82 void handleTranslationbar();
84 void handleAddLocales( const css::uno::Sequence
85 < css::lang::Locale
>& aLocaleSeq
);
87 void handleRemoveLocales( const css::uno::Sequence
88 < css::lang::Locale
>& aLocaleSeq
);
90 void handleSetDefaultLocale(const css::lang::Locale
& rLocale
);
92 void handleSetCurrentLocale(const css::lang::Locale
& rLocale
);
94 void handleBasicStarted();
96 void handleBasicStopped();
98 static void setControlResourceIDsForNewEditorObject(DlgEditor
const * pEditor
,
99 const css::uno::Any
& rControlAny
, const OUString
& aCtrlName
);
101 static void renameControlResourceIDsForEditorObject(DlgEditor
const * pEditor
,
102 const css::uno::Any
& rControlAny
, const OUString
& aNewCtrlName
);
104 static void deleteControlResourceIDsForDeletedEditorObject(DlgEditor
const * pEditor
,
105 const css::uno::Any
& rControlAny
, const OUString
& aCtrlName
);
107 static void setStringResourceAtDialog( const ScriptDocument
& rDocument
, const OUString
& aLibName
, const OUString
& aDlgName
,
108 const css::uno::Reference
< css::container::XNameContainer
>& xDialogModel
);
110 static void renameStringResourceIDs( const ScriptDocument
& rDocument
, const OUString
& aLibName
, const OUString
& aDlgName
,
111 const css::uno::Reference
< css::container::XNameContainer
>& xDialogModel
);
113 static void removeResourceForDialog( const ScriptDocument
& rDocument
, const OUString
& aLibName
, const OUString
& aDlgName
,
114 const css::uno::Reference
< css::container::XNameContainer
>& xDialogModel
);
116 static css::uno::Reference
< css::resource::XStringResourceManager
>
117 getStringResourceFromDialogLibrary( const css::uno::Reference
< css::container::XNameContainer
>& xDialogLib
);
119 // Clipboard / Drag & Drop
120 static void resetResourceForDialog(
121 const css::uno::Reference
< css::container::XNameContainer
>& xDialogModel
,
122 const css::uno::Reference
< css::resource::XStringResourceManager
>& xStringResourceManager
);
124 static void setResourceIDsForDialog(
125 const css::uno::Reference
< css::container::XNameContainer
>& xDialogModel
,
126 const css::uno::Reference
< css::resource::XStringResourceManager
>& xStringResourceManager
);
128 static void copyResourcesForPastedEditorObject( DlgEditor
const * pEditor
,
129 const css::uno::Any
& rControlAny
, const OUString
& aCtrlName
,
130 const css::uno::Reference
< css::resource::XStringResourceResolver
>& xSourceStringResolver
);
132 static void copyResourceForDroppedDialog(
133 const css::uno::Reference
< css::container::XNameContainer
>& xDialogModel
,
134 const OUString
& aDialogName
,
135 const css::uno::Reference
< css::resource::XStringResourceManager
>& xStringResourceManager
,
136 const css::uno::Reference
< css::resource::XStringResourceResolver
>& xSourceStringResolver
);
138 static void copyResourceForDialog(
139 const css::uno::Reference
< css::container::XNameContainer
>& xDialogModel
,
140 const css::uno::Reference
< css::resource::
141 XStringResourceResolver
>& xSourceStringResolver
,
142 const css::uno::Reference
< css::resource::
143 XStringResourceManager
>& xTargetStringResourceManager
);
146 } // namespace basctl
148 #endif // INCLUDED_BASCTL_SOURCE_INC_LOCALIZATIONMGR_HXX
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */