1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx> 33*cdf0e10cSrcweir #include <viewsh.hxx> 34*cdf0e10cSrcweir #include <initui.hxx> 35*cdf0e10cSrcweir #include <edtwin.hxx> 36*cdf0e10cSrcweir #include <shellres.hxx> 37*cdf0e10cSrcweir #include <fldbas.hxx> 38*cdf0e10cSrcweir #include <glosdoc.hxx> 39*cdf0e10cSrcweir #include <gloslst.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #ifndef _UTLUI_HRC 42*cdf0e10cSrcweir #include <utlui.hrc> 43*cdf0e10cSrcweir #endif 44*cdf0e10cSrcweir #ifndef _INITUI_HRC 45*cdf0e10cSrcweir #include <initui.hrc> 46*cdf0e10cSrcweir #endif 47*cdf0e10cSrcweir #ifndef _COMCORE_HRC 48*cdf0e10cSrcweir #include <comcore.hrc> 49*cdf0e10cSrcweir #endif 50*cdf0e10cSrcweir #include <authfld.hxx> 51*cdf0e10cSrcweir #ifndef _DBMGR_HXX 52*cdf0e10cSrcweir #include <dbmgr.hxx> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #include <unotools/syslocale.hxx> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #include <unomid.h> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir /*-------------------------------------------------------------------- 59*cdf0e10cSrcweir Beschreibung: globale Pointer 60*cdf0e10cSrcweir --------------------------------------------------------------------*/ 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir SwGlossaries* pGlossaries = 0; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir // Liefert alle benoetigten Pfade. Wird durch UI initialisiert 65*cdf0e10cSrcweir SwGlossaryList* pGlossaryList = 0; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir String* pOldGrfCat = 0; 68*cdf0e10cSrcweir String* pOldTabCat = 0; 69*cdf0e10cSrcweir String* pOldFrmCat = 0; 70*cdf0e10cSrcweir String* pOldDrwCat = 0; 71*cdf0e10cSrcweir String* pCurrGlosGroup = 0; 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir String* GetOldGrfCat() 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir return pOldGrfCat; 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir String* GetOldTabCat() 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir return pOldTabCat; 80*cdf0e10cSrcweir } 81*cdf0e10cSrcweir String* GetOldFrmCat() 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir return pOldFrmCat; 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir String* GetOldDrwCat() 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir return pOldDrwCat; 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir String* GetCurrGlosGroup() 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir return pCurrGlosGroup; 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir void SetCurrGlosGroup(String* pStr) 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir pCurrGlosGroup = pStr; 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir SvStringsDtor* pDBNameList = 0; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir SvStringsDtor* pAuthFieldNameList = 0; 101*cdf0e10cSrcweir SvStringsDtor* pAuthFieldTypeList = 0; 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir /*-------------------------------------------------------------------- 104*cdf0e10cSrcweir Beschreibung: UI beenden 105*cdf0e10cSrcweir --------------------------------------------------------------------*/ 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir void _FinitUI() 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir SwNewDBMgr::RemoveDbtoolsClient(); 110*cdf0e10cSrcweir delete ViewShell::GetShellRes(); 111*cdf0e10cSrcweir ViewShell::SetShellRes( 0 ); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir SwEditWin::_FinitStaticData(); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir DELETEZ(pGlossaries); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir delete SwFieldType::pFldNames; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir delete pOldGrfCat; 120*cdf0e10cSrcweir delete pOldTabCat; 121*cdf0e10cSrcweir delete pOldFrmCat; 122*cdf0e10cSrcweir delete pOldDrwCat; 123*cdf0e10cSrcweir delete pCurrGlosGroup; 124*cdf0e10cSrcweir delete pDBNameList; 125*cdf0e10cSrcweir delete pGlossaryList; 126*cdf0e10cSrcweir delete pAuthFieldNameList; 127*cdf0e10cSrcweir delete pAuthFieldTypeList; 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir /*-------------------------------------------------------------------- 132*cdf0e10cSrcweir Beschreibung: Initialisierung 133*cdf0e10cSrcweir --------------------------------------------------------------------*/ 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir void _InitUI() 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir // ShellResource gibt der CORE die Moeglichkeit mit Resourcen zu arbeiten 139*cdf0e10cSrcweir ViewShell::SetShellRes( new ShellResource ); 140*cdf0e10cSrcweir pDBNameList = new SvStringsDtor( 5, 5 ); 141*cdf0e10cSrcweir SwEditWin::_InitStaticData(); 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir ShellResource::ShellResource() 146*cdf0e10cSrcweir : Resource( SW_RES(RID_SW_SHELLRES) ), 147*cdf0e10cSrcweir aPostItAuthor( SW_RES( STR_POSTIT_AUTHOR ) ), 148*cdf0e10cSrcweir aPostItPage( SW_RES( STR_POSTIT_PAGE ) ), 149*cdf0e10cSrcweir aPostItLine( SW_RES( STR_POSTIT_LINE ) ), 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir aCalc_Syntax( SW_RES( STR_CALC_SYNTAX ) ), 152*cdf0e10cSrcweir aCalc_ZeroDiv( SW_RES( STR_CALC_ZERODIV ) ), 153*cdf0e10cSrcweir aCalc_Brack( SW_RES( STR_CALC_BRACK ) ), 154*cdf0e10cSrcweir aCalc_Pow( SW_RES( STR_CALC_POW ) ), 155*cdf0e10cSrcweir aCalc_VarNFnd( SW_RES( STR_CALC_VARNFND ) ), 156*cdf0e10cSrcweir aCalc_Overflow( SW_RES( STR_CALC_OVERFLOW ) ), 157*cdf0e10cSrcweir aCalc_WrongTime( SW_RES( STR_CALC_WRONGTIME ) ), 158*cdf0e10cSrcweir aCalc_Default( SW_RES( STR_CALC_DEFAULT ) ), 159*cdf0e10cSrcweir aCalc_Error( SW_RES( STR_CALC_ERROR ) ), 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir aGetRefFld_Up( SW_RES( STR_GETREFFLD_UP ) ), 162*cdf0e10cSrcweir aGetRefFld_Down( SW_RES( STR_GETREFFLD_DOWN ) ), 163*cdf0e10cSrcweir // --> OD 2007-09-13 #i81002# 164*cdf0e10cSrcweir aGetRefFld_RefItemNotFound( SW_RES( STR_GETREFFLD_REFITEMNOTFOUND ) ), 165*cdf0e10cSrcweir // <-- 166*cdf0e10cSrcweir aStrAllPageHeadFoot( SW_RES( STR_ALLPAGE_HEADFOOT ) ), 167*cdf0e10cSrcweir aStrNone( SW_RES( STR_TEMPLATE_NONE )), 168*cdf0e10cSrcweir aFixedStr( SW_RES( STR_FIELD_FIXED )), 169*cdf0e10cSrcweir sDurationFormat( SW_RES( STR_DURATION_FORMAT )), 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir aTOXIndexName( SW_RES(STR_TOI)), 172*cdf0e10cSrcweir aTOXUserName( SW_RES(STR_TOU)), 173*cdf0e10cSrcweir aTOXContentName( SW_RES(STR_TOC)), 174*cdf0e10cSrcweir aTOXIllustrationsName( SW_RES(STR_TOX_ILL)), 175*cdf0e10cSrcweir aTOXObjectsName( SW_RES(STR_TOX_OBJ)), 176*cdf0e10cSrcweir aTOXTablesName( SW_RES(STR_TOX_TBL)), 177*cdf0e10cSrcweir aTOXAuthoritiesName( SW_RES(STR_TOX_AUTH)), 178*cdf0e10cSrcweir aHyperlinkClick( SW_RES( STR_HYPERLINK_CLICK)), 179*cdf0e10cSrcweir pAutoFmtNameLst(0), 180*cdf0e10cSrcweir sPageDescFirstName( SW_RES(STR_PAGEDESC_FIRSTNAME)), 181*cdf0e10cSrcweir sPageDescFollowName( SW_RES(STR_PAGEDESC_FOLLOWNAME)), 182*cdf0e10cSrcweir sPageDescName( SW_RES(STR_PAGEDESC_NAME)) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir const sal_uInt16 nCount = FLD_DOCINFO_END - FLD_DOCINFO_BEGIN; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir KeyCode aCode( KEY_SPACE ); 187*cdf0e10cSrcweir KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 ); 188*cdf0e10cSrcweir String aModStr( aModifiedCode.GetName() ); 189*cdf0e10cSrcweir aModStr.SearchAndReplace( aCode.GetName(), String() ); 190*cdf0e10cSrcweir aModStr.SearchAndReplaceAllAscii( "+", String() ); 191*cdf0e10cSrcweir aHyperlinkClick.SearchAndReplaceAllAscii( "%s", aModStr ); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nCount; ++i) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir String* pNew = new SW_RESSTR(FLD_DOCINFO_BEGIN + i); 196*cdf0e10cSrcweir aDocInfoLst.Insert(pNew, aDocInfoLst.Count()); 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir FreeResource(); 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir ShellResource::~ShellResource() 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir if( pAutoFmtNameLst ) 205*cdf0e10cSrcweir delete pAutoFmtNameLst, pAutoFmtNameLst = 0; 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir String ShellResource::GetPageDescName( sal_uInt16 nNo, sal_Bool bIsFirst, sal_Bool bFollow ) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir String sRet( bIsFirst ? sPageDescFirstName 211*cdf0e10cSrcweir : bFollow ? sPageDescFollowName 212*cdf0e10cSrcweir : sPageDescName ); 213*cdf0e10cSrcweir sRet.SearchAndReplaceAscii( "$(ARG1)", String::CreateFromInt32( nNo )); 214*cdf0e10cSrcweir return sRet; 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir SwGlossaries* GetGlossaries() 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir if (!pGlossaries) 221*cdf0e10cSrcweir pGlossaries = new SwGlossaries; 222*cdf0e10cSrcweir return (pGlossaries); 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir sal_Bool HasGlossaryList() 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir return pGlossaryList != 0; 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir SwGlossaryList* GetGlossaryList() 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir if(!pGlossaryList) 233*cdf0e10cSrcweir pGlossaryList = new SwGlossaryList(); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir return pGlossaryList; 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir struct ImpAutoFmtNameListLoader : public Resource 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir ImpAutoFmtNameListLoader( SvStringsDtor& rLst ); 241*cdf0e10cSrcweir }; 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir void ShellResource::_GetAutoFmtNameLst() const 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir SvStringsDtor** ppLst = (SvStringsDtor**)&pAutoFmtNameLst; 246*cdf0e10cSrcweir *ppLst = new SvStringsDtor( STR_AUTOFMTREDL_END ); 247*cdf0e10cSrcweir ImpAutoFmtNameListLoader aTmp( **ppLst ); 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir ImpAutoFmtNameListLoader::ImpAutoFmtNameListLoader( SvStringsDtor& rLst ) 251*cdf0e10cSrcweir : Resource( ResId(RID_SHELLRES_AUTOFMTSTRS, *pSwResMgr) ) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir for( sal_uInt16 n = 0; n < STR_AUTOFMTREDL_END; ++n ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir String* p = new String( ResId( n + 1, *pSwResMgr) ); 256*cdf0e10cSrcweir if(STR_AUTOFMTREDL_TYPO == n) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir #ifdef WNT 259*cdf0e10cSrcweir //fuer Windows Sonderbehandlung, da MS hier ein paar Zeichen im Dialogfont vergessen hat 260*cdf0e10cSrcweir p->SearchAndReplace(C2S("%1"), C2S(",,")); 261*cdf0e10cSrcweir p->SearchAndReplace(C2S("%2"), C2S("''")); 262*cdf0e10cSrcweir #else 263*cdf0e10cSrcweir const SvtSysLocale aSysLocale; 264*cdf0e10cSrcweir const LocaleDataWrapper& rLclD = aSysLocale.GetLocaleData(); 265*cdf0e10cSrcweir //unter richtigen Betriebssystemen funktioniert es auch so 266*cdf0e10cSrcweir p->SearchAndReplace(C2S("%1"), rLclD.getDoubleQuotationMarkStart()); 267*cdf0e10cSrcweir p->SearchAndReplace(C2S("%2"), rLclD.getDoubleQuotationMarkEnd()); 268*cdf0e10cSrcweir #endif 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir rLst.Insert( p, n ); 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir FreeResource(); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir /* -----------------16.09.99 12:28------------------- 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir --------------------------------------------------*/ 277*cdf0e10cSrcweir const String& SwAuthorityFieldType::GetAuthFieldName(ToxAuthorityField eType) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir if(!pAuthFieldNameList) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir pAuthFieldNameList = new SvStringsDtor(AUTH_FIELD_END, 1); 282*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir String* pTmp = new String(SW_RES(STR_AUTH_FIELD_START + i)); 285*cdf0e10cSrcweir pAuthFieldNameList->Insert(pTmp, pAuthFieldNameList->Count()); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir return *pAuthFieldNameList->GetObject( static_cast< sal_uInt16 >(eType) ); 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir /* -----------------16.09.99 12:29------------------- 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir --------------------------------------------------*/ 293*cdf0e10cSrcweir const String& SwAuthorityFieldType::GetAuthTypeName(ToxAuthorityType eType) 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir if(!pAuthFieldTypeList) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir pAuthFieldTypeList = new SvStringsDtor(AUTH_TYPE_END, 1); 298*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < AUTH_TYPE_END; i++) 299*cdf0e10cSrcweir pAuthFieldTypeList->Insert( 300*cdf0e10cSrcweir new String(SW_RES(STR_AUTH_TYPE_START + i)), 301*cdf0e10cSrcweir pAuthFieldTypeList->Count()); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir return *pAuthFieldTypeList->GetObject( static_cast< sal_uInt16 >(eType) ); 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir 308