Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/inc/drawdoc.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <com/sun/star/text/WritingMode.hpp>
23
#include <svl/style.hxx>
24
#include <svx/fmmodel.hxx>
25
#include <unotools/charclass.hxx>
26
#include <vcl/prntypes.hxx>
27
#include <xmloff/autolayout.hxx>
28
29
#include <vector>
30
#include <memory>
31
#include <optional>
32
#include <string_view>
33
#include <map>
34
#include <utility>
35
36
#include "sddllapi.h"
37
#include "pres.hxx"
38
#include "stlpool.hxx"
39
#include "sdpage.hxx"
40
41
namespace com::sun::star::xml::dom { class XNode; }
42
namespace editeng { class SvxFieldItemUpdater; }
43
namespace vcl { class Font; }
44
namespace com::sun::star::presentation { class XPresentation2; }
45
class SdOutliner;
46
class Timer;
47
class SfxObjectShell;
48
class SdPage;
49
class SdAnimationInfo;
50
class SdStyleSheetPool;
51
class SfxMedium;
52
class SvxSearchItem;
53
class EditStatus;
54
class Point;
55
class SdTransferable;
56
struct SpellCallbackInfo;
57
class SdCustomShowList;
58
class SdUndoGroup;
59
class SdrObject;
60
class Idle;
61
class Outliner;
62
class SdrOutliner;
63
class SdrPage;
64
class SdrTextObj;
65
class SfxItemPool;
66
class Size;
67
class SdXImpressDocument;
68
69
namespace sd
70
{
71
class DrawDocShell;
72
#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
73
#define SV_DECL_DRAW_DOC_SHELL_DEFINED
74
typedef rtl::Reference<DrawDocShell> DrawDocShellRef;
75
#endif
76
class UndoManager;
77
class ShapeList;
78
class FrameView;
79
class SlideSectionManager;
80
}
81
82
class ImpDrawPageListWatcher;
83
class ImpMasterPageListWatcher;
84
85
struct StyleReplaceData
86
{
87
    SfxStyleFamily  nFamily;
88
    SfxStyleFamily  nNewFamily;
89
    OUString        aName;
90
    OUString        aNewName;
91
};
92
93
enum class DocCreationMode
94
{
95
    New,
96
    Loaded
97
};
98
99
namespace sd
100
{
101
    struct PresentationSettings
102
    {
103
        OUString maPresPage;
104
        bool mbAll;
105
        bool mbEndless;
106
        bool mbCustomShow;
107
        bool mbManual;
108
        bool mbMouseVisible;
109
        bool mbMouseAsPen;
110
        bool mbLockedPages;
111
        bool mbAlwaysOnTop;
112
        bool mbFullScreen;
113
        bool mbAnimationAllowed;
114
        sal_Int32 mnPauseTimeout;
115
        bool mbShowPauseLogo;
116
        bool mbStartCustomShow;
117
        bool mbInteractive;
118
119
        PresentationSettings();
120
    };
121
}
122
123
/**
124
 * Type aliases for commonly used data structures
125
 */
126
typedef std::vector<OUString> PageNameList;            // List of page/bookmark names
127
typedef std::vector<OUString> SlideLayoutNameList;     // List of slide layout names
128
typedef std::map<OUString, sal_Int32> SlideLayoutMap;  // Map of slide layout names to indices
129
typedef std::map<OUString, std::shared_ptr<model::Theme>> ThemeMap; // Map of theme names to theme objects
130
131
/**
132
 * Context for style sheet transfers during page operations
133
 *
134
 * This structure contains all data required for transferring styles (graphic, cell, table)
135
 * between documents or pages. It maintains collections of styles that need to be
136
 * transferred and manages pointers to source and destination style sheet pools.
137
 */
138
struct StyleTransferContext
139
{
140
    // Style collections to be transferred
141
    StyleSheetCopyResultVector aGraphicStyles;  // Graphic styles to be transferred
142
    StyleSheetCopyResultVector aCellStyles;     // Cell styles to be transferred
143
    XStyleVector aTableStyles;                  // Table styles to be transferred
144
    OUString aRenameString;                     // String for style renaming operations
145
146
    // Layout information
147
    SlideLayoutMap aSlideLayouts;               // Layouts to be transferred
148
    ThemeMap aThemes;                           // Themes to be transferred
149
150
    // Style sheet pools (optional, set by the caller)
151
    SdStyleSheetPool* pSourceStyleSheetPool;    // Source style sheet pool
152
    SdStyleSheetPool* pDestStyleSheetPool;      // Destination style sheet pool
153
154
    StyleTransferContext()
155
0
        : pSourceStyleSheetPool(nullptr)
156
0
        , pDestStyleSheetPool(nullptr)
157
0
    {}
158
159
    // Constructor with style sheet pools
160
    StyleTransferContext(SdStyleSheetPool* pSource, SdStyleSheetPool* pDest)
161
0
        : pSourceStyleSheetPool(pSource)
162
0
        , pDestStyleSheetPool(pDest)
163
0
    {}
164
165
};
166
167
/**
168
 * Options for inserting bookmarks as pages
169
 *
170
 * This structure defines all parameters for controlling how pages/bookmarks
171
 * are inserted into documents. It covers operations like linking, replacing,
172
 * and various flags to control the behavior during page insertion.
173
 */
174
struct InsertBookmarkOptions
175
{
176
    bool bLink;               // Insert bookmarks as links
177
    bool bReplace;            // Replace pages instead of inserting
178
    bool bNoDialogs;          // No dialogs allowed
179
    bool bCopy;               // Copy source document
180
    bool bMergeMasterPages;   // Merge master pages
181
    bool bMergeMasterPagesOnly; // Only merge master pages
182
    bool bPreservePageNames;  // Preserve page names
183
    bool bIsClipboardOperation; // Operation triggered by clipboard
184
    bool bIsDragAndDropOperation; // Operation triggered by drag and drop
185
    bool bIsSameDocumentOperation; // Operation within the same document
186
    bool bIsFileDocument;     // Operation involves a file document
187
188
    InsertBookmarkOptions()
189
0
        : bLink(false), bReplace(false), bNoDialogs(false),
190
0
          bCopy(true), bMergeMasterPages(true), bMergeMasterPagesOnly(false),
191
0
          bPreservePageNames(false), bIsClipboardOperation(false),
192
0
          bIsDragAndDropOperation(false), bIsSameDocumentOperation(false),
193
0
          bIsFileDocument(false)
194
0
    {}
195
196
    // Preset for paste operation
197
0
    static InsertBookmarkOptions ForPaste(bool bMergeMasterPages, bool bMergeMasterPagesOnly = false) {
198
0
        InsertBookmarkOptions options;
199
0
        options.bIsClipboardOperation = true;
200
0
        options.bMergeMasterPages = bMergeMasterPages;
201
0
        options.bMergeMasterPagesOnly = bMergeMasterPagesOnly;
202
        // All defaults are fine for paste
203
0
        return options;
204
0
    }
205
206
    // Preset for file insert operation
207
0
    static InsertBookmarkOptions ForFileInsert(bool bLinkPages) {
208
0
        InsertBookmarkOptions options;
209
0
        options.bLink = bLinkPages;
210
0
        options.bIsFileDocument = true;
211
0
        options.bMergeMasterPagesOnly = false;
212
0
        return options;
213
0
    }
214
215
    // Preset for drag and drop operation
216
0
    static InsertBookmarkOptions ForDragDrop(bool bMergeMasterPages, bool bMergeMasterPagesOnly = false) {
217
0
        InsertBookmarkOptions options;
218
0
        options.bIsDragAndDropOperation = true;
219
0
        options.bNoDialogs = true;
220
0
        options.bMergeMasterPages = bMergeMasterPages;
221
0
        options.bMergeMasterPagesOnly = bMergeMasterPagesOnly;
222
0
        return options;
223
0
    }
224
225
    // Preset for page link resolution
226
0
    static InsertBookmarkOptions ForPageLinks(bool bCopySource, bool bNoDialogs) {
227
0
        InsertBookmarkOptions options;
228
0
        options.bLink = true;
229
0
        options.bReplace = true;
230
0
        options.bPreservePageNames = true;
231
0
        options.bCopy = bCopySource;
232
0
        options.bNoDialogs = bNoDialogs;
233
0
        options.bMergeMasterPagesOnly = false;
234
0
        return options;
235
0
    }
236
237
    // Preset for internal document operations
238
0
    static InsertBookmarkOptions ForInternalOps(bool bPreserveNames, bool bMergeMasterPagesOnly = false) {
239
0
        InsertBookmarkOptions options;
240
0
        options.bNoDialogs = true;
241
0
        options.bMergeMasterPages = false;
242
0
        options.bPreservePageNames = bPreserveNames;
243
0
        options.bIsSameDocumentOperation = true;
244
0
        options.bMergeMasterPagesOnly = bMergeMasterPagesOnly;
245
0
        return options;
246
0
    }
247
248
    // Preset for document import operations
249
0
    static InsertBookmarkOptions ForDocumentImport(bool bMergeMasterPagesOnly = false) {
250
0
        InsertBookmarkOptions options;
251
0
        options.bLink = false;            // No linking for document import
252
0
        options.bReplace = true;          // Replace pages when importing document
253
0
        options.bNoDialogs = true;        // No dialogs for document import
254
0
        options.bCopy = true;             // Always copy when importing document
255
0
        options.bMergeMasterPages = true; // Always merge master pages
256
0
        options.bPreservePageNames = false; // Don't preserve page names
257
0
        options.bIsFileDocument = true;   // This is a file document operation
258
0
        options.bMergeMasterPagesOnly = bMergeMasterPagesOnly;// Only merge master pages
259
0
        return options;
260
0
    }
261
};
262
263
/**
264
 * Properties of a document page, used for page insertion and scaling operations
265
 *
266
 * This structure stores the geometric properties of a page including size, margins,
267
 * orientation, and a pointer to the page object itself. Used primarily during
268
 * page insertion and scaling operations.
269
 */
270
struct PageProperties
271
{
272
    Size         size;        // Page size dimensions
273
    sal_Int32    left;        // Left margin
274
    sal_Int32    right;       // Right margin
275
    sal_Int32    upper;       // Upper (top) margin
276
    sal_Int32    lower;       // Lower (bottom) margin
277
    Orientation  orientation; // Page orientation (portrait/landscape)
278
    SdPage*      pPage;       // Pointer to the page object
279
};
280
281
/**
282
 * Document page count information
283
 *
284
 * Tracks counts of different page types during document operations,
285
 * particularly useful during page insertion and master page handling.
286
 */
287
struct DocumentPageCounts
288
{
289
    sal_uInt16 nDestPageCount;     // Count of standard pages in destination document
290
    sal_uInt16 nSourcePageCount;   // Count of standard pages in source document
291
    sal_uInt16 nMasterPageCount;   // Count of master pages in destination document
292
    sal_uInt16 nNewMPageCount;     // Count of new master pages after processing
293
294
    DocumentPageCounts(sal_uInt16 destCount, sal_uInt16 sourceCount, sal_uInt16 masterCount, sal_uInt16 newmasterCount)
295
0
        : nDestPageCount(destCount)
296
0
        , nSourcePageCount(sourceCount)
297
0
        , nMasterPageCount(masterCount)
298
0
        , nNewMPageCount(newmasterCount)
299
0
    {}
300
301
    // Check if all counts are valid (non-zero)
302
0
    bool areValid() const {
303
0
        return !(nDestPageCount == 0 || nSourcePageCount == 0 || nMasterPageCount == 0);
304
0
    }
305
};
306
307
/**
308
 * Parameters related to page insertion operations
309
 *
310
 * Collects all parameters needed for page insertion operations including
311
 * insertion position, bookmark name, replacement count, undo status, scaling options,
312
 * and property information for both main and notes pages.
313
 */
314
struct PageInsertionParams
315
{
316
    sal_uInt16 nInsertPos;           // Position where to insert pages
317
    OUString aBookmarkName;          // Name of the bookmark for insertion
318
    sal_uInt16 nReplacedStandardPages; // Number of replaced standard pages
319
    bool bUndo;                      // Whether undo is enabled
320
    bool bScaleObjects;              // Whether to scale objects
321
    PageNameList* pExchangeList;     // List of pages for exchange operations
322
    SdDrawDocument* pBookmarkDoc;    // Source document for page insertion
323
    PageProperties mainProps;        // Properties of main pages (size, borders, etc.)
324
    PageProperties notesProps;       // Properties of notes pages (size, borders, etc.)
325
326
    PageInsertionParams(sal_uInt16 a_nInsertPos, PageNameList* a_pExchangeList = nullptr, SdDrawDocument* a_pBookmarkDoc = nullptr)
327
0
        : nInsertPos(a_nInsertPos)
328
0
        , aBookmarkName(OUString())
329
0
        , nReplacedStandardPages(0)
330
0
        , bUndo(true)
331
0
        , bScaleObjects(false)
332
0
        , pExchangeList(a_pExchangeList)
333
0
        , pBookmarkDoc(a_pBookmarkDoc)
334
        // mainProps and notesProps are default-initialized
335
0
    {}
336
};
337
338
339
// SdDrawDocument
340
class SD_DLLPUBLIC SdDrawDocument final : public FmFormModel
341
{
342
public:
343
0
    SAL_DLLPRIVATE void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
344
0
    SAL_DLLPRIVATE const OUString& getDocAccTitle() const { return msDocAccTitle; }
345
0
    SAL_DLLPRIVATE bool getDocReadOnly() const { return m_bReadOnly; }
346
private:
347
    OUString            msDocAccTitle;
348
    std::unique_ptr<SdOutliner>
349
                        mpOutliner;          ///< local outliner for outline mode
350
    std::unique_ptr<SdOutliner>
351
                        mpInternalOutliner;  ///< internal outliner for creation of text objects
352
    std::unique_ptr<Timer> mpWorkStartupTimer;
353
    std::unique_ptr<Idle>
354
                        mpOnlineSpellingIdle;
355
    std::unique_ptr<sd::ShapeList>
356
                        mpOnlineSpellingList;
357
    std::unique_ptr<SvxSearchItem>
358
                        mpOnlineSearchItem;
359
    std::vector<std::unique_ptr<sd::FrameView>>
360
                        maFrameViewList;
361
    std::unique_ptr<SdCustomShowList>   mpCustomShowList;
362
    std::unique_ptr<sd::SlideSectionManager> mpSectionManager;
363
    ::sd::DrawDocShell* mpDocSh;
364
    SdTransferable *    mpCreatingTransferable;
365
    bool                mbHasOnlineSpellErrors;
366
    bool                mbInitialOnlineSpellingEnabled;
367
    OUString            maBookmarkFile;
368
    ::sd::DrawDocShellRef   mxBookmarkDocShRef;
369
370
    sd::PresentationSettings maPresentationSettings;
371
372
    css::uno::Reference< css::presentation::XPresentation2 > mxPresentation;
373
374
    bool                mbNewOrLoadCompleted;
375
376
    bool                mbDestroying = false;
377
378
    bool                mbOnlineSpell;
379
    bool                mbSummationOfParagraphs;
380
    sal_uInt16          mnStartWithPresentation; ///< 1-based starting slide# when presenting via command line parameter --show
381
    bool                mbExitAfterPresenting; ///< true if GetStartWithPresentation AND Presentation was shown fully
382
    LanguageType        meLanguage;
383
    LanguageType        meLanguageCJK;
384
    LanguageType        meLanguageCTL;
385
    SvxNumType          mePageNumType;
386
    ::sd::DrawDocShellRef   mxAllocedDocShRef;   // => AllocModel()
387
    bool                mbAllocDocSh;       // => AllocModel()
388
    DocumentType        meDocType;
389
    std::optional<CharClass>
390
                        moCharClass;
391
392
    ::std::unique_ptr<ImpDrawPageListWatcher> mpDrawPageListWatcher;
393
    ::std::unique_ptr<ImpMasterPageListWatcher> mpMasterPageListWatcher;
394
    /// The last, still alive SdDrawDocument instance, for debugging.
395
    static SdDrawDocument* s_pLast;
396
397
    SAL_DLLPRIVATE void                UpdatePageObjectsInNotes(sal_uInt16 nStartPos);
398
    SAL_DLLPRIVATE void                UpdatePageRelativeURLs(SdPage const * pPage, sal_uInt16 nPos, sal_Int32 nIncrement);
399
    SAL_DLLPRIVATE void                FillOnlineSpellingList(SdPage const * pPage);
400
    SAL_DLLPRIVATE void                SpellObject(SdrTextObj* pObj);
401
402
                        DECL_DLLPRIVATE_LINK(WorkStartupHdl, Timer *, void);
403
                        DECL_DLLPRIVATE_LINK(OnlineSpellingHdl, Timer *, void);
404
                        DECL_DLLPRIVATE_LINK(OnlineSpellEventHdl, EditStatus&, void);
405
406
    std::vector< OUString > maAnnotationAuthors;
407
    std::vector<css::uno::Reference< css::xml::dom::XNode> > maLayoutInfo;
408
409
    std::vector<css::uno::Reference< css::xml::dom::XNode> > maPresObjectInfo;
410
411
    bool mbEmbedFonts : 1;
412
    bool mbEmbedUsedFontsOnly : 1;
413
    bool mbEmbedFontScriptLatin : 1;
414
    bool mbEmbedFontScriptAsian : 1;
415
    bool mbEmbedFontScriptComplex : 1;
416
417
    bool mbResizeAllPages = true;
418
419
    sal_Int32 mnImagePreferredDPI;
420
421
    rtl::Reference<SdPage> mpCanvasPage;
422
423
    bool mbSkipCanvasPreviewUpdates = false;
424
425
    SAL_DLLPRIVATE virtual css::uno::Reference< css::frame::XModel > createUnoModel() override;
426
427
public:
428
429
    /**
430
     * Initialize the bookmark document for page/object operations
431
     */
432
    bool initBookmarkDoc(::sd::DrawDocShell* pBookmarkDocSh, SdDrawDocument*& pBookmarkDoc, OUString& aBookmarkName);
433
434
    /**
435
     * Get page properties from the first standard and notes pages
436
     */
437
    void getPageProperties(PageProperties& mainProps, PageProperties& notesProps, sal_uInt16 nSdPageCount);
438
439
    // --- Page insertion and document handling operations ---
440
441
    /**
442
     * Insert specific pages selected from the bookmark list
443
     */
444
    void insertSelectedPages(const PageNameList& rBookmarkList,
445
        PageInsertionParams& rParams,
446
        InsertBookmarkOptions rOptions);
447
448
    /**
449
     * Insert all pages from the source document
450
     */
451
    void insertAllPages(PageInsertionParams& rParams,
452
        const InsertBookmarkOptions& rOptions,
453
        const DocumentPageCounts& rPageCounts);
454
455
    /**
456
     * Determine whether objects should be scaled during insertion
457
     */
458
    bool determineScaleObjects(bool bNoDialogs,
459
        const PageNameList& rBookmarkList,
460
        PageInsertionParams& rParams);
461
462
    /**
463
     * Collect layouts that need to be transferred from source document
464
     */
465
    void collectLayoutsToTransfer(const PageNameList& rBookmarkList,
466
        SdDrawDocument* pBookmarkDoc,
467
        SlideLayoutNameList& rLayoutsToTransfer,
468
        const DocumentPageCounts& rPageCounts,
469
        bool bMergeMasterPagesOnly);
470
471
    /**
472
     * Transfer layout styles from source document to destination
473
     */
474
    void transferLayoutStyles(const SlideLayoutNameList& layoutsToTransfer,
475
        SdDrawDocument* pBookmarkDoc,
476
        SfxUndoManager* pUndoMgr,
477
        StyleTransferContext& rStyleContext);
478
479
    /**
480
     * Copy styles between documents with options for replacement and dialog suppression
481
     */
482
    static void copyStyles(bool bReplace, bool bNoDialogs,
483
        StyleTransferContext& rStyleContext);
484
485
    /**
486
     * Remove duplicate master pages after insertion
487
     */
488
    void removeDuplicateMasterPages(PageInsertionParams& rParams,
489
        DocumentPageCounts& rPageCounts);
490
491
    /**
492
     * Update pages after insertion with proper styles and properties
493
     */
494
    void updateInsertedPages(PageInsertionParams& rParams,
495
        const InsertBookmarkOptions& rOptions,
496
        const DocumentPageCounts& rPageCounts,
497
        StyleTransferContext& rStyleContext);
498
499
    /**
500
     * Rename object styles if needed after page insertion
501
     */
502
    void renameObjectStylesIfNeeded(sal_uInt32 nInsertPos,
503
        StyleTransferContext& rStyleContext,
504
        sal_uInt32 nBMSdPageCount);
505
506
    /**
507
     * Clean up unused styles after page insertion
508
     */
509
    void cleanupStyles(SfxUndoManager* pUndoMgr,
510
        StyleTransferContext& rStyleContext);
511
512
    /**
513
     * Begin an undoable action for page operations
514
     */
515
    SfxUndoManager* beginUndoAction();
516
517
    /**
518
     * End an undoable action for page operations
519
     */
520
    void endUndoAction(bool bUndo, SfxUndoManager* pUndoMgr);
521
522
    SAL_DLLPRIVATE SdDrawDocument(DocumentType eType, SfxObjectShell* pDocSh);
523
    SAL_DLLPRIVATE virtual ~SdDrawDocument() override;
524
525
    // Adapt to given Size and Borders scaling all contained data, maybe
526
    // including PresObj's in higher derivations
527
    virtual void adaptSizeAndBorderForAllPages(
528
        const Size& rNewSize,
529
        tools::Long nLeft = 0,
530
        tools::Long nRight = 0,
531
        tools::Long nUpper = 0,
532
        tools::Long nLower = 0) override;
533
534
0
    bool ShouldResizeAllPages() const { return mbResizeAllPages; }
535
0
    void SetResizeAllPages(bool bValue) { mbResizeAllPages = bValue; }
536
537
    // Allows to have pages with different sizes in a document
538
    void ResizeCurrentPage(
539
        SdPage* pPage,
540
        const Size& rNewSize,
541
        PageKind ePageKind,
542
        SdUndoGroup* pUndoGroup = nullptr,
543
        tools::Long nLeft = 0,
544
        tools::Long nRight = 0,
545
        tools::Long nUpper = 0,
546
        tools::Long nLower = 0,
547
        bool bScaleAll = false,
548
        Orientation eOrientation = Orientation::Landscape,
549
        sal_uInt16 nPaperBin = 0,
550
        bool bBackgroundFullSize = false);
551
552
    // Set Borders to left/right/upper/lower, ScaleAll, Orientation,
553
    // PaperBin and BackgroundFullSize. Create Undo-Actions when
554
    // a SdUndoGroup is given (then used from the View probably)
555
    void AdaptPageSize(
556
        SdPage* pPage,
557
        const Size& rNewSize,
558
        SdUndoGroup* pUndoGroup = nullptr,
559
        tools::Long nLeft = 0,
560
        tools::Long nRight = 0,
561
        tools::Long nUpper = 0,
562
        tools::Long nLower = 0,
563
        bool bScaleAll = false,
564
        Orientation eOrientation = Orientation::Landscape,
565
        sal_uInt16 nPaperBin = 0,
566
        bool bBackgroundFullSize = false);
567
568
    // Adapt PageSize for all Pages of PageKind ePageKind.
569
    void AdaptPageSizeForAllPages(
570
        const Size& rNewSize,
571
        PageKind ePageKind,
572
        SdUndoGroup* pUndoGroup = nullptr,
573
        tools::Long nLeft = 0,
574
        tools::Long nRight = 0,
575
        tools::Long nUpper = 0,
576
        tools::Long nLower = 0,
577
        bool bScaleAll = false,
578
        Orientation eOrientation = Orientation::Landscape,
579
        sal_uInt16 nPaperBin = 0,
580
        bool bBackgroundFullSize = false);
581
582
    SAL_DLLPRIVATE SdDrawDocument*     AllocSdDrawDocument() const;
583
    SAL_DLLPRIVATE virtual SdrModel*   AllocModel() const override; //forwards to AllocSdDrawDocument
584
585
    SAL_DLLPRIVATE rtl::Reference<SdPage>          AllocSdPage(bool bMasterPage);
586
    SAL_DLLPRIVATE virtual rtl::Reference<SdrPage> AllocPage(bool bMasterPage) override; //forwards to AllocSdPage
587
588
    // Override SfxBaseModel::getUnoModel and return a more concrete type
589
    SdXImpressDocument* getUnoModel();
590
591
    SAL_DLLPRIVATE virtual bool        IsReadOnly() const override;
592
    SAL_DLLPRIVATE virtual void        SetChanged(bool bFlag = true) override;
593
594
452k
    SAL_DLLPRIVATE SfxItemPool&        GetPool() { return( *m_pItemPool ); }
595
596
    SAL_DLLPRIVATE SdOutliner* GetOutliner(bool bCreateOutliner=true);
597
    SdOutliner* GetInternalOutliner(bool bCreateOutliner=true);
598
599
480k
    SAL_DLLPRIVATE ::sd::DrawDocShell*     GetDocSh() const { return mpDocSh; }
600
601
    SAL_DLLPRIVATE LanguageType        GetLanguage( const sal_uInt16 nId ) const;
602
    SAL_DLLPRIVATE void                SetLanguage( const LanguageType eLang, const sal_uInt16 nId );
603
604
    SAL_DLLPRIVATE SvxNumType          GetPageNumType() const override;
605
49
    SAL_DLLPRIVATE void                SetPageNumType(SvxNumType eType) { mePageNumType = eType; }
606
    OUString CreatePageNumValue(sal_uInt16 nNum) const;
607
608
145k
    SAL_DLLPRIVATE DocumentType        GetDocumentType() const { return meDocType; }
609
610
    SAL_DLLPRIVATE void                SetAllocDocSh(bool bAlloc);
611
612
0
    SAL_DLLPRIVATE void                CreatingDataObj( SdTransferable* pTransferable ) { mpCreatingTransferable = pTransferable; }
613
309k
    SAL_DLLPRIVATE virtual bool        IsCreatingDataObj() const override { return mpCreatingTransferable != nullptr; }
614
615
    /** if the document does not contain at least one handout, one slide and one notes page with
616
        at least one master each this methods creates them.
617
        If a reference document is given, the sizes and border settings of that document are used
618
        for newly created slides.
619
    */
620
    void   CreateFirstPages( SdDrawDocument const * pRefDocument = nullptr );
621
    bool                CreateMissingNotesAndHandoutPages();
622
623
    SAL_DLLPRIVATE void                MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos) override;
