Get the style color and number just once
[LibreOffice.git] / basctl / source / inc / localizationmgr.hxx
blob1070e609f18dbdab756121266f44c9955dc5d200
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <sal/config.h>
24 #include <string_view>
26 #include <basctl/scriptdocument.hxx>
28 #include <com/sun/star/resource/XStringResourceManager.hpp>
30 namespace basctl
33 class Shell;
34 class DlgEditor;
36 class LocalizationMgr
38 css::uno::Reference< css::resource::XStringResourceManager > m_xStringResourceManager;
40 Shell* m_pShell;
42 ScriptDocument m_aDocument;
43 OUString m_aLibName;
45 css::lang::Locale m_aLocaleBeforeBasicStart;
47 enum HandleResourceMode
49 SET_IDS,
50 RESET_IDS,
51 RENAME_DIALOG_IDS,
52 RENAME_CONTROL_IDS,
53 REMOVE_IDS_FROM_RESOURCE,
54 MOVE_RESOURCES,
55 COPY_RESOURCES
57 static sal_Int32 implHandleControlResourceProperties(const css::uno::Any& rControlAny,
58 std::u16string_view aDialogName,
59 std::u16string_view aCtrlName,
60 const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager,
61 const css::uno::Reference< css::resource::XStringResourceResolver >& xSourceStringResolver,
62 HandleResourceMode eMode );
64 void enableResourceForAllLibraryDialogs()
66 implEnableDisableResourceForAllLibraryDialogs( SET_IDS );
68 void disableResourceForAllLibraryDialogs()
70 implEnableDisableResourceForAllLibraryDialogs( RESET_IDS );
72 void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode );
74 public:
75 LocalizationMgr(Shell*, ScriptDocument , OUString aLibName,
76 const css::uno::Reference < css::resource::XStringResourceManager >& xStringResourceManager );
78 const css::uno::Reference< css::resource::XStringResourceManager >& getStringResourceManager() const
80 return m_xStringResourceManager;
83 bool isLibraryLocalized();
85 void handleTranslationbar();
87 void handleAddLocales( const css::uno::Sequence
88 < css::lang::Locale >& aLocaleSeq );
90 void handleRemoveLocales( const css::uno::Sequence
91 < css::lang::Locale >& aLocaleSeq );
93 void handleSetDefaultLocale(const css::lang::Locale& rLocale);
95 void handleSetCurrentLocale(const css::lang::Locale& rLocale);
97 void handleBasicStarted();
99 void handleBasicStopped();
101 static void setControlResourceIDsForNewEditorObject(DlgEditor const * pEditor,
102 const css::uno::Any& rControlAny, std::u16string_view aCtrlName);
104 static void renameControlResourceIDsForEditorObject(DlgEditor const * pEditor,
105 const css::uno::Any& rControlAny, std::u16string_view aNewCtrlName);
107 static void deleteControlResourceIDsForDeletedEditorObject(DlgEditor const * pEditor,
108 const css::uno::Any& rControlAny, std::u16string_view aCtrlName);
110 static void setStringResourceAtDialog( const ScriptDocument& rDocument, const OUString& aLibName, std::u16string_view aDlgName,
111 const css::uno::Reference< css::container::XNameContainer >& xDialogModel );
113 static void renameStringResourceIDs( const ScriptDocument& rDocument, const OUString& aLibName, std::u16string_view aDlgName,
114 const css::uno::Reference< css::container::XNameContainer >& xDialogModel );
116 static void removeResourceForDialog( const ScriptDocument& rDocument, const OUString& aLibName, std::u16string_view aDlgName,
117 const css::uno::Reference< css::container::XNameContainer >& xDialogModel );
119 static css::uno::Reference< css::resource::XStringResourceManager >
120 getStringResourceFromDialogLibrary( const css::uno::Reference< css::container::XNameContainer >& xDialogLib );
122 // Clipboard / Drag & Drop
123 static void resetResourceForDialog(
124 const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
125 const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager );
127 static void setResourceIDsForDialog(
128 const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
129 const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager );
131 static void copyResourcesForPastedEditorObject( DlgEditor const * pEditor,
132 const css::uno::Any& rControlAny, std::u16string_view aCtrlName,
133 const css::uno::Reference< css::resource::XStringResourceResolver >& xSourceStringResolver );
135 static void copyResourceForDroppedDialog(
136 const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
137 std::u16string_view aDialogName,
138 const css::uno::Reference< css::resource::XStringResourceManager >& xStringResourceManager,
139 const css::uno::Reference< css::resource::XStringResourceResolver >& xSourceStringResolver );
141 static void copyResourceForDialog(
142 const css::uno::Reference< css::container::XNameContainer >& xDialogModel,
143 const css::uno::Reference< css::resource::
144 XStringResourceResolver >& xSourceStringResolver,
145 const css::uno::Reference< css::resource::
146 XStringResourceManager >& xTargetStringResourceManager );
149 } // namespace basctl
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */