2010-10-12 15:51:52 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-11-27 16:10:40 +00:00
/*
* This file is part of the LibreOffice project .
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at http : //mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice :
*
* Licensed to the Apache Software Foundation ( ASF ) under one or more
* contributor license agreements . See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership . The ASF licenses this file to you under the Apache
* License , Version 2.0 ( the " License " ) ; you may not use this file
* except in compliance with the License . You may obtain a copy of
* the License at http : //www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 23:16:46 +00:00
2015-02-16 15:16:57 +01:00
# include <libxml/xmlwriter.h>
2004-01-20 09:25:48 +00:00
# include "PageListWatcher.hxx"
2003-04-24 13:35:54 +00:00
# include <com/sun/star/document/PrinterIndependentLayout.hpp>
2009-09-17 11:26:03 +00:00
# include <com/sun/star/i18n/ScriptType.hpp>
2016-03-10 17:34:23 +01:00
# include <com/sun/star/beans/XPropertyContainer.hpp>
# include <com/sun/star/beans/PropertyAttribute.hpp>
# include <com/sun/star/document/XDocumentProperties.hpp>
2010-01-08 18:32:51 +01:00
# include <editeng/forbiddencharacterstable.hxx>
2001-04-06 13:17:19 +00:00
2000-09-18 23:16:46 +00:00
# include <svx/svxids.hrc>
2009-12-10 23:06:35 +01:00
# include <svl/srchitem.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/eeitem.hxx>
# include <editeng/scriptspaceitem.hxx>
2000-09-18 23:16:46 +00:00
2015-08-26 10:51:29 +01:00
# include <unotools/configmgr.hxx>
2009-10-06 07:38:24 +02:00
# include <unotools/useroptions.hxx>
2013-08-24 01:23:36 +02:00
# include <officecfg/Office/Impress.hxx>
2009-09-16 13:55:36 +00:00
2000-09-18 23:16:46 +00:00
# include <sfx2/printer.hxx>
# include <sfx2/app.hxx>
2010-01-13 22:25:07 +01:00
# include <sfx2/linkmgr.hxx>
2000-09-18 23:16:46 +00:00
# include <svx/dialogs.hrc>
2017-10-23 22:32:55 +02:00
# include <Outliner.hxx>
# include <sdmod.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/editstat.hxx>
# include <editeng/fontitem.hxx>
2009-10-16 00:05:16 +02:00
# include <svl/flagitem.hxx>
2000-09-18 23:16:46 +00:00
# include <svx/svdoattr.hxx>
# include <svx/svdotext.hxx>
2013-02-12 13:41:53 -05:00
# include <editeng/bulletitem.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/numitem.hxx>
2000-09-18 23:16:46 +00:00
# include <svx/svditer.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/unolingu.hxx>
2009-10-16 00:05:16 +02:00
# include <svl/itempool.hxx>
2000-10-25 09:34:04 +00:00
# include <com/sun/star/lang/XMultiServiceFactory.hpp>
2000-09-18 23:16:46 +00:00
# include <svx/xtable.hxx>
2000-10-25 09:34:04 +00:00
# include <com/sun/star/linguistic2/XHyphenator.hpp>
# include <com/sun/star/linguistic2/XSpellChecker1.hpp>
2000-09-18 23:16:46 +00:00
# include <com/sun/star/beans/XPropertySet.hpp>
2010-01-08 18:32:51 +01:00
# include <editeng/outlobj.hxx>
2009-10-06 07:38:24 +02:00
# include <unotools/saveopt.hxx>
2014-12-03 16:14:48 +01:00
# include <comphelper/getexpandeduri.hxx>
2013-04-05 18:40:39 +02:00
# include <i18nlangtag/mslangid.hxx>
# include <i18nlangtag/languagetag.hxx>
2000-09-18 23:16:46 +00:00
# include <unotools/charclass.hxx>
2000-11-17 09:56:37 +00:00
# include <comphelper/processfactory.hxx>
2009-10-06 07:38:24 +02:00
# include <unotools/pathoptions.hxx>
# include <unotools/lingucfg.hxx>
# include <unotools/linguprops.hxx>
2013-07-31 01:58:58 +05:30
# include <com/sun/star/uno/Reference.hxx>
# include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
# include <com/sun/star/xml/dom/XDocument.hpp>
# include <com/sun/star/xml/dom/XNode.hpp>
# include <com/sun/star/xml/dom/XNodeList.hpp>
# include <com/sun/star/xml/dom/DocumentBuilder.hpp>
# include <com/sun/star/uno/XComponentContext.hpp>
# include <rtl/ustring.hxx>
# include <rtl/uri.hxx>
2000-10-25 09:34:04 +00:00
2013-04-19 15:49:58 -04:00
# include <editeng/outliner.hxx>
2017-10-23 22:32:55 +02:00
# include <drawdoc.hxx>
# include <sdpage.hxx>
# include <pglink.hxx>
# include <sdattr.hxx>
# include <strings.hrc>
# include <glob.hxx>
# include <stlpool.hxx>
# include <sdiocmpt.hxx>
# include <sdresid.hxx>
# include <cusshow.hxx>
# include <customshowlist.hxx>
# include <DrawDocShell.hxx>
# include <GraphicDocShell.hxx>
# include <sdxfer.hxx>
# include <ViewShell.hxx>
# include <optsitem.hxx>
# include <FrameView.hxx>
2016-04-19 13:57:54 +02:00
# include <undo/undomanager.hxx>
2018-05-10 17:49:19 +02:00
# include <sdundogr.hxx>
# include <undopage.hxx>
2001-08-06 07:34:08 +00:00
# include <tools/tenccvt.hxx>
2014-01-02 23:52:37 +01:00
# include <vcl/settings.hxx>
2018-09-14 18:56:23 +02:00
# include <unokywds.hxx>
2001-08-06 07:34:08 +00:00
2004-03-30 14:43:59 +00:00
using namespace : : sd ;
2000-09-18 23:16:46 +00:00
using namespace : : com : : sun : : star ;
2000-10-25 09:34:04 +00:00
using namespace : : com : : sun : : star : : uno ;
using namespace : : com : : sun : : star : : lang ;
using namespace : : com : : sun : : star : : linguistic2 ;
2000-09-18 23:16:46 +00:00
2013-07-31 01:58:58 +05:30
using namespace com : : sun : : star : : xml : : dom ;
using : : com : : sun : : star : : uno : : Reference ;
using : : com : : sun : : star : : lang : : XMultiServiceFactory ;
2000-09-18 23:16:46 +00:00
2015-11-12 20:58:46 +01:00
SdDrawDocument * SdDrawDocument : : s_pDocLockedInsertingLinks = nullptr ;
2000-09-18 23:16:46 +00:00
2004-11-26 18:46:34 +00:00
PresentationSettings : : PresentationSettings ( )
: mbAll ( true ) ,
mbEndless ( false ) ,
2006-12-12 15:31:02 +00:00
mbCustomShow ( false ) ,
2004-11-26 18:46:34 +00:00
mbManual ( false ) ,
2006-07-10 10:21:11 +00:00
mbMouseVisible ( false ) ,
2004-11-26 18:46:34 +00:00
mbMouseAsPen ( false ) ,
mbLockedPages ( false ) ,
mbAlwaysOnTop ( false ) ,
mbFullScreen ( true ) ,
mbAnimationAllowed ( true ) ,
mnPauseTimeout ( 10 ) ,
2016-01-27 12:19:28 -05:00
mbShowPauseLogo ( false )
2004-11-26 18:46:34 +00:00
{
}
2006-12-12 15:31:02 +00:00
SdDrawDocument : : SdDrawDocument ( DocumentType eType , SfxObjectShell * pDrDocSh )
2018-05-24 19:09:44 +02:00
: FmFormModel (
nullptr ,
pDrDocSh )
2006-12-12 15:31:02 +00:00
, mpDocSh ( static_cast < : : sd : : DrawDocShell * > ( pDrDocSh ) )
2015-11-10 10:23:02 +01:00
, mpCreatingTransferable ( nullptr )
2013-10-25 10:54:51 +09:00
, mbHasOnlineSpellErrors ( false )
, mbInitialOnlineSpellingEnabled ( true )
, mbNewOrLoadCompleted ( false )
2015-08-26 11:06:48 +01:00
, mbOnlineSpell ( false )
2006-12-12 15:31:02 +00:00
, mbStartWithPresentation ( false )
2013-07-29 15:56:22 +02:00
, mbExitAfterPresenting ( false )
2006-12-12 15:31:02 +00:00
, meLanguage ( LANGUAGE_SYSTEM )
, meLanguageCJK ( LANGUAGE_SYSTEM )
, meLanguageCTL ( LANGUAGE_SYSTEM )
2017-03-02 16:09:36 +02:00
, mePageNumType ( SVX_NUM_ARABIC )
2013-10-25 10:54:51 +09:00
, mbAllocDocSh ( false )
2006-12-12 15:31:02 +00:00
, meDocType ( eType )
2018-07-06 12:45:31 +02:00
, mbEmbedFonts ( false )
, mbEmbedUsedFontsOnly ( false )
, mbEmbedFontScriptLatin ( true )
, mbEmbedFontScriptAsian ( true )
, mbEmbedFontScriptComplex ( true )
2000-09-18 23:16:46 +00:00
{
2013-10-02 16:41:03 +02:00
mpDrawPageListWatcher . reset ( new ImpDrawPageListWatcher ( * this ) ) ;
mpMasterPageListWatcher . reset ( new ImpMasterPageListWatcher ( * this ) ) ;
2003-10-27 12:29:26 +00:00
2013-08-24 01:23:36 +02:00
InitLayoutVector ( ) ;
2013-08-28 01:52:17 +05:30
InitObjectVector ( ) ;
2013-02-18 23:33:27 +01:00
SetObjectShell ( pDrDocSh ) ; // for VCDrawModel
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2000-09-18 23:16:46 +00:00
{
2015-08-20 11:56:07 +02:00
SetSwapGraphics ( ) ;
2000-09-18 23:16:46 +00:00
}
2013-02-18 23:33:27 +01:00
// Set measuring unit (of the application) and scale (of SdMod)
2011-01-17 11:41:00 +01:00
sal_Int32 nX , nY ;
2006-12-12 15:31:02 +00:00
SdOptions * pOptions = SD_MOD ( ) - > GetSdOptions ( meDocType ) ;
2000-09-18 23:16:46 +00:00
pOptions - > GetScale ( nX , nY ) ;
2001-09-25 11:09:02 +00:00
2011-02-07 22:11:09 +01:00
// Allow UI scale only for draw documents.
2016-10-11 12:21:55 +02:00
if ( eType = = DocumentType : : Draw )
2018-01-15 09:03:36 +01:00
SetUIUnit ( static_cast < FieldUnit > ( pOptions - > GetMetric ( ) ) , Fraction ( nX , nY ) ) ; // user-defined
2001-09-25 11:09:02 +00:00
else
2018-01-15 09:03:36 +01:00
SetUIUnit ( static_cast < FieldUnit > ( pOptions - > GetMetric ( ) ) , Fraction ( 1 , 1 ) ) ; // default
2000-09-18 23:16:46 +00:00
2016-09-20 16:41:39 +02:00
SetScaleUnit ( MapUnit : : Map100thMM ) ;
2014-10-23 17:41:47 +02:00
SetScaleFraction ( Fraction ( 1 , 1 ) ) ;
2000-09-18 23:16:46 +00:00
SetDefaultFontHeight ( 847 ) ; // 24p
2016-09-20 16:41:39 +02:00
pItemPool - > SetDefaultMetric ( MapUnit : : Map100thMM ) ;
2000-09-18 23:16:46 +00:00
pItemPool - > FreezeIdRanges ( ) ;
2014-06-13 18:03:37 +02:00
SetTextDefaults ( ) ;
2000-09-18 23:16:46 +00:00
2013-02-18 23:33:27 +01:00
// DrawingEngine has to know where it is...
2000-09-18 23:16:46 +00:00
FmFormModel : : SetStyleSheetPool ( new SdStyleSheetPool ( GetPool ( ) , this ) ) ;
2013-02-18 23:33:27 +01:00
// Set StyleSheetPool for DrawOutliner, so text objects can be read correctly.
// The link to the StyleRequest handler of the document is set later, in
// NewOrLoadCompleted, because only then do all the templates exist.
2001-02-09 12:01:31 +00:00
SdrOutliner & rOutliner = GetDrawOutliner ( ) ;
2014-11-11 07:52:45 +02:00
rOutliner . SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2009-09-16 13:55:36 +00:00
SetCalcFieldValueHdl ( & rOutliner ) ;
2000-09-18 23:16:46 +00:00
2002-07-26 11:42:05 +00:00
// set linguistic options
2017-11-08 15:47:50 +00:00
if ( ! utl : : ConfigManager : : IsFuzzing ( ) )
2000-09-18 23:16:46 +00:00
{
2002-02-20 10:05:16 +00:00
const SvtLinguConfig aLinguConfig ;
2002-07-26 11:42:05 +00:00
SvtLinguOptions aOptions ;
aLinguConfig . GetOptions ( aOptions ) ;
2002-02-20 10:05:16 +00:00
2009-09-17 11:26:03 +00:00
SetLanguage ( MsLangId : : resolveSystemLanguageByScriptType ( aOptions . nDefaultLanguage ,
2015-10-28 12:01:32 +02:00
css : : i18n : : ScriptType : : LATIN ) , EE_CHAR_LANGUAGE ) ;
2009-09-17 11:26:03 +00:00
SetLanguage ( MsLangId : : resolveSystemLanguageByScriptType ( aOptions . nDefaultLanguage_CJK ,
2015-10-28 12:01:32 +02:00
css : : i18n : : ScriptType : : ASIAN ) , EE_CHAR_LANGUAGE_CJK ) ;
2009-09-17 11:26:03 +00:00
SetLanguage ( MsLangId : : resolveSystemLanguageByScriptType ( aOptions . nDefaultLanguage_CTL ,
2015-10-28 12:01:32 +02:00
css : : i18n : : ScriptType : : COMPLEX ) , EE_CHAR_LANGUAGE_CTL ) ;
2002-02-20 10:05:16 +00:00
2017-09-14 10:29:32 +01:00
mbOnlineSpell = aOptions . bIsSpellAuto ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
LanguageType eRealLanguage = MsLangId : : getRealLanguage ( meLanguage ) ;
2012-11-23 23:06:10 +01:00
LanguageTag aLanguageTag ( eRealLanguage ) ;
2017-10-19 11:33:14 +02:00
mpCharClass . reset ( new CharClass ( aLanguageTag ) ) ;
2000-09-18 23:16:46 +00:00
2003-04-24 13:35:54 +00:00
// If the current application language is a language that uses right-to-left text...
2012-11-22 12:26:52 +01:00
LanguageType eRealCTLLanguage = Application : : GetSettings ( ) . GetLanguageTag ( ) . getLanguageType ( ) ;
2003-03-27 09:58:12 +00:00
2003-12-01 09:07:08 +00:00
// for korean and japanese languages we have a different default for apply spacing between asian, latin and ctl text
2012-06-19 13:48:45 +01:00
if ( MsLangId : : isKorean ( eRealCTLLanguage ) | | ( LANGUAGE_JAPANESE = = eRealCTLLanguage ) )
2003-12-01 09:07:08 +00:00
{
2017-11-15 14:19:37 +02:00
GetPool ( ) . GetSecondaryPool ( ) - > SetPoolDefaultItem ( SvxScriptSpaceItem ( false , EE_PARA_ASIANCJKSPACING ) ) ;
2003-12-01 09:07:08 +00:00
}
2013-02-18 23:33:27 +01:00
// Set DefTab and SpellOptions for the SD module
2011-01-17 11:41:00 +01:00
sal_uInt16 nDefTab = pOptions - > GetDefTab ( ) ;
2000-09-18 23:16:46 +00:00
SetDefaultTabulator ( nDefTab ) ;
2004-02-04 13:19:04 +00:00
try
2000-09-18 23:16:46 +00:00
{
2002-02-20 10:05:16 +00:00
Reference < XSpellChecker1 > xSpellChecker ( LinguMgr : : GetSpellChecker ( ) ) ;
if ( xSpellChecker . is ( ) )
rOutliner . SetSpeller ( xSpellChecker ) ;
Reference < XHyphenator > xHyphenator ( LinguMgr : : GetHyphenator ( ) ) ;
if ( xHyphenator . is ( ) )
rOutliner . SetHyphenator ( xHyphenator ) ;
2017-07-05 15:40:00 +01:00
SetForbiddenCharsTable ( SvxForbiddenCharactersTable : : makeForbiddenCharactersTable ( : : comphelper : : getProcessComponentContext ( ) ) ) ;
2000-09-18 23:16:46 +00:00
}
2004-02-04 13:19:04 +00:00
catch ( . . . )
2000-09-18 23:16:46 +00:00
{
2011-03-01 19:06:55 +01:00
OSL_FAIL ( " Can't get SpellChecker " ) ;
2000-09-18 23:16:46 +00:00
}
2012-11-22 12:26:52 +01:00
rOutliner . SetDefaultLanguage ( Application : : GetSettings ( ) . GetLanguageTag ( ) . getLanguageType ( ) ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2000-09-18 23:16:46 +00:00
{
2010-01-13 22:25:07 +01:00
SetLinkManager ( new sfx2 : : LinkManager ( mpDocSh ) ) ;
2000-09-18 23:16:46 +00:00
}
2001-02-09 12:01:31 +00:00
2015-03-24 16:05:55 +02:00
EEControlBits nCntrl = rOutliner . GetControlWord ( ) ;
nCntrl | = EEControlBits : : ALLOWBIGOBJS ;
2001-02-09 12:01:31 +00:00
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2015-03-24 16:05:55 +02:00
nCntrl | = EEControlBits : : ONLINESPELLING ;
2001-02-09 12:01:31 +00:00
else
2015-03-24 16:05:55 +02:00
nCntrl & = ~ EEControlBits : : ONLINESPELLING ;
2001-02-09 12:01:31 +00:00
2015-03-24 16:05:55 +02:00
nCntrl & = ~ EEControlBits : : ULSPACESUMMATION ;
2016-10-11 12:21:55 +02:00
if ( meDocType ! = DocumentType : : Impress )
2014-04-24 10:52:02 +02:00
SetSummationOfParagraphs ( false ) ;
2001-05-07 12:14:17 +00:00
else
{
SetSummationOfParagraphs ( pOptions - > IsSummationOfParagraphs ( ) ) ;
if ( pOptions - > IsSummationOfParagraphs ( ) )
2015-03-24 16:05:55 +02:00
nCntrl | = EEControlBits : : ULSPACESUMMATION ;
2001-05-07 12:14:17 +00:00
}
2001-02-09 12:01:31 +00:00
rOutliner . SetControlWord ( nCntrl ) ;
2013-02-18 23:33:27 +01:00
// Initialize the printer independent layout mode
2003-04-24 13:35:54 +00:00
SetPrinterIndependentLayout ( pOptions - > GetPrinterIndependentLayout ( ) ) ;
2001-02-09 12:01:31 +00:00
2013-02-18 23:33:27 +01:00
// Set the StyleSheetPool for HitTestOutliner.
// The link to the StyleRequest handler of the document is set later, in
// NewOrLoadCompleted, because only then do all the templates exist.
2014-11-11 07:52:45 +02:00
pHitTestOutliner - > SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2000-09-18 23:16:46 +00:00
2017-12-12 13:44:53 +02:00
SetCalcFieldValueHdl ( pHitTestOutliner . get ( ) ) ;
2001-06-25 12:08:18 +00:00
2004-02-04 13:19:04 +00:00
try
2000-09-18 23:16:46 +00:00
{
2002-02-20 10:05:16 +00:00
Reference < XSpellChecker1 > xSpellChecker ( LinguMgr : : GetSpellChecker ( ) ) ;
if ( xSpellChecker . is ( ) )
pHitTestOutliner - > SetSpeller ( xSpellChecker ) ;
Reference < XHyphenator > xHyphenator ( LinguMgr : : GetHyphenator ( ) ) ;
if ( xHyphenator . is ( ) )
pHitTestOutliner - > SetHyphenator ( xHyphenator ) ;
2000-09-18 23:16:46 +00:00
}
2004-02-04 13:19:04 +00:00
catch ( . . . )
2000-09-18 23:16:46 +00:00
{
2011-03-01 19:06:55 +01:00
OSL_FAIL ( " Can't get SpellChecker " ) ;
2000-09-18 23:16:46 +00:00
}
2012-11-22 12:26:52 +01:00
pHitTestOutliner - > SetDefaultLanguage ( Application : : GetSettings ( ) . GetLanguageTag ( ) . getLanguageType ( ) ) ;
2000-09-18 23:16:46 +00:00
2015-03-24 16:05:55 +02:00
EEControlBits nCntrl2 = pHitTestOutliner - > GetControlWord ( ) ;
nCntrl2 | = EEControlBits : : ALLOWBIGOBJS ;
nCntrl2 & = ~ EEControlBits : : ONLINESPELLING ;
2001-04-24 12:06:10 +00:00
2015-03-24 16:05:55 +02:00
nCntrl2 & = ~ EEControlBits : : ULSPACESUMMATION ;
2001-04-24 12:06:10 +00:00
if ( pOptions - > IsSummationOfParagraphs ( ) )
2015-03-24 16:05:55 +02:00
nCntrl2 | = EEControlBits : : ULSPACESUMMATION ;
2001-04-24 12:06:10 +00:00
2000-09-18 23:16:46 +00:00
pHitTestOutliner - > SetControlWord ( nCntrl2 ) ;
2013-02-18 23:33:27 +01:00
/** Create layers
*
* We create the following default layers on all pages and master pages :
*
2018-09-14 18:56:23 +02:00
* sUNO_LayerName_layout ; " layout " : default layer for drawing objects of normal pages
* localized by SdResId ( STR_LAYER_LAYOUT )
2013-02-18 23:33:27 +01:00
*
2018-09-14 18:56:23 +02:00
* sUNO_LayerName_background ; " background " : background of the master page
* localized by SdResId ( STR_LAYER_BCKGRND )
* ( currently unused within normal pages and not visible to users )
2013-02-18 23:33:27 +01:00
*
2018-09-14 18:56:23 +02:00
* sUNO_LayerName_background_objects ; " backgroundobjects " : objects on the background of master pages
* localized by SdResId ( STR_LAYER_BCKGRNDOBJ )
* ( currently unused within normal pages )
2013-02-18 23:33:27 +01:00
*
2018-09-14 18:56:23 +02:00
* sUNO_LayerName_controls ; " controls " : default layer for controls
* localized by SdResId ( STR_LAYER_CONTROLS )
* ( currently special handling in regard to z - order )
*
* sUNO_LayerName_measurelines ; " measurelines " : default layer for measure lines
* localized by SdResId ( STR_LAYER_MEASURELINES )
2013-02-18 23:33:27 +01:00
*/
2000-09-18 23:16:46 +00:00
{
SdrLayerAdmin & rLayerAdmin = GetLayerAdmin ( ) ;
2018-09-14 18:56:23 +02:00
rLayerAdmin . NewLayer ( sUNO_LayerName_layout ) ;
rLayerAdmin . NewLayer ( sUNO_LayerName_background ) ;
rLayerAdmin . NewLayer ( sUNO_LayerName_background_objects ) ;
rLayerAdmin . NewLayer ( sUNO_LayerName_controls ) ;
rLayerAdmin . NewLayer ( sUNO_LayerName_measurelines ) ;
2000-09-18 23:16:46 +00:00
2018-09-14 18:56:23 +02:00
rLayerAdmin . SetControlLayerName ( sUNO_LayerName_controls ) ;
2000-09-18 23:16:46 +00:00
}
}
2013-02-18 23:33:27 +01:00
// Destructor
2001-10-22 12:36:57 +00:00
SdDrawDocument : : ~ SdDrawDocument ( )
2000-09-18 23:16:46 +00:00
{
2016-08-22 08:24:14 +02:00
Broadcast ( SdrHint ( SdrHintKind : : ModelCleared ) ) ;
2003-03-27 09:58:12 +00:00
2006-12-12 15:31:02 +00:00
if ( mpWorkStartupTimer )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( mpWorkStartupTimer - > IsActive ( ) )
mpWorkStartupTimer - > Stop ( ) ;
2000-09-18 23:16:46 +00:00
2018-03-13 13:11:19 +02:00
mpWorkStartupTimer . reset ( ) ;
2000-09-18 23:16:46 +00:00
}
StopOnlineSpelling ( ) ;
2017-10-19 11:33:14 +02:00
mpOnlineSearchItem . reset ( ) ;
2000-09-18 23:16:46 +00:00
CloseBookmarkDoc ( ) ;
2013-10-25 10:54:51 +09:00
SetAllocDocSh ( false ) ;
2000-09-18 23:16:46 +00:00
2014-03-10 11:09:59 +02:00
ClearModel ( true ) ;
2000-09-18 23:16:46 +00:00
if ( pLinkManager )
{
2013-02-18 23:33:27 +01:00
// Release BaseLinks
2012-06-12 15:41:27 +02:00
if ( ! pLinkManager - > GetLinks ( ) . empty ( ) )
2000-09-18 23:16:46 +00:00
{
2012-06-12 15:41:27 +02:00
pLinkManager - > Remove ( 0 , pLinkManager - > GetLinks ( ) . size ( ) ) ;
2000-09-18 23:16:46 +00:00
}
delete pLinkManager ;
2015-11-10 10:23:02 +01:00
pLinkManager = nullptr ;
2000-09-18 23:16:46 +00:00
}
2017-10-19 11:33:14 +02:00
maFrameViewList . clear ( ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpCustomShowList )
2000-09-18 23:16:46 +00:00
{
2012-08-08 12:29:34 +02:00
for ( sal_uLong j = 0 ; j < mpCustomShowList - > size ( ) ; j + + )
2000-09-18 23:16:46 +00:00
{
2013-02-18 23:33:27 +01:00
// If necessary, delete CustomShows
2012-08-08 12:29:34 +02:00
SdCustomShow * pCustomShow = ( * mpCustomShowList ) [ j ] ;
2000-09-18 23:16:46 +00:00
delete pCustomShow ;
}
2018-03-13 13:11:19 +02:00
mpCustomShowList . reset ( ) ;
2000-09-18 23:16:46 +00:00
}
2017-10-19 11:33:14 +02:00
mpOutliner . reset ( ) ;
mpInternalOutliner . reset ( ) ;
mpCharClass . reset ( ) ;
2000-09-18 23:16:46 +00:00
}
2018-05-10 17:49:19 +02:00
void SdDrawDocument : : adaptSizeAndBorderForAllPages (
const Size & rNewSize ,
long nLeft ,
long nRight ,
long nUpper ,
long nLower )
{
const sal_uInt16 nMasterPageCnt ( GetMasterSdPageCount ( PageKind : : Standard ) ) ;
const sal_uInt16 nPageCnt ( GetSdPageCount ( PageKind : : Standard ) ) ;
if ( 0 = = nMasterPageCnt & & 0 = = nPageCnt )
{
return ;
}
SdPage * pPage ( 0 ! = nPageCnt ? GetSdPage ( 0 , PageKind : : Standard ) : GetMasterSdPage ( 0 , PageKind : : Standard ) ) ;
// call fully implemented local version, including getting
// some more information from one of the Pages (1st one)
AdaptPageSizeForAllPages (
rNewSize ,
PageKind : : Standard ,
nullptr ,
nLeft ,
nRight ,
nUpper ,
nLower ,
true ,
pPage - > GetOrientation ( ) ,
pPage - > GetPaperBin ( ) ,
pPage - > IsBackgroundFullSize ( ) ) ;
// adjust handout page to new format of the standard page
if ( 0 ! = nPageCnt )
{
GetSdPage ( 0 , PageKind : : Handout ) - > CreateTitleAndLayout ( true ) ;
}
}
void SdDrawDocument : : AdaptPageSizeForAllPages (
const Size & rNewSize ,
PageKind ePageKind ,
SdUndoGroup * pUndoGroup ,
long nLeft ,
long nRight ,
long nUpper ,
long nLower ,
bool bScaleAll ,
Orientation eOrientation ,
sal_uInt16 nPaperBin ,
bool bBackgroundFullSize )
{
sal_uInt16 i ;
const sal_uInt16 nMasterPageCnt ( GetMasterSdPageCount ( ePageKind ) ) ;
const sal_uInt16 nPageCnt ( GetSdPageCount ( ePageKind ) ) ;
if ( 0 = = nMasterPageCnt & & 0 = = nPageCnt )
{
return ;
}
for ( i = 0 ; i < nMasterPageCnt ; i + + )
{
// first, handle all master pages
SdPage * pPage ( GetMasterSdPage ( i , ePageKind ) ) ;
if ( pUndoGroup )
{
SdUndoAction * pUndo (
new SdPageFormatUndoAction (
this ,
pPage ,
pPage - > GetSize ( ) ,
pPage - > GetLeftBorder ( ) , pPage - > GetRightBorder ( ) ,
pPage - > GetUpperBorder ( ) , pPage - > GetLowerBorder ( ) ,
pPage - > GetOrientation ( ) ,
pPage - > GetPaperBin ( ) ,
pPage - > IsBackgroundFullSize ( ) ,
rNewSize ,
nLeft , nRight ,
nUpper , nLower ,
bScaleAll ,
eOrientation ,
nPaperBin ,
bBackgroundFullSize ) ) ;
pUndoGroup - > AddAction ( pUndo ) ;
}
if ( rNewSize . Width ( ) > 0 | | nLeft > = 0 | | nRight > = 0 | | nUpper > = 0 | | nLower > = 0 )
{
: : tools : : Rectangle aNewBorderRect ( nLeft , nUpper , nRight , nLower ) ;
pPage - > ScaleObjects ( rNewSize , aNewBorderRect , bScaleAll ) ;
if ( rNewSize . Width ( ) > 0 )
{
pPage - > SetSize ( rNewSize ) ;
}
}
if ( nLeft > = 0 | | nRight > = 0 | | nUpper > = 0 | | nLower > = 0 )
{
pPage - > SetBorder ( nLeft , nUpper , nRight , nLower ) ;
}
pPage - > SetOrientation ( eOrientation ) ;
pPage - > SetPaperBin ( nPaperBin ) ;
pPage - > SetBackgroundFullSize ( bBackgroundFullSize ) ;
if ( ePageKind = = PageKind : : Standard )
{
GetMasterSdPage ( i , PageKind : : Notes ) - > CreateTitleAndLayout ( ) ;
}
pPage - > CreateTitleAndLayout ( ) ;
}
for ( i = 0 ; i < nPageCnt ; i + + )
{
// then, handle all pages
SdPage * pPage ( GetSdPage ( i , ePageKind ) ) ;
if ( pUndoGroup )
{
SdUndoAction * pUndo (
new SdPageFormatUndoAction (
this ,
pPage ,
pPage - > GetSize ( ) ,
pPage - > GetLeftBorder ( ) , pPage - > GetRightBorder ( ) ,
pPage - > GetUpperBorder ( ) , pPage - > GetLowerBorder ( ) ,
pPage - > GetOrientation ( ) ,
pPage - > GetPaperBin ( ) ,
pPage - > IsBackgroundFullSize ( ) ,
rNewSize ,
nLeft , nRight ,
nUpper , nLower ,
bScaleAll ,
eOrientation ,
nPaperBin ,
bBackgroundFullSize ) ) ;
pUndoGroup - > AddAction ( pUndo ) ;
}
if ( rNewSize . Width ( ) > 0 | | nLeft > = 0 | | nRight > = 0 | | nUpper > = 0 | | nLower > = 0 )
{
: : tools : : Rectangle aNewBorderRect ( nLeft , nUpper , nRight , nLower ) ;
pPage - > ScaleObjects ( rNewSize , aNewBorderRect , bScaleAll ) ;
if ( rNewSize . Width ( ) > 0 )
{
pPage - > SetSize ( rNewSize ) ;
}
}
if ( nLeft > = 0 | | nRight > = 0 | | nUpper > = 0 | | nLower > = 0 )
{
pPage - > SetBorder ( nLeft , nUpper , nRight , nLower ) ;
}
pPage - > SetOrientation ( eOrientation ) ;
pPage - > SetPaperBin ( nPaperBin ) ;
pPage - > SetBackgroundFullSize ( bBackgroundFullSize ) ;
if ( ePageKind = = PageKind : : Standard )
{
SdPage * pNotesPage = GetSdPage ( i , PageKind : : Notes ) ;
pNotesPage - > SetAutoLayout ( pNotesPage - > GetAutoLayout ( ) ) ;
}
pPage - > SetAutoLayout ( pPage - > GetAutoLayout ( ) ) ;
}
}
2014-06-12 13:59:07 +01:00
SdrModel * SdDrawDocument : : AllocModel ( ) const
{
return AllocSdDrawDocument ( ) ;
}
2016-03-10 17:34:23 +01:00
namespace
{
/// Copies all user-defined properties from pSource to pDestination.
void lcl_copyUserDefinedProperties ( SfxObjectShell * pSource , SfxObjectShell * pDestination )
{
if ( ! pSource | | ! pDestination )
return ;
uno : : Reference < document : : XDocumentProperties > xSource = pSource - > getDocProperties ( ) ;
uno : : Reference < document : : XDocumentProperties > xDestination = pDestination - > getDocProperties ( ) ;
uno : : Reference < beans : : XPropertyContainer > xSourcePropertyContainer = xSource - > getUserDefinedProperties ( ) ;
uno : : Reference < beans : : XPropertyContainer > xDestinationPropertyContainer = xDestination - > getUserDefinedProperties ( ) ;
uno : : Reference < beans : : XPropertySet > xSourcePropertySet ( xSourcePropertyContainer , uno : : UNO_QUERY ) ;
uno : : Sequence < beans : : Property > aProperties = xSourcePropertySet - > getPropertySetInfo ( ) - > getProperties ( ) ;
for ( const beans : : Property & rProperty : aProperties )
{
const OUString & rKey = rProperty . Name ;
uno : : Any aValue = xSourcePropertySet - > getPropertyValue ( rKey ) ;
// We know that pDestination was just created, so has no properties: addProperty() will never throw.
xDestinationPropertyContainer - > addProperty ( rKey , beans : : PropertyAttribute : : REMOVABLE , aValue ) ;
}
}
}
2013-02-18 23:33:27 +01:00
// This method creates a new document (SdDrawDocument) and returns a pointer to
// said document. The drawing engine uses this method to put the document (or
// parts of it) into the clipboard/DragServer.
2014-06-12 13:59:07 +01:00
SdDrawDocument * SdDrawDocument : : AllocSdDrawDocument ( ) const
2000-09-18 23:16:46 +00:00
{
2015-11-10 10:23:02 +01:00
SdDrawDocument * pNewModel = nullptr ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpCreatingTransferable )
2000-09-18 23:16:46 +00:00
{
2013-02-18 23:33:27 +01:00
// Document is created for drag & drop/clipboard. To be able to
// do this, the document has to know a DocShell (SvPersist).
2015-11-10 10:23:02 +01:00
SfxObjectShell * pObj = nullptr ;
: : sd : : DrawDocShell * pNewDocSh = nullptr ;
2000-09-18 23:16:46 +00:00
2016-10-11 12:21:55 +02:00
if ( meDocType = = DocumentType : : Impress )
2006-12-12 15:31:02 +00:00
mpCreatingTransferable - > SetDocShell ( new : : sd : : DrawDocShell (
2015-04-09 15:24:21 +02:00
SfxObjectCreateMode : : EMBEDDED , true , meDocType ) ) ;
2001-11-23 13:17:09 +00:00
else
2006-12-12 15:31:02 +00:00
mpCreatingTransferable - > SetDocShell ( new : : sd : : GraphicDocShell (
2018-09-10 19:00:54 +02:00
SfxObjectCreateMode : : EMBEDDED ) ) ;
2000-09-18 23:16:46 +00:00
2016-10-05 22:00:51 +02:00
pNewDocSh = static_cast < : : sd : : DrawDocShell * > ( pObj = mpCreatingTransferable - > GetDocShell ( ) . get ( ) ) ;
2015-10-20 11:46:24 +02:00
pNewDocSh - > DoInitNew ( ) ;
2000-09-18 23:16:46 +00:00
pNewModel = pNewDocSh - > GetDoc ( ) ;
2013-08-20 18:26:05 +01:00
// Only necessary for clipboard -
2013-02-18 23:33:27 +01:00
// for drag & drop this is handled by DragServer
2014-11-11 07:52:45 +02:00
SdStyleSheetPool * pOldStylePool = static_cast < SdStyleSheetPool * > ( GetStyleSheetPool ( ) ) ;
SdStyleSheetPool * pNewStylePool = static_cast < SdStyleSheetPool * > ( pNewModel - > GetStyleSheetPool ( ) ) ;
2000-09-18 23:16:46 +00:00
pNewStylePool - > CopyGraphicSheets ( * pOldStylePool ) ;
2008-03-12 10:25:59 +00:00
pNewStylePool - > CopyCellSheets ( * pOldStylePool ) ;
pNewStylePool - > CopyTableStyles ( * pOldStylePool ) ;
2016-10-11 13:01:32 +02:00
for ( sal_uInt16 i = 0 ; i < GetMasterSdPageCount ( PageKind : : Standard ) ; i + + )
2000-09-18 23:16:46 +00:00
{
2013-02-18 23:33:27 +01:00
// Move with all of the master page's layouts
2016-10-11 13:01:32 +02:00
OUString aOldLayoutName ( const_cast < SdDrawDocument * > ( this ) - > GetMasterSdPage ( i , PageKind : : Standard ) - > GetLayoutName ( ) ) ;
2013-09-05 14:22:12 +02:00
aOldLayoutName = aOldLayoutName . copy ( 0 , aOldLayoutName . indexOf ( SD_LT_SEPARATOR ) ) ;
2018-08-22 10:08:42 +01:00
StyleSheetCopyResultVector aCreatedSheets ;
2008-03-12 10:25:59 +00:00
pNewStylePool - > CopyLayoutSheets ( aOldLayoutName , * pOldStylePool , aCreatedSheets ) ;
2000-09-18 23:16:46 +00:00
}
2016-03-10 17:34:23 +01:00
lcl_copyUserDefinedProperties ( GetDocSh ( ) , pNewDocSh ) ;
2000-09-18 23:16:46 +00:00
pNewModel - > NewOrLoadCompleted ( DOC_LOADED ) ; // loaded from source document
}
2006-12-12 15:31:02 +00:00
else if ( mbAllocDocSh )
2000-09-18 23:16:46 +00:00
{
2013-02-18 23:33:27 +01:00
// Create a DocShell which is then returned with GetAllocedDocSh()
2015-03-26 15:30:40 +01:00
SdDrawDocument * pDoc = const_cast < SdDrawDocument * > ( this ) ;
2013-10-25 10:54:51 +09:00
pDoc - > SetAllocDocSh ( false ) ;
2006-12-12 15:31:02 +00:00
pDoc - > mxAllocedDocShRef = new : : sd : : DrawDocShell (
2015-04-09 15:24:21 +02:00
SfxObjectCreateMode : : EMBEDDED , true , meDocType ) ;
2015-10-20 11:46:24 +02:00
pDoc - > mxAllocedDocShRef - > DoInitNew ( ) ;
2006-12-12 15:31:02 +00:00
pNewModel = pDoc - > mxAllocedDocShRef - > GetDoc ( ) ;
2000-09-18 23:16:46 +00:00
}
else
{
2015-11-10 10:23:02 +01:00
pNewModel = new SdDrawDocument ( meDocType , nullptr ) ;
2000-09-18 23:16:46 +00:00
}
2001-01-19 18:15:28 +00:00
return pNewModel ;
2000-09-18 23:16:46 +00:00
}
2014-05-30 09:54:40 +01:00
SdPage * SdDrawDocument : : AllocSdPage ( bool bMasterPage )
{
return new SdPage ( * this , bMasterPage ) ;
}
2013-02-18 23:33:27 +01:00
// This method creates a new page (SdPage) and returns a pointer to said page.
// The drawing engine uses this method to create pages (whose types it does
// not know, as they are _derivatives_ of SdrPage) when loading.
2010-10-05 07:57:51 -05:00
SdrPage * SdDrawDocument : : AllocPage ( bool bMasterPage )
2000-09-18 23:16:46 +00:00
{
2014-05-30 09:54:40 +01:00
return AllocSdPage ( bMasterPage ) ;
2000-09-18 23:16:46 +00:00
}
2013-02-18 23:33:27 +01:00
// When the model has changed
2014-02-11 11:43:35 +02:00
void SdDrawDocument : : SetChanged ( bool bFlag )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( mbNewOrLoadCompleted & & mpDocSh - > IsEnableSetModified ( ) )
2000-09-18 23:16:46 +00:00
{
2013-02-18 23:33:27 +01:00
// Pass on to base class
2000-09-18 23:16:46 +00:00
FmFormModel : : SetChanged ( bFlag ) ;
2013-02-18 23:33:27 +01:00
// Forward to ObjectShell
2006-12-12 15:31:02 +00:00
mpDocSh - > SetModified ( bFlag ) ;
2000-09-18 23:16:46 +00:00
}
}
else
{
2013-02-18 23:33:27 +01:00
// Pass on to base class
2000-09-18 23:16:46 +00:00
FmFormModel : : SetChanged ( bFlag ) ;
}
}
2013-02-18 23:33:27 +01:00
// The model changed, don't call anything else
2014-04-24 10:52:02 +02:00
void SdDrawDocument : : NbcSetChanged ( bool bFlag )
2002-07-19 11:06:18 +00:00
{
2011-02-07 22:11:09 +01:00
// forward to baseclass
2002-07-19 11:06:18 +00:00
FmFormModel : : SetChanged ( bFlag ) ;
}
2013-02-18 23:33:27 +01:00
// NewOrLoadCompleted is called when the document is loaded, or when it is clear
// it won't load any more.
2000-09-18 23:16:46 +00:00
void SdDrawDocument : : NewOrLoadCompleted ( DocCreationMode eMode )
{
if ( eMode = = NEW_DOC )
{
2013-02-18 23:33:27 +01:00
// New document:
// create slideshow and default templates,
// create pool for virtual controls
2000-09-18 23:16:46 +00:00
CreateLayoutTemplates ( ) ;
2008-03-12 10:25:59 +00:00
CreateDefaultCellStyles ( ) ;
2000-09-18 23:16:46 +00:00
2008-03-12 10:25:59 +00:00
static_cast < SdStyleSheetPool * > ( mxStyleSheetPool . get ( ) ) - > CreatePseudosIfNecessary ( ) ;
2000-09-18 23:16:46 +00:00
}
else if ( eMode = = DOC_LOADED )
{
2013-02-18 23:33:27 +01:00
// Document has finished loading
2000-09-18 23:16:46 +00:00
2002-01-18 14:36:06 +00:00
CheckMasterPages ( ) ;
2016-10-11 13:01:32 +02:00
if ( GetMasterSdPageCount ( PageKind : : Standard ) > 1 )
2015-11-10 10:23:02 +01:00
RemoveUnnecessaryMasterPages ( nullptr , true , false ) ;
2000-09-18 23:16:46 +00:00
2011-01-17 11:41:00 +01:00
for ( sal_uInt16 i = 0 ; i < GetPageCount ( ) ; i + + )
2000-09-18 23:16:46 +00:00
{
// Check for correct layout names
2014-11-11 07:52:45 +02:00
SdPage * pPage = static_cast < SdPage * > ( GetPage ( i ) ) ;
2004-07-12 13:55:03 +00:00
if ( pPage - > TRG_HasMasterPage ( ) )
2000-09-18 23:16:46 +00:00
{
2014-11-11 07:52:45 +02:00
SdPage & rMaster = static_cast < SdPage & > ( pPage - > TRG_GetMasterPage ( ) ) ;
2004-07-12 13:55:03 +00:00
if ( rMaster . GetLayoutName ( ) ! = pPage - > GetLayoutName ( ) )
{
pPage - > SetLayoutName ( rMaster . GetLayoutName ( ) ) ;
}
2000-09-18 23:16:46 +00:00
}
}
2011-01-17 11:41:00 +01:00
for ( sal_uInt16 nPage = 0 ; nPage < GetMasterPageCount ( ) ; nPage + + )
2000-09-18 23:16:46 +00:00
{
2001-07-03 13:21:16 +00:00
// LayoutName and PageName must be the same
2014-11-11 07:52:45 +02:00
SdPage * pPage = static_cast < SdPage * > ( GetMasterPage ( nPage ) ) ;
2000-09-18 23:16:46 +00:00
2013-09-05 14:22:12 +02:00
OUString aName ( pPage - > GetLayoutName ( ) ) ;
aName = aName . copy ( 0 , aName . indexOf ( SD_LT_SEPARATOR ) ) ;
2001-07-03 13:21:16 +00:00
if ( aName ! = pPage - > GetName ( ) )
pPage - > SetName ( aName ) ;
2000-09-18 23:16:46 +00:00
}
2013-02-18 23:33:27 +01:00
// Create names of the styles in the user's language
2008-03-12 10:25:59 +00:00
static_cast < SdStyleSheetPool * > ( mxStyleSheetPool . get ( ) ) - > UpdateStdNames ( ) ;
2000-09-18 23:16:46 +00:00
2013-08-20 18:26:05 +01:00
// Create any missing styles - eg. formerly, there was no Subtitle style
2008-03-12 10:25:59 +00:00
static_cast < SdStyleSheetPool * > ( mxStyleSheetPool . get ( ) ) - > CreatePseudosIfNecessary ( ) ;
2000-09-18 23:16:46 +00:00
}
2013-02-18 23:33:27 +01:00
// Set default style of Drawing Engine
2017-05-18 21:14:00 +01:00
OUString aName ( SdResId ( STR_STANDARD_STYLESHEET_NAME ) ) ;
2018-01-19 12:16:31 +02:00
SetDefaultStyleSheet ( static_cast < SfxStyleSheet * > ( mxStyleSheetPool - > Find ( aName , SfxStyleFamily : : Para ) ) ) ;
2000-09-18 23:16:46 +00:00
2012-05-31 13:23:45 +00:00
// #i119287# Set default StyleSheet for SdrGrafObj and SdrOle2Obj
2018-01-19 12:16:31 +02:00
SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj ( static_cast < SfxStyleSheet * > ( mxStyleSheetPool - > Find ( SdResId ( STR_POOLSHEET_OBJNOLINENOFILL ) , SfxStyleFamily : : Para ) ) ) ;
2012-05-31 13:23:45 +00:00
2013-02-18 23:33:27 +01:00
// Initialize DrawOutliner and DocumentOutliner, but don't initialize the
// global outliner, as it is not document specific like StyleSheetPool and
// StyleRequestHandler are.
2004-03-30 14:43:59 +00:00
: : Outliner & rDrawOutliner = GetDrawOutliner ( ) ;
2014-11-11 07:52:45 +02:00
rDrawOutliner . SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2015-03-24 16:05:55 +02:00
EEControlBits nCntrl = rDrawOutliner . GetControlWord ( ) ;
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2015-03-24 16:05:55 +02:00
nCntrl | = EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
else
2015-03-24 16:05:55 +02:00
nCntrl & = ~ EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
rDrawOutliner . SetControlWord ( nCntrl ) ;
2013-02-18 23:33:27 +01:00
// Initialize HitTestOutliner and DocumentOutliner, but don't initialize the
// global outliner, as it is not document specific like StyleSheetPool and
// StyleRequestHandler are.
2014-11-11 07:52:45 +02:00
pHitTestOutliner - > SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpOutliner )
2000-09-18 23:16:46 +00:00
{
2014-11-11 07:52:45 +02:00
mpOutliner - > SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
if ( mpInternalOutliner )
2000-09-18 23:16:46 +00:00
{
2014-11-11 07:52:45 +02:00
mpInternalOutliner - > SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2000-09-18 23:16:46 +00:00
}
if ( eMode = = DOC_LOADED )
{
2013-02-18 23:33:27 +01:00
// Make presentation objects listeners of the appropriate styles
2014-11-11 07:52:45 +02:00
SdStyleSheetPool * pSPool = static_cast < SdStyleSheetPool * > ( GetStyleSheetPool ( ) ) ;
2011-01-17 11:41:00 +01:00
sal_uInt16 nPage , nPageCount ;
2002-01-09 13:40:05 +00:00
2011-02-07 22:11:09 +01:00
// create missing layout style sheets for broken documents
2018-07-23 16:28:03 +02:00
// that were created with the 5.2
2016-10-11 13:01:32 +02:00
nPageCount = GetMasterSdPageCount ( PageKind : : Standard ) ;
2002-01-09 13:40:05 +00:00
for ( nPage = 0 ; nPage < nPageCount ; nPage + + )
{
2016-10-11 13:01:32 +02:00
SdPage * pPage = GetMasterSdPage ( nPage , PageKind : : Standard ) ;
2014-04-24 10:52:02 +02:00
pSPool - > CreateLayoutStyleSheets ( pPage - > GetName ( ) , true ) ;
2002-01-09 13:40:05 +00:00
}
2000-09-18 23:16:46 +00:00
2013-02-18 23:33:27 +01:00
// Default and notes pages:
2002-01-09 13:40:05 +00:00
for ( nPage = 0 ; nPage < GetPageCount ( ) ; nPage + + )
2000-09-18 23:16:46 +00:00
{
2014-11-11 07:52:45 +02:00
SdPage * pPage = static_cast < SdPage * > ( GetPage ( nPage ) ) ;
2004-03-30 14:43:59 +00:00
NewOrLoadCompleted ( pPage , pSPool ) ;
2000-10-18 11:07:10 +00:00
}
2000-09-18 23:16:46 +00:00
2013-02-18 23:33:27 +01:00
// Master pages:
2000-10-18 11:07:10 +00:00
for ( nPage = 0 ; nPage < GetMasterPageCount ( ) ; nPage + + )
{
2014-11-11 07:52:45 +02:00
SdPage * pPage = static_cast < SdPage * > ( GetMasterPage ( nPage ) ) ;
2000-09-18 23:16:46 +00:00
2004-03-30 14:43:59 +00:00
NewOrLoadCompleted ( pPage , pSPool ) ;
2000-09-18 23:16:46 +00:00
}
}
2013-10-25 10:54:51 +09:00
mbNewOrLoadCompleted = true ;
2001-12-18 14:03:13 +00:00
UpdateAllLinks ( ) ;
2014-02-11 11:43:35 +02:00
SetChanged ( false ) ;
2001-12-18 14:03:13 +00:00
}
/** updates all links, only links in this document should by resolved */
void SdDrawDocument : : UpdateAllLinks ( )
{
2015-11-12 20:58:46 +01:00
if ( ! s_pDocLockedInsertingLinks & & pLinkManager & & ! pLinkManager - > GetLinks ( ) . empty ( ) )
2000-09-18 23:16:46 +00:00
{
2015-11-12 20:58:46 +01:00
s_pDocLockedInsertingLinks = this ; // lock inserting links. only links in this document should by resolved
2000-09-18 23:16:46 +00:00
2016-09-13 15:26:41 +01:00
if ( mpDocSh )
{
comphelper : : EmbeddedObjectContainer & rEmbeddedObjectContainer = mpDocSh - > getEmbeddedObjectContainer ( ) ;
rEmbeddedObjectContainer . setUserAllowsLinkUpdate ( true ) ;
}
2017-05-03 11:48:32 +02:00
pLinkManager - > UpdateAllLinks ( true , false , nullptr ) ; // query box: update all links?
2000-09-18 23:16:46 +00:00
2015-11-12 20:58:46 +01:00
if ( s_pDocLockedInsertingLinks = = this )
s_pDocLockedInsertingLinks = nullptr ; // unlock inserting links
2000-09-18 23:16:46 +00:00
}
}
2014-04-10 09:55:52 +02:00
/** this loops over the presentation objects of a page and repairs some new settings
2004-03-30 14:43:59 +00:00
from old binary files and resets all default strings for empty presentation objects .
*/
void SdDrawDocument : : NewOrLoadCompleted ( SdPage * pPage , SdStyleSheetPool * pSPool )
{
2013-06-25 11:01:52 +01:00
sd : : ShapeList & rPresentationShapes ( pPage - > GetPresentationShapeList ( ) ) ;
2006-01-10 13:25:20 +00:00
if ( ! rPresentationShapes . isEmpty ( ) )
2004-03-30 14:43:59 +00:00
{
2013-02-18 23:33:27 +01:00
// Create lists of title and outline styles
2013-09-05 14:22:12 +02:00
OUString aName = pPage - > GetLayoutName ( ) ;
aName = aName . copy ( 0 , aName . indexOf ( SD_LT_SEPARATOR ) ) ;
2004-03-30 14:43:59 +00:00
2011-03-04 21:49:59 -08:00
std : : vector < SfxStyleSheetBase * > aOutlineList ;
pSPool - > CreateOutlineSheetList ( aName , aOutlineList ) ;
2014-11-11 07:52:45 +02:00
SfxStyleSheet * pTitleSheet = static_cast < SfxStyleSheet * > ( pSPool - > GetTitleSheet ( aName ) ) ;
2004-03-30 14:43:59 +00:00
2017-11-03 19:18:20 +01:00
SdrObject * pObj = nullptr ;
rPresentationShapes . seekShape ( 0 ) ;
2013-02-18 23:33:27 +01:00
// Now look for title and outline text objects, then make those objects
// listeners.
2017-11-03 19:18:20 +01:00
while ( ( pObj = rPresentationShapes . getNextShape ( ) ) )
2004-03-30 14:43:59 +00:00
{
2016-11-21 11:45:50 +02:00
if ( pObj - > GetObjInventor ( ) = = SdrInventor : : Default )
2004-03-30 14:43:59 +00:00
{
OutlinerParaObject * pOPO = pObj - > GetOutlinerParaObject ( ) ;
2011-01-17 11:41:00 +01:00
sal_uInt16 nId = pObj - > GetObjIdentifier ( ) ;
2004-03-30 14:43:59 +00:00
if ( nId = = OBJ_TITLETEXT )
{
2016-05-09 09:05:57 +02:00
if ( pOPO & & pOPO - > GetOutlinerMode ( ) = = OutlinerMode : : DontKnow )
pOPO - > SetOutlinerMode ( OutlinerMode : : TitleObject ) ;
2004-03-30 14:43:59 +00:00
2013-02-18 23:33:27 +01:00
// sal_True: don't delete "hard" attributes when doing this.
2004-03-30 14:43:59 +00:00
if ( pTitleSheet )
2014-01-28 20:00:21 +01:00
pObj - > SetStyleSheet ( pTitleSheet , true ) ;
2004-03-30 14:43:59 +00:00
}
else if ( nId = = OBJ_OUTLINETEXT )
{
2016-05-09 09:05:57 +02:00
if ( pOPO & & pOPO - > GetOutlinerMode ( ) = = OutlinerMode : : DontKnow )
pOPO - > SetOutlinerMode ( OutlinerMode : : OutlineObject ) ;
2004-03-30 14:43:59 +00:00
2011-03-04 21:49:59 -08:00
std : : vector < SfxStyleSheetBase * > : : iterator iter ;
for ( iter = aOutlineList . begin ( ) ; iter ! = aOutlineList . end ( ) ; + + iter )
2004-03-30 14:43:59 +00:00
{
2011-10-10 12:33:06 +03:00
SfxStyleSheet * pSheet = static_cast < SfxStyleSheet * > ( * iter ) ;
2011-03-04 21:49:59 -08:00
2004-03-30 14:43:59 +00:00
if ( pSheet )
{
pObj - > StartListening ( * pSheet ) ;
2011-03-04 21:49:59 -08:00
if ( iter = = aOutlineList . begin ( ) )
2013-02-18 23:33:27 +01:00
// text frame listens to stylesheet of layer 1
2014-03-10 11:09:59 +02:00
pObj - > NbcSetStyleSheet ( pSheet , true ) ;
2004-03-30 14:43:59 +00:00
}
}
}
2015-09-30 16:10:07 +02:00
if ( dynamic_cast < const SdrTextObj * > ( pObj ) ! = nullptr & & pObj - > IsEmptyPresObj ( ) )
2004-03-30 14:43:59 +00:00
{
2006-01-10 13:25:20 +00:00
PresObjKind ePresObjKind = pPage - > GetPresObjKind ( pObj ) ;
2013-09-05 14:22:12 +02:00
OUString aString ( pPage - > GetPresObjText ( ePresObjKind ) ) ;
2004-03-30 14:43:59 +00:00
2013-09-05 14:22:12 +02:00
if ( ! aString . isEmpty ( ) )
2004-03-30 14:43:59 +00:00
{
2016-10-14 10:10:44 +02:00
SdOutliner * pInternalOutl = GetInternalOutliner ( ) ;
2014-11-11 07:52:45 +02:00
pPage - > SetObjText ( static_cast < SdrTextObj * > ( pObj ) , pInternalOutl , ePresObjKind , aString ) ;
2014-03-10 11:09:59 +02:00
pObj - > NbcSetStyleSheet ( pPage - > GetStyleSheetForPresObj ( ePresObjKind ) , true ) ;
2004-03-30 14:43:59 +00:00
pInternalOutl - > Clear ( ) ;
}
}
}
}
}
}
2000-09-18 23:16:46 +00:00
2013-02-18 23:33:27 +01:00
// Local outliner that is used for outline mode. In this outliner, OutlinerViews
// may be inserted.
2016-10-14 10:10:44 +02:00
SdOutliner * SdDrawDocument : : GetOutliner ( bool bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( ! mpOutliner & & bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2017-10-19 11:33:14 +02:00
mpOutliner . reset ( new SdOutliner ( this , OutlinerMode : : TextObject ) ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2017-05-02 16:23:46 +02:00
mpOutliner - > SetRefDevice ( SD_MOD ( ) - > GetVirtualRefDevice ( ) ) ;
2002-07-26 07:32:44 +00:00
2006-12-12 15:31:02 +00:00
mpOutliner - > SetDefTab ( nDefaultTabulator ) ;
2014-11-11 07:52:45 +02:00
mpOutliner - > SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2000-09-18 23:16:46 +00:00
}
2017-10-19 11:33:14 +02:00
return mpOutliner . get ( ) ;
2000-09-18 23:16:46 +00:00
}
2013-02-18 23:33:27 +01:00
// Internal outliner that is used to create text objects. We don't insert any
// OutlinerViews into this outliner!
2016-10-14 10:10:44 +02:00
SdOutliner * SdDrawDocument : : GetInternalOutliner ( bool bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( ! mpInternalOutliner & & bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2017-10-19 11:33:14 +02:00
mpInternalOutliner . reset ( new SdOutliner ( this , OutlinerMode : : TextObject ) ) ;
2013-02-18 23:33:27 +01:00
// This outliner is only used to create special text objects. As no
// information about portions is saved in this outliner, the update mode
// can/should always remain sal_False.
2014-02-25 14:19:24 +02:00
mpInternalOutliner - > SetUpdateMode ( false ) ;
mpInternalOutliner - > EnableUndo ( false ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2017-05-02 16:23:46 +02:00
mpInternalOutliner - > SetRefDevice ( SD_MOD ( ) - > GetVirtualRefDevice ( ) ) ;
2002-07-26 07:32:44 +00:00
2006-12-12 15:31:02 +00:00
mpInternalOutliner - > SetDefTab ( nDefaultTabulator ) ;
2014-11-11 07:52:45 +02:00
mpInternalOutliner - > SetStyleSheetPool ( static_cast < SfxStyleSheetPool * > ( GetStyleSheetPool ( ) ) ) ;
2000-09-18 23:16:46 +00:00
}
2014-02-25 14:19:24 +02:00
DBG_ASSERT ( ! mpInternalOutliner | | ( ! mpInternalOutliner - > GetUpdateMode ( ) ) , " InternalOutliner: UpdateMode = sal_True ! " ) ;
DBG_ASSERT ( ! mpInternalOutliner | | ( ! mpInternalOutliner - > IsUndoEnabled ( ) ) , " InternalOutliner: Undo = sal_True ! " ) ;
2000-09-18 23:16:46 +00:00
2013-02-18 23:33:27 +01:00
// If you add stuff here, always clear it out.
// Advantages:
// a) no unnecessary Clear calls
// b) no wasted memory
2013-08-14 13:44:38 +01:00
DBG_ASSERT ( ! mpInternalOutliner | | ( ( mpInternalOutliner - > GetParagraphCount ( ) = = 1 ) & & ( mpInternalOutliner - > GetText ( mpInternalOutliner - > GetParagraph ( 0 ) ) . isEmpty ( ) ) ) , " InternalOutliner: not empty! " ) ;
2000-09-18 23:16:46 +00:00
2017-10-19 11:33:14 +02:00
return mpInternalOutliner . get ( ) ;
2000-09-18 23:16:46 +00:00
}
2013-02-18 23:33:27 +01:00
// OnlineSpelling on/off
2014-04-24 10:52:02 +02:00
void SdDrawDocument : : SetOnlineSpell ( bool bIn )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
mbOnlineSpell = bIn ;
2015-03-24 16:05:55 +02:00
EEControlBits nCntrl ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
nCntrl = mpOutliner - > GetControlWord ( ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2015-03-24 16:05:55 +02:00
nCntrl | = EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
else
2015-03-24 16:05:55 +02:00
nCntrl & = ~ EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
mpOutliner - > SetControlWord ( nCntrl ) ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
if ( mpInternalOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
nCntrl = mpInternalOutliner - > GetControlWord ( ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2015-03-24 16:05:55 +02:00
nCntrl | = EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
else
2015-03-24 16:05:55 +02:00
nCntrl & = ~ EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
mpInternalOutliner - > SetControlWord ( nCntrl ) ;
2000-09-18 23:16:46 +00:00
}
2004-03-30 14:43:59 +00:00
: : Outliner & rOutliner = GetDrawOutliner ( ) ;
2000-09-18 23:16:46 +00:00
nCntrl = rOutliner . GetControlWord ( ) ;
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2015-03-24 16:05:55 +02:00
nCntrl | = EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
else
2015-03-24 16:05:55 +02:00
nCntrl & = ~ EEControlBits : : ONLINESPELLING ;
2000-09-18 23:16:46 +00:00
rOutliner . SetControlWord ( nCntrl ) ;
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2000-09-18 23:16:46 +00:00
{
StartOnlineSpelling ( ) ;
}
else
{
StopOnlineSpelling ( ) ;
}
}
2013-02-18 23:33:27 +01:00
// OnlineSpelling: highlighting on/off
2000-11-26 18:24:16 +00:00
uno : : Reference < uno : : XInterface > SdDrawDocument : : createUnoModel ( )
{
uno : : Reference < uno : : XInterface > xModel ;
try
{
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
xModel = mpDocSh - > GetModel ( ) ;
2000-11-26 18:24:16 +00:00
}
2006-12-12 15:31:02 +00:00
catch ( uno : : RuntimeException & )
2000-11-26 18:24:16 +00:00
{
}
2000-09-18 23:16:46 +00:00
2000-11-26 18:24:16 +00:00
return xModel ;
}
2002-12-11 15:23:04 +00:00
SvxNumType SdDrawDocument : : GetPageNumType ( ) const
{
2006-12-12 15:31:02 +00:00
return mePageNumType ;
2003-04-24 13:35:54 +00:00
}
void SdDrawDocument : : SetPrinterIndependentLayout ( sal_Int32 nMode )
{
switch ( nMode )
{
2015-10-28 12:01:32 +02:00
case css : : document : : PrinterIndependentLayout : : DISABLED :
case css : : document : : PrinterIndependentLayout : : ENABLED :
2013-02-18 23:33:27 +01:00
// Just store supported modes and inform the doc shell
2003-04-24 13:35:54 +00:00
mnPrinterIndependentLayout = nMode ;
// Since it is possible that a SdDrawDocument is constructed without a
2006-12-12 15:31:02 +00:00
// SdDrawDocShell the pointer member mpDocSh needs to be tested
2013-02-18 23:33:27 +01:00
// before the call is executed. This is e. g. used for copy/paste.
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2003-04-24 13:35:54 +00:00
{
2006-12-12 15:31:02 +00:00
mpDocSh - > UpdateRefDevice ( ) ;
2003-04-24 13:35:54 +00:00
}
break ;
default :
2013-02-18 23:33:27 +01:00
// Ignore unknown values
2003-04-24 13:35:54 +00:00
break ;
}
}
2003-05-16 13:16:34 +00:00
void SdDrawDocument : : SetStartWithPresentation ( bool bStartWithPresentation )
{
mbStartWithPresentation = bStartWithPresentation ;
}
2013-07-17 17:42:15 +02:00
void SdDrawDocument : : SetExitAfterPresenting ( bool bExitAfterPresenting )
{
mbExitAfterPresenting = bExitAfterPresenting ;
}
2003-10-27 12:29:26 +00:00
void SdDrawDocument : : PageListChanged ( )
{
mpDrawPageListWatcher - > Invalidate ( ) ;
}
void SdDrawDocument : : MasterPageListChanged ( )
{
mpMasterPageListWatcher - > Invalidate ( ) ;
}
2009-09-16 13:55:36 +00:00
void SdDrawDocument : : SetCalcFieldValueHdl ( : : Outliner * pOutliner )
{
pOutliner - > SetCalcFieldValueHdl ( LINK ( SD_MOD ( ) , SdModule , CalcFieldValueHdl ) ) ;
}
2013-04-07 12:06:47 +02:00
sal_uInt16 SdDrawDocument : : GetAnnotationAuthorIndex ( const OUString & rAuthor )
2009-09-16 13:55:36 +00:00
{
// force current user to have first color
if ( maAnnotationAuthors . empty ( ) )
{
SvtUserOptions aUserOptions ;
maAnnotationAuthors . push_back ( aUserOptions . GetFullName ( ) ) ;
}
sal_uInt16 idx = 0 ;
2013-04-01 18:53:16 +02:00
const std : : vector < OUString > : : const_iterator aEnd ( maAnnotationAuthors . end ( ) ) ;
for ( std : : vector < OUString > : : const_iterator iter ( maAnnotationAuthors . begin ( ) ) ; iter ! = aEnd ; + + iter )
2009-09-16 13:55:36 +00:00
{
if ( ( * iter ) = = rAuthor )
{
break ;
}
idx + + ;
}
if ( idx = = maAnnotationAuthors . size ( ) )
{
maAnnotationAuthors . push_back ( rAuthor ) ;
}
return idx ;
}
2004-11-26 18:46:34 +00:00
2013-08-24 01:23:36 +02:00
void SdDrawDocument : : InitLayoutVector ( )
2013-07-31 01:58:58 +05:30
{
2017-11-08 15:47:50 +00:00
if ( utl : : ConfigManager : : IsFuzzing ( ) )
2015-08-26 10:51:29 +01:00
return ;
2013-08-24 01:23:36 +02:00
const Reference < css : : uno : : XComponentContext > xContext (
: : comphelper : : getProcessComponentContext ( ) ) ;
2013-08-05 20:18:29 +05:30
2013-08-24 01:23:36 +02:00
// get file list from configuration
Sequence < rtl : : OUString > aFiles (
officecfg : : Office : : Impress : : Misc : : LayoutListFiles : : get ( xContext ) ) ;
2013-08-28 01:52:17 +05:30
rtl : : OUString sFilename ;
2013-08-05 20:18:29 +05:30
for ( sal_Int32 i = 0 ; i < aFiles . getLength ( ) ; + + i )
2013-07-31 01:58:58 +05:30
{
2014-12-03 16:14:48 +01:00
sFilename = comphelper : : getExpandedUri ( xContext , aFiles [ i ] ) ;
2013-07-31 01:58:58 +05:30
2013-08-24 01:23:36 +02:00
// load layout file into DOM
Reference < XMultiServiceFactory > xServiceFactory (
xContext - > getServiceManager ( ) , UNO_QUERY_THROW ) ;
const Reference < XDocumentBuilder > xDocBuilder (
DocumentBuilder : : create ( comphelper : : getComponentContext ( xServiceFactory ) ) ) ;
2014-05-09 13:07:33 +02:00
try
{
// loop over every layout entry in current file
const Reference < XDocument > xDoc = xDocBuilder - > parseURI ( sFilename ) ;
const Reference < XNodeList > layoutlist = xDoc - > getElementsByTagName ( " layout " ) ;
const int nElements = layoutlist - > getLength ( ) ;
for ( int index = 0 ; index < nElements ; index + + )
maLayoutInfo . push_back ( layoutlist - > item ( index ) ) ;
}
catch ( const uno : : Exception & )
{
// skip missing config. files
}
2013-07-31 01:58:58 +05:30
}
}
2013-08-31 17:50:25 +02:00
2013-08-28 01:52:17 +05:30
void SdDrawDocument : : InitObjectVector ( )
{
2017-11-08 15:47:50 +00:00
if ( utl : : ConfigManager : : IsFuzzing ( ) )
2015-08-26 10:51:29 +01:00
return ;
2013-08-28 01:52:17 +05:30
const Reference < css : : uno : : XComponentContext > xContext (
: : comphelper : : getProcessComponentContext ( ) ) ;
// get file list from configuration
Sequence < rtl : : OUString > aFiles (
officecfg : : Office : : Impress : : Misc : : PresObjListFiles : : get ( xContext ) ) ;
rtl : : OUString sFilename ;
for ( sal_Int32 i = 0 ; i < aFiles . getLength ( ) ; + + i )
{
2014-12-03 16:14:48 +01:00
sFilename = comphelper : : getExpandedUri ( xContext , aFiles [ i ] ) ;
2013-08-28 01:52:17 +05:30
// load presentation object file into DOM
Reference < XMultiServiceFactory > xServiceFactory (
xContext - > getServiceManager ( ) , UNO_QUERY_THROW ) ;
const Reference < XDocumentBuilder > xDocBuilder (
DocumentBuilder : : create ( comphelper : : getComponentContext ( xServiceFactory ) ) ) ;
2014-05-09 13:07:33 +02:00
try
{
// loop over every object entry in current file
const Reference < XDocument > xDoc = xDocBuilder - > parseURI ( sFilename ) ;
const Reference < XNodeList > objectlist = xDoc - > getElementsByTagName ( " object " ) ;
const int nElements = objectlist - > getLength ( ) ;
for ( int index = 0 ; index < nElements ; index + + )
maPresObjectInfo . push_back ( objectlist - > item ( index ) ) ;
}
catch ( const uno : : Exception & )
{
// skip missing config. files
}
2013-08-28 01:52:17 +05:30
}
}
2015-02-16 15:16:57 +01:00
void SdDrawDocument : : dumpAsXml ( xmlTextWriterPtr pWriter ) const
{
bool bOwns = false ;
if ( ! pWriter )
{
pWriter = xmlNewTextWriterFilename ( " model.xml " , 0 ) ;
2016-09-30 16:49:56 +02:00
xmlTextWriterSetIndent ( pWriter , 1 ) ;
xmlTextWriterSetIndentString ( pWriter , BAD_CAST ( " " ) ) ;
2015-11-10 10:23:02 +01:00
xmlTextWriterStartDocument ( pWriter , nullptr , nullptr , nullptr ) ;
2015-02-16 15:16:57 +01:00
bOwns = true ;
}
2016-11-16 08:59:00 +02:00
xmlTextWriterStartElement ( pWriter , BAD_CAST ( " SdDrawDocument " ) ) ;
2016-04-19 13:57:54 +02:00
xmlTextWriterWriteFormatAttribute ( pWriter , BAD_CAST ( " ptr " ) , " %p " , this ) ;
2016-09-30 16:49:56 +02:00
if ( mpOutliner )
mpOutliner - > dumpAsXml ( pWriter ) ;
2015-02-16 15:16:57 +01:00
FmFormModel : : dumpAsXml ( pWriter ) ;
2016-04-19 13:57:54 +02:00
if ( GetUndoManager ( ) )
GetUndoManager ( ) - > dumpAsXml ( pWriter ) ;
xmlTextWriterEndElement ( pWriter ) ;
2015-02-16 15:16:57 +01:00
if ( bOwns )
{
xmlTextWriterEndDocument ( pWriter ) ;
xmlFreeTextWriter ( pWriter ) ;
}
}
2010-10-12 15:51:52 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */