Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : : #ifndef _SFXDOCTEMPL_HXX
20 : : #define _SFXDOCTEMPL_HXX
21 : :
22 : : #include "sal/config.h"
23 : : #include "sfx2/dllapi.h"
24 : : #include "sal/types.h"
25 : : #include <tools/ref.hxx>
26 : : #include <tools/string.hxx>
27 : :
28 : : // CLASS -----------------------------------------------------------------
29 : :
30 : : class SfxObjectShell;
31 : :
32 : : #ifndef SFX_DECL_OBJECTSHELL_DEFINED
33 : : #define SFX_DECL_OBJECTSHELL_DEFINED
34 : 2706402 : SV_DECL_REF(SfxObjectShell)
35 : : #endif
36 : :
37 : : class SfxDocTemplate_Impl;
38 : :
39 : : #ifndef SFX_DECL_DOCTEMPLATES_DEFINED
40 : : #define SFX_DECL_DOCTEMPLATES_DEFINED
41 : 54 : SV_DECL_REF(SfxDocTemplate_Impl)
42 : : #endif
43 : :
44 : : // class SfxDocumentTemplates --------------------------------------------
45 : :
46 : : class SFX2_DLLPUBLIC SfxDocumentTemplates
47 : : {
48 : : private:
49 : : SfxDocTemplate_ImplRef pImp;
50 : :
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();
57 : :
58 : 0 : sal_Bool IsConstructed() { return pImp != NULL; }
59 : : void Construct();
60 : :
61 : : const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &);
62 : :
63 : : sal_Bool Rescan( );
64 : : void ReInitFromComponent();
65 : :
66 : : sal_Bool IsRegionLoaded( sal_uInt16 nIdx ) const;
67 : : sal_uInt16 GetRegionCount() const;
68 : : const String& GetRegionName(sal_uInt16 nIdx) const; //dv!
69 : : String GetFullRegionName(sal_uInt16 nIdx) const;
70 : :
71 : : sal_uInt16 GetCount(sal_uInt16 nRegion) const;
72 : : const String& GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv!
73 : : String GetFileName(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
74 : : String GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
75 : :
76 : : // Allows to retrieve the target template URL from the UCB
77 : : ::rtl::OUString GetTemplateTargetURLFromComponent( const ::rtl::OUString& aGroupName,
78 : : const ::rtl::OUString& aTitle );
79 : :
80 : : // Convert a resource string - a template name - to its localised pair
81 : : // if it exists in templatelocnames.src
82 : : static ::rtl::OUString ConvertResourceString(int nSourceResIds,
83 : : int nDestResIds,
84 : : int nCount,
85 : : const ::rtl::OUString& rString);
86 : :
87 : : sal_Bool Copy(sal_uInt16 nTargetRegion,
88 : : sal_uInt16 nTargetIdx,
89 : : sal_uInt16 nSourceRegion,
90 : : sal_uInt16 nSourceIdx);
91 : : sal_Bool Move(sal_uInt16 nTargetRegion,
92 : : sal_uInt16 nTargetIdx,
93 : : sal_uInt16 nSourceRegion,
94 : : sal_uInt16 nSourceIdx);
95 : : sal_Bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
96 : : sal_Bool InsertDir(const String &rText, sal_uInt16 nRegion);
97 : : sal_Bool SetName(const String &rName, sal_uInt16 nRegion, sal_uInt16 nIdx);
98 : :
99 : : sal_Bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const String &rName) const;
100 : : sal_Bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, String &rName);
101 : :
102 : : SfxObjectShellRef CreateObjectShell(sal_uInt16 nRegion, sal_uInt16 nIdx);
103 : : sal_Bool DeleteObjectShell(sal_uInt16, sal_uInt16);
104 : :
105 : : sal_Bool GetFull( const String& rRegion, const String& rName, String& rPath );
106 : : sal_Bool GetLogicNames( const String& rPath, String& rRegion, String& rName ) const;
107 : :
108 : : /** updates the configuration where the document templates structure is stored.
109 : :
110 : : <p>The info about the document templates (which files, which groups etc.) is stored in the
111 : : configuration. This means that just by copying files into OOo's template directories, this
112 : : change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with
113 : : the file system. This can be enforced with this method.</p>
114 : :
115 : : @param _bSmart
116 : : The update of the configuration is rather expensive - nothing you want to do regulary if you don't really
117 : : need it. So you have the possibility to do a smart update - it first checks if the update if necessary.
118 : : In case the update is needed, the additional check made it somewhat more expensive. In case it's not
119 : : necessary (which should be the usual case), the check alone is (much) less expensive than the real update.
120 : : <br/>
121 : : So set <arg>_bSmart</arg> to <TRUE/> to do a check for necessity first.
122 : : */
123 : : void Update( sal_Bool _bSmart = sal_True );
124 : :
125 : : // allows to detect whether it is allowed to delete ( at least partially )
126 : : // a group or a template, or to edit a template
127 : : sal_Bool HasUserContents( sal_uInt16 nRegion, sal_uInt16 nIdx ) const;
128 : : };
129 : :
130 : : #endif // #ifndef _SFXDOCTEMPL_HXX
131 : :
132 : :
133 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|