1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10efeef26fSAndrew Rist * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12efeef26fSAndrew Rist * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19efeef26fSAndrew Rist * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vos/mutex.hxx> 28cdf0e10cSrcweir #include <vcl/image.hxx> 29cdf0e10cSrcweir #include <vcl/virdev.hxx> 30cdf0e10cSrcweir #include <vcl/svapp.hxx> 31cdf0e10cSrcweir #include <vcl/print.hxx> 32cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 33cdf0e10cSrcweir #include <sfx2/sfxbasecontroller.hxx> 34cdf0e10cSrcweir #include <sfx2/docfile.hxx> 350dccdc5dSMichael Stahl #include <sfx2/printer.hxx> 36cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 37cdf0e10cSrcweir #include <toolkit/awt/vclxdevice.hxx> 38cdf0e10cSrcweir #include <cmdid.h> 39cdf0e10cSrcweir #include <swtypes.hxx> 40cdf0e10cSrcweir #include <wdocsh.hxx> 41cdf0e10cSrcweir #include <wrtsh.hxx> 42cdf0e10cSrcweir #include <view.hxx> 43cdf0e10cSrcweir #include <pview.hxx> 44cdf0e10cSrcweir #include <srcview.hxx> 45cdf0e10cSrcweir #include <viewsh.hxx> 46cdf0e10cSrcweir #include <pvprtdat.hxx> 47cdf0e10cSrcweir #include <printdata.hxx> 48cdf0e10cSrcweir #include <svl/stritem.hxx> 49cdf0e10cSrcweir #include <unotxdoc.hxx> 50cdf0e10cSrcweir #include <svl/numuno.hxx> 51cdf0e10cSrcweir #include <fldbas.hxx> 52cdf0e10cSrcweir #include <unotextbodyhf.hxx> 53cdf0e10cSrcweir #include <unotextrange.hxx> 54cdf0e10cSrcweir #include <unotextcursor.hxx> 55cdf0e10cSrcweir #include <unosett.hxx> 56cdf0e10cSrcweir #include <unocoll.hxx> 57cdf0e10cSrcweir #include <unoredlines.hxx> 58cdf0e10cSrcweir #include <unosrch.hxx> 59cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 60cdf0e10cSrcweir #include <sfx2/request.hxx> 61cdf0e10cSrcweir #include <sfx2/objsh.hxx> // SfxObjectShellRef <-> SV_DECL_REF(SfxObjectShell) 62cdf0e10cSrcweir #include <unoprnms.hxx> 63cdf0e10cSrcweir #include <unostyle.hxx> 64cdf0e10cSrcweir #include <unodraw.hxx> 65cdf0e10cSrcweir #include <svl/eitem.hxx> 66cdf0e10cSrcweir #include <pagedesc.hxx> 67cdf0e10cSrcweir #include <svtools/txtcmp.hxx> 68cdf0e10cSrcweir #include <unocrsr.hxx> 69cdf0e10cSrcweir #include <unofield.hxx> 70cdf0e10cSrcweir #include <unoidx.hxx> 71cdf0e10cSrcweir #include <unoflatpara.hxx> 72cdf0e10cSrcweir #include <unotxvw.hxx> 73cdf0e10cSrcweir #include <poolfmt.hxx> 74cdf0e10cSrcweir #include <globdoc.hxx> 75cdf0e10cSrcweir #include <viewopt.hxx> 76cdf0e10cSrcweir #include <unochart.hxx> 77cdf0e10cSrcweir #include <doc.hxx> 78cdf0e10cSrcweir #include <charatr.hxx> 79cdf0e10cSrcweir #include <svx/xmleohlp.hxx> 80cdf0e10cSrcweir #include <globals.hrc> 81cdf0e10cSrcweir #include <unomid.h> 82cdf0e10cSrcweir #include <unotools/printwarningoptions.hxx> 83cdf0e10cSrcweir #include <com/sun/star/util/SearchOptions.hpp> 84cdf0e10cSrcweir #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> 85cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 86cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp> 87cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 88cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp> 89cdf0e10cSrcweir #include <com/sun/star/document/RedlineDisplayType.hpp> 90cdf0e10cSrcweir #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> 91cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 92cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 93cdf0e10cSrcweir #include <com/sun/star/script/XInvocation.hpp> 94cdf0e10cSrcweir #include <com/sun/star/reflection/XIdlClassProvider.hpp> 95cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 96cdf0e10cSrcweir #include <svx/unofill.hxx> 97cdf0e10cSrcweir #include <editeng/unolingu.hxx> 98cdf0e10cSrcweir #include <sfx2/progress.hxx> 99cdf0e10cSrcweir #include <swmodule.hxx> 100cdf0e10cSrcweir #include <docstat.hxx> 101cdf0e10cSrcweir #include <modcfg.hxx> 102cdf0e10cSrcweir #include <ndtxt.hxx> 103cdf0e10cSrcweir #include <utlui.hrc> 104cdf0e10cSrcweir #include <swcont.hxx> 105cdf0e10cSrcweir #include <unodefaults.hxx> 106cdf0e10cSrcweir #include <SwXDocumentSettings.hxx> 107cdf0e10cSrcweir #include <doc.hxx> 108cdf0e10cSrcweir #include <editeng/forbiddencharacterstable.hxx> 109cdf0e10cSrcweir #include <svl/zforlist.hxx> 110cdf0e10cSrcweir #include <drawdoc.hxx> 111cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 112cdf0e10cSrcweir #include <osl/file.hxx> 113cdf0e10cSrcweir #include <comphelper/storagehelper.hxx> 114cdf0e10cSrcweir 115cdf0e10cSrcweir 116cdf0e10cSrcweir // --> FME 2004-06-08 #i12836# enhanced pdf export 117cdf0e10cSrcweir #include <EnhancedPDFExportHelper.hxx> 118cdf0e10cSrcweir // <-- 119cdf0e10cSrcweir #include <numrule.hxx> 120cdf0e10cSrcweir 121cdf0e10cSrcweir ///////////////////////////Modified on Jun. 14th////////////////////////// 122cdf0e10cSrcweir ///////////////////////for getDocumentLanguages/////////////////////////// 123cdf0e10cSrcweir //--> 124cdf0e10cSrcweir #include <editeng/langitem.hxx> 125cdf0e10cSrcweir #include <doc.hxx> 126cdf0e10cSrcweir #include <docary.hxx> //SwCharFmts 127cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 128cdf0e10cSrcweir 129cdf0e10cSrcweir #include <format.hxx> 130cdf0e10cSrcweir #include <charfmt.hxx> //SwCharFmt 131cdf0e10cSrcweir #include <fmtcol.hxx> //SwTxtFmtColl 132cdf0e10cSrcweir #include <unostyle.hxx> //SwAutoStyleFamily 133cdf0e10cSrcweir #include <istyleaccess.hxx> // handling of automatic styles 134cdf0e10cSrcweir 135cdf0e10cSrcweir #include <svl/stylepool.hxx> 136cdf0e10cSrcweir #include <swatrset.hxx> 137cdf0e10cSrcweir #include <view.hxx> 138cdf0e10cSrcweir #include <srcview.hxx> 139cdf0e10cSrcweir 140cdf0e10cSrcweir //#include <com/sun/star/i18n/ScriptType.hpp> 141cdf0e10cSrcweir #include <svtools/langtab.hxx> 142cdf0e10cSrcweir #include <map> 143cdf0e10cSrcweir #include <set> 144cdf0e10cSrcweir #include <vector> 145cdf0e10cSrcweir 146cdf0e10cSrcweir #include <editeng/eeitem.hxx> 147cdf0e10cSrcweir #include <editeng/editeng.hxx> 148cdf0e10cSrcweir #include <svx/svdoutl.hxx> 149cdf0e10cSrcweir #include <svl/languageoptions.hxx> 150cdf0e10cSrcweir #include <svx/svdview.hxx> 151cdf0e10cSrcweir 152cdf0e10cSrcweir // 153cdf0e10cSrcweir //<-- 154cdf0e10cSrcweir using namespace ::com::sun::star; 155cdf0e10cSrcweir using namespace ::com::sun::star::text; 156cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 157cdf0e10cSrcweir using namespace ::com::sun::star::uno; 158cdf0e10cSrcweir using namespace ::com::sun::star::beans; 159cdf0e10cSrcweir using namespace ::com::sun::star::lang; 160cdf0e10cSrcweir using namespace ::com::sun::star::container; 161cdf0e10cSrcweir using namespace ::com::sun::star::document; 162cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 163cdf0e10cSrcweir using ::rtl::OUString; 164cdf0e10cSrcweir using ::osl::FileBase; 165cdf0e10cSrcweir 166cdf0e10cSrcweir /* -----------------------------17.01.01 15:43-------------------------------- 167cdf0e10cSrcweir 168cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 169cdf0e10cSrcweir #define SW_CREATE_DASH_TABLE 0x01 170cdf0e10cSrcweir #define SW_CREATE_GRADIENT_TABLE 0x02 171cdf0e10cSrcweir #define SW_CREATE_HATCH_TABLE 0x03 172cdf0e10cSrcweir #define SW_CREATE_BITMAP_TABLE 0x04 173cdf0e10cSrcweir #define SW_CREATE_TRANSGRADIENT_TABLE 0x05 174cdf0e10cSrcweir #define SW_CREATE_MARKER_TABLE 0x06 175cdf0e10cSrcweir #define SW_CREATE_DRAW_DEFAULTS 0x07 176cdf0e10cSrcweir 177cdf0e10cSrcweir 178cdf0e10cSrcweir /****************************************************************************** 179cdf0e10cSrcweir * 180cdf0e10cSrcweir ******************************************************************************/ 181cdf0e10cSrcweir 182cdf0e10cSrcweir extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst ); 183cdf0e10cSrcweir 184cdf0e10cSrcweir SwPrintUIOptions * lcl_GetPrintUIOptions( 185cdf0e10cSrcweir SwDocShell * pDocShell, 186cdf0e10cSrcweir const SfxViewShell * pView ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir if (!pDocShell) 189cdf0e10cSrcweir return NULL; 190cdf0e10cSrcweir 191cdf0e10cSrcweir const sal_Bool bWebDoc = NULL != dynamic_cast< const SwWebDocShell * >(pDocShell); 192cdf0e10cSrcweir const bool bSwSrcView = NULL != dynamic_cast< const SwSrcView * >(pView); 193cdf0e10cSrcweir const SwView * pSwView = dynamic_cast< const SwView * >(pView); 194cdf0e10cSrcweir const bool bHasSelection = pSwView ? pSwView->HasSelection( sal_False ) : false; // check for any selection, not just text selection 195cdf0e10cSrcweir const bool bHasPostIts = lcl_GetPostIts( pDocShell->GetDoc(), 0 ); 196cdf0e10cSrcweir 197cdf0e10cSrcweir // get default values to use in dialog from documents SwPrintData 198cdf0e10cSrcweir const SwPrintData &rPrintData = pDocShell->GetDoc()->getPrintData(); 199cdf0e10cSrcweir 200cdf0e10cSrcweir return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData ); 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir //////////////////////////////////////////////////////////// 204cdf0e10cSrcweir 205cdf0e10cSrcweir 206cdf0e10cSrcweir SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollName ); 209cdf0e10cSrcweir if( !pColl ) 210cdf0e10cSrcweir { 211cdf0e10cSrcweir sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); 212cdf0e10cSrcweir if( USHRT_MAX != nId ) 213cdf0e10cSrcweir pColl = pDoc->GetTxtCollFromPool( nId ); 214cdf0e10cSrcweir } 215cdf0e10cSrcweir return pColl; 216cdf0e10cSrcweir } 217cdf0e10cSrcweir void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell ) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir // check if the view frame still exists 220cdf0e10cSrcweir SfxViewFrame* pFound = SfxViewFrame::GetFirst( pDocShell, 221cdf0e10cSrcweir sal_False ); 222cdf0e10cSrcweir while(pFound) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir if( pFound == pToClose) 225cdf0e10cSrcweir { 226cdf0e10cSrcweir pToClose->DoClose(); 227cdf0e10cSrcweir break; 228cdf0e10cSrcweir } 229cdf0e10cSrcweir pFound = SfxViewFrame::GetNext( *pFound, 230cdf0e10cSrcweir pDocShell, 231cdf0e10cSrcweir sal_False ); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir /* -----------------------------10.03.00 18:02-------------------------------- 235cdf0e10cSrcweir 236cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 237cdf0e10cSrcweir const Sequence< sal_Int8 > & SwXTextDocument::getUnoTunnelId() 238cdf0e10cSrcweir { 239cdf0e10cSrcweir static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); 240cdf0e10cSrcweir return aSeq; 241cdf0e10cSrcweir } 242cdf0e10cSrcweir /* -----------------------------10.03.00 18:04-------------------------------- 243cdf0e10cSrcweir 244cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 245cdf0e10cSrcweir sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rId ) 246cdf0e10cSrcweir throw(RuntimeException) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir if( rId.getLength() == 16 249cdf0e10cSrcweir && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), 250cdf0e10cSrcweir rId.getConstArray(), 16 ) ) 251cdf0e10cSrcweir { 252cdf0e10cSrcweir return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); 253cdf0e10cSrcweir } 254cdf0e10cSrcweir 255cdf0e10cSrcweir sal_Int64 nRet = SfxBaseModel::getSomething( rId ); 256cdf0e10cSrcweir if ( nRet ) 257cdf0e10cSrcweir return nRet; 258cdf0e10cSrcweir else 259cdf0e10cSrcweir { 260cdf0e10cSrcweir GetNumberFormatter(); 261cdf0e10cSrcweir Any aNumTunnel = xNumFmtAgg->queryAggregation(::getCppuType((Reference<XUnoTunnel>*)0)); 262cdf0e10cSrcweir Reference<XUnoTunnel> xNumTunnel; 263cdf0e10cSrcweir aNumTunnel >>= xNumTunnel; 264cdf0e10cSrcweir if(xNumTunnel.is()) 265cdf0e10cSrcweir return xNumTunnel->getSomething(rId); 266cdf0e10cSrcweir } 267cdf0e10cSrcweir 268cdf0e10cSrcweir return SfxBaseModel::getSomething( rId ); 269cdf0e10cSrcweir } 270cdf0e10cSrcweir /* -----------------------------16.03.00 14:12-------------------------------- 271cdf0e10cSrcweir 272cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 273cdf0e10cSrcweir Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(RuntimeException) 274cdf0e10cSrcweir { 275cdf0e10cSrcweir Any aRet = SwXTextDocumentBaseClass::queryInterface(rType); 276cdf0e10cSrcweir if ( !aRet.hasValue() ) 277cdf0e10cSrcweir aRet = SfxBaseModel::queryInterface(rType); 278cdf0e10cSrcweir if ( !aRet.hasValue() && 279cdf0e10cSrcweir rType == ::getCppuType((Reference<lang::XMultiServiceFactory>*)0)) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir Reference<lang::XMultiServiceFactory> xTmp = this; 282cdf0e10cSrcweir aRet <<= xTmp; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir if ( !aRet.hasValue() 286cdf0e10cSrcweir && rType != ::getCppuType((Reference< com::sun::star::document::XDocumentEventBroadcaster>*)0) 287cdf0e10cSrcweir && rType != ::getCppuType((Reference< com::sun::star::frame::XController>*)0) 288cdf0e10cSrcweir && rType != ::getCppuType((Reference< com::sun::star::frame::XFrame>*)0) 289cdf0e10cSrcweir && rType != ::getCppuType((Reference< com::sun::star::script::XInvocation>*)0) 290cdf0e10cSrcweir && rType != ::getCppuType((Reference< com::sun::star::reflection::XIdlClassProvider>*)0) 291cdf0e10cSrcweir && rType != ::getCppuType((Reference< com::sun::star::beans::XFastPropertySet>*)0) 292cdf0e10cSrcweir && rType != ::getCppuType((Reference< com::sun::star::awt::XWindow>*)0)) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir GetNumberFormatter(); 295cdf0e10cSrcweir if(xNumFmtAgg.is()) 296cdf0e10cSrcweir aRet = xNumFmtAgg->queryAggregation(rType); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir return aRet; 299cdf0e10cSrcweir } 300cdf0e10cSrcweir /* -----------------------------16.03.00 14:12-------------------------------- 301cdf0e10cSrcweir 302cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 303cdf0e10cSrcweir void SAL_CALL SwXTextDocument::acquire()throw() 304cdf0e10cSrcweir { 305cdf0e10cSrcweir SfxBaseModel::acquire(); 306cdf0e10cSrcweir } 307cdf0e10cSrcweir /* -----------------------------16.03.00 14:12-------------------------------- 308cdf0e10cSrcweir 309cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 310cdf0e10cSrcweir void SAL_CALL SwXTextDocument::release()throw() 311cdf0e10cSrcweir { 312cdf0e10cSrcweir SfxBaseModel::release(); 313cdf0e10cSrcweir } 314cdf0e10cSrcweir /* -----------------------------07.12.00 11:37-------------------------------- 315cdf0e10cSrcweir 316cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 317cdf0e10cSrcweir Reference< XAdapter > SwXTextDocument::queryAdapter( ) throw(RuntimeException) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir return SfxBaseModel::queryAdapter(); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir /* -----------------------------16.03.00 14:12-------------------------------- 322cdf0e10cSrcweir 323cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 324cdf0e10cSrcweir Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeException) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir Sequence< uno::Type > aBaseTypes = SfxBaseModel::getTypes(); 327cdf0e10cSrcweir Sequence< uno::Type > aTextTypes = SwXTextDocumentBaseClass::getTypes(); 328cdf0e10cSrcweir 329cdf0e10cSrcweir Sequence< uno::Type > aNumTypes; 330cdf0e10cSrcweir GetNumberFormatter(); 331cdf0e10cSrcweir if(xNumFmtAgg.is()) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir const uno::Type& rProvType = ::getCppuType((Reference <XTypeProvider>*)0); 334cdf0e10cSrcweir Any aNumProv = xNumFmtAgg->queryAggregation(rProvType); 335cdf0e10cSrcweir Reference<XTypeProvider> xNumProv; 336cdf0e10cSrcweir if(aNumProv >>= xNumProv) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir aNumTypes = xNumProv->getTypes(); 339cdf0e10cSrcweir } 340cdf0e10cSrcweir } 341cdf0e10cSrcweir long nIndex = aBaseTypes.getLength(); 342cdf0e10cSrcweir // don't forget the lang::XMultiServiceFactory 343cdf0e10cSrcweir aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 1); 344cdf0e10cSrcweir uno::Type* pBaseTypes = aBaseTypes.getArray(); 345cdf0e10cSrcweir const uno::Type* pTextTypes = aTextTypes.getConstArray(); 346cdf0e10cSrcweir long nPos; 347cdf0e10cSrcweir for(nPos = 0; nPos < aTextTypes.getLength(); nPos++) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir pBaseTypes[nIndex++] = pTextTypes[nPos]; 350cdf0e10cSrcweir } 351cdf0e10cSrcweir const uno::Type* pNumTypes = aNumTypes.getConstArray(); 352cdf0e10cSrcweir for(nPos = 0; nPos < aNumTypes.getLength(); nPos++) 353cdf0e10cSrcweir { 354cdf0e10cSrcweir pBaseTypes[nIndex++] = pNumTypes[nPos]; 355cdf0e10cSrcweir } 356cdf0e10cSrcweir pBaseTypes[nIndex++] = ::getCppuType((Reference<lang::XMultiServiceFactory>*)0); 357cdf0e10cSrcweir return aBaseTypes; 358cdf0e10cSrcweir } 359cdf0e10cSrcweir /*-- 18.12.98 11:52:59--------------------------------------------------- 360cdf0e10cSrcweir 361cdf0e10cSrcweir -----------------------------------------------------------------------*/ 362cdf0e10cSrcweir SwXTextDocument::SwXTextDocument(SwDocShell* pShell) : 363cdf0e10cSrcweir SfxBaseModel(pShell), 364cdf0e10cSrcweir 365cdf0e10cSrcweir aRefreshCont ( static_cast < XTextDocument* > ( this ) ), 366cdf0e10cSrcweir 367cdf0e10cSrcweir pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_DOCUMENT)), 368cdf0e10cSrcweir 369cdf0e10cSrcweir pDocShell(pShell), 370cdf0e10cSrcweir 371cdf0e10cSrcweir bObjectValid(pShell != 0), 372cdf0e10cSrcweir 373cdf0e10cSrcweir pDrawPage(0), 374cdf0e10cSrcweir pxXDrawPage(0), 375cdf0e10cSrcweir 376cdf0e10cSrcweir pxXNumberingRules(0), 377cdf0e10cSrcweir pxXFootnotes(0), 378cdf0e10cSrcweir pxXFootnoteSettings(0), 379cdf0e10cSrcweir pxXEndnotes(0), 380cdf0e10cSrcweir pxXEndnoteSettings(0), 381cdf0e10cSrcweir pxXReferenceMarks(0), 382cdf0e10cSrcweir pxXTextFieldTypes(0), 383cdf0e10cSrcweir pxXTextFieldMasters(0), 384cdf0e10cSrcweir pxXTextSections(0), 385cdf0e10cSrcweir pxXBookmarks(0), 386cdf0e10cSrcweir pxXTextTables(0), 387cdf0e10cSrcweir pxXTextFrames(0), 388cdf0e10cSrcweir pxXGraphicObjects(0), 389cdf0e10cSrcweir pxXEmbeddedObjects(0), 390cdf0e10cSrcweir pxXStyleFamilies(0), 391cdf0e10cSrcweir pxXAutoStyles(0), 392cdf0e10cSrcweir pxXChapterNumbering(0), 393cdf0e10cSrcweir pxXDocumentIndexes(0), 394cdf0e10cSrcweir 395cdf0e10cSrcweir pxXLineNumberingProperties(0), 396cdf0e10cSrcweir pxLinkTargetSupplier(0), 397cdf0e10cSrcweir pxXRedlines(0), 398cdf0e10cSrcweir m_pHiddenViewFrame(0), 399cdf0e10cSrcweir m_pPrintUIOptions( NULL ), 4000dccdc5dSMichael Stahl m_pRenderData( NULL ), 4010dccdc5dSMichael Stahl // --> OD #i117783# 4020dccdc5dSMichael Stahl bApplyPagePrintSettingsFromXPagePrintable( sal_False ) 4030dccdc5dSMichael Stahl // <-- 404cdf0e10cSrcweir { 405cdf0e10cSrcweir } 406cdf0e10cSrcweir /*-- 18.12.98 11:53:00--------------------------------------------------- 407cdf0e10cSrcweir 408cdf0e10cSrcweir -----------------------------------------------------------------------*/ 409cdf0e10cSrcweir SwXTextDocument::~SwXTextDocument() 410cdf0e10cSrcweir { 411cdf0e10cSrcweir InitNewDoc(); 412cdf0e10cSrcweir if(xNumFmtAgg.is()) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir Reference< XInterface > x0; 415cdf0e10cSrcweir xNumFmtAgg->setDelegator(x0); 416cdf0e10cSrcweir xNumFmtAgg = 0; 417cdf0e10cSrcweir } 418cdf0e10cSrcweir delete m_pPrintUIOptions; 419cdf0e10cSrcweir delete m_pRenderData; 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir 423cdf0e10cSrcweir /*-- 18.12.98 11:55:08--------------------------------------------------- 424cdf0e10cSrcweir 425cdf0e10cSrcweir -----------------------------------------------------------------------*/ 426cdf0e10cSrcweir /* -----------------18.12.98 12:49------------------- 427cdf0e10cSrcweir * 428cdf0e10cSrcweir * --------------------------------------------------*/ 429cdf0e10cSrcweir SwXDocumentPropertyHelper * SwXTextDocument::GetPropertyHelper () 430cdf0e10cSrcweir { 431cdf0e10cSrcweir if(!xPropertyHelper.is()) 432cdf0e10cSrcweir { 433cdf0e10cSrcweir pPropertyHelper = new SwXDocumentPropertyHelper(*pDocShell->GetDoc()); 434cdf0e10cSrcweir xPropertyHelper = (cppu::OWeakObject*)pPropertyHelper; 435cdf0e10cSrcweir } 436cdf0e10cSrcweir return pPropertyHelper; 437cdf0e10cSrcweir } 438cdf0e10cSrcweir void SwXTextDocument::GetNumberFormatter() 439cdf0e10cSrcweir { 440cdf0e10cSrcweir if(IsValid()) 441cdf0e10cSrcweir { 442cdf0e10cSrcweir if(!xNumFmtAgg.is()) 443cdf0e10cSrcweir { 444cdf0e10cSrcweir if ( pDocShell->GetDoc() ) 445cdf0e10cSrcweir { 446cdf0e10cSrcweir SvNumberFormatsSupplierObj* pNumFmt = new SvNumberFormatsSupplierObj( 447cdf0e10cSrcweir pDocShell->GetDoc()->GetNumberFormatter( sal_True )); 448cdf0e10cSrcweir Reference< util::XNumberFormatsSupplier > xTmp = pNumFmt; 449cdf0e10cSrcweir xNumFmtAgg = Reference< XAggregation >(xTmp, UNO_QUERY); 450cdf0e10cSrcweir } 451cdf0e10cSrcweir if(xNumFmtAgg.is()) 452cdf0e10cSrcweir xNumFmtAgg->setDelegator((cppu::OWeakObject*)(SwXTextDocumentBaseClass*)this); 453cdf0e10cSrcweir } 454cdf0e10cSrcweir else 455cdf0e10cSrcweir { 456cdf0e10cSrcweir const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0); 457cdf0e10cSrcweir Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType); 458cdf0e10cSrcweir SvNumberFormatsSupplierObj* pNumFmt = 0; 459cdf0e10cSrcweir Reference< XUnoTunnel > xNumTunnel; 460cdf0e10cSrcweir if(aNumTunnel >>= xNumTunnel) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir pNumFmt = reinterpret_cast<SvNumberFormatsSupplierObj*>( 463cdf0e10cSrcweir xNumTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); 464cdf0e10cSrcweir 465cdf0e10cSrcweir } 466cdf0e10cSrcweir DBG_ASSERT(pNumFmt, "No number formatter available"); 467cdf0e10cSrcweir if(!pNumFmt->GetNumberFormatter()) 468cdf0e10cSrcweir pNumFmt->SetNumberFormatter(pDocShell->GetDoc()->GetNumberFormatter( sal_True )); 469cdf0e10cSrcweir } 470cdf0e10cSrcweir } 471cdf0e10cSrcweir } 472cdf0e10cSrcweir /*-- 18.12.98 11:55:11--------------------------------------------------- 473cdf0e10cSrcweir 474cdf0e10cSrcweir -----------------------------------------------------------------------*/ 475cdf0e10cSrcweir Reference< XText > SwXTextDocument::getText(void) throw( RuntimeException ) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 478cdf0e10cSrcweir if(!IsValid()) 479cdf0e10cSrcweir throw RuntimeException(); 480cdf0e10cSrcweir if(!xBodyText.is()) 481cdf0e10cSrcweir { 482cdf0e10cSrcweir pBodyText = new SwXBodyText(pDocShell->GetDoc()); 483cdf0e10cSrcweir xBodyText = pBodyText; 484cdf0e10cSrcweir } 485cdf0e10cSrcweir return xBodyText; 486cdf0e10cSrcweir } 487cdf0e10cSrcweir /*-- 18.12.98 11:55:11--------------------------------------------------- 488cdf0e10cSrcweir 489cdf0e10cSrcweir -----------------------------------------------------------------------*/ 490cdf0e10cSrcweir void SwXTextDocument::reformat(void) throw( RuntimeException ) 491cdf0e10cSrcweir { 492cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 493cdf0e10cSrcweir if(!IsValid()) 494cdf0e10cSrcweir throw RuntimeException(); 495cdf0e10cSrcweir } 496cdf0e10cSrcweir /*-- 18.12.98 11:55:16--------------------------------------------------- 497cdf0e10cSrcweir 498cdf0e10cSrcweir -----------------------------------------------------------------------*/ 499cdf0e10cSrcweir void SwXTextDocument::lockControllers(void) throw( RuntimeException ) 500cdf0e10cSrcweir { 501cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 502cdf0e10cSrcweir if(IsValid()) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir UnoActionContext* pContext = new UnoActionContext(pDocShell->GetDoc()); 505cdf0e10cSrcweir aActionArr.Insert(pContext, 0); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir else 508cdf0e10cSrcweir throw RuntimeException(); 509cdf0e10cSrcweir } 510cdf0e10cSrcweir /*-- 18.12.98 11:55:16--------------------------------------------------- 511cdf0e10cSrcweir 512cdf0e10cSrcweir -----------------------------------------------------------------------*/ 513cdf0e10cSrcweir void SwXTextDocument::unlockControllers(void) throw( RuntimeException ) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 516cdf0e10cSrcweir if(aActionArr.Count()) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir UnoActionContext* pContext = aActionArr.GetObject(0); 519cdf0e10cSrcweir aActionArr.Remove(0); 520cdf0e10cSrcweir delete pContext; 521cdf0e10cSrcweir } 522cdf0e10cSrcweir else 523cdf0e10cSrcweir throw RuntimeException(); 524cdf0e10cSrcweir } 525cdf0e10cSrcweir /*-- 18.12.98 11:55:17--------------------------------------------------- 526cdf0e10cSrcweir 527cdf0e10cSrcweir -----------------------------------------------------------------------*/ 528cdf0e10cSrcweir sal_Bool SwXTextDocument::hasControllersLocked(void) throw( RuntimeException ) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 531cdf0e10cSrcweir return aActionArr.Count() > 0; 532cdf0e10cSrcweir } 533cdf0e10cSrcweir /*-- 18.12.98 13:12:23--------------------------------------------------- 534cdf0e10cSrcweir 535cdf0e10cSrcweir -----------------------------------------------------------------------*/ 536cdf0e10cSrcweir Reference< frame::XController > SwXTextDocument::getCurrentController(void) throw( RuntimeException ) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir return SfxBaseModel::getCurrentController(); 539cdf0e10cSrcweir } 540cdf0e10cSrcweir /*-- 18.12.98 13:12:24--------------------------------------------------- 541cdf0e10cSrcweir 542cdf0e10cSrcweir -----------------------------------------------------------------------*/ 543cdf0e10cSrcweir void SwXTextDocument::setCurrentController(const Reference< frame::XController > & xController) 544cdf0e10cSrcweir throw( NoSuchElementException, RuntimeException ) 545cdf0e10cSrcweir { 546cdf0e10cSrcweir SfxBaseModel::setCurrentController(xController); 547cdf0e10cSrcweir } 548cdf0e10cSrcweir /* -----------------27.01.99 11:48------------------- 549cdf0e10cSrcweir * 550cdf0e10cSrcweir * --------------------------------------------------*/ 551cdf0e10cSrcweir Reference< XInterface > SwXTextDocument::getCurrentSelection() throw( RuntimeException ) 552cdf0e10cSrcweir { 553cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 554cdf0e10cSrcweir Reference< XInterface > xRef; 555cdf0e10cSrcweir if(IsValid()) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir 558cdf0e10cSrcweir const TypeId aTypeId = TYPE(SwView); 559cdf0e10cSrcweir SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId); 560cdf0e10cSrcweir while(pView && pView->GetObjectShell() != pDocShell) 561cdf0e10cSrcweir { 562cdf0e10cSrcweir pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId); 563cdf0e10cSrcweir } 564cdf0e10cSrcweir if(pView) 565cdf0e10cSrcweir { 566cdf0e10cSrcweir Any aRef = pView->GetUNOObject()->getSelection(); 567cdf0e10cSrcweir aRef >>= xRef; 568cdf0e10cSrcweir } 569cdf0e10cSrcweir } 570cdf0e10cSrcweir return xRef; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir 573cdf0e10cSrcweir /*-- 18.12.98 13:12:24--------------------------------------------------- 574cdf0e10cSrcweir 575cdf0e10cSrcweir -----------------------------------------------------------------------*/ 576cdf0e10cSrcweir sal_Bool SwXTextDocument::attachResource(const OUString& aURL, const Sequence< beans::PropertyValue >& aArgs) 577cdf0e10cSrcweir throw( RuntimeException ) 578cdf0e10cSrcweir { 579cdf0e10cSrcweir return SfxBaseModel::attachResource(aURL, aArgs); 580cdf0e10cSrcweir } 581cdf0e10cSrcweir /*-- 18.12.98 13:12:24--------------------------------------------------- 582cdf0e10cSrcweir 583cdf0e10cSrcweir -----------------------------------------------------------------------*/ 584cdf0e10cSrcweir OUString SwXTextDocument::getURL(void) throw( RuntimeException ) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir return SfxBaseModel::getURL(); 587cdf0e10cSrcweir } 588cdf0e10cSrcweir /*-- 18.12.98 13:12:24--------------------------------------------------- 589cdf0e10cSrcweir 590cdf0e10cSrcweir -----------------------------------------------------------------------*/ 591cdf0e10cSrcweir Sequence< beans::PropertyValue > SwXTextDocument::getArgs(void) throw( RuntimeException ) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir return SfxBaseModel::getArgs(); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir /*-- 18.12.98 13:12:24--------------------------------------------------- 596cdf0e10cSrcweir 597cdf0e10cSrcweir -----------------------------------------------------------------------*/ 598cdf0e10cSrcweir void SwXTextDocument::connectController(const Reference< frame::XController > & xController) throw( RuntimeException ) 599cdf0e10cSrcweir { 600cdf0e10cSrcweir SfxBaseModel::connectController(xController); 601cdf0e10cSrcweir } 602cdf0e10cSrcweir /*-- 18.12.98 13:12:25--------------------------------------------------- 603cdf0e10cSrcweir 604cdf0e10cSrcweir -----------------------------------------------------------------------*/ 605cdf0e10cSrcweir void SwXTextDocument::disconnectController(const Reference< frame::XController > & xController) throw( RuntimeException ) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir SfxBaseModel::disconnectController(xController); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir /*-- 18.12.98 13:12:25--------------------------------------------------- 610cdf0e10cSrcweir 611cdf0e10cSrcweir -----------------------------------------------------------------------*/ 612cdf0e10cSrcweir void SwXTextDocument::dispose(void) throw( RuntimeException ) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir SfxBaseModel::dispose(); 615cdf0e10cSrcweir } 616cdf0e10cSrcweir /*-- 10.05.2005 14:14:39--------------------------------------------------- 617cdf0e10cSrcweir 618cdf0e10cSrcweir -----------------------------------------------------------------------*/ 619cdf0e10cSrcweir void SwXTextDocument::close( sal_Bool bDeliverOwnership ) throw( util::CloseVetoException, RuntimeException ) 620cdf0e10cSrcweir { 621*9d3b3ce2SOliver-Rainer Wittmann if ( IsValid() && m_pHiddenViewFrame ) 622*9d3b3ce2SOliver-Rainer Wittmann { 623*9d3b3ce2SOliver-Rainer Wittmann ASSERT( false, "<SwXTextDocument::close(..)> - rendering data not cleaned up???" ); 624cdf0e10cSrcweir lcl_DisposeView( m_pHiddenViewFrame, pDocShell); 625*9d3b3ce2SOliver-Rainer Wittmann m_pHiddenViewFrame = 0; 626*9d3b3ce2SOliver-Rainer Wittmann // prevent crash described in #i108805 627*9d3b3ce2SOliver-Rainer Wittmann SfxItemSet *pSet = pDocShell->GetMedium()->GetItemSet(); 628*9d3b3ce2SOliver-Rainer Wittmann pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) ); 629*9d3b3ce2SOliver-Rainer Wittmann } 630*9d3b3ce2SOliver-Rainer Wittmann 631cdf0e10cSrcweir SfxBaseModel::close(bDeliverOwnership); 632cdf0e10cSrcweir } 633cdf0e10cSrcweir /*-- 18.12.98 13:12:25--------------------------------------------------- 634cdf0e10cSrcweir 635cdf0e10cSrcweir -----------------------------------------------------------------------*/ 636cdf0e10cSrcweir void SwXTextDocument::addEventListener(const Reference< lang::XEventListener > & aListener) throw( RuntimeException ) 637cdf0e10cSrcweir { 638cdf0e10cSrcweir SfxBaseModel::addEventListener(aListener); 639cdf0e10cSrcweir } 640cdf0e10cSrcweir /*-- 18.12.98 13:12:26--------------------------------------------------- 641cdf0e10cSrcweir 642cdf0e10cSrcweir -----------------------------------------------------------------------*/ 643cdf0e10cSrcweir void SwXTextDocument::removeEventListener(const Reference< lang::XEventListener > & aListener) throw( RuntimeException ) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir SfxBaseModel::removeEventListener(aListener); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir 648cdf0e10cSrcweir /*-- 18.12.98 11:55:19--------------------------------------------------- 649cdf0e10cSrcweir 650cdf0e10cSrcweir -----------------------------------------------------------------------*/ 651cdf0e10cSrcweir Reference< XPropertySet > SwXTextDocument::getLineNumberingProperties(void) 652cdf0e10cSrcweir throw( RuntimeException ) 653cdf0e10cSrcweir { 654cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 655cdf0e10cSrcweir if(IsValid()) 656cdf0e10cSrcweir { 657cdf0e10cSrcweir if(!pxXLineNumberingProperties) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir pxXLineNumberingProperties = new Reference<XPropertySet>; 660cdf0e10cSrcweir (*pxXLineNumberingProperties) = new SwXLineNumberingProperties(pDocShell->GetDoc()); 661cdf0e10cSrcweir } 662cdf0e10cSrcweir } 663cdf0e10cSrcweir else 664cdf0e10cSrcweir throw RuntimeException(); 665cdf0e10cSrcweir return *pxXLineNumberingProperties; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir /*-- 18.12.98 11:55:20--------------------------------------------------- 668cdf0e10cSrcweir 669cdf0e10cSrcweir -----------------------------------------------------------------------*/ 670cdf0e10cSrcweir Reference< XIndexReplace > SwXTextDocument::getChapterNumberingRules(void) 671cdf0e10cSrcweir throw( RuntimeException ) 672cdf0e10cSrcweir { 673cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 674cdf0e10cSrcweir if(!IsValid()) 675cdf0e10cSrcweir throw RuntimeException(); 676cdf0e10cSrcweir if(!pxXChapterNumbering) 677cdf0e10cSrcweir { 678cdf0e10cSrcweir pxXChapterNumbering = new Reference< XIndexReplace > ; 679cdf0e10cSrcweir *pxXChapterNumbering = new SwXChapterNumbering(*pDocShell); 680cdf0e10cSrcweir } 681cdf0e10cSrcweir return *pxXChapterNumbering; 682cdf0e10cSrcweir } 683cdf0e10cSrcweir 684cdf0e10cSrcweir Reference< XIndexAccess > SwXTextDocument::getNumberingRules(void) throw( RuntimeException ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 687cdf0e10cSrcweir if(!IsValid()) 688cdf0e10cSrcweir throw RuntimeException(); 689cdf0e10cSrcweir if(!pxXNumberingRules ) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXNumberingRules = new Reference< XIndexAccess > ; 692cdf0e10cSrcweir *pxXNumberingRules = new SwXNumberingRulesCollection( pDocShell->GetDoc() ); 693cdf0e10cSrcweir } 694cdf0e10cSrcweir return *pxXNumberingRules; 695cdf0e10cSrcweir } 696cdf0e10cSrcweir 697cdf0e10cSrcweir /*-- 18.12.98 11:55:21--------------------------------------------------- 698cdf0e10cSrcweir 699cdf0e10cSrcweir -----------------------------------------------------------------------*/ 700cdf0e10cSrcweir Reference< XIndexAccess > SwXTextDocument::getFootnotes(void) throw( RuntimeException ) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 703cdf0e10cSrcweir if(!IsValid()) 704cdf0e10cSrcweir throw RuntimeException(); 705cdf0e10cSrcweir if(!pxXFootnotes) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXFootnotes = new Reference< XIndexAccess > ; 708cdf0e10cSrcweir *pxXFootnotes = new SwXFootnotes(sal_False, pDocShell->GetDoc()); 709cdf0e10cSrcweir } 710cdf0e10cSrcweir return *pxXFootnotes; 711cdf0e10cSrcweir } 712cdf0e10cSrcweir /*-- 18.12.98 11:55:21--------------------------------------------------- 713cdf0e10cSrcweir 714cdf0e10cSrcweir -----------------------------------------------------------------------*/ 715cdf0e10cSrcweir Reference< XPropertySet > SAL_CALL 716cdf0e10cSrcweir SwXTextDocument::getFootnoteSettings(void) throw( RuntimeException ) 717cdf0e10cSrcweir { 718cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 719cdf0e10cSrcweir if(!IsValid()) 720cdf0e10cSrcweir throw RuntimeException(); 721cdf0e10cSrcweir if(!pxXFootnoteSettings) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXFootnoteSettings = new Reference< XPropertySet > ; 724cdf0e10cSrcweir *pxXFootnoteSettings = new SwXFootnoteProperties(pDocShell->GetDoc()); 725cdf0e10cSrcweir } 726cdf0e10cSrcweir return *pxXFootnoteSettings; 727cdf0e10cSrcweir } 728cdf0e10cSrcweir /*-- 18.12.98 11:55:21--------------------------------------------------- 729cdf0e10cSrcweir 730cdf0e10cSrcweir -----------------------------------------------------------------------*/ 731cdf0e10cSrcweir Reference< XIndexAccess > SwXTextDocument::getEndnotes(void) throw( RuntimeException ) 732cdf0e10cSrcweir { 733cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 734cdf0e10cSrcweir if(!IsValid()) 735cdf0e10cSrcweir throw RuntimeException(); 736cdf0e10cSrcweir if(!pxXEndnotes) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXEndnotes = new Reference< XIndexAccess > ; 739cdf0e10cSrcweir *pxXEndnotes = new SwXFootnotes(sal_True, pDocShell->GetDoc()); 740cdf0e10cSrcweir } 741cdf0e10cSrcweir return *pxXEndnotes; 742cdf0e10cSrcweir } 743cdf0e10cSrcweir /*-- 18.12.98 11:55:22--------------------------------------------------- 744cdf0e10cSrcweir 745cdf0e10cSrcweir -----------------------------------------------------------------------*/ 746cdf0e10cSrcweir Reference< XPropertySet > SwXTextDocument::getEndnoteSettings(void) throw( RuntimeException ) 747cdf0e10cSrcweir { 748cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 749cdf0e10cSrcweir if(!IsValid()) 750cdf0e10cSrcweir throw RuntimeException(); 751cdf0e10cSrcweir if(!pxXEndnoteSettings) 752cdf0e10cSrcweir { 753cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXEndnoteSettings = new Reference< XPropertySet > ; 754cdf0e10cSrcweir *pxXEndnoteSettings = new SwXEndnoteProperties(pDocShell->GetDoc()); 755cdf0e10cSrcweir } 756cdf0e10cSrcweir return *pxXEndnoteSettings; 757cdf0e10cSrcweir } 758cdf0e10cSrcweir /*-- 18.12.98 11:55:22--------------------------------------------------- 759cdf0e10cSrcweir 760cdf0e10cSrcweir -----------------------------------------------------------------------*/ 761cdf0e10cSrcweir Reference< util::XReplaceDescriptor > SwXTextDocument::createReplaceDescriptor(void) 762cdf0e10cSrcweir throw( RuntimeException ) 763cdf0e10cSrcweir { 764cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 765cdf0e10cSrcweir Reference< util::XReplaceDescriptor > xRet = new SwXTextSearch; 766cdf0e10cSrcweir return xRet; 767cdf0e10cSrcweir } 768cdf0e10cSrcweir /* -----------------26.02.99 15:52------------------- 769cdf0e10cSrcweir * 770cdf0e10cSrcweir * --------------------------------------------------*/ 771cdf0e10cSrcweir SwUnoCrsr* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCrsr) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir getText(); 774cdf0e10cSrcweir XText *const pText = xBodyText.get(); 775cdf0e10cSrcweir SwXBodyText* pBText = (SwXBodyText*)pText; 776cdf0e10cSrcweir SwXTextCursor *const pXTextCursor = pBText->CreateTextCursor(true); 777cdf0e10cSrcweir xCrsr.set( static_cast<text::XWordCursor*>(pXTextCursor) ); 778cdf0e10cSrcweir 779cdf0e10cSrcweir SwUnoCrsr *const pUnoCrsr = pXTextCursor->GetCursor(); 780cdf0e10cSrcweir pUnoCrsr->SetRemainInSection(sal_False); 781cdf0e10cSrcweir return pUnoCrsr; 782cdf0e10cSrcweir } 783cdf0e10cSrcweir 784cdf0e10cSrcweir /*-- 18.12.98 11:55:22--------------------------------------------------- 785cdf0e10cSrcweir 786cdf0e10cSrcweir -----------------------------------------------------------------------*/ 787cdf0e10cSrcweir sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > & xDesc) 788cdf0e10cSrcweir throw( RuntimeException ) 789cdf0e10cSrcweir { 790cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 791cdf0e10cSrcweir Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY); 792cdf0e10cSrcweir if(!IsValid() || !xDescTunnel.is() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId())) 793cdf0e10cSrcweir throw RuntimeException(); 794cdf0e10cSrcweir 795cdf0e10cSrcweir Reference< XTextCursor > xCrsr; 796cdf0e10cSrcweir SwUnoCrsr* pUnoCrsr = CreateCursorForSearch(xCrsr); 797cdf0e10cSrcweir 798cdf0e10cSrcweir const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>( 799cdf0e10cSrcweir xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId())); 800cdf0e10cSrcweir 801cdf0e10cSrcweir int eRanges(FND_IN_BODY|FND_IN_SELALL); 802cdf0e10cSrcweir 803cdf0e10cSrcweir util::SearchOptions aSearchOpt; 804cdf0e10cSrcweir pSearch->FillSearchOptions( aSearchOpt ); 805cdf0e10cSrcweir 806cdf0e10cSrcweir SwDocPositions eStart = pSearch->bBack ? DOCPOS_END : DOCPOS_START; 807cdf0e10cSrcweir SwDocPositions eEnd = pSearch->bBack ? DOCPOS_START : DOCPOS_END; 808cdf0e10cSrcweir 809cdf0e10cSrcweir // Suche soll ueberall stattfinden 810cdf0e10cSrcweir pUnoCrsr->SetRemainInSection(sal_False); 811cdf0e10cSrcweir sal_uInt32 nResult; 812cdf0e10cSrcweir UnoActionContext aContext(pDocShell->GetDoc()); 813cdf0e10cSrcweir //try attribute search first 814cdf0e10cSrcweir if(pSearch->HasSearchAttributes()||pSearch->HasReplaceAttributes()) 815cdf0e10cSrcweir { 816cdf0e10cSrcweir SfxItemSet aSearch(pDocShell->GetDoc()->GetAttrPool(), 817cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_END-1, 818cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END-1, 819cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1, 820cdf0e10cSrcweir 0); 821cdf0e10cSrcweir SfxItemSet aReplace(pDocShell->GetDoc()->GetAttrPool(), 822cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_END-1, 823cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END-1, 824cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1, 825cdf0e10cSrcweir 0); 826cdf0e10cSrcweir pSearch->FillSearchItemSet(aSearch); 827cdf0e10cSrcweir pSearch->FillReplaceItemSet(aReplace); 828cdf0e10cSrcweir sal_Bool bCancel; 829cdf0e10cSrcweir nResult = (sal_Int32)pUnoCrsr->Find( aSearch, !pSearch->bStyles, 830cdf0e10cSrcweir eStart, eEnd, bCancel, 831cdf0e10cSrcweir (FindRanges)eRanges, 832cdf0e10cSrcweir pSearch->sSearchText.Len() ? &aSearchOpt : 0, 833cdf0e10cSrcweir &aReplace ); 834cdf0e10cSrcweir } 835cdf0e10cSrcweir else if(pSearch->bStyles) 836cdf0e10cSrcweir { 837cdf0e10cSrcweir SwTxtFmtColl *pSearchColl = lcl_GetParaStyle(pSearch->sSearchText, pUnoCrsr->GetDoc()); 838cdf0e10cSrcweir SwTxtFmtColl *pReplaceColl = lcl_GetParaStyle(pSearch->sReplaceText, pUnoCrsr->GetDoc());; 839cdf0e10cSrcweir 840cdf0e10cSrcweir sal_Bool bCancel; 841cdf0e10cSrcweir nResult = pUnoCrsr->Find( *pSearchColl, 842cdf0e10cSrcweir eStart, eEnd, bCancel, 843cdf0e10cSrcweir (FindRanges)eRanges, pReplaceColl ); 844cdf0e10cSrcweir 845cdf0e10cSrcweir } 846cdf0e10cSrcweir else 847cdf0e10cSrcweir { 848cdf0e10cSrcweir //todo/mba: assuming that notes should be omitted 849cdf0e10cSrcweir sal_Bool bSearchInNotes = sal_False; 850cdf0e10cSrcweir sal_Bool bCancel; 851cdf0e10cSrcweir nResult = pUnoCrsr->Find( aSearchOpt, bSearchInNotes, 852cdf0e10cSrcweir eStart, eEnd, bCancel, 853cdf0e10cSrcweir (FindRanges)eRanges, 854cdf0e10cSrcweir sal_True ); 855cdf0e10cSrcweir } 856cdf0e10cSrcweir return (sal_Int32)nResult; 857cdf0e10cSrcweir 858cdf0e10cSrcweir } 859cdf0e10cSrcweir /*-- 18.12.98 11:55:22--------------------------------------------------- 860cdf0e10cSrcweir 861cdf0e10cSrcweir -----------------------------------------------------------------------*/ 862cdf0e10cSrcweir Reference< util::XSearchDescriptor > SwXTextDocument::createSearchDescriptor(void) 863cdf0e10cSrcweir throw( RuntimeException ) 864cdf0e10cSrcweir { 865cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 866cdf0e10cSrcweir Reference< util::XSearchDescriptor > xRet = new SwXTextSearch; 867cdf0e10cSrcweir return xRet; 868cdf0e10cSrcweir 869cdf0e10cSrcweir } 870cdf0e10cSrcweir /* -----------------26.02.99 16:08------------------- 871cdf0e10cSrcweir * wird fuer findAll/First/Next verwendet 872cdf0e10cSrcweir * --------------------------------------------------*/ 873cdf0e10cSrcweir SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > & xDesc, 874cdf0e10cSrcweir Reference< XTextCursor > & xCrsr, sal_Bool bAll, 875cdf0e10cSrcweir sal_Int32& nResult, 876cdf0e10cSrcweir Reference< XInterface > xLastResult) 877cdf0e10cSrcweir { 878cdf0e10cSrcweir Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY); 879cdf0e10cSrcweir if(!IsValid() || !xDescTunnel.is() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId())) 880cdf0e10cSrcweir return 0; 881cdf0e10cSrcweir 882cdf0e10cSrcweir SwUnoCrsr* pUnoCrsr = CreateCursorForSearch(xCrsr); 883cdf0e10cSrcweir const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>( 884cdf0e10cSrcweir xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId())); 885cdf0e10cSrcweir 886cdf0e10cSrcweir sal_Bool bParentInExtra = sal_False; 887cdf0e10cSrcweir if(xLastResult.is()) 888cdf0e10cSrcweir { 889cdf0e10cSrcweir Reference<XUnoTunnel> xCursorTunnel( xLastResult, UNO_QUERY); 890cdf0e10cSrcweir OTextCursorHelper* pPosCrsr = 0; 891cdf0e10cSrcweir if(xCursorTunnel.is()) 892cdf0e10cSrcweir { 893cdf0e10cSrcweir pPosCrsr = reinterpret_cast<OTextCursorHelper*>(xCursorTunnel->getSomething( 894cdf0e10cSrcweir OTextCursorHelper::getUnoTunnelId())); 895cdf0e10cSrcweir } 896cdf0e10cSrcweir SwPaM* pCrsr = pPosCrsr ? pPosCrsr->GetPaM() : 0; 897cdf0e10cSrcweir if(pCrsr) 898cdf0e10cSrcweir { 899cdf0e10cSrcweir *pUnoCrsr->GetPoint() = *pCrsr->End(); 900cdf0e10cSrcweir pUnoCrsr->DeleteMark(); 901cdf0e10cSrcweir } 902cdf0e10cSrcweir else 903cdf0e10cSrcweir { 904cdf0e10cSrcweir SwXTextRange* pRange = 0; 905cdf0e10cSrcweir if(xCursorTunnel.is()) 906cdf0e10cSrcweir { 907cdf0e10cSrcweir pRange = reinterpret_cast<SwXTextRange*>(xCursorTunnel->getSomething( 908cdf0e10cSrcweir SwXTextRange::getUnoTunnelId())); 909cdf0e10cSrcweir } 910cdf0e10cSrcweir if(!pRange) 911cdf0e10cSrcweir return 0; 912cdf0e10cSrcweir pRange->GetPositions(*pUnoCrsr); 913cdf0e10cSrcweir if(pUnoCrsr->HasMark()) 914cdf0e10cSrcweir { 915cdf0e10cSrcweir if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark()) 916cdf0e10cSrcweir pUnoCrsr->Exchange(); 917cdf0e10cSrcweir pUnoCrsr->DeleteMark(); 918cdf0e10cSrcweir } 919cdf0e10cSrcweir } 920cdf0e10cSrcweir const SwNode* pRangeNode = pUnoCrsr->GetNode(); 921cdf0e10cSrcweir bParentInExtra = pRangeNode->FindFlyStartNode() || 922cdf0e10cSrcweir pRangeNode->FindFootnoteStartNode() || 923cdf0e10cSrcweir pRangeNode->FindHeaderStartNode() || 924cdf0e10cSrcweir pRangeNode->FindFooterStartNode() ; 925cdf0e10cSrcweir } 926cdf0e10cSrcweir 927cdf0e10cSrcweir util::SearchOptions aSearchOpt; 928cdf0e10cSrcweir pSearch->FillSearchOptions( aSearchOpt ); 929cdf0e10cSrcweir 930cdf0e10cSrcweir /* 931cdf0e10cSrcweir * folgende Kombinationen sind erlaubt: 932cdf0e10cSrcweir * - suche einen im Body: -> FND_IN_BODY 933cdf0e10cSrcweir * - suche alle im Body: -> FND_IN_BODYONLY | FND_IN_SELALL 934cdf0e10cSrcweir * - suche in Selectionen: einen / alle -> FND_IN_SEL [ | FND_IN_SELALL ] 935cdf0e10cSrcweir * - suche im nicht Body: einen / alle -> FND_IN_OTHER [ | FND_IN_SELALL ] 936cdf0e10cSrcweir * - suche ueberall alle: -> FND_IN_SELALL 937cdf0e10cSrcweir */ 938cdf0e10cSrcweir int eRanges(FND_IN_BODY); 939cdf0e10cSrcweir if(bParentInExtra) 940cdf0e10cSrcweir eRanges = FND_IN_OTHER; 941cdf0e10cSrcweir if(bAll) //immer - ueberall? 942cdf0e10cSrcweir eRanges = FND_IN_SELALL; 943cdf0e10cSrcweir SwDocPositions eStart = !bAll ? DOCPOS_CURR : pSearch->bBack ? DOCPOS_END : DOCPOS_START; 944cdf0e10cSrcweir SwDocPositions eEnd = pSearch->bBack ? DOCPOS_START : DOCPOS_END; 945cdf0e10cSrcweir 946cdf0e10cSrcweir nResult = 0; 947cdf0e10cSrcweir sal_uInt16 nSearchProc = 0; 948cdf0e10cSrcweir while(nSearchProc < 2) 949cdf0e10cSrcweir { 950cdf0e10cSrcweir //try attribute search first 951cdf0e10cSrcweir if(pSearch->HasSearchAttributes()) 952cdf0e10cSrcweir { 953cdf0e10cSrcweir SfxItemSet aSearch(pDocShell->GetDoc()->GetAttrPool(), 954cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_END-1, 955cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END-1, 956cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1, 957cdf0e10cSrcweir RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT, 958cdf0e10cSrcweir 0); 959cdf0e10cSrcweir pSearch->FillSearchItemSet(aSearch); 960cdf0e10cSrcweir sal_Bool bCancel; 961cdf0e10cSrcweir nResult = (sal_Int32)pUnoCrsr->Find( aSearch, !pSearch->bStyles, 962cdf0e10cSrcweir eStart, eEnd, bCancel, 963cdf0e10cSrcweir (FindRanges)eRanges, 964cdf0e10cSrcweir pSearch->sSearchText.Len() ? &aSearchOpt : 0, 965cdf0e10cSrcweir 0 ); 966cdf0e10cSrcweir } 967cdf0e10cSrcweir else if(pSearch->bStyles) 968cdf0e10cSrcweir { 969cdf0e10cSrcweir SwTxtFmtColl *pSearchColl = lcl_GetParaStyle(pSearch->sSearchText, pUnoCrsr->GetDoc()); 970cdf0e10cSrcweir //pSearch->sReplaceText 971cdf0e10cSrcweir SwTxtFmtColl *pReplaceColl = 0; 972cdf0e10cSrcweir sal_Bool bCancel; 973cdf0e10cSrcweir nResult = (sal_Int32)pUnoCrsr->Find( *pSearchColl, 974cdf0e10cSrcweir eStart, eEnd, bCancel, 975cdf0e10cSrcweir (FindRanges)eRanges, pReplaceColl ); 976cdf0e10cSrcweir } 977cdf0e10cSrcweir else 978cdf0e10cSrcweir { 979cdf0e10cSrcweir //todo/mba: assuming that notes should be omitted 980cdf0e10cSrcweir sal_Bool bSearchInNotes = sal_False; 981cdf0e10cSrcweir sal_Bool bCancel; 982cdf0e10cSrcweir nResult = (sal_Int32)pUnoCrsr->Find( aSearchOpt, bSearchInNotes, 983cdf0e10cSrcweir eStart, eEnd, bCancel, 984cdf0e10cSrcweir (FindRanges)eRanges, 985cdf0e10cSrcweir /*int bReplace =*/sal_False ); 986cdf0e10cSrcweir } 987cdf0e10cSrcweir nSearchProc++; 988cdf0e10cSrcweir if(nResult || (eRanges&(FND_IN_SELALL|FND_IN_OTHER))) 989cdf0e10cSrcweir break; 990cdf0e10cSrcweir //second step - find in other 991cdf0e10cSrcweir eRanges = FND_IN_OTHER; 992cdf0e10cSrcweir } 993cdf0e10cSrcweir return pUnoCrsr; 994cdf0e10cSrcweir } 995cdf0e10cSrcweir /*-- 18.12.98 11:55:23--------------------------------------------------- 996cdf0e10cSrcweir 997cdf0e10cSrcweir -----------------------------------------------------------------------*/ 998cdf0e10cSrcweir Reference< XIndexAccess > 999cdf0e10cSrcweir SwXTextDocument::findAll(const Reference< util::XSearchDescriptor > & xDesc) 1000cdf0e10cSrcweir throw( RuntimeException ) 1001cdf0e10cSrcweir { 1002cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1003cdf0e10cSrcweir Reference< XInterface > xTmp; 1004cdf0e10cSrcweir sal_Int32 nResult = 0; 1005cdf0e10cSrcweir Reference< XTextCursor > xCrsr; 1006cdf0e10cSrcweir SwUnoCrsr* pResultCrsr = FindAny(xDesc, xCrsr, sal_True, nResult, xTmp); 1007cdf0e10cSrcweir if(!pResultCrsr) 1008cdf0e10cSrcweir throw RuntimeException(); 1009cdf0e10cSrcweir Reference< XIndexAccess > xRet; 1010cdf0e10cSrcweir xRet = new SwXTextRanges( (nResult) ? pResultCrsr : 0 ); 1011cdf0e10cSrcweir delete pResultCrsr; 1012cdf0e10cSrcweir return xRet; 1013cdf0e10cSrcweir } 1014cdf0e10cSrcweir /*-- 18.12.98 11:55:23--------------------------------------------------- 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1017cdf0e10cSrcweir Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSearchDescriptor > & xDesc) 1018cdf0e10cSrcweir throw( RuntimeException ) 1019cdf0e10cSrcweir { 1020cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1021cdf0e10cSrcweir Reference< XInterface > xTmp; 1022cdf0e10cSrcweir sal_Int32 nResult = 0; 1023cdf0e10cSrcweir Reference< XTextCursor > xCrsr; 1024cdf0e10cSrcweir SwUnoCrsr* pResultCrsr = FindAny(xDesc, xCrsr, sal_False, nResult, xTmp); 1025cdf0e10cSrcweir if(!pResultCrsr) 1026cdf0e10cSrcweir throw RuntimeException(); 1027cdf0e10cSrcweir Reference< XInterface > xRet; 1028cdf0e10cSrcweir if(nResult) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir const uno::Reference< text::XText > xParent = 1031cdf0e10cSrcweir ::sw::CreateParentXText(*pDocShell->GetDoc(), 1032cdf0e10cSrcweir *pResultCrsr->GetPoint()); 1033cdf0e10cSrcweir xRet = *new SwXTextCursor(xParent, *pResultCrsr); 1034cdf0e10cSrcweir delete pResultCrsr; 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir return xRet; 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir /*-- 18.12.98 11:55:24--------------------------------------------------- 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1041cdf0e10cSrcweir Reference< XInterface > SwXTextDocument::findNext(const Reference< XInterface > & xStartAt, 1042cdf0e10cSrcweir const Reference< util::XSearchDescriptor > & xDesc) 1043cdf0e10cSrcweir throw( RuntimeException ) 1044cdf0e10cSrcweir { 1045cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1046cdf0e10cSrcweir Reference< XInterface > xTmp; 1047cdf0e10cSrcweir sal_Int32 nResult = 0; 1048cdf0e10cSrcweir Reference< XTextCursor > xCrsr; 1049cdf0e10cSrcweir if(!xStartAt.is()) 1050cdf0e10cSrcweir throw RuntimeException(); 1051cdf0e10cSrcweir SwUnoCrsr* pResultCrsr = FindAny(xDesc, xCrsr, sal_False, nResult, xStartAt); 1052cdf0e10cSrcweir if(!pResultCrsr) 1053cdf0e10cSrcweir throw RuntimeException(); 1054cdf0e10cSrcweir Reference< XInterface > xRet; 1055cdf0e10cSrcweir if(nResult) 1056cdf0e10cSrcweir { 1057cdf0e10cSrcweir const uno::Reference< text::XText > xParent = 1058cdf0e10cSrcweir ::sw::CreateParentXText(*pDocShell->GetDoc(), 1059cdf0e10cSrcweir *pResultCrsr->GetPoint()); 1060cdf0e10cSrcweir 1061cdf0e10cSrcweir xRet = *new SwXTextCursor(xParent, *pResultCrsr); 1062cdf0e10cSrcweir delete pResultCrsr; 1063cdf0e10cSrcweir } 1064cdf0e10cSrcweir return xRet; 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir /*-- 18.12.98 11:55:24--------------------------------------------------- 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1069cdf0e10cSrcweir Sequence< beans::PropertyValue > SwXTextDocument::getPagePrintSettings(void) 1070cdf0e10cSrcweir throw( RuntimeException ) 1071cdf0e10cSrcweir { 1072cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1073cdf0e10cSrcweir Sequence< beans::PropertyValue > aSeq(9); 1074cdf0e10cSrcweir if(IsValid()) 1075cdf0e10cSrcweir { 1076cdf0e10cSrcweir beans::PropertyValue* pArray = aSeq.getArray(); 1077cdf0e10cSrcweir SwPagePreViewPrtData aData; 1078cdf0e10cSrcweir const SwPagePreViewPrtData* pData = pDocShell->GetDoc()->GetPreViewPrtData(); 1079cdf0e10cSrcweir if(pData) 1080cdf0e10cSrcweir aData = *pData; 1081cdf0e10cSrcweir Any aVal; 1082cdf0e10cSrcweir aVal <<= (sal_Int16)aData.GetRow(); 1083cdf0e10cSrcweir pArray[0] = beans::PropertyValue(C2U("PageRows"), -1, aVal, PropertyState_DIRECT_VALUE); 1084cdf0e10cSrcweir aVal <<= (sal_Int16)aData.GetCol(); 1085cdf0e10cSrcweir pArray[1] = beans::PropertyValue(C2U("PageColumns"), -1, aVal, PropertyState_DIRECT_VALUE); 1086cdf0e10cSrcweir aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetLeftSpace()); 1087cdf0e10cSrcweir pArray[2] = beans::PropertyValue(C2U("LeftMargin"), -1, aVal, PropertyState_DIRECT_VALUE); 1088cdf0e10cSrcweir aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetRightSpace()); 1089cdf0e10cSrcweir pArray[3] = beans::PropertyValue(C2U("RightMargin"), -1, aVal, PropertyState_DIRECT_VALUE); 1090cdf0e10cSrcweir aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetTopSpace()); 1091cdf0e10cSrcweir pArray[4] = beans::PropertyValue(C2U("TopMargin"), -1, aVal, PropertyState_DIRECT_VALUE); 1092cdf0e10cSrcweir aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetBottomSpace()); 1093cdf0e10cSrcweir pArray[5] = beans::PropertyValue(C2U("BottomMargin"), -1, aVal, PropertyState_DIRECT_VALUE); 1094cdf0e10cSrcweir aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetHorzSpace()); 1095cdf0e10cSrcweir pArray[6] = beans::PropertyValue(C2U("HoriMargin"), -1, aVal, PropertyState_DIRECT_VALUE); 1096cdf0e10cSrcweir aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetVertSpace()); 1097cdf0e10cSrcweir pArray[7] = beans::PropertyValue(C2U("VertMargin"), -1, aVal, PropertyState_DIRECT_VALUE); 1098cdf0e10cSrcweir sal_Bool bTemp = aData.GetLandscape(); 1099cdf0e10cSrcweir aVal.setValue(&bTemp, ::getCppuBooleanType()); 1100cdf0e10cSrcweir pArray[8] = beans::PropertyValue(C2U("IsLandscape"), -1, aVal, PropertyState_DIRECT_VALUE); 1101cdf0e10cSrcweir } 1102cdf0e10cSrcweir else 1103cdf0e10cSrcweir throw RuntimeException(); 1104cdf0e10cSrcweir return aSeq; 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir /* -----------------24.02.99 10:57------------------- 1107cdf0e10cSrcweir * 1108cdf0e10cSrcweir * --------------------------------------------------*/ 1109cdf0e10cSrcweir sal_uInt32 lcl_Any_To_ULONG(const Any& rValue, sal_Bool& bException) 1110cdf0e10cSrcweir { 1111cdf0e10cSrcweir bException = sal_False; 1112cdf0e10cSrcweir TypeClass eType = rValue.getValueType().getTypeClass(); 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir sal_uInt32 nRet = 0; 1115cdf0e10cSrcweir if( eType == TypeClass_UNSIGNED_LONG ) 1116cdf0e10cSrcweir rValue >>= nRet; 1117cdf0e10cSrcweir else 1118cdf0e10cSrcweir { 1119cdf0e10cSrcweir sal_Int32 nVal=0; 1120cdf0e10cSrcweir bException = !(rValue >>= nVal); 1121cdf0e10cSrcweir if( !bException ) 1122cdf0e10cSrcweir nRet = (sal_uInt32)nVal; 1123cdf0e10cSrcweir } 1124cdf0e10cSrcweir 1125cdf0e10cSrcweir return nRet; 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir /*-- 09.06.2004 12:18:10--------------------------------------------------- 1128cdf0e10cSrcweir 1129cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1130cdf0e10cSrcweir String lcl_CreateOutlineString( sal_uInt16 nIndex, 1131cdf0e10cSrcweir const SwOutlineNodes& rOutlineNodes, const SwNumRule* pOutlRule) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir String sEntry; 1134cdf0e10cSrcweir const SwTxtNode * pTxtNd = rOutlineNodes[ nIndex ]->GetTxtNode(); 1135cdf0e10cSrcweir SwNumberTree::tNumberVector aNumVector = pTxtNd->GetNumberVector(); 1136cdf0e10cSrcweir if( pOutlRule && pTxtNd->GetNumRule()) 1137cdf0e10cSrcweir for( sal_Int8 nLevel = 0; 1138cdf0e10cSrcweir nLevel <= pTxtNd->GetActualListLevel(); 1139cdf0e10cSrcweir nLevel++ ) 1140cdf0e10cSrcweir { 1141cdf0e10cSrcweir long nVal = aNumVector[nLevel]; 1142cdf0e10cSrcweir nVal ++; 1143cdf0e10cSrcweir nVal -= pOutlRule->Get(nLevel).GetStart(); 1144cdf0e10cSrcweir sEntry += String::CreateFromInt32( nVal ); 1145cdf0e10cSrcweir sEntry += '.'; 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir sEntry += rOutlineNodes[ nIndex ]-> 1148cdf0e10cSrcweir GetTxtNode()->GetExpandTxt( 0, STRING_LEN, sal_False ); 1149cdf0e10cSrcweir return sEntry; 1150cdf0e10cSrcweir } 1151cdf0e10cSrcweir /*-- 18.12.98 11:55:25--------------------------------------------------- 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1154cdf0e10cSrcweir void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue >& aSettings) 1155cdf0e10cSrcweir throw( RuntimeException ) 1156cdf0e10cSrcweir { 1157cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1158cdf0e10cSrcweir if(IsValid()) 1159cdf0e10cSrcweir { 1160cdf0e10cSrcweir SwPagePreViewPrtData aData; 1161cdf0e10cSrcweir //falls nur einige Properties kommen, dann die akt. Einstellungen benutzen 1162cdf0e10cSrcweir const SwPagePreViewPrtData* pData = pDocShell->GetDoc()->GetPreViewPrtData(); 1163cdf0e10cSrcweir if(pData) 1164cdf0e10cSrcweir aData = *pData; 1165cdf0e10cSrcweir const beans::PropertyValue* pProperties = aSettings.getConstArray(); 1166cdf0e10cSrcweir int nCount = aSettings.getLength(); 1167cdf0e10cSrcweir for(int i = 0; i < nCount; i++) 1168cdf0e10cSrcweir { 1169cdf0e10cSrcweir String sName = pProperties[i].Name; 1170cdf0e10cSrcweir const Any& rVal = pProperties[i].Value; 1171cdf0e10cSrcweir sal_Bool bException; 1172cdf0e10cSrcweir sal_uInt32 nVal = lcl_Any_To_ULONG(rVal, bException); 1173cdf0e10cSrcweir if( COMPARE_EQUAL == sName.CompareToAscii("PageRows" ) ) 1174cdf0e10cSrcweir { 1175cdf0e10cSrcweir if(!nVal || nVal > 0xff) 1176cdf0e10cSrcweir throw RuntimeException(); 1177cdf0e10cSrcweir aData.SetRow((sal_uInt8)nVal); 1178cdf0e10cSrcweir } 1179cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("PageColumns")) 1180cdf0e10cSrcweir { 1181cdf0e10cSrcweir if(!nVal || nVal > 0xff) 1182cdf0e10cSrcweir throw RuntimeException(); 1183cdf0e10cSrcweir aData.SetCol((sal_uInt8)nVal); 1184cdf0e10cSrcweir } 1185cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("LeftMargin")) 1186cdf0e10cSrcweir { 1187cdf0e10cSrcweir aData.SetLeftSpace(MM100_TO_TWIP_UNSIGNED(nVal)); 1188cdf0e10cSrcweir } 1189cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("RightMargin")) 1190cdf0e10cSrcweir { 1191cdf0e10cSrcweir aData.SetRightSpace(MM100_TO_TWIP_UNSIGNED(nVal)); 1192cdf0e10cSrcweir } 1193cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("TopMargin")) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir aData.SetTopSpace(MM100_TO_TWIP_UNSIGNED(nVal)); 1196cdf0e10cSrcweir } 1197cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("BottomMargin")) 1198cdf0e10cSrcweir { 1199cdf0e10cSrcweir aData.SetBottomSpace(MM100_TO_TWIP_UNSIGNED(nVal)); 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("HoriMargin")) 1202cdf0e10cSrcweir { 1203cdf0e10cSrcweir aData.SetHorzSpace(MM100_TO_TWIP_UNSIGNED(nVal)); 1204cdf0e10cSrcweir } 1205cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("VertMargin")) 1206cdf0e10cSrcweir { 1207cdf0e10cSrcweir aData.SetVertSpace(MM100_TO_TWIP_UNSIGNED(nVal)); 1208cdf0e10cSrcweir } 1209cdf0e10cSrcweir else if(COMPARE_EQUAL == sName.CompareToAscii("IsLandscape")) 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir bException = (::getBooleanCppuType() != rVal.getValueType()); 1212cdf0e10cSrcweir aData.SetLandscape(*(sal_Bool*)rVal.getValue()); 1213cdf0e10cSrcweir } 1214cdf0e10cSrcweir else 1215cdf0e10cSrcweir bException = sal_True; 1216cdf0e10cSrcweir if(bException) 1217cdf0e10cSrcweir throw RuntimeException(); 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir pDocShell->GetDoc()->SetPreViewPrtData(&aData); 1220cdf0e10cSrcweir } 1221cdf0e10cSrcweir else 1222cdf0e10cSrcweir throw RuntimeException(); 1223cdf0e10cSrcweir } 1224cdf0e10cSrcweir /*-- 18.12.98 11:55:25--------------------------------------------------- 1225cdf0e10cSrcweir 1226cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1227cdf0e10cSrcweir void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOptions) 1228cdf0e10cSrcweir throw( IllegalArgumentException, RuntimeException ) 1229cdf0e10cSrcweir { 1230cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1231cdf0e10cSrcweir if(IsValid()) 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir SfxViewFrame* pFrame = SfxViewFrame::LoadHiddenDocument( *pDocShell, 7 ); 1234cdf0e10cSrcweir SfxRequest aReq(FN_PRINT_PAGEPREVIEW, SFX_CALLMODE_SYNCHRON, 1235cdf0e10cSrcweir pDocShell->GetDoc()->GetAttrPool()); 1236cdf0e10cSrcweir aReq.AppendItem(SfxBoolItem(FN_PRINT_PAGEPREVIEW, sal_True)); 1237cdf0e10cSrcweir 1238cdf0e10cSrcweir OUString sFileName( C2U(SW_PROP_NAME_STR(UNO_NAME_FILE_NAME))); 1239cdf0e10cSrcweir OUString sCopyCount(C2U(SW_PROP_NAME_STR(UNO_NAME_COPY_COUNT))); 1240cdf0e10cSrcweir OUString sCollate(C2U(SW_PROP_NAME_STR(UNO_NAME_COLLATE))); 1241cdf0e10cSrcweir OUString sSort(C2U(SW_PROP_NAME_STR(UNO_NAME_SORT))); 1242cdf0e10cSrcweir OUString sPages(C2U(SW_PROP_NAME_STR(UNO_NAME_PAGES))); 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir for ( int n = 0; n < xOptions.getLength(); ++n ) 1245cdf0e10cSrcweir { 1246cdf0e10cSrcweir // get Property-Value from options 1247cdf0e10cSrcweir const beans::PropertyValue &rProp = xOptions.getConstArray()[n]; 1248cdf0e10cSrcweir Any aValue( rProp.Value ); 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir // FileName-Property? 1251cdf0e10cSrcweir if ( rProp.Name == sFileName ) 1252cdf0e10cSrcweir { 1253cdf0e10cSrcweir OUString sFileURL; 1254cdf0e10cSrcweir if ( (rProp.Value >>= sFileURL ) ) 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir // Convert the File URL into a system dependant path, as the SalPrinter expects 1257cdf0e10cSrcweir OUString sSystemPath; 1258cdf0e10cSrcweir FileBase::getSystemPathFromFileURL ( sFileURL, sSystemPath ); 1259cdf0e10cSrcweir aReq.AppendItem(SfxStringItem( SID_FILE_NAME, sSystemPath ) ); 1260cdf0e10cSrcweir } 1261cdf0e10cSrcweir else if ( rProp.Value.getValueType() != ::getVoidCppuType() ) 1262cdf0e10cSrcweir throw IllegalArgumentException(); 1263cdf0e10cSrcweir } 1264cdf0e10cSrcweir 1265cdf0e10cSrcweir // CopyCount-Property 1266cdf0e10cSrcweir else if ( rProp.Name == sCopyCount ) 1267cdf0e10cSrcweir { 1268cdf0e10cSrcweir sal_Int32 nCopies = 0; 1269cdf0e10cSrcweir aValue >>= nCopies; 1270cdf0e10cSrcweir aReq.AppendItem(SfxInt16Item( SID_PRINT_COPIES, (sal_Int16)nCopies ) ); 1271cdf0e10cSrcweir } 1272cdf0e10cSrcweir 1273cdf0e10cSrcweir // Collate-Property 1274cdf0e10cSrcweir else if ( rProp.Name == sCollate ) 1275cdf0e10cSrcweir { 1276cdf0e10cSrcweir if ( rProp.Value.getValueType() == ::getBooleanCppuType()) 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir aReq.AppendItem(SfxBoolItem( SID_PRINT_COLLATE, *(sal_Bool*)rProp.Value.getValue() ) ); 1279cdf0e10cSrcweir else 1280cdf0e10cSrcweir throw IllegalArgumentException(); 1281cdf0e10cSrcweir } 1282cdf0e10cSrcweir 1283cdf0e10cSrcweir // Sort-Property 1284cdf0e10cSrcweir else if ( rProp.Name == sSort ) 1285cdf0e10cSrcweir { 1286cdf0e10cSrcweir if ( rProp.Value.getValueType() == ::getBooleanCppuType() ) 1287cdf0e10cSrcweir aReq.AppendItem(SfxBoolItem( SID_PRINT_SORT, *(sal_Bool*)rProp.Value.getValue() ) ); 1288cdf0e10cSrcweir else 1289cdf0e10cSrcweir throw IllegalArgumentException(); 1290cdf0e10cSrcweir } 1291cdf0e10cSrcweir 1292cdf0e10cSrcweir // Pages-Property 1293cdf0e10cSrcweir else if ( rProp.Name == sPages ) 1294cdf0e10cSrcweir { 1295cdf0e10cSrcweir OUString sTmp; 1296cdf0e10cSrcweir if ( rProp.Value >>= sTmp ) 1297cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( SID_PRINT_PAGES, sTmp ) ); 1298cdf0e10cSrcweir else 1299cdf0e10cSrcweir throw IllegalArgumentException(); 1300cdf0e10cSrcweir } 1301cdf0e10cSrcweir } 1302cdf0e10cSrcweir 13030dccdc5dSMichael Stahl // --> OD #i117783# 13040dccdc5dSMichael Stahl bApplyPagePrintSettingsFromXPagePrintable = sal_True; 13050dccdc5dSMichael Stahl // <-- 1306cdf0e10cSrcweir pFrame->GetViewShell()->ExecuteSlot(aReq); 1307cdf0e10cSrcweir // Frame schliessen 1308cdf0e10cSrcweir pFrame->DoClose(); 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir } 1311cdf0e10cSrcweir else 1312cdf0e10cSrcweir throw RuntimeException(); 1313cdf0e10cSrcweir } 1314cdf0e10cSrcweir /*-- 18.12.98 11:55:25--------------------------------------------------- 1315cdf0e10cSrcweir 1316cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1317cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getReferenceMarks(void) 1318cdf0e10cSrcweir throw( RuntimeException ) 1319cdf0e10cSrcweir { 1320cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1321cdf0e10cSrcweir if(!IsValid()) 1322cdf0e10cSrcweir throw RuntimeException(); 1323cdf0e10cSrcweir if(!pxXReferenceMarks) 1324cdf0e10cSrcweir { 1325cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXReferenceMarks = new Reference< XNameAccess > ; 1326cdf0e10cSrcweir *pxXReferenceMarks = new SwXReferenceMarks(pDocShell->GetDoc()); 1327cdf0e10cSrcweir } 1328cdf0e10cSrcweir return *pxXReferenceMarks; 1329cdf0e10cSrcweir } 1330cdf0e10cSrcweir /* -----------------21.12.98 10:20------------------- 1331cdf0e10cSrcweir * 1332cdf0e10cSrcweir * --------------------------------------------------*/ 1333cdf0e10cSrcweir Reference< XEnumerationAccess > SwXTextDocument::getTextFields(void) throw( RuntimeException ) 1334cdf0e10cSrcweir { 1335cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1336cdf0e10cSrcweir if(!IsValid()) 1337cdf0e10cSrcweir throw RuntimeException(); 1338cdf0e10cSrcweir if(!pxXTextFieldTypes) 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXTextFieldTypes = new Reference< XEnumerationAccess > ; 1341cdf0e10cSrcweir *pxXTextFieldTypes = new SwXTextFieldTypes(pDocShell->GetDoc()); 1342cdf0e10cSrcweir } 1343cdf0e10cSrcweir return *pxXTextFieldTypes; 1344cdf0e10cSrcweir } 1345cdf0e10cSrcweir /*-- 21.12.98 10:21:12--------------------------------------------------- 1346cdf0e10cSrcweir 1347cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1348cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getTextFieldMasters(void) 1349cdf0e10cSrcweir throw( RuntimeException ) 1350cdf0e10cSrcweir { 1351cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1352cdf0e10cSrcweir if(!IsValid()) 1353cdf0e10cSrcweir throw RuntimeException(); 1354cdf0e10cSrcweir if(!pxXTextFieldMasters) 1355cdf0e10cSrcweir { 1356cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXTextFieldMasters = new Reference< XNameAccess > ; 1357cdf0e10cSrcweir *pxXTextFieldMasters = new SwXTextFieldMasters(pDocShell->GetDoc()); 1358cdf0e10cSrcweir } 1359cdf0e10cSrcweir return *pxXTextFieldMasters; 1360cdf0e10cSrcweir } 1361cdf0e10cSrcweir /*-- 21.12.98 10:21:12--------------------------------------------------- 1362cdf0e10cSrcweir 1363cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1364cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getEmbeddedObjects(void) throw( RuntimeException ) 1365cdf0e10cSrcweir { 1366cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1367cdf0e10cSrcweir if(!IsValid()) 1368cdf0e10cSrcweir throw RuntimeException(); 1369cdf0e10cSrcweir if(!pxXEmbeddedObjects) 1370cdf0e10cSrcweir { 1371cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXEmbeddedObjects = new Reference< XNameAccess > ; 1372cdf0e10cSrcweir *pxXEmbeddedObjects = new SwXTextEmbeddedObjects(pDocShell->GetDoc()); 1373cdf0e10cSrcweir } 1374cdf0e10cSrcweir return *pxXEmbeddedObjects; 1375cdf0e10cSrcweir } 1376cdf0e10cSrcweir /*-- 21.12.98 10:21:13--------------------------------------------------- 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1379cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getBookmarks(void) throw( RuntimeException ) 1380cdf0e10cSrcweir { 1381cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1382cdf0e10cSrcweir if(!IsValid()) 1383cdf0e10cSrcweir throw RuntimeException(); 1384cdf0e10cSrcweir if(!pxXBookmarks) 1385cdf0e10cSrcweir { 1386cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXBookmarks = new Reference< XNameAccess > ; 1387cdf0e10cSrcweir *pxXBookmarks = new SwXBookmarks(pDocShell->GetDoc()); 1388cdf0e10cSrcweir } 1389cdf0e10cSrcweir return *pxXBookmarks; 1390cdf0e10cSrcweir } 1391cdf0e10cSrcweir /*-- 21.12.98 10:21:13--------------------------------------------------- 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1394cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getTextSections(void) throw( RuntimeException ) 1395cdf0e10cSrcweir { 1396cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1397cdf0e10cSrcweir if(!IsValid()) 1398cdf0e10cSrcweir throw RuntimeException(); 1399cdf0e10cSrcweir if(!pxXTextSections) 1400cdf0e10cSrcweir { 1401cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXTextSections = new Reference< XNameAccess > ; 1402cdf0e10cSrcweir *pxXTextSections = new SwXTextSections(pDocShell->GetDoc()); 1403cdf0e10cSrcweir } 1404cdf0e10cSrcweir return *pxXTextSections; 1405cdf0e10cSrcweir } 1406cdf0e10cSrcweir /*-- 21.12.98 10:21:13--------------------------------------------------- 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1409cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getTextTables(void) throw( RuntimeException ) 1410cdf0e10cSrcweir { 1411cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1412cdf0e10cSrcweir if(!IsValid()) 1413cdf0e10cSrcweir throw RuntimeException(); 1414cdf0e10cSrcweir if(!pxXTextTables) 1415cdf0e10cSrcweir { 1416cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXTextTables = new Reference< XNameAccess > ; 1417cdf0e10cSrcweir *pxXTextTables = new SwXTextTables(pDocShell->GetDoc()); 1418cdf0e10cSrcweir } 1419cdf0e10cSrcweir return *pxXTextTables; 1420cdf0e10cSrcweir } 1421cdf0e10cSrcweir /*-- 21.12.98 10:21:13--------------------------------------------------- 1422cdf0e10cSrcweir 1423cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1424cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getGraphicObjects(void) throw( RuntimeException ) 1425cdf0e10cSrcweir { 1426cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1427cdf0e10cSrcweir if(!IsValid()) 1428cdf0e10cSrcweir throw RuntimeException(); 1429cdf0e10cSrcweir if(!pxXGraphicObjects) 1430cdf0e10cSrcweir { 1431cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXGraphicObjects = new Reference< XNameAccess > ; 1432cdf0e10cSrcweir *pxXGraphicObjects = new SwXTextGraphicObjects(pDocShell->GetDoc()); 1433cdf0e10cSrcweir } 1434cdf0e10cSrcweir return *pxXGraphicObjects; 1435cdf0e10cSrcweir } 1436cdf0e10cSrcweir /*-- 21.12.98 10:21:14--------------------------------------------------- 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1439cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getTextFrames(void) throw( RuntimeException ) 1440cdf0e10cSrcweir { 1441cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1442cdf0e10cSrcweir if(!IsValid()) 1443cdf0e10cSrcweir throw RuntimeException(); 1444cdf0e10cSrcweir if(!pxXTextFrames) 1445cdf0e10cSrcweir { 1446cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXTextFrames = new Reference< XNameAccess > ; 1447cdf0e10cSrcweir *pxXTextFrames = new SwXTextFrames(pDocShell->GetDoc()); 1448cdf0e10cSrcweir } 1449cdf0e10cSrcweir return *pxXTextFrames; 1450cdf0e10cSrcweir } 1451cdf0e10cSrcweir /* -----------------21.12.98 10:56------------------- 1452cdf0e10cSrcweir * 1453cdf0e10cSrcweir * --------------------------------------------------*/ 1454cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getStyleFamilies(void) throw( RuntimeException ) 1455cdf0e10cSrcweir { 1456cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1457cdf0e10cSrcweir if(!IsValid()) 1458cdf0e10cSrcweir throw RuntimeException(); 1459cdf0e10cSrcweir if(!pxXStyleFamilies) 1460cdf0e10cSrcweir { 1461cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXStyleFamilies = new Reference< XNameAccess > ; 1462cdf0e10cSrcweir *pxXStyleFamilies = new SwXStyleFamilies(*pDocShell); 1463cdf0e10cSrcweir } 1464cdf0e10cSrcweir return *pxXStyleFamilies; 1465cdf0e10cSrcweir } 1466cdf0e10cSrcweir /*-- 19.05.06 10:15:22--------------------------------------------------- 1467cdf0e10cSrcweir 1468cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1469cdf0e10cSrcweir uno::Reference< style::XAutoStyles > SwXTextDocument::getAutoStyles( ) 1470cdf0e10cSrcweir throw (uno::RuntimeException) 1471cdf0e10cSrcweir { 1472cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1473cdf0e10cSrcweir if(!IsValid()) 1474cdf0e10cSrcweir throw RuntimeException(); 1475cdf0e10cSrcweir if(!pxXAutoStyles) 1476cdf0e10cSrcweir { 1477cdf0e10cSrcweir pxXAutoStyles = new Reference< style::XAutoStyles > ; 1478cdf0e10cSrcweir *pxXAutoStyles = new SwXAutoStyles(*pDocShell); 1479cdf0e10cSrcweir } 1480cdf0e10cSrcweir return *pxXAutoStyles; 1481cdf0e10cSrcweir 1482cdf0e10cSrcweir } 1483cdf0e10cSrcweir /*-- 22.01.99 10:18:03--------------------------------------------------- 1484cdf0e10cSrcweir 1485cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1486cdf0e10cSrcweir Reference< drawing::XDrawPage > SwXTextDocument::getDrawPage(void) throw( RuntimeException ) 1487cdf0e10cSrcweir { 1488cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1489cdf0e10cSrcweir if(!IsValid()) 1490cdf0e10cSrcweir throw RuntimeException(); 1491cdf0e10cSrcweir if(!pxXDrawPage) 1492cdf0e10cSrcweir { 1493cdf0e10cSrcweir // simplified this creation, keeping original below as reference 1494cdf0e10cSrcweir // for the case that it did something by purpose 1495cdf0e10cSrcweir ((SwXTextDocument*)this)->pDrawPage = new SwXDrawPage(pDocShell->GetDoc()); 1496cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXDrawPage = new Reference< drawing::XDrawPage >(pDrawPage); 1497cdf0e10cSrcweir 1498cdf0e10cSrcweir //((SwXTextDocument*)this)->pxXDrawPage = new Reference< drawing::XDrawPage > ; 1499cdf0e10cSrcweir //((SwXTextDocument*)this)->pDrawPage = new SwXDrawPage(pDocShell->GetDoc()); 1500cdf0e10cSrcweir //Reference< drawing::XShapes > xTmp = pDrawPage; 1501cdf0e10cSrcweir //*pxXDrawPage = Reference< drawing::XDrawPage>(xTmp, UNO_QUERY); 1502cdf0e10cSrcweir } 1503cdf0e10cSrcweir return *pxXDrawPage; 1504cdf0e10cSrcweir } 1505cdf0e10cSrcweir /* -----------------07.04.99 10:11------------------- 1506cdf0e10cSrcweir * 1507cdf0e10cSrcweir * --------------------------------------------------*/ 1508cdf0e10cSrcweir SwXDrawPage* SwXTextDocument::GetDrawPage() 1509cdf0e10cSrcweir { 1510cdf0e10cSrcweir if(!IsValid()) 1511cdf0e10cSrcweir return 0; 1512cdf0e10cSrcweir if(!pDrawPage) 1513cdf0e10cSrcweir getDrawPage(); 1514cdf0e10cSrcweir return pDrawPage; 1515cdf0e10cSrcweir } 1516cdf0e10cSrcweir /*-- 18.12.98 11:55:26--------------------------------------------------- 1517cdf0e10cSrcweir 1518cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1519cdf0e10cSrcweir void SwXTextDocument::Invalidate() 1520cdf0e10cSrcweir { 152125cebbc8SOliver-Rainer Wittmann bObjectValid = sal_False; 152225cebbc8SOliver-Rainer Wittmann if(xNumFmtAgg.is()) 152325cebbc8SOliver-Rainer Wittmann { 1524cdf0e10cSrcweir const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0); 1525cdf0e10cSrcweir Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType); 1526cdf0e10cSrcweir SvNumberFormatsSupplierObj* pNumFmt = 0; 1527cdf0e10cSrcweir Reference< XUnoTunnel > xNumTunnel; 1528cdf0e10cSrcweir if(aNumTunnel >>= xNumTunnel) 1529cdf0e10cSrcweir { 1530cdf0e10cSrcweir pNumFmt = reinterpret_cast<SvNumberFormatsSupplierObj*>( 1531cdf0e10cSrcweir xNumTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); 1532cdf0e10cSrcweir pNumFmt->SetNumberFormatter(0); 1533cdf0e10cSrcweir } 1534cdf0e10cSrcweir DBG_ASSERT(pNumFmt, "No number formatter available"); 153525cebbc8SOliver-Rainer Wittmann } 153625cebbc8SOliver-Rainer Wittmann InitNewDoc(); 153725cebbc8SOliver-Rainer Wittmann pDocShell = 0; 153825cebbc8SOliver-Rainer Wittmann aRefreshCont.Disposing(); 1539cdf0e10cSrcweir } 1540cdf0e10cSrcweir /* -----------------------------13.07.00 15:59-------------------------------- 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1543cdf0e10cSrcweir void SwXTextDocument::Reactivate(SwDocShell* pNewDocShell) 1544cdf0e10cSrcweir { 1545cdf0e10cSrcweir if(pDocShell && pDocShell != pNewDocShell) 1546cdf0e10cSrcweir Invalidate(); 1547cdf0e10cSrcweir pDocShell = pNewDocShell; 1548cdf0e10cSrcweir bObjectValid = sal_True; 1549cdf0e10cSrcweir } 1550cdf0e10cSrcweir /*-- 18.12.98 11:55:26--------------------------------------------------- 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1553cdf0e10cSrcweir void SwXTextDocument::InitNewDoc() 1554cdf0e10cSrcweir { 1555cdf0e10cSrcweir // zunaechst alle Collections invalidieren, dann Referenzen loeschen und Null setzen 1556cdf0e10cSrcweir if(pxXTextTables) 1557cdf0e10cSrcweir { 1558cdf0e10cSrcweir XNameAccess* pTbls = pxXTextTables->get(); 1559cdf0e10cSrcweir ((SwXTextTables*)pTbls)->Invalidate(); 1560cdf0e10cSrcweir delete pxXTextTables; 1561cdf0e10cSrcweir pxXTextTables = 0; 1562cdf0e10cSrcweir } 1563cdf0e10cSrcweir 1564cdf0e10cSrcweir if(pxXTextFrames) 1565cdf0e10cSrcweir { 1566cdf0e10cSrcweir XNameAccess* pFrms = pxXTextFrames->get(); 1567cdf0e10cSrcweir ((SwXTextFrames*)pFrms)->Invalidate(); 1568cdf0e10cSrcweir delete pxXTextFrames; 1569cdf0e10cSrcweir pxXTextFrames = 0; 1570cdf0e10cSrcweir } 1571cdf0e10cSrcweir 1572cdf0e10cSrcweir if(pxXGraphicObjects) 1573cdf0e10cSrcweir { 1574cdf0e10cSrcweir XNameAccess* pFrms = pxXGraphicObjects->get(); 1575cdf0e10cSrcweir ((SwXTextGraphicObjects*)pFrms)->Invalidate(); 1576cdf0e10cSrcweir delete pxXGraphicObjects; 1577cdf0e10cSrcweir pxXGraphicObjects = 0; 1578cdf0e10cSrcweir } 1579cdf0e10cSrcweir 1580cdf0e10cSrcweir if(pxXEmbeddedObjects) 1581cdf0e10cSrcweir { 1582cdf0e10cSrcweir XNameAccess* pOLE = pxXEmbeddedObjects->get(); 1583cdf0e10cSrcweir ((SwXTextEmbeddedObjects*)pOLE)->Invalidate(); 1584cdf0e10cSrcweir delete pxXEmbeddedObjects; 1585cdf0e10cSrcweir pxXEmbeddedObjects = 0; 1586cdf0e10cSrcweir } 1587cdf0e10cSrcweir 1588cdf0e10cSrcweir if(xBodyText.is()) 1589cdf0e10cSrcweir { 1590cdf0e10cSrcweir xBodyText = 0; 1591cdf0e10cSrcweir pBodyText = 0; 1592cdf0e10cSrcweir } 1593cdf0e10cSrcweir 1594cdf0e10cSrcweir if(xNumFmtAgg.is()) 1595cdf0e10cSrcweir { 1596cdf0e10cSrcweir const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0); 1597cdf0e10cSrcweir Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType); 1598cdf0e10cSrcweir SvNumberFormatsSupplierObj* pNumFmt = 0; 1599cdf0e10cSrcweir Reference< XUnoTunnel > xNumTunnel; 1600cdf0e10cSrcweir if(aNumTunnel >>= xNumTunnel) 1601cdf0e10cSrcweir { 1602cdf0e10cSrcweir pNumFmt = reinterpret_cast<SvNumberFormatsSupplierObj*>( 1603cdf0e10cSrcweir xNumTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); 1604cdf0e10cSrcweir 1605cdf0e10cSrcweir } 1606cdf0e10cSrcweir DBG_ASSERT(pNumFmt, "No number formatter available"); 1607cdf0e10cSrcweir pNumFmt->SetNumberFormatter(0); 1608cdf0e10cSrcweir } 1609cdf0e10cSrcweir 1610cdf0e10cSrcweir if(pxXTextFieldTypes) 1611cdf0e10cSrcweir { 1612cdf0e10cSrcweir XEnumerationAccess* pT = pxXTextFieldTypes->get(); 1613cdf0e10cSrcweir ((SwXTextFieldTypes*)pT)->Invalidate(); 1614cdf0e10cSrcweir delete pxXTextFieldTypes; 1615cdf0e10cSrcweir pxXTextFieldTypes = 0; 1616cdf0e10cSrcweir } 1617cdf0e10cSrcweir 1618cdf0e10cSrcweir if(pxXTextFieldMasters) 1619cdf0e10cSrcweir { 1620cdf0e10cSrcweir XNameAccess* pT = pxXTextFieldMasters->get(); 1621cdf0e10cSrcweir ((SwXTextFieldMasters*)pT)->Invalidate(); 1622cdf0e10cSrcweir delete pxXTextFieldMasters; 1623cdf0e10cSrcweir pxXTextFieldMasters = 0; 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir if(pxXTextSections) 1627cdf0e10cSrcweir { 1628cdf0e10cSrcweir XNameAccess* pSect = pxXTextSections->get(); 1629cdf0e10cSrcweir ((SwXTextSections*)pSect)->Invalidate(); 1630cdf0e10cSrcweir delete pxXTextSections; 1631cdf0e10cSrcweir pxXTextSections = 0; 1632cdf0e10cSrcweir } 1633cdf0e10cSrcweir 1634cdf0e10cSrcweir if(pxXDrawPage) 1635cdf0e10cSrcweir { 1636cdf0e10cSrcweir // --> OD 2008-07-23 #i91798#, #i91895# 1637cdf0e10cSrcweir // dispose XDrawPage here. We are the owner and know that it is no longer in a valid condition. 1638cdf0e10cSrcweir uno::Reference<lang::XComponent> xComp( *pxXDrawPage, uno::UNO_QUERY ); 1639cdf0e10cSrcweir xComp->dispose(); 1640cdf0e10cSrcweir // <-- 1641cdf0e10cSrcweir pDrawPage->InvalidateSwDoc(); 1642cdf0e10cSrcweir delete pxXDrawPage; 1643cdf0e10cSrcweir pxXDrawPage = 0; 1644cdf0e10cSrcweir } 1645cdf0e10cSrcweir 1646cdf0e10cSrcweir if ( pxXNumberingRules ) 1647cdf0e10cSrcweir { 1648cdf0e10cSrcweir XIndexAccess* pNum = pxXNumberingRules->get(); 1649cdf0e10cSrcweir ((SwXNumberingRulesCollection*)pNum)->Invalidate(); 1650cdf0e10cSrcweir delete pxXNumberingRules; 1651cdf0e10cSrcweir pxXNumberingRules = 0; 1652cdf0e10cSrcweir } 1653cdf0e10cSrcweir 1654cdf0e10cSrcweir if(pxXFootnotes) 1655cdf0e10cSrcweir { 1656cdf0e10cSrcweir XIndexAccess* pFtn = pxXFootnotes->get(); 1657cdf0e10cSrcweir ((SwXFootnotes*)pFtn)->Invalidate(); 1658cdf0e10cSrcweir delete pxXFootnotes; 1659cdf0e10cSrcweir pxXFootnotes = 0; 1660cdf0e10cSrcweir } 1661cdf0e10cSrcweir 1662cdf0e10cSrcweir if(pxXEndnotes) 1663cdf0e10cSrcweir { 1664cdf0e10cSrcweir XIndexAccess* pFtn = pxXEndnotes->get(); 1665cdf0e10cSrcweir ((SwXFootnotes*)pFtn)->Invalidate(); 1666cdf0e10cSrcweir delete pxXEndnotes; 1667cdf0e10cSrcweir pxXEndnotes = 0; 1668cdf0e10cSrcweir } 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir if(pxXDocumentIndexes) 1671cdf0e10cSrcweir { 1672cdf0e10cSrcweir XIndexAccess* pIdxs = pxXDocumentIndexes->get(); 1673cdf0e10cSrcweir ((SwXDocumentIndexes*)pIdxs)->Invalidate(); 1674cdf0e10cSrcweir delete pxXDocumentIndexes; 1675cdf0e10cSrcweir pxXDocumentIndexes = 0; 1676cdf0e10cSrcweir } 1677cdf0e10cSrcweir 1678cdf0e10cSrcweir if(pxXStyleFamilies) 1679cdf0e10cSrcweir { 1680cdf0e10cSrcweir XNameAccess* pStyles = pxXStyleFamilies->get(); 1681cdf0e10cSrcweir ((SwXStyleFamilies*)pStyles)->Invalidate(); 1682cdf0e10cSrcweir delete pxXStyleFamilies; 1683cdf0e10cSrcweir pxXStyleFamilies = 0; 1684cdf0e10cSrcweir } 1685cdf0e10cSrcweir if(pxXAutoStyles) 1686cdf0e10cSrcweir { 1687cdf0e10cSrcweir XNameAccess* pStyles = pxXAutoStyles->get(); 1688cdf0e10cSrcweir ((SwXAutoStyles*)pStyles)->Invalidate(); 1689cdf0e10cSrcweir delete pxXAutoStyles; 1690cdf0e10cSrcweir pxXAutoStyles = 0; 1691cdf0e10cSrcweir } 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir if(pxXBookmarks) 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir XNameAccess* pBm = pxXBookmarks->get(); 1696cdf0e10cSrcweir ((SwXBookmarks*)pBm)->Invalidate(); 1697cdf0e10cSrcweir delete pxXBookmarks; 1698cdf0e10cSrcweir pxXBookmarks = 0; 1699cdf0e10cSrcweir } 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir if(pxXChapterNumbering) 1702cdf0e10cSrcweir { 1703cdf0e10cSrcweir XIndexReplace* pCh = pxXChapterNumbering->get(); 1704cdf0e10cSrcweir ((SwXChapterNumbering*)pCh)->Invalidate(); 1705cdf0e10cSrcweir delete pxXChapterNumbering; 1706cdf0e10cSrcweir pxXChapterNumbering = 0; 1707cdf0e10cSrcweir } 1708cdf0e10cSrcweir 1709cdf0e10cSrcweir if(pxXFootnoteSettings) 1710cdf0e10cSrcweir { 1711cdf0e10cSrcweir XPropertySet* pFntSet = pxXFootnoteSettings->get(); 1712cdf0e10cSrcweir ((SwXFootnoteProperties*)pFntSet)->Invalidate(); 1713cdf0e10cSrcweir delete pxXFootnoteSettings; 1714cdf0e10cSrcweir pxXFootnoteSettings = 0; 1715cdf0e10cSrcweir } 1716cdf0e10cSrcweir 1717cdf0e10cSrcweir if(pxXEndnoteSettings) 1718cdf0e10cSrcweir { 1719cdf0e10cSrcweir XPropertySet* pEndSet = pxXEndnoteSettings->get(); 1720cdf0e10cSrcweir ((SwXEndnoteProperties*)pEndSet)->Invalidate(); 1721cdf0e10cSrcweir delete pxXEndnoteSettings; 1722cdf0e10cSrcweir pxXEndnoteSettings = 0; 1723cdf0e10cSrcweir } 1724cdf0e10cSrcweir 1725cdf0e10cSrcweir if(pxXLineNumberingProperties) 1726cdf0e10cSrcweir { 1727cdf0e10cSrcweir XPropertySet* pLine = pxXLineNumberingProperties->get(); 1728cdf0e10cSrcweir ((SwXLineNumberingProperties*)pLine)->Invalidate(); 1729cdf0e10cSrcweir delete pxXLineNumberingProperties; 1730cdf0e10cSrcweir pxXLineNumberingProperties = 0; 1731cdf0e10cSrcweir } 1732cdf0e10cSrcweir if(pxXReferenceMarks) 1733cdf0e10cSrcweir { 1734cdf0e10cSrcweir XNameAccess* pMarks = pxXReferenceMarks->get(); 1735cdf0e10cSrcweir ((SwXReferenceMarks*)pMarks)->Invalidate(); 1736cdf0e10cSrcweir delete pxXReferenceMarks; 1737cdf0e10cSrcweir pxXReferenceMarks = 0; 1738cdf0e10cSrcweir } 1739cdf0e10cSrcweir if(pxLinkTargetSupplier) 1740cdf0e10cSrcweir { 1741cdf0e10cSrcweir XNameAccess* pAccess = (*pxLinkTargetSupplier).get(); 1742cdf0e10cSrcweir ((SwXLinkTargetSupplier*)pAccess)->Invalidate(); 1743cdf0e10cSrcweir delete pxLinkTargetSupplier; 1744cdf0e10cSrcweir pxLinkTargetSupplier = 0; 1745cdf0e10cSrcweir } 1746cdf0e10cSrcweir if(pxXRedlines) 1747cdf0e10cSrcweir { 1748cdf0e10cSrcweir XEnumerationAccess* pMarks = pxXRedlines->get(); 1749cdf0e10cSrcweir ((SwXRedlines*)pMarks)->Invalidate(); 1750cdf0e10cSrcweir delete pxXRedlines; 1751cdf0e10cSrcweir pxXRedlines = 0; 1752cdf0e10cSrcweir } 1753cdf0e10cSrcweir if(xPropertyHelper.is()) 1754cdf0e10cSrcweir { 1755cdf0e10cSrcweir pPropertyHelper->Invalidate(); 1756cdf0e10cSrcweir xPropertyHelper = 0; 1757cdf0e10cSrcweir pPropertyHelper = 0; 1758cdf0e10cSrcweir } 1759cdf0e10cSrcweir } 1760cdf0e10cSrcweir 1761cdf0e10cSrcweir /*-- 11.03.99 11:51:40--------------------------------------------------- 1762cdf0e10cSrcweir 1763cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1764cdf0e10cSrcweir #define COM_SUN_STAR__DRAWING_LENGTH 13 1765cdf0e10cSrcweir Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServiceName) 1766cdf0e10cSrcweir throw( Exception, RuntimeException ) 1767cdf0e10cSrcweir { 1768cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1769cdf0e10cSrcweir if(!IsValid()) 1770cdf0e10cSrcweir throw RuntimeException(); 1771cdf0e10cSrcweir Reference< XInterface > xRet; 1772cdf0e10cSrcweir sal_uInt16 nType = SwXServiceProvider::GetProviderType(rServiceName); 1773cdf0e10cSrcweir if(nType != SW_SERVICE_INVALID) 1774cdf0e10cSrcweir { 1775cdf0e10cSrcweir xRet = SwXServiceProvider::MakeInstance(nType, pDocShell->GetDoc()); 1776cdf0e10cSrcweir } 1777cdf0e10cSrcweir else 1778cdf0e10cSrcweir { 1779cdf0e10cSrcweir if( rServiceName.compareToAscii( "com.sun.star.", 13 ) == 0 ) 1780cdf0e10cSrcweir { 1781cdf0e10cSrcweir sal_Int32 nIndex = COM_SUN_STAR__DRAWING_LENGTH; 1782cdf0e10cSrcweir OUString sCategory = rServiceName.getToken( 0, '.', nIndex ); 1783cdf0e10cSrcweir sal_Bool bShape = sCategory == C2U("drawing"); 1784cdf0e10cSrcweir if( bShape || sCategory == C2U("form")) 1785cdf0e10cSrcweir { 1786cdf0e10cSrcweir if(bShape) 1787cdf0e10cSrcweir { 1788cdf0e10cSrcweir short nTable = 0; 1789cdf0e10cSrcweir if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) ) 1790cdf0e10cSrcweir nTable = SW_CREATE_DASH_TABLE; 1791cdf0e10cSrcweir else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) ) 1792cdf0e10cSrcweir nTable = SW_CREATE_GRADIENT_TABLE; 1793cdf0e10cSrcweir else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) ) 1794cdf0e10cSrcweir nTable = SW_CREATE_HATCH_TABLE; 1795cdf0e10cSrcweir else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) ) 1796cdf0e10cSrcweir nTable = SW_CREATE_BITMAP_TABLE; 1797cdf0e10cSrcweir else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ) 1798cdf0e10cSrcweir nTable = SW_CREATE_TRANSGRADIENT_TABLE; 1799cdf0e10cSrcweir else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) ) 1800cdf0e10cSrcweir nTable = SW_CREATE_MARKER_TABLE; 1801cdf0e10cSrcweir else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) ) 1802cdf0e10cSrcweir nTable = SW_CREATE_DRAW_DEFAULTS; 1803cdf0e10cSrcweir if(nTable) 1804cdf0e10cSrcweir { 1805cdf0e10cSrcweir xRet = GetPropertyHelper()->GetDrawTable(nTable); 1806cdf0e10cSrcweir } 1807cdf0e10cSrcweir } 1808cdf0e10cSrcweir } 1809cdf0e10cSrcweir else if (sCategory == C2U ("document") ) 1810cdf0e10cSrcweir { 1811cdf0e10cSrcweir if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) 1812cdf0e10cSrcweir xRet = Reference < XInterface > ( *new SwXDocumentSettings ( this ) ); 1813cdf0e10cSrcweir if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) ) 1814cdf0e10cSrcweir { 1815cdf0e10cSrcweir xRet = (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pDocShell, EMBEDDEDOBJECTHELPER_MODE_READ ); 1816cdf0e10cSrcweir } 1817cdf0e10cSrcweir } 1818cdf0e10cSrcweir else if (sCategory == C2U ("text") ) 1819cdf0e10cSrcweir { 1820cdf0e10cSrcweir if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.DocumentSettings") ) ) 1821cdf0e10cSrcweir xRet = Reference < XInterface > ( *new SwXDocumentSettings ( this ) ); 1822cdf0e10cSrcweir } 1823cdf0e10cSrcweir else if (sCategory == C2U ("chart2") ) 1824cdf0e10cSrcweir { 1825cdf0e10cSrcweir if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.data.DataProvider") ) ) 1826cdf0e10cSrcweir xRet = Reference < XInterface > ( dynamic_cast< chart2::data::XDataProvider * >(pDocShell->getIDocumentChartDataProviderAccess()->GetChartDataProvider()) ); 1827cdf0e10cSrcweir } 1828cdf0e10cSrcweir 1829cdf0e10cSrcweir if(!xRet.is()) 1830cdf0e10cSrcweir { 1831cdf0e10cSrcweir //! we don't want to insert OLE2 Shapes (e.g. "com.sun.star.drawing.OLE2Shape", ...) 1832cdf0e10cSrcweir //! like this (by creating them with the documents factory and 1833cdf0e10cSrcweir //! adding the shapes to the draw page). 1834cdf0e10cSrcweir //! For inserting OLE objects the proper way is to use 1835cdf0e10cSrcweir //! "com.sun.star.text.TextEmbeddedObject"! 1836cdf0e10cSrcweir if (rServiceName.lastIndexOf( C2U(".OLE2Shape") ) == rServiceName.getLength() - 10) 1837cdf0e10cSrcweir throw ServiceNotRegisteredException(); // declare service to be not registered with this factory 1838cdf0e10cSrcweir 1839cdf0e10cSrcweir // --> OD 2006-02-22 #b6382898# 1840cdf0e10cSrcweir // the XML import is allowed to create instances of com.sun.star.drawing.OLE2Shape. 1841cdf0e10cSrcweir // Thus, a temporary service name is introduced to make this possible. 1842cdf0e10cSrcweir OUString aTmpServiceName( rServiceName ); 1843cdf0e10cSrcweir if ( bShape && 1844cdf0e10cSrcweir rServiceName.compareToAscii( "com.sun.star.drawing.temporaryForXMLImportOLE2Shape" ) == 0 ) 1845cdf0e10cSrcweir { 1846cdf0e10cSrcweir aTmpServiceName = OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ); 1847cdf0e10cSrcweir } 1848cdf0e10cSrcweir //hier den Draw - Service suchen 1849cdf0e10cSrcweir Reference< XInterface > xTmp = SvxFmMSFactory::createInstance(aTmpServiceName); 1850cdf0e10cSrcweir // <-- 1851cdf0e10cSrcweir if(bShape) 1852cdf0e10cSrcweir { 1853cdf0e10cSrcweir nIndex = COM_SUN_STAR__DRAWING_LENGTH; 1854cdf0e10cSrcweir if( 0 == rServiceName.reverseCompareToAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.drawing.GroupShape" ) ) || 1855cdf0e10cSrcweir 0 == rServiceName.reverseCompareToAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.drawing.Shape3DSceneObject" ) ) ) 1856cdf0e10cSrcweir xRet = *new SwXGroupShape( xTmp ); 1857cdf0e10cSrcweir else 1858cdf0e10cSrcweir xRet = *new SwXShape( xTmp ); 1859cdf0e10cSrcweir } 1860cdf0e10cSrcweir else 1861cdf0e10cSrcweir xRet = xTmp; 1862cdf0e10cSrcweir } 1863cdf0e10cSrcweir } 1864cdf0e10cSrcweir else 1865cdf0e10cSrcweir throw ServiceNotRegisteredException(); 1866cdf0e10cSrcweir } 1867cdf0e10cSrcweir return xRet; 1868cdf0e10cSrcweir } 1869cdf0e10cSrcweir /*-- 11.03.99 11:51:40--------------------------------------------------- 1870cdf0e10cSrcweir 1871cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1872cdf0e10cSrcweir Reference< XInterface > SwXTextDocument::createInstanceWithArguments( 1873cdf0e10cSrcweir const OUString& ServiceSpecifier, 1874cdf0e10cSrcweir const Sequence< Any >& /*Arguments*/) 1875cdf0e10cSrcweir throw( Exception, RuntimeException ) 1876cdf0e10cSrcweir { 1877cdf0e10cSrcweir Reference< XInterface > xInt = createInstance(ServiceSpecifier); 1878cdf0e10cSrcweir //die Any-Sequence dient zur Initialisierung von Objekten, die auf 1879cdf0e10cSrcweir //Parameter zwingend angewiesen sind - bis jetzt haben wir das nicht 1880cdf0e10cSrcweir return xInt; 1881cdf0e10cSrcweir } 1882cdf0e10cSrcweir /*-- 11.03.99 11:51:41--------------------------------------------------- 1883cdf0e10cSrcweir 1884cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1885cdf0e10cSrcweir Sequence< OUString > SwXTextDocument::getAvailableServiceNames(void) 1886cdf0e10cSrcweir throw( RuntimeException ) 1887cdf0e10cSrcweir { 1888cdf0e10cSrcweir static Sequence< OUString > aServices; 1889cdf0e10cSrcweir if ( aServices.getLength() == 0 ) 1890cdf0e10cSrcweir { 1891cdf0e10cSrcweir Sequence< OUString > aRet = SvxFmMSFactory::getAvailableServiceNames(); 1892cdf0e10cSrcweir OUString* pRet = aRet.getArray(); 1893cdf0e10cSrcweir for ( sal_Int32 i = 0; i < aRet.getLength(); ++i ) 1894cdf0e10cSrcweir { 1895cdf0e10cSrcweir if ( pRet[i].compareToAscii( "com.sun.star.drawing.OLE2Shape" ) == 0 ) 1896cdf0e10cSrcweir { 1897cdf0e10cSrcweir pRet[i] = pRet[aRet.getLength() - 1]; 1898cdf0e10cSrcweir aRet.realloc( aRet.getLength() - 1 ); // <pRet> no longer valid. 1899cdf0e10cSrcweir break; 1900cdf0e10cSrcweir } 1901cdf0e10cSrcweir } 1902cdf0e10cSrcweir Sequence< OUString > aOwn = SwXServiceProvider::GetAllServiceNames(); 1903cdf0e10cSrcweir aServices = SvxFmMSFactory::concatServiceNames(aRet, aOwn); 1904cdf0e10cSrcweir } 1905cdf0e10cSrcweir 1906cdf0e10cSrcweir return aServices; 1907cdf0e10cSrcweir } 1908cdf0e10cSrcweir /* -----------------18.03.99 11:36------------------- 1909cdf0e10cSrcweir * 1910cdf0e10cSrcweir * --------------------------------------------------*/ 1911cdf0e10cSrcweir OUString SwXTextDocument::getImplementationName(void) throw( RuntimeException ) 1912cdf0e10cSrcweir { 1913cdf0e10cSrcweir return C2U("SwXTextDocument"); 1914cdf0e10cSrcweir } 1915cdf0e10cSrcweir /* -----------------20.01.04 10:14------------------- 1916cdf0e10cSrcweir * 1917cdf0e10cSrcweir * --------------------------------------------------*/ 1918cdf0e10cSrcweir sal_Bool SwXTextDocument::supportsService(const OUString& rServiceName) throw( RuntimeException ) 1919cdf0e10cSrcweir { 1920cdf0e10cSrcweir if ( 1921cdf0e10cSrcweir (rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.document.OfficeDocument" ))) || 1922cdf0e10cSrcweir (rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.text.GenericTextDocument"))) 1923cdf0e10cSrcweir ) 1924cdf0e10cSrcweir return sal_True; 1925cdf0e10cSrcweir 1926cdf0e10cSrcweir sal_Bool bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); 1927cdf0e10cSrcweir sal_Bool bGlobalDoc = (0 != PTR_CAST(SwGlobalDocShell, pDocShell)); 1928cdf0e10cSrcweir sal_Bool bTextDoc = (!bWebDoc && !bGlobalDoc); 1929cdf0e10cSrcweir 1930cdf0e10cSrcweir return ( 1931cdf0e10cSrcweir (bWebDoc && rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.WebDocument" ))) || 1932cdf0e10cSrcweir (bGlobalDoc && rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.GlobalDocument"))) || 1933cdf0e10cSrcweir (bTextDoc && rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument" ))) 1934cdf0e10cSrcweir ); 1935cdf0e10cSrcweir } 1936cdf0e10cSrcweir /* -----------------20.01.04 10:17------------------- 1937cdf0e10cSrcweir * 1938cdf0e10cSrcweir * --------------------------------------------------*/ 1939cdf0e10cSrcweir Sequence< OUString > SwXTextDocument::getSupportedServiceNames(void) throw( RuntimeException ) 1940cdf0e10cSrcweir { 1941cdf0e10cSrcweir sal_Bool bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); 1942cdf0e10cSrcweir sal_Bool bGlobalDoc = (0 != PTR_CAST(SwGlobalDocShell, pDocShell)); 1943cdf0e10cSrcweir sal_Bool bTextDoc = (!bWebDoc && !bGlobalDoc); 1944cdf0e10cSrcweir 1945cdf0e10cSrcweir Sequence< OUString > aRet (3); 1946cdf0e10cSrcweir OUString* pArray = aRet.getArray(); 1947cdf0e10cSrcweir 1948cdf0e10cSrcweir pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.document.OfficeDocument" ) ) ); 1949cdf0e10cSrcweir pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.GenericTextDocument" ) ) ); 1950cdf0e10cSrcweir 1951cdf0e10cSrcweir if (bTextDoc) 1952cdf0e10cSrcweir pArray[2] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.TextDocument" ) ) ); 1953cdf0e10cSrcweir else 1954cdf0e10cSrcweir if (bWebDoc) 1955cdf0e10cSrcweir pArray[2] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.WebDocument" ) ) ); 1956cdf0e10cSrcweir else 1957cdf0e10cSrcweir if (bGlobalDoc) 1958cdf0e10cSrcweir pArray[2] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.GlobalDocument" ) ) ); 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir return aRet; 1961cdf0e10cSrcweir } 1962cdf0e10cSrcweir /* -----------------05.05.99 12:10------------------- 1963cdf0e10cSrcweir * 1964cdf0e10cSrcweir * --------------------------------------------------*/ 1965cdf0e10cSrcweir Reference< XIndexAccess > SwXTextDocument::getDocumentIndexes(void) throw( RuntimeException ) 1966cdf0e10cSrcweir { 1967cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1968cdf0e10cSrcweir if(!IsValid()) 1969cdf0e10cSrcweir throw RuntimeException(); 1970cdf0e10cSrcweir if(!pxXDocumentIndexes) 1971cdf0e10cSrcweir { 1972cdf0e10cSrcweir ((SwXTextDocument*)this)->pxXDocumentIndexes = new Reference< XIndexAccess > ; 1973cdf0e10cSrcweir *pxXDocumentIndexes = new SwXDocumentIndexes(pDocShell->GetDoc()); 1974cdf0e10cSrcweir } 1975cdf0e10cSrcweir return *pxXDocumentIndexes; 1976cdf0e10cSrcweir } 1977cdf0e10cSrcweir 1978cdf0e10cSrcweir /*-- 10.05.99 13:58:58--------------------------------------------------- 1979cdf0e10cSrcweir 1980cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1981cdf0e10cSrcweir Reference< XPropertySetInfo > SwXTextDocument::getPropertySetInfo(void) throw( RuntimeException ) 1982cdf0e10cSrcweir { 1983cdf0e10cSrcweir static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo(); 1984cdf0e10cSrcweir return xRet; 1985cdf0e10cSrcweir } 1986cdf0e10cSrcweir /*-- 10.05.99 13:58:58--------------------------------------------------- 1987cdf0e10cSrcweir 1988cdf0e10cSrcweir -----------------------------------------------------------------------*/ 1989cdf0e10cSrcweir void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, 1990cdf0e10cSrcweir const Any& aValue) 1991cdf0e10cSrcweir throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, 1992cdf0e10cSrcweir WrappedTargetException, RuntimeException) 1993cdf0e10cSrcweir { 1994cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 1995cdf0e10cSrcweir if(!IsValid()) 1996cdf0e10cSrcweir throw RuntimeException(); 1997cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); 1998cdf0e10cSrcweir 1999cdf0e10cSrcweir if(!pEntry) 2000cdf0e10cSrcweir throw UnknownPropertyException(); 2001cdf0e10cSrcweir if(pEntry->nFlags & PropertyAttribute::READONLY) 2002cdf0e10cSrcweir throw PropertyVetoException(); 2003cdf0e10cSrcweir switch(pEntry->nWID) 2004cdf0e10cSrcweir { 2005cdf0e10cSrcweir case WID_DOC_CHAR_COUNT : 2006cdf0e10cSrcweir case WID_DOC_PARA_COUNT : 2007cdf0e10cSrcweir case WID_DOC_WORD_COUNT : 2008cdf0e10cSrcweir throw RuntimeException(); 2009cdf0e10cSrcweir case WID_DOC_WORD_SEPARATOR : 2010cdf0e10cSrcweir { 2011cdf0e10cSrcweir OUString sDelim; 2012cdf0e10cSrcweir aValue >>= sDelim; 2013cdf0e10cSrcweir SW_MOD()->GetModuleConfig()->SetWordDelimiter(sDelim); 2014cdf0e10cSrcweir } 2015cdf0e10cSrcweir break; 2016cdf0e10cSrcweir case WID_DOC_CHANGES_RECORD: 2017cdf0e10cSrcweir case WID_DOC_CHANGES_SHOW: 2018cdf0e10cSrcweir { 2019cdf0e10cSrcweir sal_Bool bSet = *(sal_Bool*)aValue.getValue(); 2020cdf0e10cSrcweir sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode(); 2021cdf0e10cSrcweir if(WID_DOC_CHANGES_SHOW == pEntry->nWID) 2022cdf0e10cSrcweir { 2023cdf0e10cSrcweir eMode &= ~(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE); 2024cdf0e10cSrcweir eMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT; 2025cdf0e10cSrcweir if( bSet ) 2026cdf0e10cSrcweir eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE; 2027cdf0e10cSrcweir } 2028cdf0e10cSrcweir else if(WID_DOC_CHANGES_RECORD == pEntry->nWID) 2029cdf0e10cSrcweir { 2030cdf0e10cSrcweir eMode = bSet ? eMode|nsRedlineMode_t::REDLINE_ON : eMode&~nsRedlineMode_t::REDLINE_ON; 2031cdf0e10cSrcweir } 2032cdf0e10cSrcweir pDocShell->GetDoc()->SetRedlineMode( (RedlineMode_t)(eMode )); 2033cdf0e10cSrcweir } 2034cdf0e10cSrcweir break; 2035cdf0e10cSrcweir case WID_DOC_CHANGES_PASSWORD: 2036cdf0e10cSrcweir { 2037cdf0e10cSrcweir Sequence <sal_Int8> aNew; 2038cdf0e10cSrcweir if(aValue >>= aNew) 2039cdf0e10cSrcweir { 2040cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 2041cdf0e10cSrcweir pDoc->SetRedlinePassword(aNew); 2042cdf0e10cSrcweir if(aNew.getLength()) 2043cdf0e10cSrcweir { 2044cdf0e10cSrcweir sal_uInt16 eMode = pDoc->GetRedlineMode(); 2045cdf0e10cSrcweir eMode = eMode|nsRedlineMode_t::REDLINE_ON; 2046cdf0e10cSrcweir pDoc->SetRedlineMode( (RedlineMode_t)(eMode )); 2047cdf0e10cSrcweir } 2048cdf0e10cSrcweir } 2049cdf0e10cSrcweir } 2050cdf0e10cSrcweir break; 2051cdf0e10cSrcweir case WID_DOC_AUTO_MARK_URL : 2052cdf0e10cSrcweir { 2053cdf0e10cSrcweir OUString sURL; 2054cdf0e10cSrcweir aValue >>= sURL; 2055cdf0e10cSrcweir pDocShell->GetDoc()->SetTOIAutoMarkURL(sURL); 2056cdf0e10cSrcweir } 2057cdf0e10cSrcweir break; 2058cdf0e10cSrcweir case WID_DOC_HIDE_TIPS : 2059cdf0e10cSrcweir SW_MOD()->GetModuleConfig()->SetHideFieldTips(*(sal_Bool*)aValue.getValue()); 2060cdf0e10cSrcweir break; 2061cdf0e10cSrcweir case WID_DOC_REDLINE_DISPLAY: 2062cdf0e10cSrcweir { 2063cdf0e10cSrcweir sal_Int16 eRedMode = pDocShell->GetDoc()->GetRedlineMode(); 2064cdf0e10cSrcweir eRedMode = eRedMode & (~nsRedlineMode_t::REDLINE_SHOW_MASK); 2065cdf0e10cSrcweir sal_Int16 nSet = 0; 2066cdf0e10cSrcweir aValue >>= nSet; 2067cdf0e10cSrcweir switch(nSet) 2068cdf0e10cSrcweir { 2069cdf0e10cSrcweir case RedlineDisplayType::NONE: break; 2070cdf0e10cSrcweir case RedlineDisplayType::INSERTED: eRedMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT; break; 2071cdf0e10cSrcweir case RedlineDisplayType::REMOVED: eRedMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE; break; 2072cdf0e10cSrcweir case RedlineDisplayType:: 2073cdf0e10cSrcweir INSERTED_AND_REMOVED: eRedMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT|nsRedlineMode_t::REDLINE_SHOW_DELETE; 2074cdf0e10cSrcweir break; 2075cdf0e10cSrcweir default: throw IllegalArgumentException(); 2076cdf0e10cSrcweir } 2077cdf0e10cSrcweir pDocShell->GetDoc()->SetRedlineMode(eRedMode); 2078cdf0e10cSrcweir } 2079cdf0e10cSrcweir break; 2080cdf0e10cSrcweir case WID_DOC_TWO_DIGIT_YEAR: 2081cdf0e10cSrcweir { 2082cdf0e10cSrcweir sal_Int16 nYear = 0; 2083cdf0e10cSrcweir aValue >>= nYear; 2084cdf0e10cSrcweir SfxRequest aRequest ( SID_ATTR_YEAR2000, SFX_CALLMODE_SLOT, pDocShell->GetDoc()->GetAttrPool()); 2085cdf0e10cSrcweir aRequest.AppendItem(SfxUInt16Item( SID_ATTR_YEAR2000, static_cast < sal_uInt16 > ( nYear ) ) ); 2086cdf0e10cSrcweir pDocShell->Execute ( aRequest ); 2087cdf0e10cSrcweir } 2088cdf0e10cSrcweir break; 2089cdf0e10cSrcweir case WID_DOC_AUTOMATIC_CONTROL_FOCUS: 2090cdf0e10cSrcweir { 2091cdf0e10cSrcweir SwDrawDocument * pDrawDoc; 2092cdf0e10cSrcweir sal_Bool bAuto = *(sal_Bool*) aValue.getValue(); 2093cdf0e10cSrcweir 2094cdf0e10cSrcweir if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * >( pDocShell->GetDoc()->GetDrawModel() ) ) ) 2095cdf0e10cSrcweir pDrawDoc->SetAutoControlFocus( bAuto ); 2096cdf0e10cSrcweir else if (bAuto) 2097cdf0e10cSrcweir { 2098cdf0e10cSrcweir // if setting to true, and we don't have an 2099cdf0e10cSrcweir // SdrModel, then we are changing the default and 2100cdf0e10cSrcweir // must thus create an SdrModel, if we don't have an 2101cdf0e10cSrcweir // SdrModel and we are leaving the default at false, 2102cdf0e10cSrcweir // we don't need to make an SdrModel and can do nothing 2103cdf0e10cSrcweir // --> OD 2005-08-08 #i52858# - method name changed 2104cdf0e10cSrcweir pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() ); 2105cdf0e10cSrcweir // <-- 2106cdf0e10cSrcweir pDrawDoc->SetAutoControlFocus ( bAuto ); 2107cdf0e10cSrcweir } 2108cdf0e10cSrcweir } 2109cdf0e10cSrcweir break; 2110cdf0e10cSrcweir case WID_DOC_APPLY_FORM_DESIGN_MODE: 2111cdf0e10cSrcweir { 2112cdf0e10cSrcweir SwDrawDocument * pDrawDoc; 2113cdf0e10cSrcweir sal_Bool bMode = *(sal_Bool*)aValue.getValue(); 2114cdf0e10cSrcweir 2115cdf0e10cSrcweir if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) ) 2116cdf0e10cSrcweir pDrawDoc->SetOpenInDesignMode( bMode ); 2117cdf0e10cSrcweir else if (!bMode) 2118cdf0e10cSrcweir { 2119cdf0e10cSrcweir // if setting to false, and we don't have an 2120cdf0e10cSrcweir // SdrModel, then we are changing the default and 2121cdf0e10cSrcweir // must thus create an SdrModel, if we don't have an 2122cdf0e10cSrcweir // SdrModel and we are leaving the default at true, 2123cdf0e10cSrcweir // we don't need to make an SdrModel and can do 2124cdf0e10cSrcweir // nothing 2125cdf0e10cSrcweir // --> OD 2005-08-08 #i52858# - method name changed 2126cdf0e10cSrcweir pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() ); 2127cdf0e10cSrcweir // <-- 2128cdf0e10cSrcweir pDrawDoc->SetOpenInDesignMode ( bMode ); 2129cdf0e10cSrcweir } 2130cdf0e10cSrcweir } 2131cdf0e10cSrcweir break; 2132cdf0e10cSrcweir // --> FME 2005-02-25 #i42634# New property to set the bInReading 2133cdf0e10cSrcweir // flag at the document, used during binary import 2134cdf0e10cSrcweir case WID_DOC_LOCK_UPDATES : 2135cdf0e10cSrcweir { 2136cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 2137cdf0e10cSrcweir bool bBool (false); 2138cdf0e10cSrcweir if( aValue >>= bBool ) 2139cdf0e10cSrcweir pDoc->SetInReading( bBool ); 2140cdf0e10cSrcweir } 2141cdf0e10cSrcweir break; 2142cdf0e10cSrcweir // <-- 2143cdf0e10cSrcweir case WID_DOC_BUILDID: 2144cdf0e10cSrcweir aValue >>= maBuildId; 2145cdf0e10cSrcweir break; 2146cdf0e10cSrcweir // --> OD 2006-03-21 #b6375613# 2147cdf0e10cSrcweir case WID_APPLY_WORKAROUND_FOR_B6375613: 2148cdf0e10cSrcweir { 2149cdf0e10cSrcweir bool bApplyWorkaroundForB6375613( false ); 2150cdf0e10cSrcweir aValue >>= bApplyWorkaroundForB6375613; 2151cdf0e10cSrcweir pDocShell->GetDoc()->SetApplyWorkaroundForB6375613( bApplyWorkaroundForB6375613 ); 2152cdf0e10cSrcweir } 2153cdf0e10cSrcweir break; 2154cdf0e10cSrcweir // <-- 2155d0b5cae4SJian Fang Zhang case WID_DOC_DEFAULT_PAGE_MODE: 2156d0b5cae4SJian Fang Zhang { 2157d0b5cae4SJian Fang Zhang bool bDefaultPageMode( false ); 2158d0b5cae4SJian Fang Zhang aValue >>= bDefaultPageMode; 2159d0b5cae4SJian Fang Zhang pDocShell->GetDoc()->SetDefaultPageMode( bDefaultPageMode ); 2160d0b5cae4SJian Fang Zhang } 2161d0b5cae4SJian Fang Zhang break; 2162cdf0e10cSrcweir 2163cdf0e10cSrcweir default: 2164cdf0e10cSrcweir { 2165cdf0e10cSrcweir const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID); 2166cdf0e10cSrcweir SfxPoolItem* pNewItem = rItem.Clone(); 2167cdf0e10cSrcweir pNewItem->PutValue(aValue, pEntry->nMemberId); 2168cdf0e10cSrcweir pDocShell->GetDoc()->SetDefault(*pNewItem); 2169cdf0e10cSrcweir delete pNewItem; 2170cdf0e10cSrcweir } 2171cdf0e10cSrcweir } 2172cdf0e10cSrcweir } 2173cdf0e10cSrcweir /*-- 10.05.99 13:58:59--------------------------------------------------- 2174cdf0e10cSrcweir 2175cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2176cdf0e10cSrcweir Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) 2177cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 2178cdf0e10cSrcweir { 2179cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2180cdf0e10cSrcweir if(!IsValid()) 2181cdf0e10cSrcweir throw RuntimeException(); 2182cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); 2183cdf0e10cSrcweir 2184cdf0e10cSrcweir if(!pEntry) 2185cdf0e10cSrcweir throw UnknownPropertyException(); 2186cdf0e10cSrcweir Any aAny; 2187cdf0e10cSrcweir switch(pEntry->nWID) 2188cdf0e10cSrcweir { 2189cdf0e10cSrcweir case WID_DOC_CHAR_COUNT : 2190cdf0e10cSrcweir case WID_DOC_PARA_COUNT : 2191cdf0e10cSrcweir case WID_DOC_WORD_COUNT : 2192cdf0e10cSrcweir { 2193cdf0e10cSrcweir SwDocStat aStat(pDocShell->GetDoc()->GetDocStat()); 2194cdf0e10cSrcweir if(aStat.bModified) 2195cdf0e10cSrcweir pDocShell->GetDoc()->UpdateDocStat( aStat ); 2196cdf0e10cSrcweir sal_Int32 nValue; 2197cdf0e10cSrcweir switch(pEntry->nWID) 2198cdf0e10cSrcweir { 2199cdf0e10cSrcweir case WID_DOC_CHAR_COUNT :nValue = aStat.nChar;break; 2200cdf0e10cSrcweir case WID_DOC_PARA_COUNT :nValue = aStat.nPara;break; 2201cdf0e10cSrcweir case WID_DOC_WORD_COUNT :nValue = aStat.nWord;break; 2202cdf0e10cSrcweir } 2203cdf0e10cSrcweir aAny <<= nValue; 2204cdf0e10cSrcweir } 2205cdf0e10cSrcweir break; 2206cdf0e10cSrcweir case WID_DOC_WORD_SEPARATOR : 2207cdf0e10cSrcweir { 2208cdf0e10cSrcweir aAny <<= OUString(SW_MOD()->GetDocStatWordDelim()); 2209cdf0e10cSrcweir } 2210cdf0e10cSrcweir break; 2211cdf0e10cSrcweir case WID_DOC_CHANGES_RECORD: 2212cdf0e10cSrcweir case WID_DOC_CHANGES_SHOW: 2213cdf0e10cSrcweir { 2214cdf0e10cSrcweir sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode(); 2215cdf0e10cSrcweir sal_Bool bSet = sal_False; 2216cdf0e10cSrcweir if(WID_DOC_CHANGES_SHOW == pEntry->nWID) 2217cdf0e10cSrcweir { 2218cdf0e10cSrcweir sal_uInt16 nMask = nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE; 2219cdf0e10cSrcweir bSet = (eMode & nMask) == nMask; 2220cdf0e10cSrcweir } 2221cdf0e10cSrcweir else if(WID_DOC_CHANGES_RECORD == pEntry->nWID) 2222cdf0e10cSrcweir { 2223cdf0e10cSrcweir bSet = (eMode& nsRedlineMode_t::REDLINE_ON) != 0; 2224cdf0e10cSrcweir } 2225cdf0e10cSrcweir aAny.setValue(&bSet, ::getBooleanCppuType()); 2226cdf0e10cSrcweir } 2227cdf0e10cSrcweir break; 2228cdf0e10cSrcweir case WID_DOC_CHANGES_PASSWORD: 2229cdf0e10cSrcweir { 2230cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 2231cdf0e10cSrcweir aAny <<= pDoc->GetRedlinePassword(); 2232cdf0e10cSrcweir } 2233cdf0e10cSrcweir break; 2234cdf0e10cSrcweir case WID_DOC_AUTO_MARK_URL : 2235cdf0e10cSrcweir aAny <<= OUString(pDocShell->GetDoc()->GetTOIAutoMarkURL()); 2236cdf0e10cSrcweir break; 2237cdf0e10cSrcweir case WID_DOC_HIDE_TIPS : 2238cdf0e10cSrcweir { 2239cdf0e10cSrcweir sal_Bool bTemp = SW_MOD()->GetModuleConfig()->IsHideFieldTips(); 2240cdf0e10cSrcweir aAny.setValue(&bTemp, ::getBooleanCppuType()); 2241cdf0e10cSrcweir } 2242cdf0e10cSrcweir break; 2243cdf0e10cSrcweir case WID_DOC_REDLINE_DISPLAY: 2244cdf0e10cSrcweir { 2245cdf0e10cSrcweir sal_Int16 eRedMode = pDocShell->GetDoc()->GetRedlineMode(); 2246cdf0e10cSrcweir eRedMode = eRedMode & nsRedlineMode_t::REDLINE_SHOW_MASK; 2247cdf0e10cSrcweir sal_Int16 nRet = RedlineDisplayType::NONE; 2248cdf0e10cSrcweir if(nsRedlineMode_t::REDLINE_SHOW_INSERT == eRedMode) 2249cdf0e10cSrcweir nRet = RedlineDisplayType::INSERTED; 2250cdf0e10cSrcweir else if(nsRedlineMode_t::REDLINE_SHOW_DELETE == eRedMode) 2251cdf0e10cSrcweir nRet = RedlineDisplayType::REMOVED; 2252cdf0e10cSrcweir else if(nsRedlineMode_t::REDLINE_SHOW_MASK == eRedMode) 2253cdf0e10cSrcweir nRet = RedlineDisplayType::INSERTED_AND_REMOVED; 2254cdf0e10cSrcweir aAny <<= nRet; 2255cdf0e10cSrcweir } 2256cdf0e10cSrcweir break; 2257cdf0e10cSrcweir case WID_DOC_FORBIDDEN_CHARS: 2258cdf0e10cSrcweir { 2259cdf0e10cSrcweir GetPropertyHelper(); 2260cdf0e10cSrcweir Reference<XForbiddenCharacters> xRet(xPropertyHelper, UNO_QUERY); 2261cdf0e10cSrcweir aAny <<= xRet; 2262cdf0e10cSrcweir } 2263cdf0e10cSrcweir break; 2264cdf0e10cSrcweir case WID_DOC_TWO_DIGIT_YEAR: 2265cdf0e10cSrcweir { 2266cdf0e10cSrcweir aAny <<= static_cast < sal_Int16 > (pDocShell->GetDoc()->GetNumberFormatter ( sal_True )->GetYear2000()); 2267cdf0e10cSrcweir } 2268cdf0e10cSrcweir break; 2269cdf0e10cSrcweir case WID_DOC_AUTOMATIC_CONTROL_FOCUS: 2270cdf0e10cSrcweir { 2271cdf0e10cSrcweir SwDrawDocument * pDrawDoc; 2272cdf0e10cSrcweir sal_Bool bAuto; 2273cdf0e10cSrcweir if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) ) 2274cdf0e10cSrcweir bAuto = pDrawDoc->GetAutoControlFocus(); 2275cdf0e10cSrcweir else 2276cdf0e10cSrcweir bAuto = sal_False; 2277cdf0e10cSrcweir aAny.setValue(&bAuto, ::getBooleanCppuType()); 2278cdf0e10cSrcweir } 2279cdf0e10cSrcweir break; 2280cdf0e10cSrcweir case WID_DOC_APPLY_FORM_DESIGN_MODE: 2281cdf0e10cSrcweir { 2282cdf0e10cSrcweir SwDrawDocument * pDrawDoc; 2283cdf0e10cSrcweir sal_Bool bMode; 2284cdf0e10cSrcweir if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) ) 2285cdf0e10cSrcweir bMode = pDrawDoc->GetOpenInDesignMode(); 2286cdf0e10cSrcweir else 2287cdf0e10cSrcweir bMode = sal_True; 2288cdf0e10cSrcweir aAny.setValue(&bMode, ::getBooleanCppuType()); 2289cdf0e10cSrcweir } 2290cdf0e10cSrcweir break; 2291cdf0e10cSrcweir case WID_DOC_BASIC_LIBRARIES: 2292cdf0e10cSrcweir aAny <<= pDocShell->GetBasicContainer(); 2293cdf0e10cSrcweir break; 2294cdf0e10cSrcweir case WID_DOC_DIALOG_LIBRARIES: 2295cdf0e10cSrcweir aAny <<= pDocShell->GetDialogContainer(); 2296cdf0e10cSrcweir break; 2297cdf0e10cSrcweir case WID_DOC_RUNTIME_UID: 2298cdf0e10cSrcweir aAny <<= getRuntimeUID(); 2299cdf0e10cSrcweir break; 2300cdf0e10cSrcweir case WID_DOC_LOCK_UPDATES : 2301cdf0e10cSrcweir aAny <<= static_cast<bool>( pDocShell->GetDoc()->IsInReading() ); 2302cdf0e10cSrcweir break; 2303cdf0e10cSrcweir case WID_DOC_BUILDID: 2304cdf0e10cSrcweir aAny <<= maBuildId; 2305cdf0e10cSrcweir break; 2306cdf0e10cSrcweir case WID_DOC_HAS_VALID_SIGNATURES: 2307cdf0e10cSrcweir aAny <<= hasValidSignatures(); 2308cdf0e10cSrcweir break; 2309cdf0e10cSrcweir // --> OD 2006-03-21 #b6375613# 2310cdf0e10cSrcweir case WID_APPLY_WORKAROUND_FOR_B6375613: 2311cdf0e10cSrcweir { 2312cdf0e10cSrcweir aAny <<= pDocShell->GetDoc()->ApplyWorkaroundForB6375613(); 2313cdf0e10cSrcweir } 2314cdf0e10cSrcweir break; 2315cdf0e10cSrcweir // <-- 2316cdf0e10cSrcweir 2317cdf0e10cSrcweir default: 2318cdf0e10cSrcweir { 2319cdf0e10cSrcweir const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID); 2320cdf0e10cSrcweir rItem.QueryValue(aAny, pEntry->nMemberId); 2321cdf0e10cSrcweir } 2322cdf0e10cSrcweir } 2323cdf0e10cSrcweir return aAny; 2324cdf0e10cSrcweir } 2325cdf0e10cSrcweir /*-- 10.05.99 13:58:59--------------------------------------------------- 2326cdf0e10cSrcweir 2327cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2328cdf0e10cSrcweir void SwXTextDocument::addPropertyChangeListener(const OUString& /*PropertyName*/, 2329cdf0e10cSrcweir const Reference< XPropertyChangeListener > & /*aListener*/) 2330cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 2331cdf0e10cSrcweir { 2332cdf0e10cSrcweir DBG_WARNING("not implemented"); 2333cdf0e10cSrcweir } 2334cdf0e10cSrcweir /*-- 10.05.99 13:58:59--------------------------------------------------- 2335cdf0e10cSrcweir 2336cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2337cdf0e10cSrcweir void SwXTextDocument::removePropertyChangeListener(const OUString& /*PropertyName*/, 2338cdf0e10cSrcweir const Reference< XPropertyChangeListener > & /*aListener*/) 2339cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 2340cdf0e10cSrcweir { 2341cdf0e10cSrcweir DBG_WARNING("not implemented"); 2342cdf0e10cSrcweir } 2343cdf0e10cSrcweir /*-- 10.05.99 13:59:00--------------------------------------------------- 2344cdf0e10cSrcweir 2345cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2346cdf0e10cSrcweir void SwXTextDocument::addVetoableChangeListener(const OUString& /*PropertyName*/, 2347cdf0e10cSrcweir const Reference< XVetoableChangeListener > & /*aListener*/) 2348cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 2349cdf0e10cSrcweir { 2350cdf0e10cSrcweir DBG_WARNING("not implemented"); 2351cdf0e10cSrcweir } 2352cdf0e10cSrcweir /*-- 10.05.99 13:59:00--------------------------------------------------- 2353cdf0e10cSrcweir 2354cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2355cdf0e10cSrcweir void SwXTextDocument::removeVetoableChangeListener(const OUString& /*PropertyName*/, 2356cdf0e10cSrcweir const Reference< XVetoableChangeListener > & /*aListener*/) 2357cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 2358cdf0e10cSrcweir { 2359cdf0e10cSrcweir DBG_WARNING("not implemented"); 2360cdf0e10cSrcweir } 2361cdf0e10cSrcweir /* -----------------25.10.99 10:42------------------- 2362cdf0e10cSrcweir 2363cdf0e10cSrcweir --------------------------------------------------*/ 2364cdf0e10cSrcweir Reference< XNameAccess > SwXTextDocument::getLinks(void) throw( RuntimeException ) 2365cdf0e10cSrcweir { 2366cdf0e10cSrcweir if(!pxLinkTargetSupplier) 2367cdf0e10cSrcweir { 2368cdf0e10cSrcweir pxLinkTargetSupplier = new Reference< XNameAccess > ; 2369cdf0e10cSrcweir (*pxLinkTargetSupplier) = new SwXLinkTargetSupplier(*(SwXTextDocument*)this); 2370cdf0e10cSrcweir } 2371cdf0e10cSrcweir return (*pxLinkTargetSupplier); 2372cdf0e10cSrcweir } 2373cdf0e10cSrcweir /* -----------------------------11.01.01 15:01-------------------------------- 2374cdf0e10cSrcweir 2375cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2376cdf0e10cSrcweir Reference< XEnumerationAccess > SwXTextDocument::getRedlines( ) throw(RuntimeException) 2377cdf0e10cSrcweir { 2378cdf0e10cSrcweir if(!pxXRedlines) 2379cdf0e10cSrcweir { 2380cdf0e10cSrcweir pxXRedlines = new Reference< XEnumerationAccess > ; 2381cdf0e10cSrcweir (*pxXRedlines) = new SwXRedlines(pDocShell->GetDoc()); 2382cdf0e10cSrcweir } 2383cdf0e10cSrcweir return *pxXRedlines; 2384cdf0e10cSrcweir } 2385cdf0e10cSrcweir /*-- 21.02.00 08:41:06--------------------------------------------------- 2386cdf0e10cSrcweir 2387cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2388cdf0e10cSrcweir void SwXTextDocument::refresh(void) throw( RuntimeException ) 2389cdf0e10cSrcweir { 2390cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2391cdf0e10cSrcweir if(!IsValid()) 2392cdf0e10cSrcweir throw RuntimeException(); 2393cdf0e10cSrcweir ViewShell *pViewShell = pDocShell->GetWrtShell(); 2394cdf0e10cSrcweir notifyRefreshListeners(); 2395cdf0e10cSrcweir if(pViewShell) 2396cdf0e10cSrcweir pViewShell->CalcLayout(); 2397cdf0e10cSrcweir } 2398cdf0e10cSrcweir /*-- 21.02.00 08:41:06--------------------------------------------------- 2399cdf0e10cSrcweir 2400cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2401cdf0e10cSrcweir void SwXTextDocument::addRefreshListener(const Reference< util::XRefreshListener > & l) 2402cdf0e10cSrcweir throw( RuntimeException ) 2403cdf0e10cSrcweir { 2404cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2405cdf0e10cSrcweir if ( !IsValid() ) 2406cdf0e10cSrcweir throw RuntimeException(); 2407cdf0e10cSrcweir aRefreshCont.AddListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l )); 2408cdf0e10cSrcweir } 2409cdf0e10cSrcweir /*-- 21.02.00 08:41:07--------------------------------------------------- 2410cdf0e10cSrcweir 2411cdf0e10cSrcweir -----------------------------------------------------------------------*/ 2412cdf0e10cSrcweir void SwXTextDocument::removeRefreshListener(const Reference< util::XRefreshListener > & l) 2413cdf0e10cSrcweir throw( RuntimeException ) 2414cdf0e10cSrcweir { 2415cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2416cdf0e10cSrcweir if ( !IsValid() || !aRefreshCont.RemoveListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l ) ) ) 2417cdf0e10cSrcweir throw RuntimeException(); 2418cdf0e10cSrcweir } 2419cdf0e10cSrcweir /* -----------------------------26.02.01 12:22-------------------------------- 2420cdf0e10cSrcweir 2421cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2422cdf0e10cSrcweir void SwXTextDocument::updateLinks( ) throw(RuntimeException) 2423cdf0e10cSrcweir { 2424cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2425cdf0e10cSrcweir if(!IsValid()) 2426cdf0e10cSrcweir throw RuntimeException(); 2427cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 2428cdf0e10cSrcweir sfx2::LinkManager& rLnkMan = pDoc->GetLinkManager(); 2429cdf0e10cSrcweir if( rLnkMan.GetLinks().Count() ) 2430cdf0e10cSrcweir { 2431cdf0e10cSrcweir UnoActionContext aAction(pDoc); 2432cdf0e10cSrcweir rLnkMan.UpdateAllLinks( sal_False, sal_False, sal_True ); 2433cdf0e10cSrcweir } 2434cdf0e10cSrcweir } 2435cdf0e10cSrcweir //XPropertyState 2436cdf0e10cSrcweir PropertyState SAL_CALL SwXTextDocument::getPropertyState( const OUString& rPropertyName ) 2437cdf0e10cSrcweir throw (UnknownPropertyException, RuntimeException) 2438cdf0e10cSrcweir { 2439cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2440cdf0e10cSrcweir PropertyState eRet = PropertyState_DIRECT_VALUE; 2441cdf0e10cSrcweir if(!IsValid()) 2442cdf0e10cSrcweir throw RuntimeException(); 2443cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); 2444cdf0e10cSrcweir 2445cdf0e10cSrcweir if(!pEntry) 2446cdf0e10cSrcweir throw UnknownPropertyException(); 2447cdf0e10cSrcweir Any aAny; 2448cdf0e10cSrcweir switch(pEntry->nWID) 2449cdf0e10cSrcweir { 2450cdf0e10cSrcweir case 0:default:break; 2451cdf0e10cSrcweir } 2452cdf0e10cSrcweir return eRet; 2453cdf0e10cSrcweir } 2454cdf0e10cSrcweir Sequence< PropertyState > SAL_CALL SwXTextDocument::getPropertyStates( const Sequence< OUString >& rPropertyNames ) 2455cdf0e10cSrcweir throw (UnknownPropertyException, RuntimeException) 2456cdf0e10cSrcweir { 2457cdf0e10cSrcweir const sal_Int32 nCount = rPropertyNames.getLength(); 2458cdf0e10cSrcweir const OUString * pNames = rPropertyNames.getConstArray(); 2459cdf0e10cSrcweir Sequence < PropertyState > aRet ( nCount ); 2460cdf0e10cSrcweir PropertyState *pState = aRet.getArray(); 2461cdf0e10cSrcweir 2462cdf0e10cSrcweir for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++) 2463cdf0e10cSrcweir pState[nIndex] = getPropertyState( pNames[nIndex] ); 2464cdf0e10cSrcweir 2465cdf0e10cSrcweir return aRet; 2466cdf0e10cSrcweir } 2467cdf0e10cSrcweir void SAL_CALL SwXTextDocument::setPropertyToDefault( const OUString& rPropertyName ) 2468cdf0e10cSrcweir throw (UnknownPropertyException, RuntimeException) 2469cdf0e10cSrcweir { 2470cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2471cdf0e10cSrcweir if(!IsValid()) 2472cdf0e10cSrcweir throw RuntimeException(); 2473cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); 2474cdf0e10cSrcweir if(!pEntry) 2475cdf0e10cSrcweir throw UnknownPropertyException(); 2476cdf0e10cSrcweir switch(pEntry->nWID) 2477cdf0e10cSrcweir { 2478cdf0e10cSrcweir case 0:default:break; 2479cdf0e10cSrcweir } 2480cdf0e10cSrcweir } 2481cdf0e10cSrcweir Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName ) 2482cdf0e10cSrcweir throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 2483cdf0e10cSrcweir { 2484cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2485cdf0e10cSrcweir if(!IsValid()) 2486cdf0e10cSrcweir throw RuntimeException(); 2487cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); 2488cdf0e10cSrcweir if(!pEntry) 2489cdf0e10cSrcweir throw UnknownPropertyException(); 2490cdf0e10cSrcweir Any aAny; 2491cdf0e10cSrcweir switch(pEntry->nWID) 2492cdf0e10cSrcweir { 2493cdf0e10cSrcweir case 0:default:break; 2494cdf0e10cSrcweir } 2495cdf0e10cSrcweir return aAny; 2496cdf0e10cSrcweir } 2497cdf0e10cSrcweir 2498cdf0e10cSrcweir static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions ) 2499cdf0e10cSrcweir { 2500cdf0e10cSrcweir OutputDevice *pOut = 0; 2501cdf0e10cSrcweir 2502cdf0e10cSrcweir uno::Any aAny( rPrintUIOptions.getValue( C2U( "RenderDevice" ) )); 2503cdf0e10cSrcweir uno::Reference< awt::XDevice > xRenderDevice; 2504cdf0e10cSrcweir aAny >>= xRenderDevice; 2505cdf0e10cSrcweir if (xRenderDevice.is()) 2506cdf0e10cSrcweir { 2507cdf0e10cSrcweir VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); 2508cdf0e10cSrcweir pOut = pDevice ? pDevice->GetOutputDevice() : 0; 2509cdf0e10cSrcweir } 2510cdf0e10cSrcweir 2511cdf0e10cSrcweir return pOut; 2512cdf0e10cSrcweir } 2513cdf0e10cSrcweir 2514cdf0e10cSrcweir 2515cdf0e10cSrcweir static bool lcl_SeqHasProperty( 2516cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rOptions, 2517cdf0e10cSrcweir const sal_Char *pPropName ) 2518cdf0e10cSrcweir { 2519cdf0e10cSrcweir bool bRes = false; 2520cdf0e10cSrcweir const sal_Int32 nLen = rOptions.getLength(); 2521cdf0e10cSrcweir const beans::PropertyValue *pProps = rOptions.getConstArray(); 2522cdf0e10cSrcweir for (sal_Int32 i = 0; i < nLen && !bRes; ++i) 2523cdf0e10cSrcweir { 2524cdf0e10cSrcweir if (pProps[i].Name.equalsAscii( pPropName )) 2525cdf0e10cSrcweir bRes = true; 2526cdf0e10cSrcweir } 2527cdf0e10cSrcweir return bRes; 2528cdf0e10cSrcweir } 2529cdf0e10cSrcweir 2530cdf0e10cSrcweir 2531cdf0e10cSrcweir SfxViewShell * SwXTextDocument::GetRenderView( 2532cdf0e10cSrcweir bool &rbIsSwSrcView, 2533cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rOptions, 2534cdf0e10cSrcweir bool bIsPDFExport ) 2535cdf0e10cSrcweir { 2536cdf0e10cSrcweir // get view shell to use 2537cdf0e10cSrcweir SfxViewShell *pView = 0; 2538cdf0e10cSrcweir if (bIsPDFExport) 2539cdf0e10cSrcweir pView = GuessViewShell( rbIsSwSrcView ); 2540cdf0e10cSrcweir else 2541cdf0e10cSrcweir { 2542cdf0e10cSrcweir uno::Any aTmp; 2543cdf0e10cSrcweir const sal_Int32 nLen = rOptions.getLength(); 2544cdf0e10cSrcweir const beans::PropertyValue *pProps = rOptions.getConstArray(); 2545cdf0e10cSrcweir for (sal_Int32 i = 0; i < nLen; ++i) 2546cdf0e10cSrcweir { 2547cdf0e10cSrcweir if (pProps[i].Name.equalsAscii( "View" )) 2548cdf0e10cSrcweir { 2549cdf0e10cSrcweir aTmp = pProps[i].Value; 2550cdf0e10cSrcweir break; 2551cdf0e10cSrcweir } 2552cdf0e10cSrcweir } 2553cdf0e10cSrcweir 2554cdf0e10cSrcweir uno::Reference< frame::XController > xController; 2555cdf0e10cSrcweir if (aTmp >>= xController) 2556cdf0e10cSrcweir { 2557cdf0e10cSrcweir DBG_ASSERT( xController.is(), "controller is empty!" ); 2558cdf0e10cSrcweir pView = GuessViewShell( rbIsSwSrcView, xController ); 2559cdf0e10cSrcweir } 2560cdf0e10cSrcweir } 2561cdf0e10cSrcweir return pView; 2562cdf0e10cSrcweir } 2563cdf0e10cSrcweir 2564cdf0e10cSrcweir 2565cdf0e10cSrcweir /* 2566cdf0e10cSrcweir * GetRenderDoc: 2567cdf0e10cSrcweir * returns the document to be rendered, usually this will be the 'regular' 2568cdf0e10cSrcweir * document but in case of PDF export of (multi-)selection it will 2569cdf0e10cSrcweir * be a temporary document that gets created if not already done. 2570cdf0e10cSrcweir * The rpView variable will be set (if not already done) to the used 2571cdf0e10cSrcweir * SfxViewShell. 2572cdf0e10cSrcweir */ 2573cdf0e10cSrcweir 2574cdf0e10cSrcweir SwDoc * SwXTextDocument::GetRenderDoc( 2575cdf0e10cSrcweir SfxViewShell *&rpView, 2576cdf0e10cSrcweir const uno::Any& rSelection, 2577cdf0e10cSrcweir bool bIsPDFExport ) 2578cdf0e10cSrcweir { 2579cdf0e10cSrcweir SwDoc *pDoc = 0; 2580cdf0e10cSrcweir 2581cdf0e10cSrcweir uno::Reference< frame::XModel > xModel; 2582cdf0e10cSrcweir rSelection >>= xModel; 2583cdf0e10cSrcweir if (xModel == pDocShell->GetModel()) 2584cdf0e10cSrcweir pDoc = pDocShell->GetDoc(); 2585cdf0e10cSrcweir else 2586cdf0e10cSrcweir { 2587cdf0e10cSrcweir DBG_ASSERT( !xModel.is(), "unexpected model found" ); 2588cdf0e10cSrcweir 2589cdf0e10cSrcweir if (rSelection.hasValue()) // is anything selected ? 2590cdf0e10cSrcweir { 2591cdf0e10cSrcweir // this part should only be called when a temporary document needs to be created, 2592cdf0e10cSrcweir // for example for PDF export or printing of (multi-)selection only. 2593cdf0e10cSrcweir 2594cdf0e10cSrcweir bool bIsSwSrcView = false; 2595cdf0e10cSrcweir if (!rpView) 2596cdf0e10cSrcweir { 2597cdf0e10cSrcweir (void) bIsPDFExport; 2598cdf0e10cSrcweir // aside from maybe PDF export the view should always have been provided! 2599cdf0e10cSrcweir DBG_ASSERT( bIsPDFExport, "view is missing, guessing one..." ); 2600cdf0e10cSrcweir 2601cdf0e10cSrcweir rpView = GuessViewShell( bIsSwSrcView ); 2602cdf0e10cSrcweir } 2603cdf0e10cSrcweir DBG_ASSERT( rpView, "ViewShell missing" ); 2604cdf0e10cSrcweir // the view shell should be SwView for documents PDF export. 2605cdf0e10cSrcweir // for the page preview no selection should be possible 2606cdf0e10cSrcweir // (the export dialog does not allow for this option) 2607cdf0e10cSrcweir const TypeId aSwViewTypeId = TYPE(SwView); 2608cdf0e10cSrcweir if (rpView && rpView->IsA(aSwViewTypeId)) 2609cdf0e10cSrcweir { 2610cdf0e10cSrcweir SfxObjectShellLock xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc()); 2611cdf0e10cSrcweir if (xDocSh.Is()) 2612cdf0e10cSrcweir { 2613cdf0e10cSrcweir pDoc = ((SwDocShell*)&xDocSh)->GetDoc(); 2614cdf0e10cSrcweir rpView = pDoc->GetDocShell()->GetView(); 2615cdf0e10cSrcweir } 2616cdf0e10cSrcweir } 2617cdf0e10cSrcweir else 2618cdf0e10cSrcweir { 2619cdf0e10cSrcweir DBG_ERROR( "unexpected ViewShell" ); 2620cdf0e10cSrcweir } 2621cdf0e10cSrcweir } 2622cdf0e10cSrcweir } 2623cdf0e10cSrcweir return pDoc; 2624cdf0e10cSrcweir } 2625cdf0e10cSrcweir 2626cdf0e10cSrcweir /* -----------------------------23.08.02 16:00-------------------------------- 2627cdf0e10cSrcweir 2628cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2629cdf0e10cSrcweir 2630cdf0e10cSrcweir static void lcl_SavePrintUIOptionsToDocumentPrintData( 2631cdf0e10cSrcweir SwDoc &rDoc, 2632cdf0e10cSrcweir const SwPrintUIOptions &rPrintUIOptions, 2633cdf0e10cSrcweir bool bIsPDFEXport ) 2634cdf0e10cSrcweir { 2635cdf0e10cSrcweir SwPrintData aDocPrintData( rDoc.getPrintData() ); 2636cdf0e10cSrcweir 2637cdf0e10cSrcweir aDocPrintData.SetPrintGraphic( rPrintUIOptions.IsPrintGraphics() ); 2638cdf0e10cSrcweir aDocPrintData.SetPrintTable( rPrintUIOptions.IsPrintTables() ); 2639cdf0e10cSrcweir aDocPrintData.SetPrintDraw( rPrintUIOptions.IsPrintDrawings() ); 2640cdf0e10cSrcweir aDocPrintData.SetPrintControl( rPrintUIOptions.IsPrintFormControls() ); 2641cdf0e10cSrcweir aDocPrintData.SetPrintLeftPage( rPrintUIOptions.IsPrintLeftPages() ); 2642cdf0e10cSrcweir aDocPrintData.SetPrintRightPage( rPrintUIOptions.IsPrintRightPages() ); 2643cdf0e10cSrcweir aDocPrintData.SetPrintReverse( rPrintUIOptions.IsPrintReverse() ); 2644cdf0e10cSrcweir aDocPrintData.SetPaperFromSetup( rPrintUIOptions.IsPaperFromSetup() ); 2645cdf0e10cSrcweir aDocPrintData.SetPrintEmptyPages( rPrintUIOptions.IsPrintEmptyPages( bIsPDFEXport ) ); 2646cdf0e10cSrcweir aDocPrintData.SetPrintPostIts( rPrintUIOptions.GetPrintPostItsType() ); 2647cdf0e10cSrcweir aDocPrintData.SetPrintProspect( rPrintUIOptions.IsPrintProspect() ); 2648cdf0e10cSrcweir aDocPrintData.SetPrintProspect_RTL( rPrintUIOptions.IsPrintProspectRTL() ); 2649cdf0e10cSrcweir aDocPrintData.SetPrintPageBackground( rPrintUIOptions.IsPrintPageBackground() ); 2650cdf0e10cSrcweir aDocPrintData.SetPrintBlackFont( rPrintUIOptions.IsPrintWithBlackTextColor() ); 2651cdf0e10cSrcweir // aDocPrintData.SetPrintSingleJobs( b ); handled by File/Print dialog itself 2652cdf0e10cSrcweir // arDocPrintData.SetFaxName( s ); n/a in File/Print dialog 2653cdf0e10cSrcweir aDocPrintData.SetPrintHiddenText( rPrintUIOptions.IsPrintHiddenText() ); 2654cdf0e10cSrcweir aDocPrintData.SetPrintTextPlaceholder( rPrintUIOptions.IsPrintTextPlaceholders() ); 2655cdf0e10cSrcweir 2656cdf0e10cSrcweir rDoc.setPrintData( aDocPrintData ); 2657cdf0e10cSrcweir } 2658cdf0e10cSrcweir 2659cdf0e10cSrcweir 2660cdf0e10cSrcweir sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( 2661cdf0e10cSrcweir const uno::Any& rSelection, 2662cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rxOptions ) 2663cdf0e10cSrcweir throw (IllegalArgumentException, RuntimeException) 2664cdf0e10cSrcweir { 2665cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2666cdf0e10cSrcweir if(!IsValid()) 2667cdf0e10cSrcweir throw RuntimeException(); 2668cdf0e10cSrcweir 2669cdf0e10cSrcweir const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); 2670cdf0e10cSrcweir bool bIsSwSrcView = false; 2671cdf0e10cSrcweir SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); 267225cebbc8SOliver-Rainer Wittmann 2673cdf0e10cSrcweir SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); 2674cdf0e10cSrcweir DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); 267525cebbc8SOliver-Rainer Wittmann if ( pDoc == 0 || pView == 0 ) 267625cebbc8SOliver-Rainer Wittmann { 2677cdf0e10cSrcweir return 0; 267825cebbc8SOliver-Rainer Wittmann } 267925cebbc8SOliver-Rainer Wittmann 268025cebbc8SOliver-Rainer Wittmann // clean up <RenderData> and <PrintUIOptions> 268125cebbc8SOliver-Rainer Wittmann { 268225cebbc8SOliver-Rainer Wittmann if ( m_pRenderData ) 268325cebbc8SOliver-Rainer Wittmann { 268425cebbc8SOliver-Rainer Wittmann delete m_pRenderData; 268525cebbc8SOliver-Rainer Wittmann m_pRenderData = 0; 268625cebbc8SOliver-Rainer Wittmann } 268725cebbc8SOliver-Rainer Wittmann if ( m_pPrintUIOptions ) 268825cebbc8SOliver-Rainer Wittmann { 268925cebbc8SOliver-Rainer Wittmann delete m_pPrintUIOptions; 269025cebbc8SOliver-Rainer Wittmann m_pPrintUIOptions = 0; 269125cebbc8SOliver-Rainer Wittmann } 269225cebbc8SOliver-Rainer Wittmann } 269325cebbc8SOliver-Rainer Wittmann 269425cebbc8SOliver-Rainer Wittmann if ( !bIsSwSrcView ) 269525cebbc8SOliver-Rainer Wittmann { 269625cebbc8SOliver-Rainer Wittmann m_pRenderData = new SwRenderData; 269725cebbc8SOliver-Rainer Wittmann } 269825cebbc8SOliver-Rainer Wittmann // new <PrintUIOptions> 269925cebbc8SOliver-Rainer Wittmann m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); 270025cebbc8SOliver-Rainer Wittmann const bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); 2701cdf0e10cSrcweir 2702cdf0e10cSrcweir // save current UI options from the print dialog for the next call to that dialog 2703cdf0e10cSrcweir lcl_SavePrintUIOptionsToDocumentPrintData( *pDoc, *m_pPrintUIOptions, bIsPDFExport ); 2704cdf0e10cSrcweir 2705cdf0e10cSrcweir sal_Int32 nRet = 0; 270625cebbc8SOliver-Rainer Wittmann if ( bIsSwSrcView ) 2707cdf0e10cSrcweir { 2708cdf0e10cSrcweir SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); 2709cdf0e10cSrcweir OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); 2710cdf0e10cSrcweir nRet = pSwSrcView->PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ ); 2711cdf0e10cSrcweir } 2712cdf0e10cSrcweir else 2713cdf0e10cSrcweir { 2714cdf0e10cSrcweir SwDocShell *pRenderDocShell = pDoc->GetDocShell(); 2715cdf0e10cSrcweir 2716cdf0e10cSrcweir // TODO/mba: we really need a generic way to get the ViewShell! 2717cdf0e10cSrcweir ViewShell* pViewShell = 0; 2718cdf0e10cSrcweir SwView* pSwView = PTR_CAST(SwView, pView); 2719cdf0e10cSrcweir if ( pSwView ) 2720cdf0e10cSrcweir { 2721cdf0e10cSrcweir pViewShell = pSwView->GetWrtShellPtr(); 2722cdf0e10cSrcweir } 2723cdf0e10cSrcweir else 2724cdf0e10cSrcweir { 2725cdf0e10cSrcweir if ( bIsPDFExport && bFormat ) 2726cdf0e10cSrcweir { 2727cdf0e10cSrcweir //create a hidden view to be able to export as PDF also in print preview 2728cdf0e10cSrcweir //pView and pSwView are not changed intentionally! 2729cdf0e10cSrcweir m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, 2 ); 2730cdf0e10cSrcweir pViewShell = ((SwView*)m_pHiddenViewFrame->GetViewShell())->GetWrtShellPtr(); 2731cdf0e10cSrcweir } 2732cdf0e10cSrcweir else 2733cdf0e10cSrcweir pViewShell = ((SwPagePreView*)pView)->GetViewShell(); 2734cdf0e10cSrcweir } 2735cdf0e10cSrcweir 2736cdf0e10cSrcweir if (!pViewShell || !pViewShell->GetLayout()) 2737cdf0e10cSrcweir return 0; 2738cdf0e10cSrcweir 273925cebbc8SOliver-Rainer Wittmann if ( bFormat ) 2740cdf0e10cSrcweir { 2741cdf0e10cSrcweir // #i38289 2742cdf0e10cSrcweir if( pViewShell->GetViewOptions()->getBrowseMode() ) 2743cdf0e10cSrcweir { 2744cdf0e10cSrcweir SwViewOption aOpt( *pViewShell->GetViewOptions() ); 2745cdf0e10cSrcweir aOpt.setBrowseMode( false ); 2746cdf0e10cSrcweir pViewShell->ApplyViewOptions( aOpt ); 2747cdf0e10cSrcweir pSwView->RecheckBrowseMode(); 2748cdf0e10cSrcweir } 2749cdf0e10cSrcweir 2750cdf0e10cSrcweir // reformating the document for printing will show the changes in the view 2751cdf0e10cSrcweir // which is likely to produce many unwanted and not nice to view actions. 2752cdf0e10cSrcweir // We don't want that! Thus we disable updating of the view. 2753cdf0e10cSrcweir pViewShell->StartAction(); 2754cdf0e10cSrcweir 275525cebbc8SOliver-Rainer Wittmann if ( pSwView ) 2756cdf0e10cSrcweir { 2757cdf0e10cSrcweir if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pViewShell ) ) 2758cdf0e10cSrcweir m_pRenderData->ViewOptionAdjustStop(); 2759cdf0e10cSrcweir if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust()) 2760cdf0e10cSrcweir m_pRenderData->ViewOptionAdjustStart( *pViewShell, *pViewShell->GetViewOptions() ); 2761cdf0e10cSrcweir } 2762cdf0e10cSrcweir 2763cdf0e10cSrcweir m_pRenderData->SetSwPrtOptions( new SwPrintData ); 2764cdf0e10cSrcweir m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, 2765cdf0e10cSrcweir m_pPrintUIOptions, m_pRenderData, bIsPDFExport ); 2766cdf0e10cSrcweir 276725cebbc8SOliver-Rainer Wittmann if ( pSwView ) 2768cdf0e10cSrcweir { 2769cdf0e10cSrcweir // PDF export should not make use of the SwPrtOptions 2770cdf0e10cSrcweir const SwPrintData *pPrtOptions = (bIsPDFExport) 277125cebbc8SOliver-Rainer Wittmann ? NULL 277225cebbc8SOliver-Rainer Wittmann : m_pRenderData->GetSwPrtOptions(); 2773cdf0e10cSrcweir m_pRenderData->ViewOptionAdjust( pPrtOptions ); 2774cdf0e10cSrcweir } 2775cdf0e10cSrcweir 2776cdf0e10cSrcweir // since printing now also use the API for PDF export this option 2777cdf0e10cSrcweir // should be set for printing as well ... 2778cdf0e10cSrcweir pViewShell->SetPDFExportOption( sal_True ); 2779cdf0e10cSrcweir bool bOrigStatus = pRenderDocShell->IsEnableSetModified(); 2780cdf0e10cSrcweir // check configuration: shall update of printing information in DocInfo set the document to "modified"? 2781cdf0e10cSrcweir bool bStateChanged = false; 2782cdf0e10cSrcweir if ( bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) 2783cdf0e10cSrcweir { 2784cdf0e10cSrcweir pRenderDocShell->EnableSetModified( sal_False ); 2785cdf0e10cSrcweir bStateChanged = true; 2786cdf0e10cSrcweir } 278725cebbc8SOliver-Rainer Wittmann 2788cdf0e10cSrcweir // --> FME 2005-05-23 #122919# Force field update before PDF export: 2789cdf0e10cSrcweir pViewShell->ViewShell::UpdateFlds(sal_True); 2790cdf0e10cSrcweir // <-- 2791cdf0e10cSrcweir if( bStateChanged ) 2792cdf0e10cSrcweir pRenderDocShell->EnableSetModified( sal_True ); 2793cdf0e10cSrcweir 2794cdf0e10cSrcweir // there is some redundancy between those two function calls, but right now 2795cdf0e10cSrcweir // there is no time to sort this out. 2796cdf0e10cSrcweir //TODO: check what exatly needs to be done and make just one function for that 2797cdf0e10cSrcweir pViewShell->CalcLayout(); 2798cdf0e10cSrcweir pViewShell->CalcPagesForPrint( pViewShell->GetPageCount() ); 279925cebbc8SOliver-Rainer Wittmann 2800cdf0e10cSrcweir pViewShell->SetPDFExportOption( sal_False ); 280125cebbc8SOliver-Rainer Wittmann 2802cdf0e10cSrcweir // enable view again 2803cdf0e10cSrcweir pViewShell->EndAction(); 2804cdf0e10cSrcweir } 2805cdf0e10cSrcweir 2806cdf0e10cSrcweir const sal_Int32 nPageCount = pViewShell->GetPageCount(); 2807cdf0e10cSrcweir 2808cdf0e10cSrcweir // 2809cdf0e10cSrcweir // get number of pages to be rendered 2810cdf0e10cSrcweir // 2811cdf0e10cSrcweir const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); 2812cdf0e10cSrcweir if (bPrintProspect) 2813cdf0e10cSrcweir { 2814cdf0e10cSrcweir pDoc->CalculatePagePairsForProspectPrinting( *pViewShell->GetLayout(), *m_pRenderData, *m_pPrintUIOptions, nPageCount ); 2815cdf0e10cSrcweir nRet = m_pRenderData->GetPagePairsForProspectPrinting().size(); 2816cdf0e10cSrcweir } 2817cdf0e10cSrcweir else 2818cdf0e10cSrcweir { 281998e1256eSOliver-Rainer Wittmann if ( m_pRenderData->HasPostItData() ) 282098e1256eSOliver-Rainer Wittmann { 282198e1256eSOliver-Rainer Wittmann m_pRenderData->DeletePostItData(); 282298e1256eSOliver-Rainer Wittmann } 2823cdf0e10cSrcweir const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ); 2824cdf0e10cSrcweir if (nPostItMode != POSTITS_NONE) 2825cdf0e10cSrcweir { 2826cdf0e10cSrcweir OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); 2827cdf0e10cSrcweir m_pRenderData->CreatePostItData( pDoc, pViewShell->GetViewOptions(), pOutDev ); 2828cdf0e10cSrcweir } 2829cdf0e10cSrcweir 2830cdf0e10cSrcweir // get set of valid document pages (according to the current settings) 2831cdf0e10cSrcweir // and their start frames 2832cdf0e10cSrcweir pDoc->CalculatePagesForPrinting( *pViewShell->GetLayout(), *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount ); 2833cdf0e10cSrcweir 2834cdf0e10cSrcweir if (nPostItMode != POSTITS_NONE) 2835cdf0e10cSrcweir { 2836cdf0e10cSrcweir pDoc->UpdatePagesForPrintingWithPostItData( *m_pRenderData, 2837cdf0e10cSrcweir *m_pPrintUIOptions, bIsPDFExport, nPageCount ); 2838cdf0e10cSrcweir } 2839cdf0e10cSrcweir 2840cdf0e10cSrcweir nRet = m_pRenderData->GetPagesToPrint().size(); 2841cdf0e10cSrcweir } 2842cdf0e10cSrcweir } 2843cdf0e10cSrcweir DBG_ASSERT( nRet >= 0, "negative number of pages???" ); 2844cdf0e10cSrcweir 2845cdf0e10cSrcweir return nRet; 2846cdf0e10cSrcweir } 2847cdf0e10cSrcweir /* -----------------------------23.08.02 16:00-------------------------------- 2848cdf0e10cSrcweir 2849cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 2850cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( 2851cdf0e10cSrcweir sal_Int32 nRenderer, 2852cdf0e10cSrcweir const uno::Any& rSelection, 2853cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rxOptions ) 2854cdf0e10cSrcweir throw (IllegalArgumentException, RuntimeException) 2855cdf0e10cSrcweir { 2856cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 2857cdf0e10cSrcweir if(!IsValid()) 2858cdf0e10cSrcweir throw RuntimeException(); 2859cdf0e10cSrcweir 2860cdf0e10cSrcweir const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); 2861cdf0e10cSrcweir bool bIsSwSrcView = false; 2862cdf0e10cSrcweir SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); 2863cdf0e10cSrcweir 2864cdf0e10cSrcweir // m_pRenderData should NOT be created here! 2865cdf0e10cSrcweir // That should only be done in getRendererCount. If this function is called before 2866cdf0e10cSrcweir // getRendererCount was called then the caller will probably just retrieve the extra UI options 2867cdf0e10cSrcweir // and is not interested in getting valid information about the other data that would 2868cdf0e10cSrcweir // otherwise be provided here! 2869cdf0e10cSrcweir // if( ! m_pRenderData ) 2870cdf0e10cSrcweir // m_pRenderData = new SwRenderData; 2871cdf0e10cSrcweir if (!m_pPrintUIOptions) 2872cdf0e10cSrcweir m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); 2873cdf0e10cSrcweir m_pPrintUIOptions->processProperties( rxOptions ); 2874cdf0e10cSrcweir const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); 2875cdf0e10cSrcweir const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); 2876cdf0e10cSrcweir const bool bPrintPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", false ); 2877cdf0e10cSrcweir 2878cdf0e10cSrcweir SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); 2879cdf0e10cSrcweir DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); 2880cdf0e10cSrcweir if (!pDoc || !pView) 2881cdf0e10cSrcweir return uno::Sequence< beans::PropertyValue >(); 2882cdf0e10cSrcweir 288325cebbc8SOliver-Rainer Wittmann if ( nRenderer < 0 || nRenderer >= SAL_MAX_UINT16 ) 2884cdf0e10cSrcweir throw IllegalArgumentException(); 2885cdf0e10cSrcweir 2886cdf0e10cSrcweir // TODO/mba: we really need a generic way to get the ViewShell! 2887cdf0e10cSrcweir ViewShell* pVwSh = 0; 2888cdf0e10cSrcweir SwView* pSwView = PTR_CAST(SwView, pView); 2889cdf0e10cSrcweir if ( pSwView ) 2890cdf0e10cSrcweir pVwSh = pSwView->GetWrtShellPtr(); 2891cdf0e10cSrcweir else 2892cdf0e10cSrcweir pVwSh = ((SwPagePreView*)pView)->GetViewShell(); 2893cdf0e10cSrcweir 2894cdf0e10cSrcweir sal_Int32 nMaxRenderer = 0; 2895cdf0e10cSrcweir if (!bIsSwSrcView && m_pRenderData) 2896cdf0e10cSrcweir { 2897cdf0e10cSrcweir DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); 2898cdf0e10cSrcweir nMaxRenderer = bPrintProspect? 2899cdf0e10cSrcweir m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : 2900cdf0e10cSrcweir m_pRenderData->GetPagesToPrint().size() - 1; 2901cdf0e10cSrcweir } 2902cdf0e10cSrcweir // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print 2903cdf0e10cSrcweir // we obmit checking of the upper bound in this case. 2904cdf0e10cSrcweir if (!bIsSwSrcView && m_pRenderData && nRenderer > nMaxRenderer) 2905cdf0e10cSrcweir return uno::Sequence< beans::PropertyValue >(); 2906cdf0e10cSrcweir 2907cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aRenderer; 2908cdf0e10cSrcweir if (m_pRenderData) 2909cdf0e10cSrcweir { 291025cebbc8SOliver-Rainer Wittmann const sal_Int32 nPage = bPrintProspect 291125cebbc8SOliver-Rainer Wittmann ? nRenderer + 1 291225cebbc8SOliver-Rainer Wittmann : m_pRenderData->GetPagesToPrint()[ nRenderer ]; 291325cebbc8SOliver-Rainer Wittmann 2914cdf0e10cSrcweir // get paper tray to use ... 2915cdf0e10cSrcweir sal_Int32 nPrinterPaperTray = -1; 2916cdf0e10cSrcweir if (! bPrintPaperFromSetup) 2917cdf0e10cSrcweir { 2918cdf0e10cSrcweir // ... from individual page style (see the page tab in Format/Page dialog) 2919cdf0e10cSrcweir const std::map< sal_Int32, sal_Int32 > &rPaperTrays = m_pRenderData->GetPrinterPaperTrays(); 2920cdf0e10cSrcweir std::map< sal_Int32, sal_Int32 >::const_iterator aIt( rPaperTrays.find( nPage ) ); 2921cdf0e10cSrcweir if (aIt != rPaperTrays.end()) 2922cdf0e10cSrcweir nPrinterPaperTray = aIt->second; 2923cdf0e10cSrcweir } 2924cdf0e10cSrcweir 2925cdf0e10cSrcweir awt::Size aPageSize; 2926cdf0e10cSrcweir awt::Size aPreferredPageSize; 2927cdf0e10cSrcweir Size aTmpSize; 2928cdf0e10cSrcweir if (bIsSwSrcView || bPrintProspect) 2929cdf0e10cSrcweir { 2930cdf0e10cSrcweir // for printing of HTML source code and prospect printing we should use 2931cdf0e10cSrcweir // the printers paper size since 2932cdf0e10cSrcweir // a) HTML source view has no page size 2933cdf0e10cSrcweir // b) prospect printing has a different page size from the documents page 2934cdf0e10cSrcweir // since two document pages will get rendered on one printer page 2935cdf0e10cSrcweir 2936cdf0e10cSrcweir // since PageIncludesNonprintableArea will be set to true we can return the 2937cdf0e10cSrcweir // printers paper size here. 2938cdf0e10cSrcweir // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this 2939cdf0e10cSrcweir // case we won't get an OutputDevice here, but then the caller also has no need 2940cdf0e10cSrcweir // for the correct PageSisze right now... 2941cdf0e10cSrcweir Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions )); 2942cdf0e10cSrcweir if (pPrinter) 2943cdf0e10cSrcweir { 2944cdf0e10cSrcweir // HTML source view and prospect adapt to the printer's paper size 2945cdf0e10cSrcweir aTmpSize = pPrinter->GetPaperSize(); 2946cdf0e10cSrcweir aTmpSize = pPrinter->LogicToLogic( aTmpSize, 2947cdf0e10cSrcweir pPrinter->GetMapMode(), MapMode( MAP_100TH_MM )); 2948cdf0e10cSrcweir aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() ); 2949cdf0e10cSrcweir if( bPrintProspect ) 2950cdf0e10cSrcweir { 2951cdf0e10cSrcweir // just switch to an appropriate portrait/landscape format 2952cdf0e10cSrcweir // FIXME: brochure printing with landscape pages puts the 2953cdf0e10cSrcweir // pages next to each other, so landscape is currently always 2954cdf0e10cSrcweir // the better choice 2955cdf0e10cSrcweir if( aPageSize.Width < aPageSize.Height ) 2956cdf0e10cSrcweir { 2957cdf0e10cSrcweir aPreferredPageSize.Width = aPageSize.Height; 2958cdf0e10cSrcweir aPreferredPageSize.Height = aPageSize.Width; 2959cdf0e10cSrcweir } 2960cdf0e10cSrcweir } 2961cdf0e10cSrcweir } 2962cdf0e10cSrcweir } 2963cdf0e10cSrcweir else 2964cdf0e10cSrcweir { 296525cebbc8SOliver-Rainer Wittmann ASSERT( nPage > 0 && nPage <= SAL_MAX_UINT16, 296625cebbc8SOliver-Rainer Wittmann "<SwXTextDocument::getRenderer(..)> - unexpected value for the page number, it does not fit into sal_uInt16." ); 296725cebbc8SOliver-Rainer Wittmann aTmpSize = pVwSh->GetPageSize( static_cast< sal_uInt16 >(nPage), bIsSkipEmptyPages ); 2968cdf0e10cSrcweir aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ), 2969cdf0e10cSrcweir TWIP_TO_MM100( aTmpSize.Height() )); 2970cdf0e10cSrcweir } 2971cdf0e10cSrcweir 2972cdf0e10cSrcweir sal_Int32 nLen = 2; 2973cdf0e10cSrcweir aRenderer.realloc(2); 2974cdf0e10cSrcweir aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); 2975cdf0e10cSrcweir aRenderer[0].Value <<= aPageSize; 2976cdf0e10cSrcweir aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); 2977cdf0e10cSrcweir aRenderer[1].Value <<= sal_True; 2978cdf0e10cSrcweir if (aPreferredPageSize.Width && aPreferredPageSize.Height) 2979cdf0e10cSrcweir { 2980cdf0e10cSrcweir ++nLen; 2981cdf0e10cSrcweir aRenderer.realloc( nLen ); 2982cdf0e10cSrcweir aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferredPageSize" ) ); 2983cdf0e10cSrcweir aRenderer[ nLen - 1 ].Value <<= aPreferredPageSize; 2984cdf0e10cSrcweir } 2985cdf0e10cSrcweir if (nPrinterPaperTray >= 0) 2986cdf0e10cSrcweir { 2987cdf0e10cSrcweir ++nLen; 2988cdf0e10cSrcweir aRenderer.realloc( nLen ); 2989cdf0e10cSrcweir aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrinterPaperTray" ) ); 2990cdf0e10cSrcweir aRenderer[ nLen - 1 ].Value <<= nPrinterPaperTray; 2991cdf0e10cSrcweir } 2992cdf0e10cSrcweir } 2993cdf0e10cSrcweir 29940dccdc5dSMichael Stahl if ( bApplyPagePrintSettingsFromXPagePrintable ) 29950dccdc5dSMichael Stahl { 29960dccdc5dSMichael Stahl const SwPagePreViewPrtData* pPagePrintSettings = 29970dccdc5dSMichael Stahl pDocShell->GetDoc()->GetPreViewPrtData(); 29980dccdc5dSMichael Stahl if ( pPagePrintSettings && 29990dccdc5dSMichael Stahl ( pPagePrintSettings->GetRow() > 1 || 30000dccdc5dSMichael Stahl pPagePrintSettings->GetCol() > 1 ) ) 30010dccdc5dSMichael Stahl { 30020dccdc5dSMichael Stahl // extend render data by page print settings attributes 30030dccdc5dSMichael Stahl sal_Int32 nLen = aRenderer.getLength(); 30040dccdc5dSMichael Stahl const sal_Int32 nRenderDataIdxStart = nLen; 30050dccdc5dSMichael Stahl nLen += 9; 30060dccdc5dSMichael Stahl aRenderer.realloc( nLen ); 30070dccdc5dSMichael Stahl // put page print settings attribute into render data 30080dccdc5dSMichael Stahl const sal_Int32 nRow = pPagePrintSettings->GetRow(); 30090dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpRows" ) ); 30100dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 0 ].Value <<= ( nRow > 1 ? nRow : 1 ); 30110dccdc5dSMichael Stahl const sal_Int32 nCol = pPagePrintSettings->GetCol(); 30120dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpColumns" ) ); 30130dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 1 ].Value <<= ( nCol > 1 ? nCol : 1 ); 30140dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 2 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginLeft" ) ); 30150dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 2 ].Value <<= pPagePrintSettings->GetLeftSpace(); 30160dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 3 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginRight" ) ); 30170dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 3 ].Value <<= pPagePrintSettings->GetRightSpace(); 30180dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 4 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginTop" ) ); 30190dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 4 ].Value <<= pPagePrintSettings->GetTopSpace(); 30200dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 5 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginBottom" ) ); 30210dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 5 ].Value <<= pPagePrintSettings->GetBottomSpace(); 30220dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 6 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpHorizontalSpacing" ) ); 30230dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 6 ].Value <<= pPagePrintSettings->GetHorzSpace(); 30240dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 7 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpVerticalSpacing" ) ); 30250dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 7 ].Value <<= pPagePrintSettings->GetVertSpace(); 30260dccdc5dSMichael Stahl { 30270dccdc5dSMichael Stahl Printer* pPrinter = pDocShell->GetDoc()->getPrinter( false ); 30280dccdc5dSMichael Stahl if ( pPrinter ) 30290dccdc5dSMichael Stahl { 30300dccdc5dSMichael Stahl awt::Size aNewPageSize; 30310dccdc5dSMichael Stahl const Size aPageSize = pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ); 30320dccdc5dSMichael Stahl aNewPageSize = awt::Size( aPageSize.Width(), aPageSize.Height() ); 30330dccdc5dSMichael Stahl if ( ( pPagePrintSettings->GetLandscape() && 30340dccdc5dSMichael Stahl aPageSize.Width() < aPageSize.Height() ) || 30350dccdc5dSMichael Stahl ( !pPagePrintSettings->GetLandscape() && 30360dccdc5dSMichael Stahl aPageSize.Width() > aPageSize.Height() ) ) 30370dccdc5dSMichael Stahl { 30380dccdc5dSMichael Stahl aNewPageSize = awt::Size( aPageSize.Height(), aPageSize.Width() ); 30390dccdc5dSMichael Stahl } 30400dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 8 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPaperSize" ) ); 30410dccdc5dSMichael Stahl aRenderer[ nRenderDataIdxStart + 8 ].Value <<= aNewPageSize; 30420dccdc5dSMichael Stahl } 30430dccdc5dSMichael Stahl } 30440dccdc5dSMichael Stahl } 30450dccdc5dSMichael Stahl 30460dccdc5dSMichael Stahl bApplyPagePrintSettingsFromXPagePrintable = sal_False; 30470dccdc5dSMichael Stahl } 30480dccdc5dSMichael Stahl 3049cdf0e10cSrcweir m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); 3050cdf0e10cSrcweir 3051cdf0e10cSrcweir return aRenderer; 3052cdf0e10cSrcweir } 3053cdf0e10cSrcweir /* -----------------------------28.10.02 16:00-------------------------------- 3054cdf0e10cSrcweir 3055cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3056cdf0e10cSrcweir SfxViewShell * SwXTextDocument::GuessViewShell( 3057cdf0e10cSrcweir /* out */ bool &rbIsSwSrcView, 3058cdf0e10cSrcweir const uno::Reference< css::frame::XController > xController ) 3059cdf0e10cSrcweir { 3060cdf0e10cSrcweir // #130810# SfxViewShell::Current() / SfxViewShell::GetObjectShell() 3061cdf0e10cSrcweir // must not be used (see comment from MBA) 3062cdf0e10cSrcweir // 3063cdf0e10cSrcweir SfxViewShell *pView = 0; 3064cdf0e10cSrcweir SwView *pSwView = 0; 3065cdf0e10cSrcweir SwPagePreView *pSwPagePreView = 0; 3066cdf0e10cSrcweir SwSrcView *pSwSrcView = 0; 3067cdf0e10cSrcweir SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False ); 3068cdf0e10cSrcweir 3069cdf0e10cSrcweir // look for the view shell with the same controller in use, 3070cdf0e10cSrcweir // otherwise look for a suitable view, preferably a SwView, 3071cdf0e10cSrcweir // if that one is not found use a SwPagePreView if found. 3072cdf0e10cSrcweir while (pFrame) 3073cdf0e10cSrcweir { 3074cdf0e10cSrcweir pView = pFrame->GetViewShell(); 3075cdf0e10cSrcweir pSwView = dynamic_cast< SwView * >(pView); 3076cdf0e10cSrcweir pSwSrcView = dynamic_cast< SwSrcView * >(pView); 3077cdf0e10cSrcweir if (!pSwPagePreView) 3078cdf0e10cSrcweir pSwPagePreView = dynamic_cast< SwPagePreView * >(pView); 3079cdf0e10cSrcweir if (xController.is()) 3080cdf0e10cSrcweir { 3081cdf0e10cSrcweir if (pView && pView->GetController() == xController) 3082cdf0e10cSrcweir break; 3083cdf0e10cSrcweir } 3084cdf0e10cSrcweir else if (pSwView || pSwSrcView) 3085cdf0e10cSrcweir break; 3086cdf0e10cSrcweir pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False ); 3087cdf0e10cSrcweir } 3088cdf0e10cSrcweir 3089cdf0e10cSrcweir DBG_ASSERT( pSwView || pSwPagePreView || pSwSrcView, "failed to get view shell" ); 3090cdf0e10cSrcweir if (pView) 3091cdf0e10cSrcweir rbIsSwSrcView = pSwSrcView != 0; 3092cdf0e10cSrcweir return pView; 3093cdf0e10cSrcweir } 3094cdf0e10cSrcweir 3095cdf0e10cSrcweir 3096cdf0e10cSrcweir void SAL_CALL SwXTextDocument::render( 3097cdf0e10cSrcweir sal_Int32 nRenderer, 3098cdf0e10cSrcweir const uno::Any& rSelection, 3099cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rxOptions ) 3100cdf0e10cSrcweir throw (IllegalArgumentException, RuntimeException) 3101cdf0e10cSrcweir { 3102cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 3103cdf0e10cSrcweir if(!IsValid()) 3104cdf0e10cSrcweir throw RuntimeException(); 3105cdf0e10cSrcweir 3106cdf0e10cSrcweir // due to #110067# (document page count changes sometimes during 3107cdf0e10cSrcweir // PDF export/printing) we can not check for the upper bound properly. 3108cdf0e10cSrcweir // Thus instead of throwing the exception we silently return. 3109cdf0e10cSrcweir if (0 > nRenderer) 3110cdf0e10cSrcweir throw IllegalArgumentException(); 3111cdf0e10cSrcweir 3112cdf0e10cSrcweir const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" ); 3113cdf0e10cSrcweir bool bIsSwSrcView = false; 3114cdf0e10cSrcweir SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport ); 311525cebbc8SOliver-Rainer Wittmann 311625cebbc8SOliver-Rainer Wittmann // error handling - avoid crash 311725cebbc8SOliver-Rainer Wittmann if ( !bIsSwSrcView && m_pRenderData == NULL ) 311825cebbc8SOliver-Rainer Wittmann { 311925cebbc8SOliver-Rainer Wittmann DBG_ASSERT( false, "data should have been created already in getRendererCount..." ); 3120cdf0e10cSrcweir m_pRenderData = new SwRenderData; 312125cebbc8SOliver-Rainer Wittmann } 312225cebbc8SOliver-Rainer Wittmann if ( m_pPrintUIOptions == 0 ) 312325cebbc8SOliver-Rainer Wittmann { 312425cebbc8SOliver-Rainer Wittmann DBG_ASSERT( false, "data should have been created already in getRendererCount..." ); 3125cdf0e10cSrcweir m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView ); 312625cebbc8SOliver-Rainer Wittmann } 312725cebbc8SOliver-Rainer Wittmann 3128cdf0e10cSrcweir m_pPrintUIOptions->processProperties( rxOptions ); 3129cdf0e10cSrcweir const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false ); 3130cdf0e10cSrcweir const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); 3131cdf0e10cSrcweir 3132cdf0e10cSrcweir SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); 3133cdf0e10cSrcweir DBG_ASSERT( pDoc && pView, "doc or view shell missing!" ); 3134cdf0e10cSrcweir if (pDoc && pView) 3135cdf0e10cSrcweir { 3136cdf0e10cSrcweir sal_Int32 nMaxRenderer = 0; 3137cdf0e10cSrcweir if (!bIsSwSrcView) 3138cdf0e10cSrcweir { 3139cdf0e10cSrcweir DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" ); 3140cdf0e10cSrcweir nMaxRenderer = bPrintProspect? 3141cdf0e10cSrcweir m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 : 3142cdf0e10cSrcweir m_pRenderData->GetPagesToPrint().size() - 1; 3143cdf0e10cSrcweir } 3144cdf0e10cSrcweir // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print 3145cdf0e10cSrcweir // we obmit checking of the upper bound in this case. 3146cdf0e10cSrcweir if (bIsSwSrcView || nRenderer <= nMaxRenderer) 3147cdf0e10cSrcweir { 3148cdf0e10cSrcweir if (bIsSwSrcView) 3149cdf0e10cSrcweir { 3150cdf0e10cSrcweir SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView); 3151cdf0e10cSrcweir OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); 3152cdf0e10cSrcweir pSwSrcView->PrintSource( pOutDev, nRenderer + 1, false ); 3153cdf0e10cSrcweir } 3154cdf0e10cSrcweir else 3155cdf0e10cSrcweir { 3156cdf0e10cSrcweir // the view shell should be SwView for documents PDF export 3157cdf0e10cSrcweir // or SwPagePreView for PDF export of the page preview 3158cdf0e10cSrcweir //!! (check for SwView first as in GuessViewShell) !! 3159cdf0e10cSrcweir DBG_ASSERT( pView, "!! view missing !!" ); 3160cdf0e10cSrcweir const TypeId aSwViewTypeId = TYPE(SwView); 3161cdf0e10cSrcweir ViewShell* pVwSh = 0; 3162cdf0e10cSrcweir if (pView) 3163cdf0e10cSrcweir { 3164cdf0e10cSrcweir // TODO/mba: we really need a generic way to get the ViewShell! 3165cdf0e10cSrcweir SwView* pSwView = PTR_CAST(SwView, pView); 3166cdf0e10cSrcweir if ( pSwView ) 3167cdf0e10cSrcweir pVwSh = pSwView->GetWrtShellPtr(); 3168cdf0e10cSrcweir else 3169cdf0e10cSrcweir pVwSh = ((SwPagePreView*)pView)->GetViewShell(); 3170cdf0e10cSrcweir } 317125cebbc8SOliver-Rainer Wittmann 3172cdf0e10cSrcweir // get output device to use 3173cdf0e10cSrcweir OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions ); 3174cdf0e10cSrcweir 3175cdf0e10cSrcweir if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions()) 3176cdf0e10cSrcweir { 3177cdf0e10cSrcweir const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); 3178cdf0e10cSrcweir const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); 3179cdf0e10cSrcweir bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport ); 318025cebbc8SOliver-Rainer Wittmann 3181cdf0e10cSrcweir DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust()) 3182cdf0e10cSrcweir || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()), 3183cdf0e10cSrcweir "SwView / SwViewOptionAdjust_Impl availability mismatch" ); 318425cebbc8SOliver-Rainer Wittmann 3185cdf0e10cSrcweir // since printing now also use the API for PDF export this option 3186cdf0e10cSrcweir // should be set for printing as well ... 3187cdf0e10cSrcweir pVwSh->SetPDFExportOption( sal_True ); 3188cdf0e10cSrcweir 3189cdf0e10cSrcweir // --> FME 2004-06-08 #i12836# enhanced pdf export 3190cdf0e10cSrcweir // 3191cdf0e10cSrcweir // First, we have to export hyperlinks, notes, and outline to pdf. 3192cdf0e10cSrcweir // During this process, additional information required for tagging 3193cdf0e10cSrcweir // the pdf file are collected, which are evaulated during painting. 3194cdf0e10cSrcweir // 3195cdf0e10cSrcweir SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ? 3196cdf0e10cSrcweir ((SwView*)pView)->GetWrtShellPtr() : 3197cdf0e10cSrcweir 0; 3198cdf0e10cSrcweir 3199cdf0e10cSrcweir if (bIsPDFExport && bFirstPage && pWrtShell) 3200cdf0e10cSrcweir { 3201cdf0e10cSrcweir SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False ); 3202cdf0e10cSrcweir } 3203cdf0e10cSrcweir // <-- 3204cdf0e10cSrcweir 3205cdf0e10cSrcweir SwPrintData const& rSwPrtOptions = 3206cdf0e10cSrcweir *m_pRenderData->GetSwPrtOptions(); 3207cdf0e10cSrcweir if (bPrintProspect) 3208cdf0e10cSrcweir pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); 3209cdf0e10cSrcweir else // normal printing and PDF export 3210cdf0e10cSrcweir pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer ); 3211cdf0e10cSrcweir 3212cdf0e10cSrcweir // After printing the last page, we take care for the links coming 3213cdf0e10cSrcweir // from the EditEngine. The links are generated during the painting 3214cdf0e10cSrcweir // process, but the destinations are still missing. 3215cdf0e10cSrcweir // 3216cdf0e10cSrcweir if (bIsPDFExport && bLastPage && pWrtShell) 3217cdf0e10cSrcweir { 3218cdf0e10cSrcweir SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True ); 3219cdf0e10cSrcweir } 3220*9d3b3ce2SOliver-Rainer Wittmann 3221cdf0e10cSrcweir pVwSh->SetPDFExportOption( sal_False ); 3222cdf0e10cSrcweir } 3223cdf0e10cSrcweir } 3224cdf0e10cSrcweir } 3225cdf0e10cSrcweir } 3226*9d3b3ce2SOliver-Rainer Wittmann // last page to be rendered? (not necessarily the last page of the document) 3227*9d3b3ce2SOliver-Rainer Wittmann // -> do clean-up of data 3228*9d3b3ce2SOliver-Rainer Wittmann if ( bLastPage ) 3229cdf0e10cSrcweir { 3230*9d3b3ce2SOliver-Rainer Wittmann CleanUpRenderingData(); 3231cdf0e10cSrcweir } 3232cdf0e10cSrcweir } 3233cdf0e10cSrcweir /* -----------------------------03.10.04 ------------------------------------- 3234cdf0e10cSrcweir 3235cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3236cdf0e10cSrcweir // xforms::XFormsSupplier 3237cdf0e10cSrcweir Reference<XNameContainer> SAL_CALL SwXTextDocument::getXForms() 3238cdf0e10cSrcweir throw( RuntimeException ) 3239cdf0e10cSrcweir { 3240cdf0e10cSrcweir if ( !pDocShell ) 3241cdf0e10cSrcweir throw DisposedException( ::rtl::OUString(), static_cast< XTextDocument* >( this ) ); 3242cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 3243cdf0e10cSrcweir return pDoc->getXForms(); 3244cdf0e10cSrcweir } 3245cdf0e10cSrcweir 3246cdf0e10cSrcweir /* -----------------------------25.09.07 ------------------------------------- 3247cdf0e10cSrcweir 3248cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3249cdf0e10cSrcweir uno::Reference< text::XFlatParagraphIterator > SAL_CALL SwXTextDocument::getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic) 3250cdf0e10cSrcweir throw ( uno::RuntimeException ) 3251cdf0e10cSrcweir { 3252cdf0e10cSrcweir return new SwXFlatParagraphIterator( *pDocShell->GetDoc(), nTextMarkupType, bAutomatic ); 3253cdf0e10cSrcweir } 3254cdf0e10cSrcweir /*-- 07.05.2009 09:21:12--------------------------------------------------- 3255cdf0e10cSrcweir 3256cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3257cdf0e10cSrcweir uno::Reference< util::XCloneable > SwXTextDocument::createClone( ) throw (uno::RuntimeException) 3258cdf0e10cSrcweir { 3259cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 3260cdf0e10cSrcweir if(!IsValid()) 3261cdf0e10cSrcweir throw RuntimeException(); 3262cdf0e10cSrcweir 3263cdf0e10cSrcweir // create a new document - hidden - copy the storage and return it 3264cdf0e10cSrcweir // SfxObjectShellRef is used here, since the model should control object lifetime after creation 3265cdf0e10cSrcweir // and thus SfxObjectShellLock is not allowed here 3266cdf0e10cSrcweir // the model holds reference to the shell, so the shell will not destructed at the end of method 3267cdf0e10cSrcweir SfxObjectShellRef pShell = pDocShell->GetDoc()->CreateCopy(false); 3268cdf0e10cSrcweir uno::Reference< frame::XModel > xNewModel = pShell->GetModel(); 3269cdf0e10cSrcweir uno::Reference< embed::XStorage > xNewStorage = ::comphelper::OStorageHelper::GetTemporaryStorage( ); 3270cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aTempMediaDescriptor; 3271cdf0e10cSrcweir storeToStorage( xNewStorage, aTempMediaDescriptor ); 3272cdf0e10cSrcweir uno::Reference< document::XStorageBasedDocument > xStorageDoc( xNewModel, uno::UNO_QUERY ); 3273cdf0e10cSrcweir xStorageDoc->loadFromStorage( xNewStorage, aTempMediaDescriptor ); 3274cdf0e10cSrcweir return uno::Reference< util::XCloneable >( xNewModel, UNO_QUERY ); 3275cdf0e10cSrcweir } 3276cdf0e10cSrcweir /* -----------------------------20.06.00 09:54-------------------------------- 3277cdf0e10cSrcweir 3278cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3279cdf0e10cSrcweir void * SAL_CALL SwXTextDocument::operator new( size_t t) throw() 3280cdf0e10cSrcweir { 3281cdf0e10cSrcweir return SwXTextDocumentBaseClass::operator new(t); 3282cdf0e10cSrcweir } 3283cdf0e10cSrcweir /* -----------------------------20.06.00 09:54-------------------------------- 3284cdf0e10cSrcweir 3285cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3286cdf0e10cSrcweir void SAL_CALL SwXTextDocument::operator delete( void * p) throw() 3287cdf0e10cSrcweir { 3288cdf0e10cSrcweir SwXTextDocumentBaseClass::operator delete(p); 3289cdf0e10cSrcweir } 3290cdf0e10cSrcweir 3291cdf0e10cSrcweir 3292cdf0e10cSrcweir /*--------------------------------------------------- 3293cdf0e10cSrcweir retrieve languages already used in current document 3294cdf0e10cSrcweir -----------------------------------------------------*/ 3295cdf0e10cSrcweir uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages( 3296cdf0e10cSrcweir ::sal_Int16 nScriptTypes, 3297cdf0e10cSrcweir ::sal_Int16 nMaxCount ) 3298cdf0e10cSrcweir throw (lang::IllegalArgumentException, uno::RuntimeException) 3299cdf0e10cSrcweir { 3300cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 3301cdf0e10cSrcweir 3302cdf0e10cSrcweir // possible canonical values for nScriptTypes 3303cdf0e10cSrcweir // any bit wise combination is allowed 3304cdf0e10cSrcweir const sal_Int16 nLatin = 0x001; 3305cdf0e10cSrcweir const sal_Int16 nAsian = 0x002; 3306cdf0e10cSrcweir const sal_Int16 nComplex = 0x004; 3307cdf0e10cSrcweir 3308cdf0e10cSrcweir // script types for which to get the languages 3309cdf0e10cSrcweir const bool bLatin = 0 != (nScriptTypes & nLatin); 3310cdf0e10cSrcweir const bool bAsian = 0 != (nScriptTypes & nAsian); 3311cdf0e10cSrcweir const bool bComplex = 0 != (nScriptTypes & nComplex); 3312cdf0e10cSrcweir 3313cdf0e10cSrcweir if (nScriptTypes < nLatin || nScriptTypes > (nLatin | nAsian | nComplex)) 3314cdf0e10cSrcweir throw IllegalArgumentException(::rtl::OUString::createFromAscii("nScriptTypes ranges from 1 to 7!"), Reference< XInterface >(), 1); 3315cdf0e10cSrcweir if (!pDocShell) 3316cdf0e10cSrcweir throw DisposedException(); 3317cdf0e10cSrcweir SwDoc* pDoc = pDocShell->GetDoc(); 3318cdf0e10cSrcweir 3319cdf0e10cSrcweir // avoid duplicate values 3320cdf0e10cSrcweir std::set< LanguageType > aAllLangs; 3321cdf0e10cSrcweir 3322cdf0e10cSrcweir //USER STYLES 3323cdf0e10cSrcweir 3324cdf0e10cSrcweir const SwCharFmts *pFmts = pDoc->GetCharFmts(); 3325cdf0e10cSrcweir for(sal_uInt16 i = 0; i < pFmts->Count(); ++i) 3326cdf0e10cSrcweir { 3327cdf0e10cSrcweir const SwAttrSet &rAttrSet = (*pFmts)[i]->GetAttrSet(); 3328cdf0e10cSrcweir LanguageType nLang = LANGUAGE_DONTKNOW; 3329cdf0e10cSrcweir if (bLatin) 3330cdf0e10cSrcweir { 3331cdf0e10cSrcweir nLang = rAttrSet.GetLanguage( sal_False ).GetLanguage(); 3332cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3333cdf0e10cSrcweir aAllLangs.insert( nLang ); 3334cdf0e10cSrcweir } 3335cdf0e10cSrcweir if (bAsian) 3336cdf0e10cSrcweir { 3337cdf0e10cSrcweir nLang = rAttrSet.GetCJKLanguage( sal_False ).GetLanguage(); 3338cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3339cdf0e10cSrcweir aAllLangs.insert( nLang ); 3340cdf0e10cSrcweir } 3341cdf0e10cSrcweir if (bComplex) 3342cdf0e10cSrcweir { 3343cdf0e10cSrcweir nLang = rAttrSet.GetCTLLanguage( sal_False ).GetLanguage(); 3344cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3345cdf0e10cSrcweir aAllLangs.insert( nLang ); 3346cdf0e10cSrcweir } 3347cdf0e10cSrcweir } 3348cdf0e10cSrcweir 3349cdf0e10cSrcweir const SwTxtFmtColls *pColls = pDoc->GetTxtFmtColls(); 3350cdf0e10cSrcweir for (sal_uInt16 i = 0; i < pColls->Count(); ++i) 3351cdf0e10cSrcweir { 3352cdf0e10cSrcweir const SwAttrSet &rAttrSet = (*pColls)[i]->GetAttrSet(); 3353cdf0e10cSrcweir LanguageType nLang = LANGUAGE_DONTKNOW;; 3354cdf0e10cSrcweir if (bLatin) 3355cdf0e10cSrcweir { 3356cdf0e10cSrcweir nLang = rAttrSet.GetLanguage( sal_False ).GetLanguage(); 3357cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3358cdf0e10cSrcweir aAllLangs.insert( nLang ); 3359cdf0e10cSrcweir } 3360cdf0e10cSrcweir if (bAsian) 3361cdf0e10cSrcweir { 3362cdf0e10cSrcweir nLang = rAttrSet.GetCJKLanguage( sal_False ).GetLanguage(); 3363cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3364cdf0e10cSrcweir aAllLangs.insert( nLang ); 3365cdf0e10cSrcweir } 3366cdf0e10cSrcweir if (bComplex) 3367cdf0e10cSrcweir { 3368cdf0e10cSrcweir nLang = rAttrSet.GetCTLLanguage( sal_False ).GetLanguage(); 3369cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3370cdf0e10cSrcweir aAllLangs.insert( nLang ); 3371cdf0e10cSrcweir } 3372cdf0e10cSrcweir } 3373cdf0e10cSrcweir 3374cdf0e10cSrcweir //AUTO STYLES 3375cdf0e10cSrcweir const IStyleAccess::SwAutoStyleFamily aFam[2] = 3376cdf0e10cSrcweir { 3377cdf0e10cSrcweir IStyleAccess::AUTO_STYLE_CHAR, 3378cdf0e10cSrcweir IStyleAccess::AUTO_STYLE_PARA 3379cdf0e10cSrcweir }; 3380cdf0e10cSrcweir for (sal_uInt16 i = 0; i < 2; ++i) 3381cdf0e10cSrcweir { 3382cdf0e10cSrcweir std::vector< SfxItemSet_Pointer_t > rStyles; 3383cdf0e10cSrcweir pDoc->GetIStyleAccess().getAllStyles(rStyles, aFam[i]); 3384cdf0e10cSrcweir while (!rStyles.empty()) 3385cdf0e10cSrcweir { 3386cdf0e10cSrcweir SfxItemSet_Pointer_t pStyle = rStyles.back(); 3387cdf0e10cSrcweir rStyles.pop_back(); 3388cdf0e10cSrcweir const SfxItemSet *pSet = dynamic_cast< const SfxItemSet * >(pStyle.get()); 3389cdf0e10cSrcweir 3390cdf0e10cSrcweir LanguageType nLang = LANGUAGE_DONTKNOW; 3391cdf0e10cSrcweir if (bLatin) 3392cdf0e10cSrcweir { 3393cdf0e10cSrcweir nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_LANGUAGE, sal_False )).GetLanguage(); 3394cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3395cdf0e10cSrcweir aAllLangs.insert( nLang ); 3396cdf0e10cSrcweir } 3397cdf0e10cSrcweir if (bAsian) 3398cdf0e10cSrcweir { 3399cdf0e10cSrcweir nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_CJK_LANGUAGE, sal_False )).GetLanguage(); 3400cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3401cdf0e10cSrcweir aAllLangs.insert( nLang ); 3402cdf0e10cSrcweir } 3403cdf0e10cSrcweir if (bComplex) 3404cdf0e10cSrcweir { 3405cdf0e10cSrcweir nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_CTL_LANGUAGE, sal_False )).GetLanguage(); 3406cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3407cdf0e10cSrcweir aAllLangs.insert( nLang ); 3408cdf0e10cSrcweir } 3409cdf0e10cSrcweir } 3410cdf0e10cSrcweir } 3411cdf0e10cSrcweir 3412cdf0e10cSrcweir //TODO/mba: it's a strange concept that a view is needed to retrieve core data 3413cdf0e10cSrcweir SwWrtShell *pWrtSh = pDocShell->GetWrtShell(); 3414cdf0e10cSrcweir SdrView *pSdrView = pWrtSh->GetDrawView(); 3415cdf0e10cSrcweir 3416cdf0e10cSrcweir if( pSdrView ) 3417cdf0e10cSrcweir { 3418cdf0e10cSrcweir SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); 3419cdf0e10cSrcweir if(pOutliner) 3420cdf0e10cSrcweir { 3421cdf0e10cSrcweir EditEngine& rEditEng = (EditEngine&)pOutliner->GetEditEngine(); 3422cdf0e10cSrcweir sal_uLong nParCount = pOutliner->GetParagraphCount(); 3423cdf0e10cSrcweir for (sal_uLong nPar=0; nPar<nParCount; nPar++) 3424cdf0e10cSrcweir { 3425cdf0e10cSrcweir //every paragraph 3426cdf0e10cSrcweir SvUShorts aPortions; 3427cdf0e10cSrcweir rEditEng.GetPortions( (sal_uInt16)nPar, aPortions ); 3428cdf0e10cSrcweir 3429cdf0e10cSrcweir for ( sal_uInt16 nPos = aPortions.Count(); nPos; ) 3430cdf0e10cSrcweir { 3431cdf0e10cSrcweir //every position 3432cdf0e10cSrcweir --nPos; 3433cdf0e10cSrcweir sal_uInt16 nEnd = aPortions.GetObject( nPos ); 3434cdf0e10cSrcweir sal_uInt16 nStart = nPos ? aPortions.GetObject( nPos - 1 ) : 0; 3435cdf0e10cSrcweir ESelection aSelection( (sal_uInt16)nPar, nStart, (sal_uInt16)nPar, nEnd ); 3436cdf0e10cSrcweir SfxItemSet aAttr = rEditEng.GetAttribs( aSelection ); 3437cdf0e10cSrcweir 3438cdf0e10cSrcweir LanguageType nLang = LANGUAGE_DONTKNOW; 3439cdf0e10cSrcweir if (bLatin) 3440cdf0e10cSrcweir { 3441cdf0e10cSrcweir nLang = dynamic_cast< const SvxLanguageItem & >(aAttr.Get( EE_CHAR_LANGUAGE, sal_False )).GetLanguage(); 3442cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3443cdf0e10cSrcweir aAllLangs.insert( nLang ); 3444cdf0e10cSrcweir } 3445cdf0e10cSrcweir if (bAsian) 3446cdf0e10cSrcweir { 3447cdf0e10cSrcweir nLang = dynamic_cast< const SvxLanguageItem & >(aAttr.Get( EE_CHAR_LANGUAGE_CJK, sal_False )).GetLanguage(); 3448cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3449cdf0e10cSrcweir aAllLangs.insert( nLang ); 3450cdf0e10cSrcweir } 3451cdf0e10cSrcweir if (bComplex) 3452cdf0e10cSrcweir { 3453cdf0e10cSrcweir nLang = dynamic_cast< const SvxLanguageItem & >(aAttr.Get( EE_CHAR_LANGUAGE_CTL, sal_False )).GetLanguage(); 3454cdf0e10cSrcweir if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) 3455cdf0e10cSrcweir aAllLangs.insert( nLang ); 3456cdf0e10cSrcweir } 3457cdf0e10cSrcweir } 3458cdf0e10cSrcweir } 3459cdf0e10cSrcweir } 3460cdf0e10cSrcweir } 3461cdf0e10cSrcweir // less than nMaxCount languages 3462cdf0e10cSrcweir if (nMaxCount > static_cast< sal_Int16 >( aAllLangs.size() )) 3463cdf0e10cSrcweir nMaxCount = static_cast< sal_Int16 >( aAllLangs.size() ); 3464cdf0e10cSrcweir 3465cdf0e10cSrcweir // build return value 3466cdf0e10cSrcweir sal_Int32 nCount = 0; 3467cdf0e10cSrcweir uno::Sequence< lang::Locale > aLanguages( nMaxCount ); 3468cdf0e10cSrcweir lang::Locale* pLanguage = aLanguages.getArray(); 3469cdf0e10cSrcweir if (nMaxCount > 0) 3470cdf0e10cSrcweir { 3471cdf0e10cSrcweir const SvtLanguageTable aLangTab; 3472cdf0e10cSrcweir for (std::set< LanguageType >::const_iterator it = aAllLangs.begin(); it != aAllLangs.end(); ++it) 3473cdf0e10cSrcweir { 3474cdf0e10cSrcweir if (nCount >= nMaxCount) 3475cdf0e10cSrcweir break; 3476cdf0e10cSrcweir if (LANGUAGE_NONE != *it) 3477cdf0e10cSrcweir { 3478cdf0e10cSrcweir MsLangId::convertLanguageToLocale( *it, pLanguage[nCount] ); 3479cdf0e10cSrcweir pLanguage[nCount].Language = aLangTab.GetString( *it ); 3480cdf0e10cSrcweir nCount += 1; 3481cdf0e10cSrcweir } 3482cdf0e10cSrcweir } 3483cdf0e10cSrcweir } 3484cdf0e10cSrcweir 3485cdf0e10cSrcweir return aLanguages; 3486cdf0e10cSrcweir } 3487cdf0e10cSrcweir 348825cebbc8SOliver-Rainer Wittmann // #121125#, #122868# 348925cebbc8SOliver-Rainer Wittmann // method to assure clean up of the rendering data to restore view options 349025cebbc8SOliver-Rainer Wittmann // and to loose hold reference to the ViewShell in SwViewOptionAdjust_Impl. 3491*9d3b3ce2SOliver-Rainer Wittmann // also perform clean up for the still existing hidden frame for PDF export from Page Preview 349225cebbc8SOliver-Rainer Wittmann void SwXTextDocument::CleanUpRenderingData() 3493ad54a8fdSArmin Le Grand { 349425cebbc8SOliver-Rainer Wittmann if( m_pRenderData != NULL ) 3495ad54a8fdSArmin Le Grand { 349625cebbc8SOliver-Rainer Wittmann if ( m_pRenderData->HasPostItData() ) 349725cebbc8SOliver-Rainer Wittmann { 349825cebbc8SOliver-Rainer Wittmann m_pRenderData->DeletePostItData(); 349925cebbc8SOliver-Rainer Wittmann } 350025cebbc8SOliver-Rainer Wittmann delete m_pRenderData; 3501ad54a8fdSArmin Le Grand m_pRenderData = NULL; 3502ad54a8fdSArmin Le Grand } 3503ad54a8fdSArmin Le Grand 350425cebbc8SOliver-Rainer Wittmann if( m_pPrintUIOptions != NULL ) 3505ad54a8fdSArmin Le Grand { 350625cebbc8SOliver-Rainer Wittmann delete m_pPrintUIOptions; 3507ad54a8fdSArmin Le Grand m_pPrintUIOptions = NULL; 3508ad54a8fdSArmin Le Grand } 3509*9d3b3ce2SOliver-Rainer Wittmann 3510*9d3b3ce2SOliver-Rainer Wittmann if ( IsValid() && m_pHiddenViewFrame ) 3511*9d3b3ce2SOliver-Rainer Wittmann { 3512*9d3b3ce2SOliver-Rainer Wittmann lcl_DisposeView( m_pHiddenViewFrame, pDocShell); 3513*9d3b3ce2SOliver-Rainer Wittmann m_pHiddenViewFrame = 0; 3514*9d3b3ce2SOliver-Rainer Wittmann SfxItemSet *pSet = pDocShell->GetMedium()->GetItemSet(); 3515*9d3b3ce2SOliver-Rainer Wittmann pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) ); 3516*9d3b3ce2SOliver-Rainer Wittmann } 3517ad54a8fdSArmin Le Grand } 3518ad54a8fdSArmin Le Grand 3519cdf0e10cSrcweir /* -----------------25.10.99 11:06------------------- 3520cdf0e10cSrcweir 3521cdf0e10cSrcweir --------------------------------------------------*/ 3522cdf0e10cSrcweir SwXLinkTargetSupplier::SwXLinkTargetSupplier(SwXTextDocument& rxDoc) : 3523cdf0e10cSrcweir pxDoc(&rxDoc) 3524cdf0e10cSrcweir { 3525cdf0e10cSrcweir sTables = String(SW_RES(STR_CONTENT_TYPE_TABLE)); 3526cdf0e10cSrcweir sFrames = String(SW_RES(STR_CONTENT_TYPE_FRAME)); 3527cdf0e10cSrcweir sGraphics = String(SW_RES(STR_CONTENT_TYPE_GRAPHIC)); 3528cdf0e10cSrcweir sOLEs = String(SW_RES(STR_CONTENT_TYPE_OLE)); 3529cdf0e10cSrcweir sSections = String(SW_RES(STR_CONTENT_TYPE_REGION)); 3530cdf0e10cSrcweir sOutlines = String(SW_RES(STR_CONTENT_TYPE_OUTLINE)); 3531cdf0e10cSrcweir sBookmarks = String(SW_RES(STR_CONTENT_TYPE_BOOKMARK)); 3532cdf0e10cSrcweir } 3533cdf0e10cSrcweir /* -----------------25.10.99 11:11------------------- 3534cdf0e10cSrcweir 3535cdf0e10cSrcweir --------------------------------------------------*/ 3536cdf0e10cSrcweir SwXLinkTargetSupplier::~SwXLinkTargetSupplier() 3537cdf0e10cSrcweir { 3538cdf0e10cSrcweir } 3539cdf0e10cSrcweir 3540cdf0e10cSrcweir /*-- 25.10.99 11:12:45--------------------------------------------------- 3541cdf0e10cSrcweir 3542cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3543cdf0e10cSrcweir Any SwXLinkTargetSupplier::getByName(const OUString& rName) 3544cdf0e10cSrcweir throw( NoSuchElementException, WrappedTargetException, RuntimeException ) 3545cdf0e10cSrcweir { 3546cdf0e10cSrcweir Any aRet; 3547cdf0e10cSrcweir if(!pxDoc) 3548cdf0e10cSrcweir throw RuntimeException(); 3549cdf0e10cSrcweir String sToCompare(rName); 3550cdf0e10cSrcweir String sSuffix('|'); 3551cdf0e10cSrcweir if(sToCompare == sTables) 3552cdf0e10cSrcweir { 3553cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToTable); 3554cdf0e10cSrcweir 3555cdf0e10cSrcweir Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper( 3556cdf0e10cSrcweir pxDoc->getTextTables(), sToCompare, sSuffix ); 3557cdf0e10cSrcweir Reference< XPropertySet > xRet(xTbls, UNO_QUERY); 3558cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((Reference<XPropertySet>*)0)); 3559cdf0e10cSrcweir } 3560cdf0e10cSrcweir else if(sToCompare == sFrames) 3561cdf0e10cSrcweir { 3562cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToFrame); 3563cdf0e10cSrcweir Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper( 3564cdf0e10cSrcweir pxDoc->getTextFrames(), sToCompare, sSuffix ); 3565cdf0e10cSrcweir Reference< XPropertySet > xRet(xTbls, UNO_QUERY); 3566cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0)); 3567cdf0e10cSrcweir } 3568cdf0e10cSrcweir else if(sToCompare == sSections) 3569cdf0e10cSrcweir { 3570cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToRegion); 3571cdf0e10cSrcweir Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper( 3572cdf0e10cSrcweir pxDoc->getTextSections(), sToCompare, sSuffix ); 3573cdf0e10cSrcweir Reference< XPropertySet > xRet(xTbls, UNO_QUERY); 3574cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0)); 3575cdf0e10cSrcweir } 3576cdf0e10cSrcweir /* else if(sToCompare == ) 3577cdf0e10cSrcweir { 3578cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToText); 3579cdf0e10cSrcweir Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper( 3580cdf0e10cSrcweir pxDoc->, sSuffix ); 3581cdf0e10cSrcweir Reference< XPropertySet > xRet(xTbls, UNO_QUERY); 3582cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((const XPropertySet*)0)); 3583cdf0e10cSrcweir }*/ 3584cdf0e10cSrcweir else if(sToCompare == sGraphics) 3585cdf0e10cSrcweir { 3586cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToGraphic); 3587cdf0e10cSrcweir Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper( 3588cdf0e10cSrcweir pxDoc->getGraphicObjects(), sToCompare, sSuffix ); 3589cdf0e10cSrcweir Reference< XPropertySet > xRet(xTbls, UNO_QUERY); 3590cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0)); 3591cdf0e10cSrcweir } 3592cdf0e10cSrcweir else if(sToCompare == sOLEs) 3593cdf0e10cSrcweir { 3594cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToOLE); 3595cdf0e10cSrcweir Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper( 3596cdf0e10cSrcweir pxDoc->getEmbeddedObjects(), sToCompare, sSuffix ); 3597cdf0e10cSrcweir Reference< XPropertySet > xRet(xTbls, UNO_QUERY); 3598cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0)); 3599cdf0e10cSrcweir } 3600cdf0e10cSrcweir else if(sToCompare == sOutlines) 3601cdf0e10cSrcweir { 3602cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToOutline); 3603cdf0e10cSrcweir Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper( 3604cdf0e10cSrcweir *pxDoc, sToCompare, sSuffix ); 3605cdf0e10cSrcweir Reference< XPropertySet > xRet(xTbls, UNO_QUERY); 3606cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0)); 3607cdf0e10cSrcweir } 3608cdf0e10cSrcweir else if(sToCompare == sBookmarks) 3609cdf0e10cSrcweir { 3610cdf0e10cSrcweir sSuffix.Erase(); 3611cdf0e10cSrcweir Reference< XNameAccess > xBkms = new SwXLinkNameAccessWrapper( 3612cdf0e10cSrcweir pxDoc->getBookmarks(), sToCompare, sSuffix ); 3613cdf0e10cSrcweir Reference< XPropertySet > xRet(xBkms, UNO_QUERY); 3614cdf0e10cSrcweir aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0)); 3615cdf0e10cSrcweir } 3616cdf0e10cSrcweir else 3617cdf0e10cSrcweir throw NoSuchElementException(); 3618cdf0e10cSrcweir return aRet; 3619cdf0e10cSrcweir } 3620cdf0e10cSrcweir /*-- 25.10.99 11:12:46--------------------------------------------------- 3621cdf0e10cSrcweir 3622cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3623cdf0e10cSrcweir Sequence< OUString > SwXLinkTargetSupplier::getElementNames(void) 3624cdf0e10cSrcweir throw( RuntimeException ) 3625cdf0e10cSrcweir { 3626cdf0e10cSrcweir Sequence< OUString > aRet(7); 3627cdf0e10cSrcweir OUString* pNames = aRet.getArray(); 3628cdf0e10cSrcweir pNames[0] = sTables; 3629cdf0e10cSrcweir pNames[1] = sFrames ; 3630cdf0e10cSrcweir pNames[2] = sGraphics; 3631cdf0e10cSrcweir pNames[3] = sOLEs ; 3632cdf0e10cSrcweir pNames[4] = sSections; 3633cdf0e10cSrcweir pNames[5] = sOutlines; 3634cdf0e10cSrcweir pNames[6] = sBookmarks; 3635cdf0e10cSrcweir return aRet; 3636cdf0e10cSrcweir } 3637cdf0e10cSrcweir /*-- 25.10.99 11:12:46--------------------------------------------------- 3638cdf0e10cSrcweir 3639cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3640cdf0e10cSrcweir sal_Bool SwXLinkTargetSupplier::hasByName(const OUString& rName) 3641cdf0e10cSrcweir throw( RuntimeException ) 3642cdf0e10cSrcweir { 3643cdf0e10cSrcweir String sToCompare(rName); 3644cdf0e10cSrcweir if( sToCompare == sTables || 3645cdf0e10cSrcweir sToCompare == sFrames || 3646cdf0e10cSrcweir sToCompare == sGraphics|| 3647cdf0e10cSrcweir sToCompare == sOLEs || 3648cdf0e10cSrcweir sToCompare == sSections || 3649cdf0e10cSrcweir sToCompare == sOutlines || 3650cdf0e10cSrcweir sToCompare == sBookmarks ) 3651cdf0e10cSrcweir return sal_True; 3652cdf0e10cSrcweir return sal_False; 3653cdf0e10cSrcweir } 3654cdf0e10cSrcweir /*-- 25.10.99 11:12:47--------------------------------------------------- 3655cdf0e10cSrcweir 3656cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3657cdf0e10cSrcweir uno::Type SwXLinkTargetSupplier::getElementType(void) 3658cdf0e10cSrcweir throw( RuntimeException ) 3659cdf0e10cSrcweir { 3660cdf0e10cSrcweir return ::getCppuType((Reference< XPropertySet>*)0); 3661cdf0e10cSrcweir 3662cdf0e10cSrcweir } 3663cdf0e10cSrcweir /*-- 25.10.99 11:12:47--------------------------------------------------- 3664cdf0e10cSrcweir 3665cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3666cdf0e10cSrcweir sal_Bool SwXLinkTargetSupplier::hasElements(void) throw( RuntimeException ) 3667cdf0e10cSrcweir { 3668cdf0e10cSrcweir return 0 != pxDoc; 3669cdf0e10cSrcweir } 3670cdf0e10cSrcweir /*-- 25.10.99 11:12:47--------------------------------------------------- 3671cdf0e10cSrcweir 3672cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3673cdf0e10cSrcweir OUString SwXLinkTargetSupplier::getImplementationName(void) throw( RuntimeException ) 3674cdf0e10cSrcweir { 3675cdf0e10cSrcweir return C2U("SwXLinkTargetSupplier"); 3676cdf0e10cSrcweir } 3677cdf0e10cSrcweir /*-- 25.10.99 11:12:48--------------------------------------------------- 3678cdf0e10cSrcweir 3679cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3680cdf0e10cSrcweir sal_Bool SwXLinkTargetSupplier::supportsService(const OUString& rServiceName) 3681cdf0e10cSrcweir throw( RuntimeException ) 3682cdf0e10cSrcweir { 3683cdf0e10cSrcweir return (rServiceName == C2U("com.sun.star.document.LinkTargets")); 3684cdf0e10cSrcweir } 3685cdf0e10cSrcweir /*-- 25.10.99 11:12:48--------------------------------------------------- 3686cdf0e10cSrcweir 3687cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3688cdf0e10cSrcweir Sequence< OUString > SwXLinkTargetSupplier::getSupportedServiceNames(void) 3689cdf0e10cSrcweir throw( RuntimeException ) 3690cdf0e10cSrcweir { 3691cdf0e10cSrcweir Sequence< OUString > aRet(1); 3692cdf0e10cSrcweir OUString* pNames = aRet.getArray(); 3693cdf0e10cSrcweir pNames[0] = C2U("com.sun.star.document.LinkTargets"); 3694cdf0e10cSrcweir return aRet; 3695cdf0e10cSrcweir } 3696cdf0e10cSrcweir 3697cdf0e10cSrcweir /*-- 26.10.99 09:16:23--------------------------------------------------- 3698cdf0e10cSrcweir 3699cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3700cdf0e10cSrcweir SwXLinkNameAccessWrapper::SwXLinkNameAccessWrapper( 3701cdf0e10cSrcweir Reference< XNameAccess > xAccess, const String& rLinkDisplayName, String sSuffix ) : 3702cdf0e10cSrcweir xRealAccess(xAccess), 3703cdf0e10cSrcweir pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)), 3704cdf0e10cSrcweir sLinkSuffix(sSuffix), 3705cdf0e10cSrcweir sLinkDisplayName(rLinkDisplayName), 3706cdf0e10cSrcweir pxDoc(0) 3707cdf0e10cSrcweir { 3708cdf0e10cSrcweir } 3709cdf0e10cSrcweir /* -----------------26.10.99 14:17------------------- 3710cdf0e10cSrcweir 3711cdf0e10cSrcweir --------------------------------------------------*/ 3712cdf0e10cSrcweir SwXLinkNameAccessWrapper::SwXLinkNameAccessWrapper(SwXTextDocument& rxDoc, 3713cdf0e10cSrcweir const String& rLinkDisplayName, String sSuffix) : 3714cdf0e10cSrcweir pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)), 3715cdf0e10cSrcweir sLinkSuffix(sSuffix), 3716cdf0e10cSrcweir sLinkDisplayName(rLinkDisplayName), 3717cdf0e10cSrcweir xDoc(&rxDoc), 3718cdf0e10cSrcweir pxDoc(&rxDoc) 3719cdf0e10cSrcweir { 3720cdf0e10cSrcweir } 3721cdf0e10cSrcweir /*-- 26.10.99 09:16:23--------------------------------------------------- 3722cdf0e10cSrcweir 3723cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3724cdf0e10cSrcweir SwXLinkNameAccessWrapper::~SwXLinkNameAccessWrapper() 3725cdf0e10cSrcweir { 3726cdf0e10cSrcweir } 3727cdf0e10cSrcweir /*-- 26.10.99 09:16:24--------------------------------------------------- 3728cdf0e10cSrcweir 3729cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3730cdf0e10cSrcweir Any SwXLinkNameAccessWrapper::getByName(const OUString& rName) 3731cdf0e10cSrcweir throw( NoSuchElementException, WrappedTargetException, RuntimeException ) 3732cdf0e10cSrcweir { 3733cdf0e10cSrcweir Any aRet; 3734cdf0e10cSrcweir sal_Bool bFound = sal_False; 3735cdf0e10cSrcweir //cut link extension and call the real NameAccess 3736cdf0e10cSrcweir String sParam = rName; 3737cdf0e10cSrcweir String sSuffix(sLinkSuffix); 3738cdf0e10cSrcweir if(sParam.Len() > sSuffix.Len() ) 3739cdf0e10cSrcweir { 3740cdf0e10cSrcweir String sCmp = sParam.Copy(sParam.Len() - sSuffix.Len(), 3741cdf0e10cSrcweir sSuffix.Len()); 3742cdf0e10cSrcweir if(sCmp == sSuffix) 3743cdf0e10cSrcweir { 3744cdf0e10cSrcweir if(pxDoc) 3745cdf0e10cSrcweir { 3746cdf0e10cSrcweir sParam = sParam.Copy(0, sParam.Len() - sSuffix.Len()); 3747cdf0e10cSrcweir if(!pxDoc->GetDocShell()) 3748cdf0e10cSrcweir throw RuntimeException(); 3749cdf0e10cSrcweir SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc(); 3750cdf0e10cSrcweir sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().Count(); 3751cdf0e10cSrcweir 3752cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nOutlineCount && !bFound; ++i) 3753cdf0e10cSrcweir { 3754cdf0e10cSrcweir const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds(); 3755cdf0e10cSrcweir const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule(); 3756cdf0e10cSrcweir if(sParam == 3757cdf0e10cSrcweir lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule)) 3758cdf0e10cSrcweir { 3759cdf0e10cSrcweir Reference< XPropertySet > xOutline = new SwXOutlineTarget(sParam); 3760cdf0e10cSrcweir aRet.setValue(&xOutline, ::getCppuType((Reference<XPropertySet>*)0)); 3761cdf0e10cSrcweir bFound = sal_True; 3762cdf0e10cSrcweir } 3763cdf0e10cSrcweir } 3764cdf0e10cSrcweir } 3765cdf0e10cSrcweir else 3766cdf0e10cSrcweir { 3767cdf0e10cSrcweir aRet = xRealAccess->getByName(sParam.Copy(0, sParam.Len() - sSuffix.Len())); 3768cdf0e10cSrcweir Reference< XInterface > xInt; 3769cdf0e10cSrcweir if(!(aRet >>= xInt)) 3770cdf0e10cSrcweir throw RuntimeException(); 3771cdf0e10cSrcweir Reference< XPropertySet > xProp(xInt, UNO_QUERY); 3772cdf0e10cSrcweir aRet <<= xProp; 3773cdf0e10cSrcweir bFound = sal_True; 3774cdf0e10cSrcweir } 3775cdf0e10cSrcweir } 3776cdf0e10cSrcweir } 3777cdf0e10cSrcweir if(!bFound) 3778cdf0e10cSrcweir throw NoSuchElementException(); 3779cdf0e10cSrcweir return aRet; 3780cdf0e10cSrcweir } 3781cdf0e10cSrcweir /*-- 26.10.99 09:16:24--------------------------------------------------- 3782cdf0e10cSrcweir 3783cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3784cdf0e10cSrcweir Sequence< OUString > SwXLinkNameAccessWrapper::getElementNames(void) 3785cdf0e10cSrcweir throw( RuntimeException ) 3786cdf0e10cSrcweir { 3787cdf0e10cSrcweir Sequence< OUString > aRet; 3788cdf0e10cSrcweir if(pxDoc) 3789cdf0e10cSrcweir { 3790cdf0e10cSrcweir if(!pxDoc->GetDocShell()) 3791cdf0e10cSrcweir throw RuntimeException(); 3792cdf0e10cSrcweir 3793cdf0e10cSrcweir SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc(); 3794cdf0e10cSrcweir const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds(); 3795cdf0e10cSrcweir sal_uInt16 nOutlineCount = rOutlineNodes.Count(); 3796cdf0e10cSrcweir aRet.realloc(nOutlineCount); 3797cdf0e10cSrcweir OUString* pResArr = aRet.getArray(); 3798cdf0e10cSrcweir String sSuffix('|'); 3799cdf0e10cSrcweir sSuffix += UniString::CreateFromAscii(pMarkToOutline); 3800cdf0e10cSrcweir const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule(); 3801cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nOutlineCount; ++i) 3802cdf0e10cSrcweir { 3803cdf0e10cSrcweir String sEntry = lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule); 3804cdf0e10cSrcweir sEntry += sSuffix; 3805cdf0e10cSrcweir pResArr[i] = sEntry; 3806cdf0e10cSrcweir } 3807cdf0e10cSrcweir } 3808cdf0e10cSrcweir else 3809cdf0e10cSrcweir { 3810cdf0e10cSrcweir Sequence< OUString > aOrg = xRealAccess->getElementNames(); 3811cdf0e10cSrcweir const OUString* pOrgArr = aOrg.getConstArray(); 3812cdf0e10cSrcweir aRet.realloc(aOrg.getLength()); 3813cdf0e10cSrcweir OUString* pResArr = aRet.getArray(); 3814cdf0e10cSrcweir for(long i = 0; i < aOrg.getLength(); i++) 3815cdf0e10cSrcweir { 3816cdf0e10cSrcweir pResArr[i] = pOrgArr[i] + sLinkSuffix; 3817cdf0e10cSrcweir } 3818cdf0e10cSrcweir } 3819cdf0e10cSrcweir return aRet; 3820cdf0e10cSrcweir } 3821cdf0e10cSrcweir /*-- 26.10.99 09:16:25--------------------------------------------------- 3822cdf0e10cSrcweir 3823cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3824cdf0e10cSrcweir sal_Bool SwXLinkNameAccessWrapper::hasByName(const OUString& rName) 3825cdf0e10cSrcweir throw( RuntimeException ) 3826cdf0e10cSrcweir { 3827cdf0e10cSrcweir sal_Bool bRet = sal_False; 3828cdf0e10cSrcweir String sParam(rName); 3829cdf0e10cSrcweir if(sParam.Len() > sLinkSuffix.Len() ) 3830cdf0e10cSrcweir { 3831cdf0e10cSrcweir String sCmp = sParam.Copy(sParam.Len() - sLinkSuffix.Len(), 3832cdf0e10cSrcweir sLinkSuffix.Len()); 3833cdf0e10cSrcweir if(sCmp == sLinkSuffix) 3834cdf0e10cSrcweir { 3835cdf0e10cSrcweir sParam = sParam.Copy(0, sParam.Len() - sLinkSuffix.Len()); 3836cdf0e10cSrcweir if(pxDoc) 3837cdf0e10cSrcweir { 3838cdf0e10cSrcweir if(!pxDoc->GetDocShell()) 3839cdf0e10cSrcweir throw RuntimeException(); 3840cdf0e10cSrcweir SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc(); 3841cdf0e10cSrcweir sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().Count(); 3842cdf0e10cSrcweir 3843cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nOutlineCount && !bRet; ++i) 3844cdf0e10cSrcweir { 3845cdf0e10cSrcweir const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds(); 3846cdf0e10cSrcweir const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule(); 3847cdf0e10cSrcweir if(sParam == 3848cdf0e10cSrcweir lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule)) 3849cdf0e10cSrcweir { 3850cdf0e10cSrcweir bRet = sal_True; 3851cdf0e10cSrcweir } 3852cdf0e10cSrcweir } 3853cdf0e10cSrcweir } 3854cdf0e10cSrcweir else 3855cdf0e10cSrcweir { 3856cdf0e10cSrcweir bRet = xRealAccess->hasByName(sParam); 3857cdf0e10cSrcweir } 3858cdf0e10cSrcweir } 3859cdf0e10cSrcweir } 3860cdf0e10cSrcweir return bRet; 3861cdf0e10cSrcweir } 3862cdf0e10cSrcweir /*-- 26.10.99 09:16:25--------------------------------------------------- 3863cdf0e10cSrcweir 3864cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3865cdf0e10cSrcweir uno::Type SwXLinkNameAccessWrapper::getElementType(void) 3866cdf0e10cSrcweir throw( RuntimeException ) 3867cdf0e10cSrcweir { 3868cdf0e10cSrcweir return ::getCppuType((Reference<XPropertySet>*)0); 3869cdf0e10cSrcweir } 3870cdf0e10cSrcweir /*-- 26.10.99 09:16:25--------------------------------------------------- 3871cdf0e10cSrcweir 3872cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3873cdf0e10cSrcweir sal_Bool SwXLinkNameAccessWrapper::hasElements(void) throw( RuntimeException ) 3874cdf0e10cSrcweir { 3875cdf0e10cSrcweir sal_Bool bRet = sal_False; 3876cdf0e10cSrcweir if(pxDoc) 3877cdf0e10cSrcweir { 3878cdf0e10cSrcweir DBG_ERROR("not implemented"); 3879cdf0e10cSrcweir } 3880cdf0e10cSrcweir else 3881cdf0e10cSrcweir { 3882cdf0e10cSrcweir bRet = xRealAccess->hasElements(); 3883cdf0e10cSrcweir } 3884cdf0e10cSrcweir return bRet; 3885cdf0e10cSrcweir } 3886cdf0e10cSrcweir /*-- 26.10.99 09:16:26--------------------------------------------------- 3887cdf0e10cSrcweir 3888cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3889cdf0e10cSrcweir Reference< XPropertySetInfo > SwXLinkNameAccessWrapper::getPropertySetInfo(void) 3890cdf0e10cSrcweir throw( RuntimeException ) 3891cdf0e10cSrcweir { 3892cdf0e10cSrcweir static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo(); 3893cdf0e10cSrcweir return xRet; 3894cdf0e10cSrcweir } 3895cdf0e10cSrcweir /*-- 26.10.99 09:16:26--------------------------------------------------- 3896cdf0e10cSrcweir 3897cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3898cdf0e10cSrcweir void SwXLinkNameAccessWrapper::setPropertyValue( 3899cdf0e10cSrcweir const OUString& , const Any& ) 3900cdf0e10cSrcweir throw( UnknownPropertyException, 3901cdf0e10cSrcweir PropertyVetoException, 3902cdf0e10cSrcweir IllegalArgumentException, 3903cdf0e10cSrcweir WrappedTargetException, 3904cdf0e10cSrcweir RuntimeException) 3905cdf0e10cSrcweir { 3906cdf0e10cSrcweir throw UnknownPropertyException(); 3907cdf0e10cSrcweir } 3908cdf0e10cSrcweir /* -----------------------------08.12.99 11:10-------------------------------- 3909cdf0e10cSrcweir 3910cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3911cdf0e10cSrcweir Any lcl_GetDisplayBitmap(String sLinkSuffix) 3912cdf0e10cSrcweir { 3913cdf0e10cSrcweir Any aRet; 3914cdf0e10cSrcweir if(sLinkSuffix.Len()) 3915cdf0e10cSrcweir sLinkSuffix.Erase(0, 1); 3916cdf0e10cSrcweir sal_uInt16 nImgId = USHRT_MAX; 3917cdf0e10cSrcweir 3918cdf0e10cSrcweir if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToOutline)) 3919cdf0e10cSrcweir nImgId = CONTENT_TYPE_OUTLINE; 3920cdf0e10cSrcweir else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToTable)) 3921cdf0e10cSrcweir nImgId = CONTENT_TYPE_TABLE; 3922cdf0e10cSrcweir else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToFrame)) 3923cdf0e10cSrcweir nImgId = CONTENT_TYPE_FRAME; 3924cdf0e10cSrcweir else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToGraphic)) 3925cdf0e10cSrcweir nImgId = CONTENT_TYPE_GRAPHIC; 3926cdf0e10cSrcweir // else if(== sLinkSuffix) 3927cdf0e10cSrcweir // nImgId = CONTENT_TYPE_BOOKMARK; 3928cdf0e10cSrcweir else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToRegion)) 3929cdf0e10cSrcweir nImgId = CONTENT_TYPE_REGION; 3930cdf0e10cSrcweir else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToOLE)) 3931cdf0e10cSrcweir nImgId = CONTENT_TYPE_OLE; 3932cdf0e10cSrcweir else if(!sLinkSuffix.Len()) 3933cdf0e10cSrcweir nImgId = CONTENT_TYPE_BOOKMARK; 3934cdf0e10cSrcweir if(USHRT_MAX != nImgId) 3935cdf0e10cSrcweir { 3936cdf0e10cSrcweir nImgId += 20000; 3937cdf0e10cSrcweir sal_Bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); 3938cdf0e10cSrcweir ImageList aEntryImages( SW_RES(bHighContrast ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP) ); 3939cdf0e10cSrcweir const Image& rImage = aEntryImages.GetImage( nImgId ); 3940cdf0e10cSrcweir Bitmap aBitmap( rImage.GetBitmapEx().GetBitmap() ); 3941cdf0e10cSrcweir Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( aBitmap ); 3942cdf0e10cSrcweir aRet.setValue( &xBmp, ::getCppuType((Reference<awt::XBitmap>*)0) ); 3943cdf0e10cSrcweir } 3944cdf0e10cSrcweir return aRet; 3945cdf0e10cSrcweir } 3946cdf0e10cSrcweir /*-- 26.10.99 09:16:27--------------------------------------------------- 3947cdf0e10cSrcweir 3948cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3949cdf0e10cSrcweir Any SwXLinkNameAccessWrapper::getPropertyValue(const OUString& rPropertyName) 3950cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 3951cdf0e10cSrcweir { 3952cdf0e10cSrcweir Any aRet; 3953cdf0e10cSrcweir if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_NAME))) 3954cdf0e10cSrcweir { 3955cdf0e10cSrcweir aRet <<= OUString(sLinkDisplayName); 3956cdf0e10cSrcweir } 3957cdf0e10cSrcweir else if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_BITMAP))) 3958cdf0e10cSrcweir { 3959cdf0e10cSrcweir aRet = lcl_GetDisplayBitmap(sLinkSuffix); 3960cdf0e10cSrcweir } 3961cdf0e10cSrcweir else 3962cdf0e10cSrcweir throw UnknownPropertyException(); 3963cdf0e10cSrcweir return aRet; 3964cdf0e10cSrcweir } 3965cdf0e10cSrcweir /*-- 26.10.99 09:16:27--------------------------------------------------- 3966cdf0e10cSrcweir 3967cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3968cdf0e10cSrcweir void SwXLinkNameAccessWrapper::addPropertyChangeListener( 3969cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) 3970cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 3971cdf0e10cSrcweir {} 3972cdf0e10cSrcweir /*-- 26.10.99 09:16:28--------------------------------------------------- 3973cdf0e10cSrcweir 3974cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3975cdf0e10cSrcweir void SwXLinkNameAccessWrapper::removePropertyChangeListener( 3976cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) 3977cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 3978cdf0e10cSrcweir {} 3979cdf0e10cSrcweir /*-- 26.10.99 09:16:28--------------------------------------------------- 3980cdf0e10cSrcweir 3981cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3982cdf0e10cSrcweir void SwXLinkNameAccessWrapper::addVetoableChangeListener( 3983cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) 3984cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 3985cdf0e10cSrcweir {} 3986cdf0e10cSrcweir /*-- 26.10.99 09:16:29--------------------------------------------------- 3987cdf0e10cSrcweir 3988cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3989cdf0e10cSrcweir void SwXLinkNameAccessWrapper::removeVetoableChangeListener( 3990cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) 3991cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 3992cdf0e10cSrcweir {} 3993cdf0e10cSrcweir /*-- 26.10.99 09:16:32--------------------------------------------------- 3994cdf0e10cSrcweir 3995cdf0e10cSrcweir 3996cdf0e10cSrcweir -----------------------------------------------------------------------*/ 3997cdf0e10cSrcweir Reference< XNameAccess > SwXLinkNameAccessWrapper::getLinks(void) 3998cdf0e10cSrcweir throw( RuntimeException ) 3999cdf0e10cSrcweir { 4000cdf0e10cSrcweir return (SwXLinkNameAccessWrapper*)this; 4001cdf0e10cSrcweir } 4002cdf0e10cSrcweir 4003cdf0e10cSrcweir /*-- 26.10.99 09:21:48--------------------------------------------------- 4004cdf0e10cSrcweir 4005cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4006cdf0e10cSrcweir OUString SwXLinkNameAccessWrapper::getImplementationName(void) throw( RuntimeException ) 4007cdf0e10cSrcweir { 4008cdf0e10cSrcweir return C2U("SwXLinkNameAccessWrapper"); 4009cdf0e10cSrcweir } 4010cdf0e10cSrcweir /*-- 26.10.99 09:21:48--------------------------------------------------- 4011cdf0e10cSrcweir 4012cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4013cdf0e10cSrcweir sal_Bool SwXLinkNameAccessWrapper::supportsService(const OUString& rServiceName) 4014cdf0e10cSrcweir throw( RuntimeException ) 4015cdf0e10cSrcweir { 4016cdf0e10cSrcweir return (rServiceName == C2U("com.sun.star.document.LinkTargets")); 4017cdf0e10cSrcweir } 4018cdf0e10cSrcweir /*-- 26.10.99 09:21:48--------------------------------------------------- 4019cdf0e10cSrcweir 4020cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4021cdf0e10cSrcweir Sequence< OUString > SwXLinkNameAccessWrapper::getSupportedServiceNames(void) 4022cdf0e10cSrcweir throw( RuntimeException ) 4023cdf0e10cSrcweir { 4024cdf0e10cSrcweir Sequence< OUString > aRet(1); 4025cdf0e10cSrcweir OUString* pNames = aRet.getArray(); 4026cdf0e10cSrcweir pNames[0] = C2U("com.sun.star.document.LinkTargets"); 4027cdf0e10cSrcweir return aRet; 4028cdf0e10cSrcweir } 4029cdf0e10cSrcweir /* -----------------26.10.99 15:50------------------- 4030cdf0e10cSrcweir 4031cdf0e10cSrcweir --------------------------------------------------*/ 4032cdf0e10cSrcweir SwXOutlineTarget::SwXOutlineTarget(const String& rOutlineText) : 4033cdf0e10cSrcweir pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)), 4034cdf0e10cSrcweir sOutlineText(rOutlineText) 4035cdf0e10cSrcweir { 4036cdf0e10cSrcweir } 4037cdf0e10cSrcweir /*-- 26.10.99 15:51:45--------------------------------------------------- 4038cdf0e10cSrcweir 4039cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4040cdf0e10cSrcweir SwXOutlineTarget::~SwXOutlineTarget() 4041cdf0e10cSrcweir { 4042cdf0e10cSrcweir } 4043cdf0e10cSrcweir /*-- 26.10.99 15:51:46--------------------------------------------------- 4044cdf0e10cSrcweir 4045cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4046cdf0e10cSrcweir Reference< XPropertySetInfo > SwXOutlineTarget::getPropertySetInfo(void) throw( RuntimeException ) 4047cdf0e10cSrcweir { 4048cdf0e10cSrcweir static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo(); 4049cdf0e10cSrcweir return xRet; 4050cdf0e10cSrcweir } 4051cdf0e10cSrcweir /*-- 26.10.99 15:51:46--------------------------------------------------- 4052cdf0e10cSrcweir 4053cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4054cdf0e10cSrcweir void SwXOutlineTarget::setPropertyValue( 4055cdf0e10cSrcweir const OUString& /*PropertyName*/, const Any& /*aValue*/) 4056cdf0e10cSrcweir throw( UnknownPropertyException, PropertyVetoException, 4057cdf0e10cSrcweir IllegalArgumentException, WrappedTargetException, RuntimeException) 4058cdf0e10cSrcweir { 4059cdf0e10cSrcweir throw UnknownPropertyException(); 4060cdf0e10cSrcweir } 4061cdf0e10cSrcweir /*-- 26.10.99 15:51:46--------------------------------------------------- 4062cdf0e10cSrcweir 4063cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4064cdf0e10cSrcweir Any SwXOutlineTarget::getPropertyValue(const OUString& rPropertyName) 4065cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 4066cdf0e10cSrcweir { 4067cdf0e10cSrcweir Any aRet; 4068cdf0e10cSrcweir if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_NAME))) 4069cdf0e10cSrcweir aRet <<= OUString(sOutlineText); 4070cdf0e10cSrcweir else 4071cdf0e10cSrcweir throw UnknownPropertyException(); 4072cdf0e10cSrcweir return aRet; 4073cdf0e10cSrcweir } 4074cdf0e10cSrcweir /*-- 26.10.99 15:51:46--------------------------------------------------- 4075cdf0e10cSrcweir 4076cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4077cdf0e10cSrcweir void SwXOutlineTarget::addPropertyChangeListener( 4078cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) 4079cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 4080cdf0e10cSrcweir { 4081cdf0e10cSrcweir } 4082cdf0e10cSrcweir /*-- 26.10.99 15:51:47--------------------------------------------------- 4083cdf0e10cSrcweir 4084cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4085cdf0e10cSrcweir void SwXOutlineTarget::removePropertyChangeListener( 4086cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) 4087cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 4088cdf0e10cSrcweir { 4089cdf0e10cSrcweir } 4090cdf0e10cSrcweir /*-- 26.10.99 15:51:47--------------------------------------------------- 4091cdf0e10cSrcweir 4092cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4093cdf0e10cSrcweir void SwXOutlineTarget::addVetoableChangeListener( 4094cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) 4095cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 4096cdf0e10cSrcweir { 4097cdf0e10cSrcweir } 4098cdf0e10cSrcweir /*-- 26.10.99 15:51:47--------------------------------------------------- 4099cdf0e10cSrcweir 4100cdf0e10cSrcweir -----------------------------------------------------------------------*/ 4101cdf0e10cSrcweir void SwXOutlineTarget::removeVetoableChangeListener( 4102cdf0e10cSrcweir const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) 4103cdf0e10cSrcweir throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 4104cdf0e10cSrcweir { 4105cdf0e10cSrcweir } 4106cdf0e10cSrcweir /* -----------------03.05.99 12:28------------------- 4107cdf0e10cSrcweir * 4108cdf0e10cSrcweir * --------------------------------------------------*/ 4109cdf0e10cSrcweir OUString SwXOutlineTarget::getImplementationName(void) throw( RuntimeException ) 4110cdf0e10cSrcweir { 4111cdf0e10cSrcweir return C2U("SwXOutlineTarget"); 4112cdf0e10cSrcweir } 4113cdf0e10cSrcweir /* -----------------03.05.99 12:28------------------- 4114cdf0e10cSrcweir * 4115cdf0e10cSrcweir * --------------------------------------------------*/ 4116cdf0e10cSrcweir sal_Bool SwXOutlineTarget::supportsService(const OUString& ServiceName) throw( RuntimeException ) 4117cdf0e10cSrcweir { 4118cdf0e10cSrcweir return C2U("com.sun.star.document.LinkTarget") == ServiceName; 4119cdf0e10cSrcweir } 4120cdf0e10cSrcweir /* -----------------03.05.99 12:28------------------- 4121cdf0e10cSrcweir * 4122cdf0e10cSrcweir * --------------------------------------------------*/ 4123cdf0e10cSrcweir Sequence< OUString > SwXOutlineTarget::getSupportedServiceNames(void) throw( RuntimeException ) 4124cdf0e10cSrcweir { 4125cdf0e10cSrcweir Sequence < OUString > aRet(1); 4126cdf0e10cSrcweir OUString* pArray = aRet.getArray(); 4127cdf0e10cSrcweir pArray[0] = C2U("com.sun.star.document.LinkTarget"); 4128cdf0e10cSrcweir 4129cdf0e10cSrcweir return aRet; 4130cdf0e10cSrcweir } 4131cdf0e10cSrcweir /* -----------------------------17.01.01 16:06-------------------------------- 4132cdf0e10cSrcweir 4133cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4134cdf0e10cSrcweir SwXDocumentPropertyHelper::SwXDocumentPropertyHelper(SwDoc& rDoc) : 4135cdf0e10cSrcweir SvxUnoForbiddenCharsTable ( rDoc.getForbiddenCharacterTable() ) 4136cdf0e10cSrcweir ,m_pDoc(&rDoc) 4137cdf0e10cSrcweir { 4138cdf0e10cSrcweir } 4139cdf0e10cSrcweir /* -----------------------------17.01.01 16:06-------------------------------- 4140cdf0e10cSrcweir 4141cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4142cdf0e10cSrcweir SwXDocumentPropertyHelper::~SwXDocumentPropertyHelper() 4143cdf0e10cSrcweir { 4144cdf0e10cSrcweir } 4145cdf0e10cSrcweir /* -----------------------------17.01.01 16:06-------------------------------- 4146cdf0e10cSrcweir 4147cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 4148cdf0e10cSrcweir Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(short nWhich) 4149cdf0e10cSrcweir { 4150cdf0e10cSrcweir Reference<XInterface> xRet; 4151cdf0e10cSrcweir if(m_pDoc) 4152cdf0e10cSrcweir { 4153cdf0e10cSrcweir switch(nWhich) 4154cdf0e10cSrcweir { 4155cdf0e10cSrcweir // --> OD 2005-08-08 #i52858# 4156cdf0e10cSrcweir // assure that Draw model is created, if it doesn't exist. 4157cdf0e10cSrcweir case SW_CREATE_DASH_TABLE : 4158cdf0e10cSrcweir if(!xDashTable.is()) 4159cdf0e10cSrcweir xDashTable = SvxUnoDashTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); 4160cdf0e10cSrcweir xRet = xDashTable; 4161cdf0e10cSrcweir break; 4162cdf0e10cSrcweir case SW_CREATE_GRADIENT_TABLE : 4163cdf0e10cSrcweir if(!xGradientTable.is()) 4164cdf0e10cSrcweir xGradientTable = SvxUnoGradientTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); 4165cdf0e10cSrcweir xRet = xGradientTable; 4166cdf0e10cSrcweir break; 4167cdf0e10cSrcweir case SW_CREATE_HATCH_TABLE : 4168cdf0e10cSrcweir if(!xHatchTable.is()) 4169cdf0e10cSrcweir xHatchTable = SvxUnoHatchTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); 4170cdf0e10cSrcweir xRet = xHatchTable; 4171cdf0e10cSrcweir break; 4172cdf0e10cSrcweir case SW_CREATE_BITMAP_TABLE : 4173cdf0e10cSrcweir if(!xBitmapTable.is()) 4174cdf0e10cSrcweir xBitmapTable = SvxUnoBitmapTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); 4175cdf0e10cSrcweir xRet = xBitmapTable; 4176cdf0e10cSrcweir break; 4177cdf0e10cSrcweir case SW_CREATE_TRANSGRADIENT_TABLE: 4178cdf0e10cSrcweir if(!xTransGradientTable.is()) 4179cdf0e10cSrcweir xTransGradientTable = SvxUnoTransGradientTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); 4180cdf0e10cSrcweir xRet = xTransGradientTable; 4181cdf0e10cSrcweir break; 4182cdf0e10cSrcweir case SW_CREATE_MARKER_TABLE : 4183cdf0e10cSrcweir if(!xMarkerTable.is()) 4184cdf0e10cSrcweir xMarkerTable = SvxUnoMarkerTable_createInstance( m_pDoc->GetOrCreateDrawModel() ); 4185cdf0e10cSrcweir xRet = xMarkerTable; 4186cdf0e10cSrcweir break; 4187cdf0e10cSrcweir // <-- 4188cdf0e10cSrcweir case SW_CREATE_DRAW_DEFAULTS: 4189cdf0e10cSrcweir if(!xDrawDefaults.is()) 4190cdf0e10cSrcweir xDrawDefaults = (cppu::OWeakObject*)new SwSvxUnoDrawPool(m_pDoc); 4191cdf0e10cSrcweir xRet = xDrawDefaults; 4192cdf0e10cSrcweir break; 4193cdf0e10cSrcweir #ifdef DBG_UTIL 4194cdf0e10cSrcweir default: DBG_ERROR("which table?"); 4195cdf0e10cSrcweir #endif 4196cdf0e10cSrcweir } 4197cdf0e10cSrcweir } 4198cdf0e10cSrcweir return xRet; 4199cdf0e10cSrcweir } 4200cdf0e10cSrcweir 4201cdf0e10cSrcweir void SwXDocumentPropertyHelper::Invalidate() 4202cdf0e10cSrcweir { 4203cdf0e10cSrcweir xDashTable = 0; 4204cdf0e10cSrcweir xGradientTable = 0; 4205cdf0e10cSrcweir xHatchTable = 0; 4206cdf0e10cSrcweir xBitmapTable = 0; 4207cdf0e10cSrcweir xTransGradientTable = 0; 4208cdf0e10cSrcweir xMarkerTable = 0; 4209cdf0e10cSrcweir xDrawDefaults = 0; 4210cdf0e10cSrcweir m_pDoc = 0; 4211cdf0e10cSrcweir SvxUnoForbiddenCharsTable::mxForbiddenChars.unbind(); 4212cdf0e10cSrcweir } 4213cdf0e10cSrcweir /* -----------------13.08.2003 12:43----------------- 4214cdf0e10cSrcweir 4215cdf0e10cSrcweir --------------------------------------------------*/ 4216cdf0e10cSrcweir void SwXDocumentPropertyHelper::onChange() 4217cdf0e10cSrcweir { 4218cdf0e10cSrcweir if(m_pDoc) 4219cdf0e10cSrcweir m_pDoc->SetModified(); 4220cdf0e10cSrcweir } 4221cdf0e10cSrcweir 4222cdf0e10cSrcweir 4223cdf0e10cSrcweir /*****************************************************************************/ 4224cdf0e10cSrcweir 4225cdf0e10cSrcweir SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( ViewShell& rSh, const SwViewOption &rViewOptions ) : 4226cdf0e10cSrcweir m_rShell( rSh ), 4227cdf0e10cSrcweir m_aOldViewOptions( rViewOptions ) 4228cdf0e10cSrcweir { 4229cdf0e10cSrcweir } 4230cdf0e10cSrcweir 4231cdf0e10cSrcweir 4232cdf0e10cSrcweir SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() 4233cdf0e10cSrcweir { 4234cdf0e10cSrcweir m_rShell.ApplyViewOptions( m_aOldViewOptions ); 4235cdf0e10cSrcweir } 4236cdf0e10cSrcweir 4237cdf0e10cSrcweir 4238cdf0e10cSrcweir void 4239cdf0e10cSrcweir SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions) 4240cdf0e10cSrcweir { 4241cdf0e10cSrcweir // to avoid unnecessary reformatting the view options related to the content 4242cdf0e10cSrcweir // below should only change if necessary, that is if respective content is present 4243cdf0e10cSrcweir const bool bContainsHiddenChars = m_rShell.GetDoc()->ContainsHiddenChars(); 4244cdf0e10cSrcweir const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENTXTFLD ); 4245cdf0e10cSrcweir const bool bContainsHiddenFields = pFldType && pFldType->GetDepends(); 4246cdf0e10cSrcweir pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENPARAFLD ); 4247cdf0e10cSrcweir const bool bContainsHiddenParagraphs = pFldType && pFldType->GetDepends(); 4248cdf0e10cSrcweir pFldType = m_rShell.GetDoc()->GetSysFldType( RES_JUMPEDITFLD ); 4249cdf0e10cSrcweir const bool bContainsPlaceHolders = pFldType && pFldType->GetDepends(); 4250cdf0e10cSrcweir const bool bContainsFields = m_rShell.IsAnyFieldInDoc(); 4251cdf0e10cSrcweir 4252cdf0e10cSrcweir SwViewOption aRenderViewOptions( m_aOldViewOptions ); 4253cdf0e10cSrcweir 4254cdf0e10cSrcweir // disable anything in the view that should not be printed (or exported to PDF) by default 4255cdf0e10cSrcweir // (see also dialog "Tools/Options - StarOffice Writer - Formatting Aids" 4256cdf0e10cSrcweir // in section "Display of ...") 4257cdf0e10cSrcweir aRenderViewOptions.SetParagraph( sal_False ); // paragraph end 4258cdf0e10cSrcweir aRenderViewOptions.SetSoftHyph( sal_False ); // aka custom hyphens 4259cdf0e10cSrcweir aRenderViewOptions.SetBlank( sal_False ); // spaces 4260cdf0e10cSrcweir aRenderViewOptions.SetHardBlank( sal_False ); // non-breaking spaces 4261cdf0e10cSrcweir aRenderViewOptions.SetTab( sal_False ); // tabs 4262cdf0e10cSrcweir aRenderViewOptions.SetLineBreak( sal_False ); // breaks (type 1) 4263cdf0e10cSrcweir aRenderViewOptions.SetPageBreak( sal_False ); // breaks (type 2) 4264cdf0e10cSrcweir aRenderViewOptions.SetColumnBreak( sal_False ); // breaks (type 3) 4265cdf0e10cSrcweir sal_Bool bVal = pPrtOptions? pPrtOptions->bPrintHiddenText : sal_False; 4266cdf0e10cSrcweir if (bContainsHiddenChars) 4267cdf0e10cSrcweir aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text 4268cdf0e10cSrcweir if (bContainsHiddenFields) 4269cdf0e10cSrcweir aRenderViewOptions.SetShowHiddenField( bVal ); 4270cdf0e10cSrcweir if (bContainsHiddenParagraphs) 4271cdf0e10cSrcweir aRenderViewOptions.SetShowHiddenPara( bVal ); 4272cdf0e10cSrcweir 4273cdf0e10cSrcweir if (bContainsPlaceHolders) 4274cdf0e10cSrcweir { 4275cdf0e10cSrcweir // should always be printed in PDF export! 4276cdf0e10cSrcweir bVal = pPrtOptions ? pPrtOptions->bPrintTextPlaceholder : sal_True; 4277cdf0e10cSrcweir aRenderViewOptions.SetShowPlaceHolderFields( bVal ); 4278cdf0e10cSrcweir } 4279cdf0e10cSrcweir 4280cdf0e10cSrcweir if (bContainsFields) 4281cdf0e10cSrcweir aRenderViewOptions.SetFldName( sal_False ); 4282cdf0e10cSrcweir 4283cdf0e10cSrcweir // we need to set this flag in order to get to see the visible effect of 4284cdf0e10cSrcweir // some of the above settings (needed for correct rendering) 4285cdf0e10cSrcweir aRenderViewOptions.SetViewMetaChars( sal_True ); 4286cdf0e10cSrcweir 4287cdf0e10cSrcweir if (m_aOldViewOptions != aRenderViewOptions) // check if reformatting is necessary 4288cdf0e10cSrcweir { 4289cdf0e10cSrcweir aRenderViewOptions.SetPrinting( pPrtOptions != NULL ); 4290cdf0e10cSrcweir m_rShell.ApplyViewOptions( aRenderViewOptions ); 4291cdf0e10cSrcweir } 4292cdf0e10cSrcweir } 4293cdf0e10cSrcweir 4294cdf0e10cSrcweir 4295cdf0e10cSrcweir /*****************************************************************************/ 4296cdf0e10cSrcweir 4297cdf0e10cSrcweir 4298