624
    SAL_DLLPRIVATE void                InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF) override;
625
    SAL_DLLPRIVATE void                DeletePage(sal_uInt16 nPgNum) override;
626
    SAL_DLLPRIVATE rtl::Reference<SdrPage> RemovePage(sal_uInt16 nPgNum) override;
627
628
    SAL_DLLPRIVATE virtual void     InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF) override;
629
    SAL_DLLPRIVATE virtual rtl::Reference<SdrPage> RemoveMasterPage(sal_uInt16 nPgNum) override;
630
631
    SAL_DLLPRIVATE void                RemoveUnnecessaryMasterPages( SdPage* pMaster=nullptr, bool bOnlyDuplicatePages=false, bool bUndo=true );
632
    void   SetMasterPage(sal_uInt16 nSdPageNum, std::u16string_view rLayoutName,
633
                                      SdDrawDocument* pSourceDoc, bool bMaster, bool bCheckMasters);
634
635
    SdDrawDocument* OpenBookmarkDoc(const OUString& rBookmarkFile);
636
    SAL_DLLPRIVATE SdDrawDocument* OpenBookmarkDoc(SfxMedium* pMedium);
637
638
    SAL_DLLPRIVATE void InsertBookmark(const std::vector<OUString> &rBookmarkList,
639
                            std::vector<OUString> &rExchangeList, bool bLink,
640
                            sal_uInt16 nPgPos,
641
                            ::sd::DrawDocShell* pBookmarkDocSh,
642
                            Point const * pObjPos);
