Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / sfx2 / doctempl.hxx
blob029c8e8b27909faf635422375595a7185d40b1ab
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 INCLUDED_SFX2_DOCTEMPL_HXX
20 #define INCLUDED_SFX2_DOCTEMPL_HXX
22 #include <sal/config.h>
24 #include <string_view>
26 #include <rtl/ustring.hxx>
27 #include <sal/types.h>
28 #include <sfx2/dllapi.h>
29 #include <tools/ref.hxx>
31 // CLASS -----------------------------------------------------------------
33 class SfxDocTemplate_Impl;
35 // class SfxDocumentTemplates --------------------------------------------
37 class SFX2_DLLPUBLIC SfxDocumentTemplates
39 private:
40 tools::SvRef<SfxDocTemplate_Impl> pImp;
42 SAL_DLLPRIVATE bool CopyOrMove( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx,
43 sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx, bool bMove );
44 public:
45 SfxDocumentTemplates();
46 SfxDocumentTemplates(const SfxDocumentTemplates &);
47 ~SfxDocumentTemplates();
49 const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &);
51 void ReInitFromComponent();
53 sal_uInt16 GetRegionCount() const;
54 OUString GetRegionName(sal_uInt16 nIdx) const; //dv!
55 OUString GetFullRegionName(sal_uInt16 nIdx) const;
57 sal_uInt16 GetCount(sal_uInt16 nRegion) const;
58 OUString GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv!
59 OUString GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
61 // Allows to retrieve the target template URL from the UCB
62 OUString GetTemplateTargetURLFromComponent(std::u16string_view aGroupName,
63 std::u16string_view aTitle );
65 // Convert a resource string - a template name - to its localised pair
66 // if it exists in sfx2/inc/strings.hxx
67 static OUString ConvertResourceString(const OUString& rString);
69 bool Copy(sal_uInt16 nTargetRegion,
70 sal_uInt16 nTargetIdx,
71 sal_uInt16 nSourceRegion,
72 sal_uInt16 nSourceIdx);
73 bool Move(sal_uInt16 nTargetRegion,
74 sal_uInt16 nTargetIdx,
75 sal_uInt16 nSourceRegion,
76 sal_uInt16 nSourceIdx);
77 bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
78 bool InsertDir(const OUString &rText, sal_uInt16 nRegion);
80 bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath);
82 /** Change the name of an entry or a directory
84 \param rName
85 The new name to set
86 \param nRegion
87 The id of the region to rename or containing the template to rename
88 \param nIdx
89 The id of the template to rename or USHRT_MAX to rename the region.
91 \return
92 sal_True if the action could be performed, sal_False otherwise
95 bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx);
97 bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, std::u16string_view rName) const;
98 bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, OUString &rName);
100 bool GetFull(
101 std::u16string_view rRegion, std::u16string_view rName, OUString& rPath );
102 bool GetLogicNames( std::u16string_view rPath, OUString& rRegion, OUString& rName ) const;
104 /** updates the configuration where the document templates structure is stored.
106 <p>The info about the document templates (which files, which groups etc.) is stored in the
107 configuration. This means that just by copying files into OOo's template directories, this
108 change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with
109 the file system. This can be enforced with this method.</p>
111 void Update();
114 #endif // INCLUDED_SFX2_DOCTEMPL_HXX
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */