20#include <libxml/xmlwriter.h>
23#include <com/sun/star/document/PrinterIndependentLayout.hpp>
24#include <com/sun/star/i18n/ScriptType.hpp>
25#include <com/sun/star/beans/XPropertyContainer.hpp>
26#include <com/sun/star/beans/PropertyAttribute.hpp>
27#include <com/sun/star/document/XDocumentProperties.hpp>
28#include <com/sun/star/frame/XModel.hpp>
38#include <officecfg/Office/Impress.hxx>
47#include <com/sun/star/lang/XMultiServiceFactory.hpp>
48#include <com/sun/star/beans/XPropertySet.hpp>
56#include <com/sun/star/uno/Reference.hxx>
57#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
58#include <com/sun/star/xml/dom/XDocument.hpp>
59#include <com/sun/star/xml/dom/XNodeList.hpp>
60#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
61#include <com/sun/star/uno/XComponentContext.hpp>
62#include <rtl/ustring.hxx>
94using ::com::sun::star::uno::Reference;
99PresentationSettings::PresentationSettings()
104 mbMouseVisible( false ),
105 mbMouseAsPen( false ),
106 mbLockedPages( false ),
107 mbAlwaysOnTop( false ),
108 mbUseNavigation( false ),
109 mbFullScreen( true ),
110 mbAnimationAllowed( true ),
112 mbShowPauseLogo( false ),
113 mbStartCustomShow( false )
121, mpDocSh(static_cast< ::
sd::DrawDocShell*>(pDrDocSh))
122, mpCreatingTransferable( nullptr )
123, mbHasOnlineSpellErrors(false)
124, mbInitialOnlineSpellingEnabled(true)
125, mbNewOrLoadCompleted(false)
126, mbOnlineSpell(false)
127, mbStartWithPresentation( false )
128, mbExitAfterPresenting( false )
136, mbEmbedUsedFontsOnly(false)
137, mbEmbedFontScriptLatin(true)
138, mbEmbedFontScriptAsian(true)
139, mbEmbedFontScriptComplex(true)
140, mnImagePreferredDPI(0)
170 m_pItemPool->SetDefaultMetric(MapUnit::Map100thMM);
214 sal_uInt16 nDefTab = pOptions->
GetDefTab();
220 if ( xSpellChecker.is() )
221 rOutliner.SetSpeller( xSpellChecker );
224 if( xHyphenator.is() )
225 rOutliner.SetHyphenator( xHyphenator );
231 OSL_FAIL(
"Can't get SpellChecker");
242 nCntrl |= EEControlBits::ALLOWBIGOBJS;
245 nCntrl |= EEControlBits::ONLINESPELLING;
256 nCntrl |= EEControlBits::ULSPACESUMMATION;
258 rOutliner.SetControlWord(nCntrl);
273 if ( xSpellChecker.is() )
277 if( xHyphenator.is() )
282 OSL_FAIL(
"Can't get SpellChecker");
288 nCntrl2 |= EEControlBits::ALLOWBIGOBJS;
293 nCntrl2 |= EEControlBits::ULSPACESUMMATION;
336 Broadcast(
SdrHint(SdrHintKind::ModelCleared));
374 const Size& rNewSize,
383 if(0 == nMasterPageCnt && 0 == nPageCnt)
413 const Size& rNewSize,
422 sal_uInt16 nPaperBin,
423 bool bBackgroundFullSize)
429 if(0 == nMasterPageCnt && 0 == nPageCnt)
434 for (
i = 0;
i < nMasterPageCnt;
i++)
457 bBackgroundFullSize));
461 if (rNewSize.
Width() > 0 || nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
464 pPage->
ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
466 if (rNewSize.
Width() > 0)
472 if( nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
474 pPage->
SetBorder(nLeft, nUpper, nRight, nLower);
489 for (
i = 0;
i < nPageCnt;
i++)
512 bBackgroundFullSize));
516 if (rNewSize.
Width() > 0 || nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
519 pPage->
ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
521 if (rNewSize.
Width() > 0)
527 if( nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
529 pPage->
SetBorder(nLeft, nUpper, nRight, nLower);
557 if (!pSource || !pDestination)
560 uno::Reference<document::XDocumentProperties> xSource = pSource->
getDocProperties();
561 uno::Reference<document::XDocumentProperties> xDestination = pDestination->
getDocProperties();
562 uno::Reference<beans::XPropertyContainer> xSourcePropertyContainer = xSource->getUserDefinedProperties();
563 uno::Reference<beans::XPropertyContainer> xDestinationPropertyContainer = xDestination->getUserDefinedProperties();
564 uno::Reference<beans::XPropertySet> xSourcePropertySet(xSourcePropertyContainer, uno::UNO_QUERY);
565 const uno::Sequence<beans::Property>
aProperties = xSourcePropertySet->getPropertySetInfo()->getProperties();
567 for (
const beans::Property& rProperty : aProperties)
569 const OUString& rKey = rProperty.Name;
570 uno::Any aValue = xSourcePropertySet->getPropertyValue(rKey);
572 xDestinationPropertyContainer->addProperty(rKey, beans::PropertyAttribute::REMOVABLE, aValue);
594 SfxObjectCreateMode::EMBEDDED,
true,
meDocType ) );
597 SfxObjectCreateMode::EMBEDDED ) );
602 pNewModel = pNewDocSh->
GetDoc();
617 aOldLayoutName = aOldLayoutName.copy( 0, aOldLayoutName.indexOf(
SD_LT_SEPARATOR ) );
619 pNewStylePool->
CopyLayoutSheets(aOldLayoutName, *pOldStylePool, aCreatedSheets );
622 lcl_copyUserDefinedProperties(
GetDocSh(), pNewDocSh);
632 SfxObjectCreateMode::EMBEDDED,
true,
meDocType);
646 return new SdPage(*
this, bMasterPage);
757 nCntrl |= EEControlBits::ONLINESPELLING;
780 sal_uInt16 nPage, nPageCount;
785 for (nPage = 0; nPage < nPageCount; nPage++)
838 if(rPresentationShapes.
isEmpty())
845 std::vector<SfxStyleSheetBase*> aOutlineList;
862 if (
nId == SdrObjKind::TitleText)
871 else if (
nId == SdrObjKind::OutlineText)
876 std::vector<SfxStyleSheetBase*>::iterator iter;
877 for (iter = aOutlineList.begin(); iter != aOutlineList.end(); ++iter)
883 pObj->StartListening(*pSheet);
885 if( iter == aOutlineList.begin())
893 if (pTextObj->IsEmptyPresObj())
898 if (!aString.isEmpty())
901 pPage->
SetObjText( pTextObj, pInternalOutl, ePresObjKind, aString );
903 pInternalOutl->Clear();
972 nCntrl |= EEControlBits::ONLINESPELLING;
984 nCntrl |= EEControlBits::ONLINESPELLING;
996 nCntrl |= EEControlBits::ONLINESPELLING;
1015 uno::Reference< uno::XInterface >
xModel;
1022 catch( uno::RuntimeException& )
1038 case css::document::PrinterIndependentLayout::DISABLED:
1039 case css::document::PrinterIndependentLayout::ENABLED:
1109 const Reference<css::uno::XComponentContext> xContext(
1110 ::comphelper::getProcessComponentContext() );
1113 const Sequence< OUString > aFiles(
1114 officecfg::Office::Impress::Misc::LayoutListFiles::get() );
1116 if (aFiles.getLength() == 0)
1118 const Reference<XDocumentBuilder> xDocBuilder = DocumentBuilder::create( xContext );
1120 for(
const auto& rFile : aFiles )
1129 const Reference<XDocument> xDoc = xDocBuilder->parseURI( sFilename );
1130 const Reference<XNodeList> layoutlist = xDoc->getElementsByTagName(
"layout");
1131 const int nElements = layoutlist->getLength();
1135 catch (
const uno::Exception &)
1147 const Reference<css::uno::XComponentContext> xContext(
1148 ::comphelper::getProcessComponentContext() );
1151 const Sequence< OUString > aFiles(
1152 officecfg::Office::Impress::Misc::PresObjListFiles::get() );
1154 if (aFiles.getLength() == 0)
1156 const Reference<XDocumentBuilder> xDocBuilder = DocumentBuilder::create( xContext );
1157 for(
const auto& rFile : aFiles )
1166 const Reference<XDocument> xDoc = xDocBuilder->parseURI( sFilename );
1167 const Reference<XNodeList> objectlist = xDoc->getElementsByTagName(
"object");
1168 const int nElements = objectlist->getLength();
1172 catch (
const uno::Exception &)
1184 pWriter = xmlNewTextWriterFilename(
"model.xml", 0);
1185 xmlTextWriterSetIndent(pWriter,1);
1186 (void)xmlTextWriterSetIndentString(pWriter, BAD_CAST(
" "));
1187 (void)xmlTextWriterStartDocument(pWriter,
nullptr,
nullptr,
nullptr);
1190 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SdDrawDocument"));
1191 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
1199 (void)xmlTextWriterEndElement(pWriter);
1202 (void)xmlTextWriterEndDocument(pWriter);
1203 xmlFreeTextWriter(pWriter);
PropertiesInfo aProperties
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
LanguageType getLanguageType(bool bResolveSystem=true) const
static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker()
static css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator()
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
static bool isKorean(LanguageType nLang)
static LanguageType getRealLanguage(LanguageType nLang)
void SetOutlinerMode(OutlinerMode nNew)
OutlinerMode GetOutlinerMode() const
EEControlBits GetControlWord() const
void SetControlWord(EEControlBits nWord)
void SetStyleSheetPool(SfxStyleSheetPool *pSPool)
void SetCalcFieldValueHdl(const Link< EditFieldInfo *, void > &rLink)
std::unique_ptr< SdOutliner > mpInternalOutliner
internal outliner for creation of text objects
static SAL_DLLPRIVATE void SetCalcFieldValueHdl(::Outliner *pOutliner)
void AdaptPageSizeForAllPages(const Size &rNewSize, PageKind ePageKind, SdUndoGroup *pUndoGroup=nullptr, tools::Long nLeft=0, tools::Long nRight=0, tools::Long nUpper=0, tools::Long nLower=0, bool bScaleAll=false, Orientation eOrientation=Orientation::Landscape, sal_uInt16 nPaperBin=0, bool bBackgroundFullSize=false)
sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const
bool mbExitAfterPresenting
true if mbStartWithPresentation AND Presentation was shown fully
SdTransferable * mpCreatingTransferable
std::unique_ptr< SdCustomShowList > mpCustomShowList
SAL_DLLPRIVATE void SetPrinterIndependentLayout(sal_Int32 nMode)
Set the mode that controls whether (and later how) the formatting of the document depends on the curr...
SAL_DLLPRIVATE sal_uInt16 GetAnnotationAuthorIndex(const OUString &rAuthor)
sal_Int32 mnPrinterIndependentLayout
This member stores the printer independent layout mode.
virtual void adaptSizeAndBorderForAllPages(const Size &rNewSize, tools::Long nLeft=0, tools::Long nRight=0, tools::Long nUpper=0, tools::Long nLower=0) override
SAL_DLLPRIVATE void StopOnlineSpelling()
SAL_DLLPRIVATE void CreateLayoutTemplates()
virtual SAL_DLLPRIVATE rtl::Reference< SdrPage > AllocPage(bool bMasterPage) override
std::unique_ptr< SvxSearchItem > mpOnlineSearchItem
SAL_DLLPRIVATE void SetOnlineSpell(bool bIn)
sd::UndoManager * GetUndoManager() const
SAL_DLLPRIVATE SfxItemPool & GetPool()
SAL_DLLPRIVATE void InitObjectVector()
load xml-based impress master presentation object definitions into document
SAL_DLLPRIVATE void SetSummationOfParagraphs(bool bOn=true)
std::vector< css::uno::Reference< css::xml::dom::XNode > > maLayoutInfo
bool mbNewOrLoadCompleted
SAL_DLLPRIVATE void SetAllocDocSh(bool bAlloc)
SAL_DLLPRIVATE SdDrawDocument(DocumentType eType, SfxObjectShell *pDocSh)
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SdOutliner * GetInternalOutliner(bool bCreateOutliner=true)
std::unique_ptr< Timer > mpWorkStartupTimer
::sd::DrawDocShell * mpDocSh
SAL_DLLPRIVATE SdOutliner * GetOutliner(bool bCreateOutliner=true)
SAL_DLLPRIVATE void SetLanguage(const LanguageType eLang, const sal_uInt16 nId)
SAL_DLLPRIVATE void NbcSetChanged(bool bFlag)
SAL_DLLPRIVATE void CreateDefaultCellStyles()
SAL_DLLPRIVATE void StartOnlineSpelling(bool bForceSpelling=true)
SAL_DLLPRIVATE void SetTextDefaults() const
SAL_DLLPRIVATE void SetExitAfterPresenting(bool bExitAfterPresenting)
::std::unique_ptr< ImpMasterPageListWatcher > mpMasterPageListWatcher
bool mbStartWithPresentation
is set to true when starting with command line parameter -start
SAL_DLLPRIVATE void CheckMasterPages()
this method enforces that the masterpages are in the correct order, that is at position 1 is a PageKi...
std::vector< std::unique_ptr< sd::FrameView > > maFrameViewList
std::vector< css::uno::Reference< css::xml::dom::XNode > > maPresObjectInfo
virtual SAL_DLLPRIVATE css::uno::Reference< css::uno::XInterface > createUnoModel() override
virtual SAL_DLLPRIVATE void PageListChanged() override
SAL_DLLPRIVATE void UpdateAllLinks()
updates all links, only links in this document should by resolved
static SAL_DLLPRIVATE SdDrawDocument * s_pDocLockedInsertingLinks
static to prevent recursions while resolving links
::std::unique_ptr< ImpDrawPageListWatcher > mpDrawPageListWatcher
::sd::DrawDocShellRef mxAllocedDocShRef
SdPage * GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
SAL_DLLPRIVATE void NewOrLoadCompleted(DocCreationMode eMode)
std::optional< CharClass > moCharClass
SAL_DLLPRIVATE void RemoveUnnecessaryMasterPages(SdPage *pMaster=nullptr, bool bOnlyDuplicatePages=false, bool bUndo=true)
SAL_DLLPRIVATE void InitLayoutVector()
load xml-based impress layout definitions into document
virtual SAL_DLLPRIVATE void MasterPageListChanged() override
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
void dumpAsXml(xmlTextWriterPtr pWriter) const override
std::vector< OUString > maAnnotationAuthors
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
virtual SAL_DLLPRIVATE ~SdDrawDocument() override
SAL_DLLPRIVATE void SetStartWithPresentation(bool bStartWithPresentation)
SAL_DLLPRIVATE SdDrawDocument * AllocSdDrawDocument() const
SAL_DLLPRIVATE SvxNumType GetPageNumType() const override
virtual SAL_DLLPRIVATE SdrModel * AllocModel() const override
std::unique_ptr< SdOutliner > mpOutliner
local outliner for outline mode
SAL_DLLPRIVATE rtl::Reference< SdPage > AllocSdPage(bool bMasterPage)
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
sal_uInt16 GetDefTab() const
sal_uInt16 GetMetric() const
bool IsSummationOfParagraphs() const
sal_uInt16 GetPrinterIndependentLayout() const
Return the currently selected printer independent layout mode.
void GetScale(sal_Int32 &rX, sal_Int32 &rY) const
The main purpose of this class is searching and replacing as well as spelling of impress documents.
virtual void SetOrientation(Orientation eOrient) override
virtual Orientation GetOrientation() const override
void SetObjText(SdrTextObj *pObj, SdrOutliner *pOutliner, PresObjKind eObjKind, std::u16string_view rStr)
void CreateTitleAndLayout(bool bInit=false, bool bCreate=false)
virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr) override
OUString GetPresObjText(PresObjKind eObjKind) const
SfxStyleSheet * GetStyleSheetForPresObj(PresObjKind eObjKind) const
sd::ShapeList & GetPresentationShapeList()
PresObjKind GetPresObjKind(SdrObject *pObj) const
void SetPaperBin(sal_uInt16 nBin)
void SetLayoutName(const OUString &aName)
void SetAutoLayout(AutoLayout eLayout, bool bInit=false, bool bCreate=false)
void ScaleObjects(const Size &rNewPageSize, const ::tools::Rectangle &rNewBorderRect, bool bScaleAllObj)
virtual OUString GetLayoutName() const override
const OUString & GetName() const
sal_uInt16 GetPaperBin() const
void SetName(const OUString &rName)
Set the name of the page and broadcast a model change.
AutoLayout GetAutoLayout() const
virtual void SetSize(const Size &aSize) override
SfxStyleSheetBase * GetTitleSheet(std::u16string_view rLayoutName)
void CopyCellSheets(SdStyleSheetPool &rSourcePool)
void CreateOutlineSheetList(std::u16string_view rLayoutName, std::vector< SfxStyleSheetBase * > &rOutlineStyles)
void CopyLayoutSheets(std::u16string_view rLayoutName, SdStyleSheetPool &rSourcePool, StyleSheetCopyResultVector &rCreatedSheets)
void CopyGraphicSheets(SdStyleSheetPool &rSourcePool)
void CopyTableStyles(SdStyleSheetPool const &rSourcePool)
SD_DLLPUBLIC void CreateLayoutStyleSheets(std::u16string_view rLayoutName, bool bCheck=false)
creates all layout style sheets for the given layout name if they don't exist yet.
const SfxObjectShellRef & GetDocShell() const
void SetDocShell(const SfxObjectShellRef &rRef)
void AddAction(SdUndoAction *pAction)
void SetControlLayerName(const OUString &rNewName)
SdrLayer * NewLayer(const OUString &rName, sal_uInt16 nPos=0xFFFF)
sfx2::LinkManager * m_pLinkManager
sal_uInt16 m_nDefaultTabulator
void SetLinkManager(sfx2::LinkManager *pLinkMgr)
virtual void SetChanged(bool bFlg=true)
const SdrPage * GetMasterPage(sal_uInt16 nPgNum) const
void SetForbiddenCharsTable(const std::shared_ptr< SvxForbiddenCharactersTable > &xForbiddenChars)
void SetDefaultStyleSheet(SfxStyleSheet *pDefSS)
void SetUIUnit(FieldUnit eUnit)
void SetDefaultTabulator(sal_uInt16 nVal)
void ClearModel(bool bCalledFromDestructor)
SdrOutliner & GetDrawOutliner(const SdrTextObj *pObj=nullptr) const
sal_uInt16 GetMasterPageCount() const
void SetScaleUnit(MapUnit eMap)
void SetStyleSheetPool(SfxStyleSheetBasePool *pPool)
rtl::Reference< SfxItemPool > m_pItemPool
SfxStyleSheetBasePool * GetStyleSheetPool() const
void SetDefaultFontHeight(sal_Int32 nVal)
void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet *pDefSS)
const SdrPage * GetPage(sal_uInt16 nPgNum) const
rtl::Reference< SfxStyleSheetBasePool > mxStyleSheetPool
const SdrLayerAdmin & GetLayerAdmin() const
sal_uInt16 GetPageCount() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
std::unique_ptr< SdrOutliner > m_pHitTestOutliner
void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
virtual SdrInventor GetObjInventor() const
virtual OutlinerParaObject * GetOutlinerParaObject() const
void NbcSetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
virtual SdrObjKind GetObjIdentifier() const
SdrPage & TRG_GetMasterPage() const
void SetBackgroundFullSize(bool bIn)
sal_Int32 GetUpperBorder() const
sal_Int32 GetRightBorder() const
sal_Int32 GetLeftBorder() const
bool TRG_HasMasterPage() const
bool IsBackgroundFullSize() const
sal_Int32 GetLowerBorder() const
SfxItemPool * GetSecondaryPool() const
void SetPoolDefaultItem(const SfxPoolItem &)
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
bool IsEnableSetModified() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual comphelper::EmbeddedObjectContainer & getEmbeddedObjectContainer() const override
constexpr tools::Long Width() const
void GetOptions(SvtLinguOptions &rOptions) const
OUString GetFullName() const
static std::shared_ptr< SvxForbiddenCharactersTable > makeForbiddenCharactersTable(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
void setUserAllowsLinkUpdate(bool bNew)
virtual void SetModified(bool=true) override
SdDrawDocument * GetDoc()
bool isEmpty() const
returns true if this list is empty
SdrObject * getNextShape()
returns the shape the internal iterator points to, or 0 if the list end is reached.
void seekShape(sal_uInt32 nIndex)
Sets the internal iterator to the shape at given index.
void UpdateAllLinks(bool bAskUpdate, bool bUpdateGrfLinks, weld::Window *pParentWin)
void Remove(SvBaseLink const *pLink)
const SvBaseLinks & GetLinks() const
#define DBG_ASSERT(sCon, aError)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvxScriptSpaceItem > EE_PARA_ASIANCJKSPACING(EE_PARA_START+4)
struct _xmlTextWriter * xmlTextWriterPtr
constexpr OUStringLiteral SD_LT_SEPARATOR
#define LANGUAGE_JAPANESE
#define LINK(Instance, Class, Member)
COMPHELPER_DLLPUBLIC OUString getExpandedUri(css::uno::Reference< css::uno::XComponentContext > const &context, OUString const &uri)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OUString SdResId(TranslateId aId)
std::vector< StyleSheetCopyResult > StyleSheetCopyResultVector
LanguageType nDefaultLanguage
LanguageType nDefaultLanguage_CTL
LanguageType nDefaultLanguage_CJK
Reference< XModel > xModel
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
constexpr OUStringLiteral sUNO_LayerName_measurelines
constexpr OUStringLiteral sUNO_LayerName_background_objects
constexpr OUStringLiteral sUNO_LayerName_layout
constexpr OUStringLiteral sUNO_LayerName_controls
constexpr OUStringLiteral sUNO_LayerName_background