643
644
0
    SAL_DLLPRIVATE sal_uInt16 GetStartWithPresentation() const { return mnStartWithPresentation; }
645
    SAL_DLLPRIVATE void SetStartWithPresentation(sal_uInt16 nStartingSlide);
646
647
0
    SAL_DLLPRIVATE bool IsExitAfterPresenting() const { return mbExitAfterPresenting;}
648
    SAL_DLLPRIVATE void SetExitAfterPresenting( bool bExitAfterPresenting );
649
650
    /// load xml-based impress layout definitions into document
651
    SAL_DLLPRIVATE void InitLayoutVector();
652
    /// return reference to vector of Impress layout definitions
653
    SAL_DLLPRIVATE const std::vector<css::uno::Reference< css::xml::dom::XNode> >& GetLayoutVector() const
654
36.6k
    { return maLayoutInfo; }
655
656
   /// load xml-based impress master presentation object definitions into document
657
    SAL_DLLPRIVATE void InitObjectVector();
658
    /// return reference to vector of master presentation object definitions
659
294k
    SAL_DLLPRIVATE const std::vector<css::uno::Reference<css::xml::dom::XNode> >& GetObjectVector() const { return maPresObjectInfo; }
660
661
662
    /**
663
     * Paste pages from clipboard - handles regular paste operations
664
     *
665
     * This method is called when the user performs a paste operation from the clipboard.
666
     * It handles the insertion of pages that were previously copied or cut to the clipboard.
667
     *
668
     * @param rBookmarkList List of page names to be pasted
669
     * @param nInsertPos Position where pages should be inserted
670
     * @param pBookmarkDocSh Source document shell
671
     * @param bMergeMasterPages Whether to merge master pages from source
672
     * @param bMergeMasterPagesOnly Whether to only merge master pages (not content pages)
673
     * @return true if operation was successful
674
     */
675
    bool PasteBookmarkAsPage(
676
        const PageNameList &rBookmarkList,
677
        sal_uInt16 nInsertPos,
678
        ::sd::DrawDocShell* pBookmarkDocSh,
679
        bool bMergeMasterPages,
680
        bool bMergeMasterPagesOnly = false);
681
682
    /**
683
     * Insert pages from external files
684
     *
685
     * This method is called when inserting pages from external files, either through
686
     * the Insert > Page from File menu command or when handling file links.
687
     * It manages the transfer of pages from an external document to the current one.
688
     *
689
     * @param rBookmarkList List of page names to be inserted
690
     * @param pExchangeList Optional list of names to use for the inserted pages
691
     * @param bLink Whether to link to the source pages instead of copying
692
     * @param nInsertPos Position where pages should be inserted
693
     * @param pBookmarkDocSh Source document shell
694
     * @return true if operation was successful
695
     */
696
    bool InsertFileAsPage(
697
        const PageNameList &rBookmarkList,
698
        PageNameList *pExchangeList,
699
        bool bLink,
700
        sal_uInt16 nInsertPos,
701
        ::sd::DrawDocShell* pBookmarkDocSh,
702
        std::optional<bool> oScaleObjects = std::nullopt);
703
704
    /**
705
     * Handle drag and drop operations
706
     *
707
     * This method is called when pages are dragged and dropped, either within
708
     * the same document or from another document. It processes the dropped pages
709
     * and inserts them at the specified position.
710
     *
711
     * @param rBookmarkList List of page names to be dropped
712
     * @param nInsertPos Position where pages should be inserted
713
     * @param pBookmarkDocSh Source document shell
714
     * @param bMergeMasterPages Whether to merge master pages from source
715
     * @return true if operation was successful
716
     */
717
    bool DropBookmarkAsPage(
718
        const PageNameList &rBookmarkList,
719
        sal_uInt16 nInsertPos,
720
        ::sd::DrawDocShell* pBookmarkDocSh,
721
        bool bMergeMasterPages);
722
723
    /**
724
     * Resolve page links
725
     *
726
     * This method is called when linked pages need to be resolved, typically
727
     * when a document with linked pages is opened or when the user chooses
728
     * to update or break links to external pages.
729
     *
730
     * @param rBookmarkList List of page names to resolve links for
731
     * @param nInsertPos Position where resolved pages should be inserted
732
     * @param bNoDialogs Whether to suppress dialogs during operation
733
     * @param bCopy Whether to copy the linked pages
734
     * @return true if operation was successful
735
     */
736
    bool ResolvePageLinks(
737
        const PageNameList &rBookmarkList,
738
        sal_uInt16 nInsertPos,
739
        bool bNoDialogs,
740
        bool bCopy);
741
742
    /**
743
     * Copy or move pages within the same document
744
     *
745
     * This method is called for internal page operations such as duplicating pages
746
     * or moving pages within the same document. It handles the copying or moving
747
     * of pages while maintaining proper references and styles.
748
     *
749
     * @param rBookmarkList List of page names to be copied or moved
750
     * @param nInsertPos Position where pages should be inserted
751
     * @param bPreservePageNames Whether to preserve original page names
752
     * @return true if operation was successful
753
     */
754
    bool CopyOrMovePagesWithinDocument(
755
        const PageNameList &rBookmarkList,
756
        sal_uInt16 nInsertPos,
757
        bool bPreservePageNames);
758
759
    /**
760
     * Import a whole document
761
     *
762
     * This method is called when importing an entire document, such as when
763
     * using Insert > Document or when merging presentations. It handles the
764
     * transfer of all pages and associated resources from the source document.
765
     *
766
     * @param rBookmarkList List of page names to be imported (empty for all pages)
767
     * @param nInsertPos Position where imported pages should be inserted
768
     * @param pBookmarkDocSh Source document shell
769
     * @param bMergeMasterPagesOnly Whether to only merge master pages (not content pages)
770
     * @return true if operation was successful
771
     */
