Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / sfx2 / doctempl.hxx
blob70b34362f64cb8f2687248917a401730ba848862
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 <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 class SfxDocTemplate_Impl;
34 // class SfxDocumentTemplates --------------------------------------------
36 class SFX2_DLLPUBLIC SfxDocumentTemplates
38 private:
39 tools::SvRef<SfxDocTemplate_Impl> pImp;
41 SAL_DLLPRIVATE bool CopyOrMove( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx,
42 sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx, bool bMove );
43 public:
44 SfxDocumentTemplates();
45 SfxDocumentTemplates(const SfxDocumentTemplates &);
46 ~SfxDocumentTemplates();
48 const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &);
50 void ReInitFromComponent();
52 sal_uInt16 GetRegionCount() const;
53 OUString GetRegionName(sal_uInt16 nIdx) const; //dv!
54 OUString GetFullRegionName(sal_uInt16 nIdx) const;
56 sal_uInt16 GetCount(sal_uInt16 nRegion) const;
57 OUString GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv!
58 OUString GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
60 // Allows to retrieve the target template URL from the UCB
61 OUString GetTemplateTargetURLFromComponent( const OUString& aGroupName,
62 const OUString& aTitle );
64 // Convert a resource string - a template name - to its localised pair
65 // if it exists in templatelocnames.src
66 static OUString ConvertResourceString(int nSourceResIds,
67 int nDestResIds,
68 int nCount,
69 const OUString& rString);
71 bool Copy(sal_uInt16 nTargetRegion,
72 sal_uInt16 nTargetIdx,
73 sal_uInt16 nSourceRegion,
74 sal_uInt16 nSourceIdx);
75 bool Move(sal_uInt16 nTargetRegion,
76 sal_uInt16 nTargetIdx,
77 sal_uInt16 nSourceRegion,
78 sal_uInt16 nSourceIdx);
79 bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
80 bool InsertDir(const OUString &rText, sal_uInt16 nRegion);
82 bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath);
84 /** Change the name of an entry or a directory
86 \param rName
87 The new name to set
88 \param nRegion
89 The id of the region to rename or containing the template to rename
90 \param nIdx
91 The id of the template to rename or USHRT_MAX to rename the region.
93 \return
94 sal_True if the action could be performed, sal_False otherwise
97 bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx);
99 bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const OUString &rName) const;
100 bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, OUString &rName);
102 bool GetFull( const OUString& rRegion, const OUString& rName, OUString& rPath );
103 bool GetLogicNames( const OUString& rPath, OUString& rRegion, OUString& rName ) const;
105 /** updates the configuration where the document templates structure is stored.
107 <p>The info about the document templates (which files, which groups etc.) is stored in the
108 configuration. This means that just by copying files into OOo's template directories, this
109 change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with
110 the file system. This can be enforced with this method.</p>
112 void Update();
115 #endif // INCLUDED_SFX2_DOCTEMPL_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */