1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski #ifndef _GLOSDOC_HXX 24*b1cdbd2cSJim Jagielski #define _GLOSDOC_HXX 25*b1cdbd2cSJim Jagielski 26*b1cdbd2cSJim Jagielski #include <tools/string.hxx> 27*b1cdbd2cSJim Jagielski #include <svl/svarray.hxx> 28*b1cdbd2cSJim Jagielski #include <com/sun/star/text/XAutoTextGroup.hpp> 29*b1cdbd2cSJim Jagielski 30*b1cdbd2cSJim Jagielski class SwTextBlocks; 31*b1cdbd2cSJim Jagielski class SvStrings; 32*b1cdbd2cSJim Jagielski class SwDocShell; 33*b1cdbd2cSJim Jagielski 34*b1cdbd2cSJim Jagielski #ifndef SW_DECL_SWDOCSHELL_DEFINED 35*b1cdbd2cSJim Jagielski #define SW_DECL_SWDOCSHELL_DEFINED 36*b1cdbd2cSJim Jagielski #include <tools/ref.hxx> 37*b1cdbd2cSJim Jagielski SV_DECL_REF( SwDocShell ) 38*b1cdbd2cSJim Jagielski #endif 39*b1cdbd2cSJim Jagielski #include <cppuhelper/weakref.hxx> 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski #ifndef INCLUDED_VECTOR 42*b1cdbd2cSJim Jagielski #include <vector> 43*b1cdbd2cSJim Jagielski #define INCLUDED_VECTOR 44*b1cdbd2cSJim Jagielski #endif 45*b1cdbd2cSJim Jagielski #include "swdllapi.h" 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef; 48*b1cdbd2cSJim Jagielski typedef ::std::vector< AutoTextGroupRef > UnoAutoTextGroups; 49*b1cdbd2cSJim Jagielski 50*b1cdbd2cSJim Jagielski typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextEntry > AutoTextEntryRef; 51*b1cdbd2cSJim Jagielski typedef ::std::vector< AutoTextEntryRef > UnoAutoTextEntries; 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski #define GLOS_DELIM (sal_Unicode)'*' 54*b1cdbd2cSJim Jagielski 55*b1cdbd2cSJim Jagielski // CLASS ----------------------------------------------------------------- 56*b1cdbd2cSJim Jagielski class SW_DLLPUBLIC SwGlossaries 57*b1cdbd2cSJim Jagielski { 58*b1cdbd2cSJim Jagielski UnoAutoTextGroups m_aGlossaryGroups; 59*b1cdbd2cSJim Jagielski UnoAutoTextEntries m_aGlossaryEntries; 60*b1cdbd2cSJim Jagielski 61*b1cdbd2cSJim Jagielski String m_aPath; 62*b1cdbd2cSJim Jagielski String m_sOldErrPath; 63*b1cdbd2cSJim Jagielski String m_sErrPath; 64*b1cdbd2cSJim Jagielski SvStrings *m_pPathArr; 65*b1cdbd2cSJim Jagielski SvStrings *m_pGlosArr; 66*b1cdbd2cSJim Jagielski sal_Bool m_bError; 67*b1cdbd2cSJim Jagielski 68*b1cdbd2cSJim Jagielski SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const; 69*b1cdbd2cSJim Jagielski SW_DLLPRIVATE SvStrings *GetNameList(); 70*b1cdbd2cSJim Jagielski 71*b1cdbd2cSJim Jagielski // implementation in unoatxt.cxx 72*b1cdbd2cSJim Jagielski SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup ); 73*b1cdbd2cSJim Jagielski SW_DLLPRIVATE void InvalidateUNOOjects(); 74*b1cdbd2cSJim Jagielski 75*b1cdbd2cSJim Jagielski public: 76*b1cdbd2cSJim Jagielski SwGlossaries(); 77*b1cdbd2cSJim Jagielski ~SwGlossaries(); 78*b1cdbd2cSJim Jagielski 79*b1cdbd2cSJim Jagielski /** returns the cached AutoTextGroup (if any) for the given group name 80*b1cdbd2cSJim Jagielski 81*b1cdbd2cSJim Jagielski @precond 82*b1cdbd2cSJim Jagielski If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method. 83*b1cdbd2cSJim Jagielski 84*b1cdbd2cSJim Jagielski @param _rGroupName 85*b1cdbd2cSJim Jagielski the name of the glossaries group 86*b1cdbd2cSJim Jagielski @param _bCreate 87*b1cdbd2cSJim Jagielski if <TRUE/>, the group is created if it does not yet exist 88*b1cdbd2cSJim Jagielski */ 89*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup > 90*b1cdbd2cSJim Jagielski GetAutoTextGroup( 91*b1cdbd2cSJim Jagielski const ::rtl::OUString& _rGroupName, 92*b1cdbd2cSJim Jagielski bool _bCreate = false 93*b1cdbd2cSJim Jagielski ); 94*b1cdbd2cSJim Jagielski 95*b1cdbd2cSJim Jagielski /** returns the cached AutoTextEntry (if any) for the given group/with the given name 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski @precond 98*b1cdbd2cSJim Jagielski If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method. 99*b1cdbd2cSJim Jagielski 100*b1cdbd2cSJim Jagielski @param _rGroupAccessName 101*b1cdbd2cSJim Jagielski the name to access the group 102*b1cdbd2cSJim Jagielski @param _rGroupName 103*b1cdbd2cSJim Jagielski the name of the glossaries group, as to be passed to the entry 104*b1cdbd2cSJim Jagielski @param _rEntryName 105*b1cdbd2cSJim Jagielski the name of the auto text entry 106*b1cdbd2cSJim Jagielski @param _bCreate 107*b1cdbd2cSJim Jagielski if <TRUE/>, the entry is created if it does not yet exist 108*b1cdbd2cSJim Jagielski */ 109*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry > 110*b1cdbd2cSJim Jagielski GetAutoTextEntry( 111*b1cdbd2cSJim Jagielski const String& _rCompleteGroupName, 112*b1cdbd2cSJim Jagielski const ::rtl::OUString& _rGroupName, 113*b1cdbd2cSJim Jagielski const ::rtl::OUString& _rEntryName, 114*b1cdbd2cSJim Jagielski bool _bCreate = false 115*b1cdbd2cSJim Jagielski ); 116*b1cdbd2cSJim Jagielski 117*b1cdbd2cSJim Jagielski sal_uInt16 GetGroupCnt(); 118*b1cdbd2cSJim Jagielski String GetGroupName(sal_uInt16 ); 119*b1cdbd2cSJim Jagielski String GetGroupTitle( const String& rGroupName ); 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski sal_Bool FindGroupName(String & rGroup); 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski SwTextBlocks* GetGroupDoc(const String &rName, 124*b1cdbd2cSJim Jagielski sal_Bool bCreate = sal_False) const; GetDefGroupDoc() const125*b1cdbd2cSJim Jagielski SwTextBlocks* GetDefGroupDoc() const {return GetGroupDoc(GetDefName());} 126*b1cdbd2cSJim Jagielski void PutGroupDoc(SwTextBlocks *pBlock); 127*b1cdbd2cSJim Jagielski static String GetDefName(); 128*b1cdbd2cSJim Jagielski static String GetExtension(); 129*b1cdbd2cSJim Jagielski 130*b1cdbd2cSJim Jagielski String GetCompleteGroupName( const ::rtl::OUString& GroupName ); 131*b1cdbd2cSJim Jagielski 132*b1cdbd2cSJim Jagielski sal_Bool NewGroupDoc(String &rGroupName, const String& rTitle); 133*b1cdbd2cSJim Jagielski sal_Bool RenameGroupDoc(const String& sOldGroup, String& sNewGroup, const String& rNewTitle); 134*b1cdbd2cSJim Jagielski sal_Bool DelGroupDoc(const String &); 135*b1cdbd2cSJim Jagielski SwDocShellRef EditGroupDoc(const String &rGrpName, const String& rShortName, sal_Bool bShow = sal_True ); 136*b1cdbd2cSJim Jagielski void SaveGroupDoc(const String &rGrpName, const String& rLongName ); 137*b1cdbd2cSJim Jagielski void UpdateGlosPath(sal_Bool bFull); 138*b1cdbd2cSJim Jagielski void ShowError(); IsGlosPathErr()139*b1cdbd2cSJim Jagielski inline sal_uLong IsGlosPathErr() { return m_bError; } GetPathArray() const140*b1cdbd2cSJim Jagielski const SvStrings* GetPathArray() const {return m_pPathArr;} 141*b1cdbd2cSJim Jagielski }; 142*b1cdbd2cSJim Jagielski 143*b1cdbd2cSJim Jagielski 144*b1cdbd2cSJim Jagielski #endif // _GLOSDOC_HXX 145