772
    bool ImportDocumentPages(
773
        const PageNameList &rBookmarkList,
774
        sal_uInt16 nInsertPos,
775
        ::sd::DrawDocShell* pBookmarkDocSh,
776
        bool bMergeMasterPagesOnly = false);
777
778
    SAL_DLLPRIVATE bool InsertBookmarkAsObject(const PageNameList &rBookmarkList,
779
                                    const PageNameList &rExchangeList,
780
                                    ::sd::DrawDocShell* pBookmarkDocSh,
781
                                    Point const * pObjPos, bool bCalcObjCount);
782
783
    void   CloseBookmarkDoc();
784
785
    SAL_DLLPRIVATE SdrObject*          GetObj(std::u16string_view rObjName) const;
786
787
    /** Return the first page that has the given name.  Regular pages and
788
        notes pages are searched first.  When not found then the master
789
        pages are searched.
790
        @param rPgName
791
            Name of the page to return.
792
        @param rbIsMasterPage
793
            Is set by the method to indicate whether the returned index
794
            belongs to a master page (<TRUE/>) or a regular or notes page
795
            (<FALSE/>). The given value is ignored.
796
        @return
797
            Returns the index of the page with the given name or
798
            SDRPAGE_NOTFOUND (=0xffff) when such a page does not exist.
799
    */
800
    SAL_DLLPRIVATE sal_uInt16 GetPageByName(std::u16string_view rPgName, bool& rbIsMasterPage ) const;
801
    /** checks, if the given name is a *unique* name for an *existing* slide
802
803
        @param rPageName the name of an existing slide
804
805
        @return true, if the name is unique and the slide exists
806
    */
807
    bool IsPageNameUnique( std::u16string_view rPageName ) const;
808
    SdPage*GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const;
809
    sal_uInt16 GetSdPageCount(PageKind ePgKind) const;
810
811
    SAL_DLLPRIVATE void                SetSelected(SdPage* pPage, bool bSelect);
812
    SAL_DLLPRIVATE void                UnselectAllPages();
813
    SAL_DLLPRIVATE bool                MoveSelectedPages(sal_uInt16 nTargetPage);
814
    SAL_DLLPRIVATE bool MovePages(sal_uInt16 nTargetPage, const std::vector<SdPage*>& rSelectedPages);
815
816
    SdPage*GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind);
817
    sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const;
818
819
    sal_uInt16 GetActiveSdPageCount() const;
820
821
    SAL_DLLPRIVATE sal_uInt16              GetMasterPageUserCount(SdrPage const * pMaster) const;
822
823
0
    SAL_DLLPRIVATE const sd::PresentationSettings& getPresentationSettings() const { return maPresentationSettings; }
824
9.59k
    SAL_DLLPRIVATE sd::PresentationSettings& getPresentationSettings() { return maPresentationSettings; }
825
826
    SAL_DLLPRIVATE const css::uno::Reference< css::presentation::XPresentation2 >& getPresentation() const;
827
828
22.6k
    SAL_DLLPRIVATE void                SetSummationOfParagraphs( bool bOn = true ) { mbSummationOfParagraphs = bOn; }
829
116
    SAL_DLLPRIVATE bool            IsSummationOfParagraphs() const { return mbSummationOfParagraphs; }
830
831
    /** Set the mode that controls whether (and later how) the formatting of the document
832
        depends on the current printer metrics.
833
        @param nMode
834
            Use <const
835
            scope="css::document::PrinterIndependentLayout">ENABLED</const>
836
            to make formatting printer-independent and <const
837
            scope="css::document::PrinterIndependentLayout">DISABLED</const>
838
            to make formatting depend on the current printer metrics.
839
    */
840
    SAL_DLLPRIVATE void SetPrinterIndependentLayout (sal_Int32 nMode);
841
842
    /** Get the flag that controls whether the formatting of the document
843
        depends on the current printer metrics.
844
        @return
845
            Use <const
846
            scope="css::document::PrinterIndependentLayout">ENABLED</const>
847
            when formatting is printer-independent and <const
848
            scope="css::document::PrinterIndependentLayout">DISABLED</const>
849
            when formatting depends on the current printer metrics.
850
    */
851
44.7k
    SAL_DLLPRIVATE sal_Int32 GetPrinterIndependentLayout() const { return mnPrinterIndependentLayout;}
852
853
    SAL_DLLPRIVATE void                SetOnlineSpell( bool bIn );
854
10.9k
    SAL_DLLPRIVATE bool                GetOnlineSpell() const { return mbOnlineSpell; }
855
    SAL_DLLPRIVATE void                StopOnlineSpelling();
856
    SAL_DLLPRIVATE void                StartOnlineSpelling(bool bForceSpelling=true);
857
858
    SAL_DLLPRIVATE void                ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, SdrObject* pObj, SdrOutliner const * pOutl);
859
860
    SAL_DLLPRIVATE void                InsertObject(SdrObject* pObj);
861
    SAL_DLLPRIVATE void                RemoveObject(SdrObject* pObj);
862
863
    SAL_DLLPRIVATE size_t           GetLinkCount() const;
864
865
8.20k
    SAL_DLLPRIVATE std::vector<std::unique_ptr<sd::FrameView>>& GetFrameViewList() { return maFrameViewList; }
866
    SdCustomShowList* GetCustomShowList(bool bCreate = false);
867
    sd::SlideSectionManager& GetSectionManager();
868
869
    SAL_DLLPRIVATE void                NbcSetChanged(bool bFlag);
870
871
    SAL_DLLPRIVATE void                SetTextDefaults() const;
872
873
    SAL_DLLPRIVATE void                CreateLayoutTemplates();
874
    void                               RenameLayoutTemplate(const OUString& rOldLayoutName, const OUString& rNewName);
875
876
    SAL_DLLPRIVATE void                CreateDefaultCellStyles();
877
878
    void   StopWorkStartupDelay();
879
880
    SAL_DLLPRIVATE void                NewOrLoadCompleted(DocCreationMode eMode);
881
    SAL_DLLPRIVATE void                NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool );
882
0
    SAL_DLLPRIVATE bool                IsNewOrLoadCompleted() const {return mbNewOrLoadCompleted; }
883
884
16.1k
    SAL_DLLPRIVATE ::sd::FrameView* GetFrameView(size_t nPos) {
885
16.1k
        return nPos < maFrameViewList.size() ? maFrameViewList[nPos].get() : nullptr; }
886
887
    /** deprecated*/
888
    SAL_DLLPRIVATE static SdAnimationInfo* GetAnimationInfo(SdrObject* pObject);
889
890
    static     SdAnimationInfo* GetShapeUserData(SdrObject& rObject, bool bCreate = false );
891
892
0
    SAL_DLLPRIVATE const std::optional<CharClass>& GetCharClass() const { return moCharClass; }
893
894
    SAL_DLLPRIVATE void                UpdateAllLinks();
895
896
    SAL_DLLPRIVATE void                CheckMasterPages();
