bump product version to 4.2.0.1
[LibreOffice.git] / include / sfx2 / doctempl.hxx
blobcc3fc4e0ea74b217c5706abe16de3d103e3b4a57
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 .
19 #ifndef _SFXDOCTEMPL_HXX
20 #define _SFXDOCTEMPL_HXX
22 #include <rtl/ustring.hxx>
23 #include <sal/config.h>
24 #include <sal/types.h>
25 #include <sfx2/dllapi.h>
26 #include <tools/ref.hxx>
28 // CLASS -----------------------------------------------------------------
30 class SfxObjectShell;
32 #ifndef SFX_DECL_OBJECTSHELL_DEFINED
33 #define SFX_DECL_OBJECTSHELL_DEFINED
34 SV_DECL_REF(SfxObjectShell)
35 #endif
37 class SfxDocTemplate_Impl;
39 #ifndef SFX_DECL_DOCTEMPLATES_DEFINED
40 #define SFX_DECL_DOCTEMPLATES_DEFINED
41 SV_DECL_REF(SfxDocTemplate_Impl)
42 #endif
44 // class SfxDocumentTemplates --------------------------------------------
46 class SFX2_DLLPUBLIC SfxDocumentTemplates
48 private:
49 SfxDocTemplate_ImplRef pImp;
51 SAL_DLLPRIVATE sal_Bool CopyOrMove( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx,
52 sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx, sal_Bool bMove );
53 public:
54 SfxDocumentTemplates();
55 SfxDocumentTemplates(const SfxDocumentTemplates &);
56 ~SfxDocumentTemplates();
58 sal_Bool IsConstructed() { return pImp != NULL; }
59 void Construct();
61 const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &);
63 void ReInitFromComponent();
65 sal_uInt16 GetRegionCount() const;
66 const OUString& GetRegionName(sal_uInt16 nIdx) const; //dv!
67 OUString GetFullRegionName(sal_uInt16 nIdx) const;
69 sal_uInt16 GetCount(sal_uInt16 nRegion) const;
70 const OUString& GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv!
71 OUString GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
73 // Allows to retrieve the target template URL from the UCB
74 OUString GetTemplateTargetURLFromComponent( const OUString& aGroupName,
75 const OUString& aTitle );
77 // Convert a resource string - a template name - to its localised pair
78 // if it exists in templatelocnames.src
79 static OUString ConvertResourceString(int nSourceResIds,
80 int nDestResIds,
81 int nCount,
82 const OUString& rString);
84 sal_Bool Copy(sal_uInt16 nTargetRegion,
85 sal_uInt16 nTargetIdx,
86 sal_uInt16 nSourceRegion,
87 sal_uInt16 nSourceIdx);
88 sal_Bool Move(sal_uInt16 nTargetRegion,
89 sal_uInt16 nTargetIdx,
90 sal_uInt16 nSourceRegion,
91 sal_uInt16 nSourceIdx);
92 sal_Bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
93 sal_Bool InsertDir(const OUString &rText, sal_uInt16 nRegion);
95 sal_Bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath);
97 /** Change the name of an entry or a directory
99 \param rName
100 The new name to set
101 \param nRegion
102 The id of the region to rename or containing the template to rename
103 \param nIdx
104 The id of the template to rename or USHRT_MAX to rename the region.
106 \return
107 sal_True if the action could be performed, sal_False otherwise
110 sal_Bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx);
112 sal_Bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const OUString &rName) const;
113 sal_Bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, OUString &rName);
115 sal_Bool GetFull( const OUString& rRegion, const OUString& rName, OUString& rPath );
116 sal_Bool GetLogicNames( const OUString& rPath, OUString& rRegion, OUString& rName ) const;
118 /** updates the configuration where the document templates structure is stored.
120 <p>The info about the document templates (which files, which groups etc.) is stored in the
121 configuration. This means that just by copying files into OOo's template directories, this
122 change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with
123 the file system. This can be enforced with this method.</p>
125 @param _bSmart
126 The update of the configuration is rather expensive - nothing you want to do regulary if you don't really
127 need it. So you have the possibility to do a smart update - it first checks if the update if necessary.
128 In case the update is needed, the additional check made it somewhat more expensive. In case it's not
129 necessary (which should be the usual case), the check alone is (much) less expensive than the real update.
130 <br/>
131 So set <arg>_bSmart</arg> to <TRUE/> to do a check for necessity first.
133 void Update( sal_Bool _bSmart = sal_True );
136 #endif // #ifndef _SFXDOCTEMPL_HXX
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */