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