897
898
    SAL_DLLPRIVATE void                Merge(SdrModel& rSourceModel,
899
                                sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
900
                                sal_uInt16 nDestPos,
901
                                bool bMergeMasterPages, bool bAllMasterPages,
902
                                bool bUndo = true, bool bTreadSourceAsConst = false) override;
903
904
    css::text::WritingMode GetDefaultWritingMode() const;
905
    SAL_DLLPRIVATE void SetDefaultWritingMode( css::text::WritingMode eMode );
906
907
    /** replacespOldPage from all custom shows with pNewPage or removes pOldPage from
908
        all custom shows if pNewPage is 0.
909
    */
910
    SAL_DLLPRIVATE void ReplacePageInCustomShows( const SdPage* pOldPage, const SdPage* pNewPage );
911
912
public:
913
914
    /// static to prevent recursions while resolving links
915
    SAL_DLLPRIVATE static SdDrawDocument* s_pDocLockedInsertingLinks;
916
917
    /** Create and insert a set of two new pages: a standard (draw) page and
918
        the associated notes page.  The new pages are inserted directly
919
        after the specified page set.
920
        @param pCurrentPage
921
            This page is used to retrieve the layout for the page to
922
            create.
923
        @param ePageKind
924
            This specifies whether <argument>pCurrentPage</argument> is a
925
            standard (draw) page or a notes page.
926
        @param sStandardPageName
927
            Name of the standard page.  An empty string leads to using an
928
            automatically created name.
929
        @param sNotesPageName
930
            Name of the standard page.  An empty string leads to using an
931
            automatically created name.
932
        @param eStandardLayout
933
            Layout to use for the new standard page.  Note that this layout
934
            is not used when the given <argument>pCurrentPage</argument> is
935
            not a standard page.  In this case the layout is taken from the
936
            standard page associated with <argument>pCurrentPage</argument>.
937
        @param eNotesLayout
938
            Layout to use for the new notes page.  Note that this layout
939
            is not used when the given <argument>pCurrentPage</argument> is
940
            not a notes page.  In this case the layout is taken from the
941
            notes page associated with <argument>pCurrentPage</argument>.
942
        @param bIsPageBack
943
            This flag indicates whether to show the background shape.
944
        @param bIsPageObj
945
            This flag indicates whether to show the shapes on the master page.
946
        @param nInsertPosition
947
            Position where to insert the standard page.  When -1 then the
948
            new page set is inserted after the current page.
949
950
        @return
951
            Returns an index of the inserted pages that can be used with the
952
            <member>GetSdPage()</member> method.
953
    */
954
    SAL_DLLPRIVATE sal_uInt16 CreatePage (
955
        SdPage* pCurrentPage,
956
        PageKind ePageKind,
957
        const OUString& sStandardPageName,
958
        const OUString& sNotesPageName,
959
        AutoLayout eStandardLayout,
960
        AutoLayout eNotesLayout,
961
        bool bIsPageBack,
962
        bool bIsPageObj,
963
        const sal_Int32 nInsertPosition);
964
965
    /** This method acts as a simplified front end for the more complex
966
        <member>DuplicatePage()</member> method.
967
        @param nPageNum
968
            The page number as passed to the <member>GetSdPage()</member>
969
            method for which the standard page and the notes page are to be
970
            copied.
971
        @return
972
            Returns an index of the inserted pages that can be used with the
973
            <member>GetSdPage()</member> method.
974
    */
975
    SAL_DLLPRIVATE sal_uInt16 DuplicatePage (sal_uInt16 nPageNum);
976
977
    /** Create and insert a set of two new pages that are copies of the
978
        given <argument>pCurrentPage</argument> and its associated notes
979
        resp. standard page.  The copies are inserted directly after the
980
        specified page set.
981
        @param pCurrentPage
982
            This page and its associated notes/standard page is copied.
983
        @param ePageKind
984
            This specifies whether <argument>pCurrentPage</argument> is a
985
            standard (draw) page or a notes page.
986
        @param sStandardPageName
987
            Name of the standard page.  An empty string leads to using an
988
            automatically created name.
989
        @param sNotesPageName
990
            Name of the standard page.  An empty string leads to using an
991
            automatically created name.
992
        @param bIsPageBack
993
            This flag indicates whether to show the background shape.
994
        @param bIsPageObj
995
            This flag indicates whether to show the shapes on the master page.
996
        @param nInsertPosition
997
            Position where to insert the standard page.  When -1 then the
998
            new page set is inserted after the current page.
999
1000
        @return
1001
            Returns an index of the inserted pages that can be used with the
1002
            <member>GetSdPage()</member> method.
1003
    */
1004
    SAL_DLLPRIVATE sal_uInt16 DuplicatePage (
1005
        SdPage* pCurrentPage,
1006
        PageKind ePageKind,
1007
        const OUString& sStandardPageName,
1008
        const OUString& sNotesPageName,
1009
        bool bIsPageBack,
1010
        bool bIsPageObj,
1011
        const sal_Int32 nInsertPosition);
1012
1013
164k
    SAL_DLLPRIVATE bool HasCanvasPage() const { return mpCanvasPage.is(); }
1014
1015
    SAL_DLLPRIVATE void ImportCanvasPage();
1016
    SAL_DLLPRIVATE bool ValidateCanvasPage(const SdPage* pPage) const;
1017
1018
    SAL_DLLPRIVATE sal_uInt16 GetOrInsertCanvasPage ();
1019
1020
    /** return the document fonts for latin, cjk and ctl according to the current
1021
        languages set at this document */
1022
    SAL_DLLPRIVATE void getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont );
1023
1024
    sd::UndoManager* GetUndoManager() const;
1025
1026
    /** converts the given western font height to a corresponding ctl font height, depending on the system language */
1027
    SAL_DLLPRIVATE static sal_uInt32 convertFontHeightToCTL( sal_uInt32 nWesternFontHeight );
1028
1029
    /** Get the style sheet pool if it was a SdStyleSheetPool.
1030
     */
1031
    SdStyleSheetPool* GetSdStyleSheetPool() const;
1032
1033
    SAL_DLLPRIVATE void UpdatePageRelativeURLs(
1034
        std::u16string_view aOldName, std::u16string_view aNewName);
1035
1036
    SAL_DLLPRIVATE static void SetCalcFieldValueHdl( ::Outliner* pOutliner);
1037
1038
    /** Extract the base layout name from a layout name by removing the separator and anything after it
1039
     * @param rLayoutName The full layout name that may include a separator and suffix
1040
     * @return The base layout name without separator and suffix
1041
     */
1042
    static OUString GetBaseLayoutName(std::u16string_view rLayoutName);
1043
1044
    /** Generate a new layout name based on the original name by appending a number to it
1045
     * @param aOriginalName The original layout name
1046
     * @return A new layout name that is unique and based on the original name
1047
     */
1048
    static OUString GenerateNewLayoutName(std::u16string_view rOriginalName);
