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 INCLUDED_SW_SOURCE_UI_INC_GLOSDOC_HXX
20 : #define INCLUDED_SW_SOURCE_UI_INC_GLOSDOC_HXX
21 :
22 : #include "rtl/ustring.hxx"
23 : #include <com/sun/star/text/XAutoTextGroup.hpp>
24 :
25 : class SwTextBlocks;
26 : class SwDocShell;
27 :
28 : #ifndef SW_DECL_SWDOCSHELL_DEFINED
29 : #define SW_DECL_SWDOCSHELL_DEFINED
30 : #include <tools/ref.hxx>
31 : typedef tools::SvRef<SwDocShell> SwDocShellRef;
32 : #endif
33 : #include <cppuhelper/weakref.hxx>
34 :
35 : #include <vector>
36 : #include "swdllapi.h"
37 :
38 : typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef;
39 : typedef ::std::vector< AutoTextGroupRef > UnoAutoTextGroups;
40 :
41 : typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextEntry > AutoTextEntryRef;
42 : typedef ::std::vector< AutoTextEntryRef > UnoAutoTextEntries;
43 :
44 : #define GLOS_DELIM (sal_Unicode)'*'
45 :
46 : // CLASS -----------------------------------------------------------------
47 : class SW_DLLPUBLIC SwGlossaries
48 : {
49 : UnoAutoTextGroups m_aGlossaryGroups;
50 : UnoAutoTextEntries m_aGlossaryEntries;
51 :
52 : OUString m_aPath;
53 : std::vector<OUString> m_aInvalidPaths;
54 : std::vector<OUString> m_PathArr;
55 : std::vector<OUString> m_GlosArr;
56 : sal_Bool m_bError;
57 :
58 : SAL_DLLPRIVATE SwTextBlocks* GetGlosDoc(const OUString &rName, sal_Bool bCreate = sal_True) const;
59 : SAL_DLLPRIVATE std::vector<OUString> & GetNameList();
60 :
61 : // implementation in unoatxt.cxx
62 : SAL_DLLPRIVATE void RemoveFileFromList( const OUString& rGroup );
63 : SAL_DLLPRIVATE void InvalidateUNOOjects();
64 :
65 : public:
66 : SwGlossaries();
67 : ~SwGlossaries();
68 :
69 : /** returns the cached AutoTextGroup (if any) for the given group name
70 :
71 : @precond
72 : If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
73 :
74 : @param _rGroupName
75 : the name of the glossaries group
76 : @param _bCreate
77 : if <TRUE/>, the group is created if it does not yet exist
78 : */
79 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup >
80 : GetAutoTextGroup(
81 : const OUString& _rGroupName,
82 : bool _bCreate = false
83 : );
84 :
85 : /** returns the cached AutoTextEntry (if any) for the given group/with the given name
86 :
87 : @precond
88 : If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
89 :
90 : @param _rGroupAccessName
91 : the name to access the group
92 : @param _rGroupName
93 : the name of the glossaries group, as to be passed to the entry
94 : @param _rEntryName
95 : the name of the auto text entry
96 : @param _bCreate
97 : if <TRUE/>, the entry is created if it does not yet exist
98 : */
99 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry >
100 : GetAutoTextEntry(
101 : const OUString& _rCompleteGroupName,
102 : const OUString& _rGroupName,
103 : const OUString& _rEntryName,
104 : bool _bCreate = false
105 : );
106 :
107 : sal_uInt16 GetGroupCnt();
108 : OUString GetGroupName(sal_uInt16 );
109 : OUString GetGroupTitle( const OUString& rGroupName );
110 :
111 : sal_Bool FindGroupName(OUString& rGroup);
112 :
113 : SwTextBlocks* GetGroupDoc(const OUString &rName,
114 : sal_Bool bCreate = sal_False);
115 : SwTextBlocks* GetDefGroupDoc() { return GetGroupDoc(GetDefName()); }
116 : void PutGroupDoc(SwTextBlocks *pBlock);
117 : static OUString GetDefName();
118 : static OUString GetExtension();
119 :
120 : OUString GetCompleteGroupName( const OUString& GroupName );
121 :
122 : sal_Bool NewGroupDoc(OUString &rGroupName, const OUString& rTitle);
123 : sal_Bool RenameGroupDoc(const OUString& sOldGroup, OUString& sNewGroup, const OUString& rNewTitle);
124 : sal_Bool DelGroupDoc(const OUString &);
125 : SwDocShellRef EditGroupDoc(const OUString &rGrpName, const OUString& rShortName, sal_Bool bShow = sal_True );
126 : void SaveGroupDoc(const OUString &rGrpName, const OUString& rLongName );
127 : void UpdateGlosPath(sal_Bool bFull);
128 : void ShowError();
129 0 : inline sal_uLong IsGlosPathErr() { return m_bError; }
130 0 : std::vector<OUString> const& GetPathArray() const { return m_PathArr; }
131 : };
132 :
133 : #endif // INCLUDED_SW_SOURCE_UI_INC_GLOSDOC_HXX
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|