1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: localizationmgr.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LOCALIZATIONMGR_HXX
32 #define _LOCALIZATIONMGR_HXX
34 #include <com/sun/star/resource/XStringResourceManager.hpp>
35 #include <com/sun/star/container/XNameContainer.hpp>
37 #include "scriptdocument.hxx"
44 ::com::sun::star::uno::Reference
45 < ::com::sun::star::resource::XStringResourceManager
> m_xStringResourceManager
;
47 BasicIDEShell
* m_pIDEShell
;
49 ScriptDocument m_aDocument
;
52 ::com::sun::star::lang::Locale m_aLocaleBeforeBasicStart
;
54 enum HandleResourceMode
60 REMOVE_IDS_FROM_RESOURCE
,
64 static sal_Int32
implHandleControlResourceProperties( ::com::sun::star::uno::Any aControlAny
,
65 const ::rtl::OUString
& aDialogName
, const ::rtl::OUString
& aCtrlName
,
66 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceManager
>
67 xStringResourceManager
, ::com::sun::star::uno::Reference
< ::com::sun::star::resource::
68 XStringResourceResolver
> xSourceStringResolver
, HandleResourceMode eMode
);
70 void enableResourceForAllLibraryDialogs( void )
72 implEnableDisableResourceForAllLibraryDialogs( SET_IDS
);
74 void disableResourceForAllLibraryDialogs( void )
76 implEnableDisableResourceForAllLibraryDialogs( RESET_IDS
);
78 void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode
);
81 LocalizationMgr( BasicIDEShell
* pIDEShell
, const ScriptDocument
& rDocument
, String aLibName
,
82 const ::com::sun::star::uno::Reference
83 < ::com::sun::star::resource::XStringResourceManager
>& xStringResourceManager
);
84 ::com::sun::star::uno::Reference
85 < ::com::sun::star::resource::XStringResourceManager
>getStringResourceManager( void )
87 return m_xStringResourceManager
;
90 bool isLibraryLocalized( void );
92 void handleTranslationbar( void );
94 void handleAddLocales( ::com::sun::star::uno::Sequence
95 < ::com::sun::star::lang::Locale
> aLocaleSeq
);
97 void handleRemoveLocales( ::com::sun::star::uno::Sequence
98 < ::com::sun::star::lang::Locale
> aLocaleSeq
);
100 void handleSetDefaultLocale( ::com::sun::star::lang::Locale aLocale
);
102 void handleSetCurrentLocale( ::com::sun::star::lang::Locale aLocale
);
104 void handleBasicStarted( void );
106 void handleBasicStopped( void );
108 static void setControlResourceIDsForNewEditorObject( DlgEditor
* pEditor
,
109 ::com::sun::star::uno::Any aControlAny
, const ::rtl::OUString
& aCtrlName
);
111 static void renameControlResourceIDsForEditorObject( DlgEditor
* pEditor
,
112 ::com::sun::star::uno::Any aControlAny
, const ::rtl::OUString
& aNewCtrlName
);
114 static void deleteControlResourceIDsForDeletedEditorObject( DlgEditor
* pEditor
,
115 ::com::sun::star::uno::Any aControlAny
, const ::rtl::OUString
& aCtrlName
);
117 static void setStringResourceAtDialog( const ScriptDocument
& rDocument
, const String
& aLibName
, const String
& aDlgName
,
118 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xDialogModel
);
120 static void renameStringResourceIDs( const ScriptDocument
& rDocument
, const String
& aLibName
, const String
& aDlgName
,
121 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xDialogModel
);
123 static void removeResourceForDialog( const ScriptDocument
& rDocument
, const String
& aLibName
, const String
& aDlgName
,
124 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xDialogModel
);
126 static ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceManager
>
127 getStringResourceFromDialogLibrary( ::com::sun::star::uno::Reference
128 < ::com::sun::star::container::XNameContainer
> xDialogLib
);
130 // Clipboard / Drag & Drop
131 static void resetResourceForDialog(
132 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xDialogModel
,
133 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceManager
> xStringResourceManager
);
135 static void setResourceIDsForDialog(
136 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xDialogModel
,
137 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceManager
> xStringResourceManager
);
139 static void copyResourcesForPastedEditorObject( DlgEditor
* pEditor
,
140 ::com::sun::star::uno::Any aControlAny
, const ::rtl::OUString
& aCtrlName
,
141 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::
142 XStringResourceResolver
> xSourceStringResolver
);
144 static void copyResourceForDroppedDialog(
145 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xDialogModel
,
146 const ::rtl::OUString
& aDialogName
,
147 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceManager
> xStringResourceManager
,
148 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceResolver
> xSourceStringResolver
);
150 static void copyResourceForDialog(
151 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
>& xDialogModel
,
152 const ::com::sun::star::uno::Reference
< ::com::sun::star::resource::
153 XStringResourceResolver
>& xSourceStringResolver
,
154 const ::com::sun::star::uno::Reference
< ::com::sun::star::resource::
155 XStringResourceManager
>& xTargetStringResourceManager
);