1049
1050
    SAL_DLLPRIVATE sal_uInt16 GetAnnotationAuthorIndex( const OUString& rAuthor );
1051
1052
253
    SAL_DLLPRIVATE bool IsEmbedFonts() const { return mbEmbedFonts; }
1053
232
    SAL_DLLPRIVATE bool IsEmbedUsedFontsOnly() const { return mbEmbedUsedFontsOnly; }
1054
232
    SAL_DLLPRIVATE bool IsEmbedFontScriptLatin() const { return mbEmbedFontScriptLatin; }
1055
232
    SAL_DLLPRIVATE bool IsEmbedFontScriptAsian() const { return mbEmbedFontScriptAsian; }
1056
232
    SAL_DLLPRIVATE bool IsEmbedFontScriptComplex() const { return mbEmbedFontScriptComplex; }
1057
1058
21
    SAL_DLLPRIVATE void SetEmbedFonts(bool bUse) { mbEmbedFonts = bUse; }
1059
0
    SAL_DLLPRIVATE void SetEmbedUsedFontsOnly(bool bUse) { mbEmbedUsedFontsOnly = bUse; }
1060
0
    SAL_DLLPRIVATE void SetEmbedFontScriptLatin(bool bUse) { mbEmbedFontScriptLatin = bUse; }
1061
0
    SAL_DLLPRIVATE void SetEmbedFontScriptAsian(bool bUse) { mbEmbedFontScriptAsian = bUse; }
1062
0
    SAL_DLLPRIVATE void SetEmbedFontScriptComplex(bool bUse) { mbEmbedFontScriptComplex = bUse; }
1063
1064
116
    sal_Int32 getImagePreferredDPI() const override { return mnImagePreferredDPI; }
1065
0
    void setImagePreferredDPI(sal_Int32 nValue) { mnImagePreferredDPI = nValue; }
1066
1067
    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
1068
1069
    /** Create a new master page based on an existing master page.
1070
     *  This function is useful for copy/paste operations of master pages.
1071
     *
1072
     *  @param pSourceMasterPage The master page to copy from.
1073
     *  @param pBookmarkDoc The document containing the source master page. If null, assumes this document.
1074
     *  @param bUndo Whether to support undo for this operation.
1075
     *  @param sNewName Optional new name for the master page. If empty, a new name will be generated.
1076
     *  @return The newly created master page.
1077
     */
1078
    SdPage* AddNewMasterPageFromExisting(
1079
        const SdPage* pSourceMasterPage,
1080
        SdDrawDocument* pBookmarkDoc = nullptr,
1081
        bool bUndo = true,
1082
        const OUString& sNewName = OUString());
1083
1084
0
    void StoreCanvasPage(SdPage* pPage) { mpCanvasPage = pPage; }
1085
1086
    /** Re-order the pages based on the position of their previews on canvas page.
1087
     */
1088
    void ReshufflePages();
1089
1090
private:
1091
1092
    void UpdatePageRelativeURLsImpl(const std::function<void(const SvxFieldItem & rFieldItem, editeng::SvxFieldItemUpdater& rFieldItemUpdater)>& rItemCallback);
1093
1094
    /** This member stores the printer independent layout mode.  Please
1095
        refer to <member>SetPrinterIndependentLayout()</member> for its
1096
        values.
1097
    */
1098
    sal_Int32 mnPrinterIndependentLayout;
1099
1100
    /** Insert a given set of standard and notes page after the given <argument>pCurrentPage</argument>.
1101
        @param pCurrentPage
1102
            This page and its associated notes/standard page is copied.
1103
        @param ePageKind
1104
            This specifies whether <argument>pCurrentPage</argument> is a
1105
            standard (draw) page or a notes page.
1106
        @param sStandardPageName
1107
            Name of the standard page.  An empty string leads to using an
1108
            automatically created name.
1109
        @param sNotesPageName
1110
            Name of the standard page.  An empty string leads to using an
1111
            automatically created name.
1112
        @param bIsPageBack
1113
            This flag indicates whether to show the background shape.
1114
        @param bIsPageObj
1115
            This flag indicates whether to show the shapes on the master page.
1116
        @param pStandardPage
1117
            The standard page to insert.
1118
        @param pNotesPage
1119
            The notes page to insert.
1120
        @param nInsertPosition
1121
            Position where to insert the standard page.  When -1 then the
1122
            new page set is inserted after the current page.
1123
1124
        @return
1125
            Returns an index of the inserted pages that can be used with the
1126
            <member>GetSdPage()</member> method.
1127
    */
1128
    SAL_DLLPRIVATE sal_uInt16 InsertPageSet (
1129
        SdPage* pCurrentPage,
1130
        PageKind ePageKind,
1131
        const OUString& sStandardPageName,
1132
        const OUString& sNotesPageName,
1133
        bool bIsPageBack,
1134
        bool bIsPageObj,
1135
        SdPage* pStandardPage,
1136
        SdPage* pNotesPage,
1137
        sal_Int32 nInsertPosition);
1138
1139
    /** Set up a newly created page and insert it into the list of pages.
1140
        @param pPreviousPage
1141
            A page to take the size and border geometry from.
1142
        @param pPage
1143
            This is the page to set up and insert.
1144
        @param sPageName
1145
            The name of the new page.
1146
        @param nInsertionPoint
1147
            Index of the page before which the new page will be inserted.
1148
        @param bIsPageBack
1149
            This flag indicates whether to show the background shape.
1150
        @param bIsPageObj
1151
            This flag indicates whether to show the shapes on the master
1152
            page.
1153
    */
1154
    SAL_DLLPRIVATE void SetupNewPage (
1155
        SdPage const * pPreviousPage,
1156
        SdPage* pPage,
1157
        const OUString& sPageName,
1158
        sal_uInt16 nInsertionPoint,
1159
        bool bIsPageBack,
1160
        bool bIsPageObj);
1161
1162
    SAL_DLLPRIVATE void populatePagePreviewsGrid();
1163
    SAL_DLLPRIVATE void updatePagePreviewsGrid(const SdPage* pPage);
1164
    SAL_DLLPRIVATE void connectPagePreviews();
1165
1166
    SAL_DLLPRIVATE virtual void PageListChanged() override;
1167
    SAL_DLLPRIVATE virtual void MasterPageListChanged() override;
1168
};
1169
1170
namespace sd
1171
{
1172
1173
/**an instance of this guard disables modification of a document
1174
 during its lifetime*/
1175
class ModifyGuard
1176
{
1177
public:
1178
    ModifyGuard( SdDrawDocument* pDoc );
1179
    ~ModifyGuard();
1180
1181
private:
1182
    void init();
1183
1184
    DrawDocShell* mpDocShell;
1185
    SdDrawDocument* mpDoc;
1186
    bool mbIsEnableSetModified;
1187
    bool mbIsDocumentChanged;
1188
};
1189
1190
}
1191
1192
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */