diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sw/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/inc')
295 files changed, 55562 insertions, 0 deletions
diff --git a/sw/inc/AccessibilityCheckStrings.hrc b/sw/inc/AccessibilityCheckStrings.hrc new file mode 100644 index 000000000..e51f26c79 --- /dev/null +++ b/sw/inc/AccessibilityCheckStrings.hrc @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + * + */ + +#ifndef INCLUDED_SW_INC_ACCESSIBILITY_CHECK_STRINGS_HRC +#define INCLUDED_SW_INC_ACCESSIBILITY_CHECK_STRINGS_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +#define STR_NO_ALT NC_("STR_NO_ALT", "No alt text for graphic '%OBJECT_NAME%'") +#define STR_TABLE_MERGE_SPLIT NC_("STR_TABLE_MERGE_SPLIT", "Table '%OBJECT_NAME%' contains merges or splits") +#define STR_FAKE_NUMBERING NC_("STR_FAKE_NUMBERING", "Fake numbering '%NUMBERING%'") +#define STR_HYPERLINK_TEXT_IS_LINK NC_("STR_HYPERLINK_TEXT_IS_LINK", "Hyperlink text is the same as the link address '%LINK%'") +#define STR_TEXT_CONTRAST NC_("STR_TEXT_CONTRAST", "Text contrast is too low.") +#define STR_TEXT_BLINKING NC_("STR_TEXT_BLINKING", "Blinking text.") +#define STR_AVOID_FOOTNOTES NC_("STR_AVOID_FOOTNOTES", "Avoid footnotes.") +#define STR_AVOID_ENDNOTES NC_("STR_AVOID_ENDNOTES", "Avoid endnotes.") +#define STR_HEADINGS_NOT_IN_ORDER NC_("STR_HEADINGS_NOT_IN_ORDER", "Headings not in order.") +#define STR_TEXT_FORMATTING_CONVEYS_MEANING NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys additional meaning.") + +#define STR_DOCUMENT_DEFAULT_LANGUAGE NC_("STR_DOCUMENT_DEFAULT_LANGUAGE", "Document default language is not set") +#define STR_STYLE_NO_LANGUAGE NC_("STR_STYLE_NO_LANGUAGE", "Style '%STYLE_NAME%' has no language set") +#define STR_DOCUMENT_TITLE NC_("STR_DOCUMENT_TITLE", "Document title is not set") + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx new file mode 100644 index 000000000..e8e16158e --- /dev/null +++ b/sw/inc/AnnotationWin.hxx @@ -0,0 +1,278 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_ANNOTATIONWIN_HXX +#define INCLUDED_SW_INC_ANNOTATIONWIN_HXX + +#include <basegfx/range/b2drange.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <vcl/builder.hxx> +#include <vcl/window.hxx> + +#include "postithelper.hxx" +#include "swrect.hxx" +#include "SidebarWindowsTypes.hxx" + +class PopupMenu; +class OutlinerParaObject; +class SwPostItMgr; +class SwPostItField; +class OutlinerView; +class Outliner; +class ScrollBar; +class SwEditWin; +class SwView; +class Edit; +class MenuButton; +class SwFrame; +class SvxLanguageItem; +namespace sw::overlay { class OverlayRanges; } +namespace sw::sidebarwindows { + class SidebarTextControl; + class AnchorOverlayObject; + class ShadowOverlayObject; +} + + +namespace sw::annotation { + +class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window +{ + public: + SwAnnotationWin( SwEditWin& rEditWin, + SwPostItMgr& aMgr, + SwSidebarItem& rSidebarItem, + SwFormatField* aField ); + virtual ~SwAnnotationWin() override; + virtual void dispose() override; + + void UpdateData(); + void SetPostItText(); + void Delete(); + void GotoPos(); + const SwPostItField* GetPostItField() const { return mpField; } + void UpdateText(const OUString& aText); + + OUString GetAuthor() const; + Date GetDate() const; + tools::Time GetTime() const; + + sal_uInt32 MoveCaret(); + + /// Calculate parent postit id of current annotation window + sal_uInt32 CalcParent(); + void InitAnswer(OutlinerParaObject const * pText); + + bool IsProtected() const; + + void SetSize( const Size& rNewSize ); + void SetPosSizePixelRect( long nX, + long nY, + long nWidth, + long nHeight, + const SwRect& aAnchorRect, + const long PageBorder); + void SetPosAndSize(); + void TranslateTopPosition(const long aAmount); + void CheckMetaText(); + + Point const & GetAnchorPos() { return mAnchorRect.Pos(); } + const SwRect& GetAnchorRect() const { return mAnchorRect; } + bool IsAnchorRectChanged() const { return mbAnchorRectChanged; } + void ResetAnchorRectChanged() { mbAnchorRectChanged = false; } + const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() const { return maAnnotationTextRanges; } + SwEditWin& EditWin(); + SwSidebarItem& GetSidebarItem() { return mrSidebarItem; } + + OutlinerView* GetOutlinerView() { return mpOutlinerView.get();} + bool HasScrollbar() const; + bool IsScrollbarVisible() const; + ScrollBar* Scrollbar() { return mpVScrollbar; } + ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor.get();} + ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow.get();} + ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();} + + long GetPostItTextHeight(); + + void SwitchToPostIt(sal_uInt16 aDirection); + void SwitchToFieldPos(); + + void ExecuteCommand(sal_uInt16 nSlot); + void InitControls(); + void DoResize(); + void ResizeIfNecessary(long aOldHeight, long aNewHeight); + void SetScrollbar(); + + void SetVirtualPosSize( const Point& aPoint, const Size& aSize); + Point VirtualPos() { return mPosSize.TopLeft(); } + Size VirtualSize() { return mPosSize.GetSize(); } + + void ShowAnchorOnly(const Point &aPoint); + void ShowNote(); + void HideNote(); + void InvalidateControl(); + + void ResetAttributes(); + + void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition); + void SetReadonly(bool bSet); + bool IsReadOnly() const + { + return mbReadonly; + } + + void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor); + const Color& ColorAnchor() { return mColorAnchor; } + const Color& ColorDark() { return mColorDark; } + const Color& ColorLight() { return mColorLight; } + void Rescale(); + + void SetViewState(::sw::sidebarwindows::ViewState bViewState); + + bool IsFollow() const { return mbIsFollow; } + void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; }; + + sal_Int32 GetMetaHeight(); + sal_Int32 GetMinimumSizeWithMeta() const; + sal_Int32 GetMinimumSizeWithoutMeta() const; + sal_Int32 GetMetaButtonAreaWidth() const; + sal_Int32 GetScrollbarWidth() const; + sal_Int32 GetNumFields(); + + void SetSpellChecking(); + + void ToggleInsMode(); + + void ActivatePostIt(); + void DeactivatePostIt(); + + void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus, + const Color& aColor); + SwPostItHelper::SwLayoutStatus GetLayoutStatus() const { return mLayoutStatus; } + const Color& GetChangeColor() const { return mChangeColor; } + + DECL_LINK( WindowEventListener, VclWindowEvent&, void ); + bool IsMouseOverSidebarWin() const { return mbMouseOver; } + + void SetLanguage(const SvxLanguageItem& rNewItem); + + void ChangeSidebarItem( SwSidebarItem const & rSidebarItem ); + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; + + virtual void Draw(OutputDevice* pDev, const Point&, DrawFlags) override; + virtual void KeyInput(const KeyEvent& rKeyEvt) override; + virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override; + virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override; + virtual void MouseMove(const MouseEvent& rMouseEvent) override; + void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect); + /// Is there a matching sub-widget inside this sidebar widget for rPointLogic? + bool IsHitWindow(const Point& rPointLogic); + /// Allows adjusting the point or mark of the selection to a document coordinate. + void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark); + + // Various access functions for 'resolved' status + void SetResolved(bool resolved); + void ToggleResolved(); + void ToggleResolvedForThread(); + bool IsResolved() const; + bool IsThreadResolved(); + + // Set this SwAnnotationWin as the currently active one + // return false if it was already active + bool SetActiveSidebarWin(); + // Unset this SwAnnotationWin as the currently active one + void UnsetActiveSidebarWin(); + + /// Find the first annotation for the thread which this annotation is in. + /// This may be the same annotation as this one. + SwAnnotationWin* GetTopReplyNote(); + + private: + VclPtr<MenuButton> CreateMenuButton(); + virtual void LoseFocus() override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void GetFocus() override; + + void SetSizePixel( const Size& rNewSize ) override; + SfxItemSet DefaultItem(); + + DECL_LINK(ModifyHdl, LinkParamNone*, void); + DECL_LINK(ScrollHdl, ScrollBar*, void); + DECL_LINK(DeleteHdl, void*, void); + + sal_uInt32 CountFollowing(); + + SvxLanguageItem GetLanguage() const; + + VclBuilder maBuilder; + SwPostItMgr& mrMgr; + SwView& mrView; + + ImplSVEvent * mnEventId; + + std::unique_ptr<OutlinerView> mpOutlinerView; + std::unique_ptr<Outliner> mpOutliner; + + VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl; + VclPtr<ScrollBar> mpVScrollbar; + VclPtr<Edit> mpMetadataAuthor; + VclPtr<Edit> mpMetadataDate; + VclPtr<Edit> mpMetadataResolved; + VclPtr<MenuButton> mpMenuButton; + + std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor; + std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow; + std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay; + + Color mColorAnchor; + Color mColorDark; + Color mColorLight; + Color mChangeColor; + + sw::sidebarwindows::SidebarPosition meSidebarPosition; + + tools::Rectangle mPosSize; + SwRect mAnchorRect; + long mPageBorder; + bool mbAnchorRectChanged; + + bool mbResolvedStateUpdated; + + std::vector<basegfx::B2DRange> maAnnotationTextRanges; + + bool mbMouseOver; + SwPostItHelper::SwLayoutStatus mLayoutStatus; + + bool mbReadonly; + bool mbIsFollow; + + SwSidebarItem& mrSidebarItem; + const SwFrame* mpAnchorFrame; + + SwFormatField* mpFormatField; + SwPostItField* mpField; + VclPtr<PopupMenu> mpButtonPopup; +}; + +} // end of namespace sw::annotation + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/EnhancedPDFExportHelper.hxx b/sw/inc/EnhancedPDFExportHelper.hxx new file mode 100644 index 000000000..6aa586737 --- /dev/null +++ b/sw/inc/EnhancedPDFExportHelper.hxx @@ -0,0 +1,255 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_ENHANCEDPDFEXPORTHELPER_HXX +#define INCLUDED_SW_INC_ENHANCEDPDFEXPORTHELPER_HXX + +#include <i18nlangtag/lang.h> +#include <vcl/pdfwriter.hxx> +#include "swrect.hxx" +#include "swtypes.hxx" + +#include <map> +#include <memory> +#include <vector> +#include <set> + +namespace vcl +{ + class PDFExtOutDevData; +} +class OutputDevice; +class SwFrame; +class SwLinePortion; +class SwPageFrame; +class SwPrintData; +class SwTextPainter; +class SwEditShell; +class StringRangeEnumerator; +class SwTextNode; +class SwTable; +class SwNumberTreeNode; + +/* + * Mapping of OOo elements to tagged pdf elements: + * + * OOo element tagged pdf element + * ----------- ------------------ + * + * Grouping elements: + * + * SwRootFrame Document + * Part + * Art + * SwSection Sect + * SwFootnoteContFrame and SwFlyFrame Div + * SwFormat "Quotations" BlockQuote + * SwFormat "Caption" Caption + * SwSection (TOC) TOC + * SwTextNode in TOC TOCI + * SwSection (Index) Index + * + * Block-Level Structure Elements: + * + * SwTextNode P + * SwFormat "Heading" H + * SwTextNode with Outline H1 - H6 + * SwTextNode with NumRule L, LI, LBody + * SwTable Table + * SwRowFrame TR + * SwCellFrame in Headline row or + * SwFtm "Table Heading" TH + * SwCellFrame TD + * + * Inline-Level Structure Elements: + * + * SwTextPortion Span + * SwFormat "Quotation" Quote + * SwFootnoteFrame Note + * Form + * Reference + * SwFieldPortion (AuthorityField) BibEntry + * SwFormat "Source Text" Code + * SwFootnotePortion, SwFieldPortion (RefField) Link + * + * Illustration elements: + * + * SwFlyFrame with SwNoTextFrame Figure + * SwFlyFrame with Math OLE Object Formula + * + */ + +struct Num_Info +{ + const SwFrame& mrFrame; + Num_Info( const SwFrame& rFrame ) : mrFrame( rFrame ) {}; +}; + +struct Frame_Info +{ + const SwFrame& mrFrame; + Frame_Info( const SwFrame& rFrame ) : mrFrame( rFrame ) {}; +}; + +struct Por_Info +{ + const SwLinePortion& mrPor; + const SwTextPainter& mrTextPainter; + Por_Info( const SwLinePortion& rPor, const SwTextPainter& rTextPainer ) + : mrPor( rPor ), mrTextPainter( rTextPainer ) {}; +}; + +struct lt_TableColumn +{ + bool operator()( long nVal1, long nVal2 ) const + { + return nVal1 + ( MINLAY - 1 ) < nVal2; + } +}; + +// Analyses a given frame during painting and generates the appropriate +// structure elements. +class SwTaggedPDFHelper +{ + private: + + // This will be incremented for each BeginTag() call. + // It denotes the number of tags to close during EndStructureElements(); + sal_uInt8 nEndStructureElement; + + // If an already existing tag is reopened for follows of flow frames, + // this value stores the tag id which has to be restored. + sal_Int32 nRestoreCurrentTag; + + vcl::PDFExtOutDevData* mpPDFExtOutDevData; + + const Num_Info* mpNumInfo; + const Frame_Info* mpFrameInfo; + const Por_Info* mpPorInfo; + + void BeginTag( vcl::PDFWriter::StructElement aTagRole, const OUString& rTagName ); + void EndTag(); + + void SetAttributes( vcl::PDFWriter::StructElement eType ); + + // These functions are called by the c'tor, d'tor + void BeginNumberedListStructureElements(); + void BeginBlockStructureElements(); + void BeginInlineStructureElements(); + void EndStructureElements(); + + bool CheckReopenTag(); + void CheckRestoreTag() const; + + public: + + // pFrameInfo != 0 => BeginBlockStructureElement + // pPorInfo != 0 => BeginInlineStructureElement + // pFrameInfo, pPorInfo = 0 => BeginNonStructureElement + SwTaggedPDFHelper( const Num_Info* pNumInfo, const Frame_Info* pFrameInfo, const Por_Info* pPorInfo, + OutputDevice const & rOut ); + ~SwTaggedPDFHelper(); + + static bool IsExportTaggedPDF( const OutputDevice& rOut ); +}; + +/* + * Analyses the document structure and export Notes, Hyperlinks, References, + * and Outline. Link ids created during pdf export are stored in + * aReferenceIdMap and aHyperlinkIdMap, in order to use them during + * tagged pdf output. Therefore the SwEnhancedPDFExportHelper is used + * before painting. Unfortunately links from the EditEngine into the + * Writer document require to be exported after they have been painted. + * Therefore SwEnhancedPDFExportHelper also has to be used after the + * painting process, the parameter bEditEngineOnly indicated that only + * the bookmarks from the EditEngine have to be processed. + */ +typedef std::set< long, lt_TableColumn > TableColumnsMapEntry; +typedef std::pair< SwRect, sal_Int32 > IdMapEntry; +typedef std::vector< IdMapEntry > LinkIdMap; +typedef std::map< const SwTable*, TableColumnsMapEntry > TableColumnsMap; +typedef std::map< const SwNumberTreeNode*, sal_Int32 > NumListIdMap; +typedef std::map< const SwNumberTreeNode*, sal_Int32 > NumListBodyIdMap; +typedef std::map< const void*, sal_Int32 > FrameTagIdMap; + +class SwEnhancedPDFExportHelper +{ + private: + + SwEditShell& mrSh; + OutputDevice& mrOut; + + std::unique_ptr<StringRangeEnumerator> mpRangeEnum; + /** The problem is that numbers in StringRangeEnumerator aren't accordant + * to real page numbers if mbSkipEmptyPages is true, because in this case + * empty pages are excluded from a page range and numbers in + * StringRangeEnumerator are shifted. + * + * maPageNumberMap[real_page_number] is either a corresponding page number + * in a page range without empty pages, or -1 if this page is empty. */ + std::vector< sal_Int32 > maPageNumberMap; + + bool mbSkipEmptyPages; + bool mbEditEngineOnly; + + const SwPrintData& mrPrintData; + + static TableColumnsMap aTableColumnsMap; + static LinkIdMap aLinkIdMap; + static NumListIdMap aNumListIdMap; + static NumListBodyIdMap aNumListBodyIdMap; + static FrameTagIdMap aFrameTagIdMap; + + static LanguageType eLanguageDefault; + + void EnhancedPDFExport(); + sal_Int32 CalcOutputPageNum( const SwRect& rRect ) const; + std::vector< sal_Int32 > CalcOutputPageNums( const SwRect& rRect ) const; + + void MakeHeaderFooterLinks( vcl::PDFExtOutDevData& rPDFExtOutDevData, + const SwTextNode& rTNd, const SwRect& rLinkRect, + sal_Int32 nDestId, const OUString& rURL, bool bIntern ) const; + + public: + + SwEnhancedPDFExportHelper( SwEditShell& rSh, + OutputDevice& rOut, + const OUString& rPageRange, + bool bSkipEmptyPages, + bool bEditEngineOnly, + const SwPrintData& rPrintData ); + + ~SwEnhancedPDFExportHelper(); + + static TableColumnsMap& GetTableColumnsMap() {return aTableColumnsMap; } + static LinkIdMap& GetLinkIdMap() { return aLinkIdMap; } + static NumListIdMap& GetNumListIdMap() {return aNumListIdMap; } + static NumListBodyIdMap& GetNumListBodyIdMap() {return aNumListBodyIdMap; } + static FrameTagIdMap& GetFrameTagIdMap() { return aFrameTagIdMap; } + + static LanguageType GetDefaultLanguage() {return eLanguageDefault; } + + //scale and position rRectangle if we're scaling due to notes in margins. + tools::Rectangle SwRectToPDFRect(const SwPageFrame* pCurrPage, + const tools::Rectangle& rRectangle) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/HandleAnchorNodeChg.hxx b/sw/inc/HandleAnchorNodeChg.hxx new file mode 100644 index 000000000..c25d5fbdd --- /dev/null +++ b/sw/inc/HandleAnchorNodeChg.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_HANDLEANCHORNODECHG_HXX +#define INCLUDED_SW_INC_HANDLEANCHORNODECHG_HXX + +class SwFlyFrameFormat; +class SwFormatAnchor; +class SwFlyFrame; + +// helper class to track change of anchor node of at-paragraph respectively +// at-character anchored fly frames +// if such a change happens, it has to be checked, if the count of the anchor +// frames also change. if yes, a re-creation of the fly frames is needed: +// - deletion of existing fly frames before the intrinsic anchor node changes +// - creation of new fly frames after the intrinsic anchor node change. +class SwHandleAnchorNodeChg +{ +public: + /** checks, if re-creation of fly frames for an anchor node change at the + given fly frame format is necessary, and performs the first part. + + @param _rFlyFrameFormat + reference to the fly frame format instance, which is handled. + + @param _rNewAnchorFormat + new anchor attribute, which will be applied at the given fly frame format + + @param _pKeepThisFlyFrame + optional parameter - pointer to a fly frame of the given fly frame format, + which isn't deleted, if re-creation of fly frames is necessary. + */ + SwHandleAnchorNodeChg( SwFlyFrameFormat& _rFlyFrameFormat, + const SwFormatAnchor& _rNewAnchorFormat, + SwFlyFrame const * _pKeepThisFlyFrame = nullptr ); + + /** calls <SwFlyFrameFormat::MakeFrames>, if re-creation of fly frames is necessary. */ + ~SwHandleAnchorNodeChg() COVERITY_NOEXCEPT_FALSE; + +private: + // fly frame format, which is tracked for an anchor node change. + SwFlyFrameFormat& mrFlyFrameFormat; + // internal flag, which indicates that the certain anchor node change occurs + // and that re-creation of fly frames is necessary. + bool mbAnchorNodeChanged; + + /// If the fly frame has a comment, this points to the old comment anchor. + std::unique_ptr<SwPosition> mpCommentAnchor; + + SwWrtShell* mpWrtShell; + + SwHandleAnchorNodeChg( const SwHandleAnchorNodeChg& ) = delete; + void operator=( const SwHandleAnchorNodeChg ) = delete; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentChartDataProviderAccess.hxx b/sw/inc/IDocumentChartDataProviderAccess.hxx new file mode 100644 index 000000000..59a7f817a --- /dev/null +++ b/sw/inc/IDocumentChartDataProviderAccess.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTCHARTDATAPROVIDERACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTCHARTDATAPROVIDERACCESS_HXX + +class SwTable; +class SwChartDataProvider; +class SwChartLockController_Helper; + +/** Give access to the data-provider for chart + */ +class IDocumentChartDataProviderAccess +{ +public: + + /** + returns or creates the data-provider for chart + */ + virtual SwChartDataProvider * GetChartDataProvider( bool bCreate = false ) const = 0; + + /** + calls createInternalDataProvider for all charts using the specified table + */ + virtual void CreateChartInternalDataProviders( const SwTable *pTable ) = 0; + + /** + returns chart controller helper that is used to lock/unlock all + charts when relevant parts of tables are changed + */ + virtual SwChartLockController_Helper & GetChartControllerHelper() = 0; + +protected: + virtual ~IDocumentChartDataProviderAccess() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTCHARTDATAPROVIDERACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx new file mode 100644 index 000000000..14724eae3 --- /dev/null +++ b/sw/inc/IDocumentContentOperations.hxx @@ -0,0 +1,250 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX +#define INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include "swtypes.hxx" + +class SwPaM; +struct SwPosition; +class SwNode; +class SwNodeRange; +class Graphic; +class SfxItemSet; +class SfxPoolItem; +class GraphicObject; +class SdrObject; +class SwFrameFormat; +class SwDrawFrameFormat; +class SwFlyFrameFormat; +class SwNodeIndex; +class SwRootFrame; +class SwTextAttr; + +namespace utl { class TransliterationWrapper; } +namespace svt { class EmbeddedObjectRef; } + +enum class SwMoveFlags +{ + DEFAULT = 0x00, + ALLFLYS = 0x01, + CREATEUNDOOBJ = 0x02, + REDLINES = 0x04, + NO_DELFRMS = 0x08 +}; +namespace o3tl +{ + template<> struct typed_flags<SwMoveFlags> : is_typed_flags<SwMoveFlags, 0x0f> {}; +} + +// constants for inserting text +enum class SwInsertFlags +{ + DEFAULT = 0x00, // no extras + EMPTYEXPAND = 0x01, // expand empty hints at insert position + NOHINTEXPAND = 0x02, // do not expand any hints at insert pos + FORCEHINTEXPAND = 0x04 // expand all hints at insert position +}; +namespace o3tl +{ + template<> struct typed_flags<SwInsertFlags> : is_typed_flags<SwInsertFlags, 0x07> {}; +} + +enum class SwCopyFlags +{ + Default = 0, + CopyAll = (1<<0), ///< copy break attributes even when source is single node + CheckPosInFly = (1<<1), ///< check if target position is in fly anchored at source range + IsMoveToFly = (1<<2), ///< MakeFlyAndMove + // TODO: mbCopyIsMove? mbIsRedlineMove? +}; +namespace o3tl +{ + template<> struct typed_flags<SwCopyFlags> : is_typed_flags<SwCopyFlags, 0x07> {}; +} + +/** Text operation/manipulation interface +*/ +class IDocumentContentOperations +{ +public: +public: + /** Copy a selected content range to a position + + The position can be in the same or in an another document. It can also + be within the range! + + \warning The range has to include at least two nodes or has to be a + SwDoc::IsColumnSelection, because the rPam is treated [mark, point[. + + Normally this function should work only with content nodes. But there + is a special case used by SwDoc::Paste, which starts the SwPaM at the + content start node. This position doesn't contain any content: + + @code + SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 1 ); + @endcode + + This is important, because it prevents merging of the first node of + the range into the node pointed to by \p rPos. + As a result this keeps all properties of the first real content node, + which is the 2nd, including the Flys and the page description. In this + case the first (fake) node is silently dropped and all other nodes are + just copied. + + @param rPam + The source node range to copy + + @param rPos + The target copy destination + + @param flags + SwCopyFlags::CheckPos: + If this function should check if rPos is in a fly frame anchored in + rPam. If false, then no such check will be performed, and it is assumed + that the caller took care of verifying this constraint already. + */ + virtual bool CopyRange(SwPaM& rPam, SwPosition& rPos, SwCopyFlags flags) const = 0; + + /** Delete section containing the node. + */ + virtual void DeleteSection(SwNode* pNode) = 0; + + /** Delete a range SwFlyFrameFormat. + */ + virtual void DeleteRange(SwPaM&) = 0; + + /** Delete full paragraphs. + */ + virtual bool DelFullPara(SwPaM&) = 0; + + /** complete delete of a given PaM + + #i100466# + Add optional parameter <bForceJoinNext>, default value <false> + Needed for hiding of deletion redlines + */ + virtual bool DeleteAndJoin( SwPaM&, + const bool bForceJoinNext = false ) = 0; + + virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0; + + virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0; + + /** Move a range. + */ + virtual bool MoveAndJoin(SwPaM&, SwPosition&) = 0; + + /** Overwrite string in an existing text node. + */ + virtual bool Overwrite(const SwPaM &rRg, const OUString& rStr) = 0; + + /** Insert string into existing text node at position rRg.Point(). + */ + virtual bool InsertString(const SwPaM &rRg, const OUString&, + const SwInsertFlags nInsertMode = SwInsertFlags::EMPTYEXPAND ) = 0; + + /** change text to Upper/Lower/Hiragana/Katakana/... + */ + virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) = 0; + + /** Insert graphic or formula. The XXXX are copied. + */ + virtual SwFlyFrameFormat* InsertGraphic( + const SwPaM &rRg, const OUString& rGrfName, + const OUString& rFltName, const Graphic* pGraphic, + const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, + SwFrameFormat*) = 0; + + virtual SwFlyFrameFormat* InsertGraphicObject( + const SwPaM& rRg, const GraphicObject& rGrfObj, + const SfxItemSet* pFlyAttrSet, + const SfxItemSet* pGrfAttrSet) = 0; + + /** Transpose graphic (with undo) + */ + virtual void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic) = 0; + + /** Insert a DrawObject. The object must be already registered + in DrawModel. + */ + virtual SwDrawFrameFormat* InsertDrawObj( + const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet) = 0; + + /** Insert OLE-objects. + */ + virtual SwFlyFrameFormat* InsertEmbObject( + const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, + SfxItemSet* pFlyAttrSet) = 0; + + virtual SwFlyFrameFormat* InsertOLE( + const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, + const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet) = 0; + + /** Split a node at rPos (implemented only for TextNode). + */ + virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart) = 0; + + virtual bool AppendTextNode(SwPosition& rPos) = 0; + + /** Replace selected range in a TextNode with string. + Intended for search & replace. + bRegExpRplc - replace tabs (\\t) and insert the found string + ( not \& ). E.g.: Find: "zzz", Replace: "xx\t\\t..&..\&" + --> "xx\t<Tab>..zzz..&" + */ + virtual bool ReplaceRange(SwPaM& rPam, const OUString& rNewStr, + const bool bRegExReplace) = 0; + + /** Insert an attribute. If rRg spans several nodes the + attribute is split, provided it makes sense. + Nodes, where this attribute does not make sense are ignored. + In nodes completely enclosed in the selection the attribute + becomes hard-formatted, in all other (text-) nodes the attribute + is inserted into the attribute array. + For a character attribute, in cases where no selection exists + an "empty" hint is inserted. If there is a selection the attribute + is hard-formatted and added to the node at rRg.Start(). + If the attribute could not be inserted, the method returns + false. + */ + virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&, + const SetAttrMode nFlags = SetAttrMode::DEFAULT, + SwRootFrame const* pLayout = nullptr, + bool bExpandCharToPara = false, + SwTextAttr **ppNewTextAttr = nullptr) = 0; + + virtual void InsertItemSet (const SwPaM &rRg, const SfxItemSet&, + const SetAttrMode nFlags = SetAttrMode::DEFAULT, + SwRootFrame const* pLayout = nullptr) = 0; + + /** Removes any leading white space from the paragraph + */ + virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0; + +protected: + virtual ~IDocumentContentOperations() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentDeviceAccess.hxx b/sw/inc/IDocumentDeviceAccess.hxx new file mode 100644 index 000000000..c1c1bdce4 --- /dev/null +++ b/sw/inc/IDocumentDeviceAccess.hxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTDEVICEACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTDEVICEACCESS_HXX + +class SfxPrinter; +class JobSetup; +class SwPrintData; +class VirtualDevice; +class OutputDevice; + +/** Provides access to the formatting devices of a document + */ +class IDocumentDeviceAccess +{ +public: + + /** Return the printer set at the document. + + @param bCreate + [in] if set, a printer will be created if not already done. + + @returns + the printer set at the document. + */ + virtual SfxPrinter* getPrinter(/*[in]*/ bool bCreate ) const = 0; + + /** Set the printer at the document. + + @param pP + [in] the new printer or 0. + + @param bDeleteOld + [in] if set, the old printer will be deleted. + + @param bCallPrtDataChanged + [in] if set, triggers all necessary invalidations. + */ + virtual void setPrinter(/*[in]*/ SfxPrinter* pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged ) = 0; + + /** Return the virtual device set at the document. + + @param bCreate + [in] if set, a virtual device will be created if not already done. + + @returns + the virtual device set at the document. + */ + virtual VirtualDevice* getVirtualDevice(/*[in]*/ bool bCreate ) const = 0; + + /** Sets the current virtual device + + @param pVd + [in] the new virtual device. + + The old virtual device will be deleted. + Triggers all necessary invalidations. + */ + virtual void setVirtualDevice(/*[in]*/ VirtualDevice* pVd ) = 0; + + /** Returns the current reference device + + @param bCreate + [in] if set, the reference device will be created if not already done. + + @returns + the current reference device + */ + virtual OutputDevice* getReferenceDevice(/*[in]*/ bool bCreate ) const = 0; + + /** Sets the type of the reference device used for formatting the document + + @param bNewVirtual + [in] if set, the reference device will be a virtual device, otherwise + the printer is used for formatting the document + + @param bNewHiRes + [in] if set, the virtual device will be the HiRes virtual device + */ + virtual void setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /*[in]*/ bool bNewHiRes ) = 0; + + /** Returns the Jobsetup + + @returns + the current Jobsetup + */ + virtual const JobSetup* getJobsetup() const = 0; + + /** Sets the Jobsetup + + @param rJobSetup + [in] the new Jobsetup. + */ + virtual void setJobsetup(/*[in]*/ const JobSetup& rJobSetup ) = 0; + + /** Returns the PrintData + + @returns + the current PrintData + */ + virtual const SwPrintData & getPrintData() const = 0; + + /** Sets the PrintData + + @param rPrtData + [in] the new PrintData. + */ + virtual void setPrintData(/*[in]*/ const SwPrintData& rPrtData) = 0; + +protected: + virtual ~IDocumentDeviceAccess() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTDEVICEACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentDrawModelAccess.hxx b/sw/inc/IDocumentDrawModelAccess.hxx new file mode 100644 index 000000000..b631317a0 --- /dev/null +++ b/sw/inc/IDocumentDrawModelAccess.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTDRAWMODELACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTDRAWMODELACCESS_HXX + +#include <svx/svdtypes.hxx> + +class SwDrawModel; +class SwPaM; +class SdrPageView; +class SvxSearchItem; + +class IDocumentDrawModelAccess +{ +public: + + /** Draw Model and id accessors + */ + virtual const SwDrawModel* GetDrawModel() const = 0; + virtual SwDrawModel* GetDrawModel() = 0; + virtual SwDrawModel* MakeDrawModel_() = 0; + virtual SwDrawModel* GetOrCreateDrawModel() = 0; + virtual SdrLayerID GetHeavenId() const = 0; + virtual SdrLayerID GetHellId() const = 0; + virtual SdrLayerID GetControlsId() const = 0; + virtual SdrLayerID GetInvisibleHeavenId() const = 0; + virtual SdrLayerID GetInvisibleHellId() const = 0; + virtual SdrLayerID GetInvisibleControlsId() const = 0; + + /** method to notify drawing page view about the invisible layers */ + virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) = 0; + + /** method to determine, if a layer ID belongs to the visible ones. + Note: If given layer ID is unknown, method asserts and returns <false>. + + @param _nLayerId + input parameter - layer ID, which has to be checked, if it belongs to + the visible ones. + + @return bool, indicating, if given layer ID belongs to the visible ones. + */ + virtual bool IsVisibleLayerId( SdrLayerID _nLayerId ) const = 0; + + /** method to determine, if the corresponding invisible layer ID for a visible one. + + Note: If given layer ID is an invisible one, method returns given layer ID. + Note: If given layer ID is unknown, method returns given layer ID. + + @param _nVisibleLayerId + input parameter - visible layer ID for which the corresponding + invisible one has to be returned. + + @return sal_Int8, invisible layer ID corresponding to given layer ID + */ + virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( SdrLayerID _nVisibleLayerId ) = 0; + + /// Searches text in shapes anchored inside rPaM. + virtual bool Search(const SwPaM& rPaM, const SvxSearchItem& rSearchItem) = 0; + +protected: + + virtual ~IDocumentDrawModelAccess() {}; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentExternalData.hxx b/sw/inc/IDocumentExternalData.hxx new file mode 100644 index 000000000..7ed3dfafb --- /dev/null +++ b/sw/inc/IDocumentExternalData.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_IDOCUMENTEXTERNALDATA_HXX +#define INCLUDED_SW_INC_IDOCUMENTEXTERNALDATA_HXX + +#include <memory> +#include <unordered_map> + +namespace sw +{ + +enum class tExternalDataType { FIB, STTBF_ASSOC }; + +struct ExternalDataTypeHash +{ + size_t operator()(tExternalDataType eType) const { return static_cast<size_t>(eType); } +}; + +class ExternalData +{ +public: + ExternalData() {} + virtual ~ExternalData() {} +}; + +typedef std::shared_ptr<ExternalData> tExternalDataPointer; +} + +class IDocumentExternalData +{ +protected: + typedef std::unordered_map<sw::tExternalDataType, sw::tExternalDataPointer, sw::ExternalDataTypeHash> + tExternalData; + + tExternalData m_externalData; + + virtual ~IDocumentExternalData() {}; + +public: + virtual void setExternalData(sw::tExternalDataType eType, + sw::tExternalDataPointer pPayload) = 0; + virtual sw::tExternalDataPointer getExternalData(sw::tExternalDataType eType) = 0; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTEXTERNALDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx new file mode 100644 index 000000000..2a2e8935e --- /dev/null +++ b/sw/inc/IDocumentFieldsAccess.hxx @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX + +#include <sal/types.h> +#include <tools/solar.h> + +class SwFieldTypes; +class SwFieldType; +class SfxPoolItem; +struct SwPosition; +class SwDocUpdateField; +class SwCalc; +class SwTextField; +class SwField; +class SwMsgPoolItem; +class DateTime; +class SetGetExpField; +class SwNode; +enum class SwFieldIds : sal_uInt16; +template <class T> class SwHashTable; +struct HashStr; +class SwRootFrame; +class IDocumentRedlineAccess; + +namespace rtl { class OUString; } +using rtl::OUString; +namespace com::sun::star::uno { class Any; } + + /** Document fields related interfaces + */ + class IDocumentFieldsAccess + { + public: + virtual const SwFieldTypes *GetFieldTypes() const = 0; + + virtual SwFieldType *InsertFieldType(const SwFieldType &) = 0; + + virtual SwFieldType *GetSysFieldType( const SwFieldIds eWhich ) const = 0; + + virtual SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName, bool bDbFieldMatching) const = 0; + + virtual void RemoveFieldType(size_t nField) = 0; + + virtual void UpdateFields(bool bCloseDB) = 0; + + virtual void InsDeletedFieldType(SwFieldType &) = 0; + + /** + Puts a value into a field at a certain position. + + A missing field at the given position leads to a failure. + + @param rPosition position of the field + @param rVal the value + @param nMId + + @retval true putting of value was successful + @retval false else + */ + virtual void PutValueToField(const SwPosition & rPos, const css::uno::Any& rVal, sal_uInt16 nWhich) = 0; + + // Call update of expression fields. All expressions are re-evaluated. + + /** Updates a field. + + @param rDstFormatField field to update + @param rSrcField field containing the new values + @param pMsgHint + @param bUpdateTableFields TRUE: update table fields, too. + + @retval true update was successful + @retval false else + */ + virtual bool UpdateField(SwTextField * rDstFormatField, SwField & rSrcField, SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0; + + virtual void UpdateRefFields() = 0; + + virtual void UpdateTableFields(SfxPoolItem* pHt) = 0; + + virtual void UpdateExpFields(SwTextField* pField, bool bUpdateRefFields) = 0; + + virtual void UpdateUsrFields() = 0; + + virtual void UpdatePageFields(SfxPoolItem*) = 0; + + virtual void LockExpFields() = 0; + + virtual void UnlockExpFields() = 0; + + virtual bool IsExpFieldsLocked() const = 0; + + virtual SwDocUpdateField& GetUpdateFields() const = 0; + + /* @@@MAINTAINABILITY-HORROR@@@ + SwNode (see parameter pChk) is (?) part of the private + data structure of SwDoc and should not be exposed + */ + virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0; + + virtual void SetFixFields(const DateTime* pNewDateTime) = 0; + + // In Calculator set all SetExpression fields that are valid up to the indicated position + // (Node [ + css::ucb::Content]). + // A generated list of all fields may be passed along too + // (if the address != 0 and the pointer == 0 a new list will be returned). + virtual void FieldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt) = 0; + + virtual void FieldsToCalc(SwCalc& rCalc, const SetGetExpField& rToThisField, SwRootFrame const* pLayout) = 0; + + virtual void FieldsToExpand(SwHashTable<HashStr> & rTable, const SetGetExpField& rToThisField, SwRootFrame const& rLayout) = 0; + + virtual bool IsNewFieldLst() const = 0; + + virtual void SetNewFieldLst( bool bFlag) = 0; + + virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField& rField) = 0; + + virtual sal_Int32 GetRecordsPerDocument() const = 0; + +protected: + virtual ~IDocumentFieldsAccess() {}; + }; + +namespace sw { +bool IsFieldDeletedInModel(IDocumentRedlineAccess const& rIDRA, + SwTextField const& rTextField); +} + +#endif // INCLUDED_SW_INC_IDOCUMENTFIELDSACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentLayoutAccess.hxx b/sw/inc/IDocumentLayoutAccess.hxx new file mode 100644 index 000000000..67c1b908a --- /dev/null +++ b/sw/inc/IDocumentLayoutAccess.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTLAYOUTACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTLAYOUTACCESS_HXX + +class SwViewShell; +class SwRootFrame; +class SwFrameFormat; +class SfxItemSet; +class SwLayouter; +class SwFormatAnchor; +enum class RndStdIds; + +/** Provides access to the layout of a document. +*/ +class IDocumentLayoutAccess +{ +public: + + /** Returns the layout set at the document. + */ + virtual const SwViewShell* GetCurrentViewShell() const = 0; + virtual SwViewShell* GetCurrentViewShell() = 0; + virtual const SwRootFrame* GetCurrentLayout() const = 0; + virtual SwRootFrame* GetCurrentLayout() = 0; + virtual bool HasLayout() const = 0; + + /** !!!The old layout must be deleted!!! + */ + virtual void SetCurrentViewShell( SwViewShell* pNew ) = 0; + + virtual SwFrameFormat* MakeLayoutFormat( RndStdIds eRequest, const SfxItemSet* pSet ) = 0; + + virtual SwLayouter* GetLayouter() = 0; + virtual const SwLayouter* GetLayouter() const = 0; + virtual void SetLayouter( SwLayouter* pNew ) = 0; + + virtual void DelLayoutFormat( SwFrameFormat *pFormat ) = 0; + + virtual SwFrameFormat* CopyLayoutFormat( const SwFrameFormat& rSrc, const SwFormatAnchor& rNewAnchor, + bool bSetTextFlyAtt, bool bMakeFrames ) = 0; + +protected: + + virtual ~IDocumentLayoutAccess() {}; + }; + + #endif // INCLUDED_SW_INC_IDOCUMENTLAYOUTACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentLinksAdministration.hxx b/sw/inc/IDocumentLinksAdministration.hxx new file mode 100644 index 000000000..43bc0298c --- /dev/null +++ b/sw/inc/IDocumentLinksAdministration.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTLINKSADMINISTRATION_HXX +#define INCLUDED_SW_INC_IDOCUMENTLINKSADMINISTRATION_HXX + +#include <sal/types.h> + +namespace com::sun::star::uno { class Any; } +namespace sfx2 { class SvLinkSource; class LinkManager; } +namespace rtl { class OUString; } +using rtl::OUString; + + + /** Document links administration interface + */ + class IDocumentLinksAdministration + { + public: + /** Insert links in-/visibly into LinkManager (linked ranges). + */ + virtual bool IsVisibleLinks() const = 0; + + virtual void SetVisibleLinks(bool bFlag) = 0; + + virtual sfx2::LinkManager& GetLinkManager() = 0; + + virtual const sfx2::LinkManager& GetLinkManager() const = 0; + + /** #i42634# Moved common code of SwReader::Read() and + SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks(): + */ + virtual void UpdateLinks() = 0; + + /** for linking of parts of documents. + */ + virtual bool GetData(const OUString& rItem, const OUString& rMimeType, css::uno::Any& rValue) const = 0; + + virtual void SetData(const OUString& rItem) = 0; + + virtual ::sfx2::SvLinkSource* CreateLinkSource(const OUString& rItem) = 0; + + /** Embed all local links (ranges/graphics). + */ + virtual bool EmbedAllLinks() = 0; + + virtual void SetLinksUpdated(const bool bNewLinksUpdated) = 0; + + virtual bool LinksUpdated() const = 0; + +protected: + virtual ~IDocumentLinksAdministration() {}; + }; + + #endif // INCLUDED_SW_INC_IDOCUMENTLINKSADMINISTRATION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentListItems.hxx b/sw/inc/IDocumentListItems.hxx new file mode 100644 index 000000000..b5d1e8083 --- /dev/null +++ b/sw/inc/IDocumentListItems.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTLISTITEMS_HXX +#define INCLUDED_SW_INC_IDOCUMENTLISTITEMS_HXX + +#include <vector> +#include <rtl/ustring.hxx> + +class SwRootFrame; +class SwNodeNum; + +/** Provides numbered items of a document. +*/ +class IDocumentListItems +{ +public: + typedef std::vector< const SwNodeNum* > tSortedNodeNumList; + + virtual void addListItem( const SwNodeNum& rNodeNum ) = 0; + virtual void removeListItem( const SwNodeNum& rNodeNum ) = 0; + + virtual OUString getListItemText(const SwNodeNum& rNodeNum, + SwRootFrame const& rLayout) const = 0; + + virtual bool isNumberedInLayout(SwNodeNum const& rNodeNum, + SwRootFrame const& rLayout) const = 0; + + /** get vector of all list items, which are numbered + */ + virtual void getNumItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const = 0; + +protected: + virtual ~IDocumentListItems() {}; +}; + + #endif // INCLUDED_SW_INC_IDOCUMENTLISTITEMS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentListsAccess.hxx b/sw/inc/IDocumentListsAccess.hxx new file mode 100644 index 000000000..ada66af3b --- /dev/null +++ b/sw/inc/IDocumentListsAccess.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTLISTSACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTLISTSACCESS_HXX + +#include <rtl/ustring.hxx> + +class SwList; + +/** Provides access to the lists of a document. +*/ +class IDocumentListsAccess +{ + public: + virtual SwList* createList( const OUString& rListId, + const OUString& rDefaultListStyleName ) = 0; + virtual SwList* getListByName( const OUString& rListId ) const = 0; + + virtual void createListForListStyle( const OUString& rListStyleName ) = 0; + virtual SwList* getListForListStyle( const OUString& rListStyleName ) const = 0; + virtual void deleteListForListStyle( const OUString& rListStyleName ) = 0; + virtual void deleteListsByDefaultListStyle( const OUString& rListStyleName ) = 0; + // #i91400# + virtual void trackChangeOfListStyleName( const OUString& rListStyleName, + const OUString& rNewListStyleName ) = 0; + protected: + virtual ~IDocumentListsAccess() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTLISTSACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx new file mode 100644 index 000000000..13bd7fdc0 --- /dev/null +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -0,0 +1,357 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTMARKACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTMARKACCESS_HXX + +#include <sal/types.h> +#include "IMark.hxx" +#include <memory> + +class SwPaM; +struct SwPosition; +class SwTextNode; +class SwCursorShell; + +namespace sw::mark { + class SaveBookmark; // FIXME: Ugly: SaveBookmark is a core-internal class, and should not be used in the interface + class MarkBase; +} + +/** Provides access to the marks of a document. +*/ +class IDocumentMarkAccess +{ + public: + enum class MarkType + { + UNO_BOOKMARK, + DDE_BOOKMARK, + BOOKMARK, + CROSSREF_HEADING_BOOKMARK, + CROSSREF_NUMITEM_BOOKMARK, + ANNOTATIONMARK, + TEXT_FIELDMARK, + CHECKBOX_FIELDMARK, + DROPDOWN_FIELDMARK, + DATE_FIELDMARK, + NAVIGATOR_REMINDER + }; + + /** wrapper iterator: wraps iterator of implementation while hiding + MarkBase class; only IMark instances can be retrieved directly. + */ + class SW_DLLPUBLIC iterator + { + private: + std::unique_ptr<std::vector<::sw::mark::MarkBase*>::const_iterator> m_pIter; + + public: + // MarkManager implementation needs to get the real iterator + std::vector<::sw::mark::MarkBase*>::const_iterator const& get() const; + + typedef std::ptrdiff_t difference_type; + typedef ::sw::mark::IMark* value_type; + typedef ::sw::mark::IMark* const* pointer; + typedef ::sw::mark::IMark* const& reference; + typedef std::random_access_iterator_tag iterator_category; + + iterator(); + iterator(std::vector<::sw::mark::MarkBase*>::const_iterator const& rIter); + iterator(iterator const& rOther); + iterator& operator=(iterator const& rOther); + iterator(iterator && rOther) noexcept; + iterator& operator=(iterator && rOther) noexcept; + ~iterator(); + + // FIXME unfortunately there's a requirement on input iterator + // and forward iterator to return reference, which isn't + // possible because we have to return a temp value; + // let's try value_type instead, perhaps it's sufficient, + // for a const_iterator... + ::sw::mark::IMark* /*const&*/ operator*() const; + // nope can't do that :( + //::sw::mark::IMark* /* const* */ operator->() const; + iterator& operator++(); + iterator operator++(int); + bool operator==(iterator const& rOther) const; + bool operator!=(iterator const& rOther) const; + iterator& operator--(); + iterator operator--(int); + iterator& operator+=(difference_type); + iterator operator+(difference_type) const; + iterator& operator-=(difference_type); + iterator operator-(difference_type) const; + difference_type operator-(iterator const&) const; + value_type operator[](difference_type) const; + bool operator<(iterator const& rOther) const; + bool operator>(iterator const& rOther) const; + bool operator<=(iterator const& rOther) const; + bool operator>=(iterator const& rOther) const; + }; + + typedef iterator const_iterator_t; + + /// To avoid recursive calls of deleteMark, the removal of dummy + /// characters of fieldmarks has to be delayed; this is the baseclass + /// that can be subclassed for that purpose. + struct ILazyDeleter { virtual ~ILazyDeleter() { } }; + + /** Generates a new mark in the document for a certain selection. + + @param rPaM + [in] the selection being marked. + + @param rProposedName + [in] the proposed name of the new mark. + + @param eMark + [in] the type of the new mark. + + @param eMode + [in] is the new mark part of a text copy operation + + @returns + a pointer to the new mark (name might have changed). + */ + virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, + const OUString& rProposedName, + MarkType eMark, ::sw::mark::InsertMode eMode, + SwPosition const* pSepPos = nullptr) = 0; + + virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM, + const OUString& rName, + const OUString& rType, + SwPosition const* pSepPos = nullptr) = 0; + virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, + const OUString& rName, + const OUString& rType) = 0; + + virtual sw::mark::IMark* makeAnnotationMark( + const SwPaM& rPaM, + const OUString& rName ) = 0; + + /** Returns a mark in the document for a paragraph. + If there is none, a mark will be created. + + @param rTextNode + [in] the paragraph being marked (a selection over the paragraph is marked) + + @param eMark + [in] the type of the new mark. + + @returns + a pointer to the new mark (name might have changed). + */ + virtual ::sw::mark::IMark* getMarkForTextNode(const SwTextNode& rTextNode, + MarkType eMark) =0; + + /** Moves an existing mark to a new selection and performs needed updates. + @param io_pMark + [in/out] the mark to be moved + + @param rPaM + [in] new selection to be marked + */ + + virtual void repositionMark(::sw::mark::IMark* io_pMark, + const SwPaM& rPaM) =0; + + /** Renames an existing Mark, if possible. + @param io_pMark + [in/out] the mark to be renamed + + @param rNewName + [in] new name for the mark + + @returns false, if renaming failed (because the name is already in use) + */ + virtual bool renameMark(::sw::mark::IMark* io_pMark, + const OUString& rNewName) =0; + + /** Corrects marks (absolute) + This method ignores the previous position of the mark in the paragraph + + @param rOldNode + [in] the node from which nodes should be moved + + @param rNewPos + [in] new position to which marks will be moved, if nOffset == 0 + + @param nOffset + [in] the offset by which the mark gets positioned of rNewPos + */ + virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const sal_Int32 nOffset) =0; + + /** Corrects marks (relative) + This method uses the previous position of the mark in the paragraph as offset + + @param rOldNode + [in] the node from which nodes should be moved + + @param rNewPos + [in] new position to which marks from the start of the paragraph will be + moved, if nOffset == 0 + + @param nOffset + [in] the offset by which the mark gets positioned of rNewPos in addition to + its old position in the paragraph + */ + virtual void correctMarksRelative(const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const sal_Int32 nOffset) =0; + + /** Deletes marks in a range + + Note: navigator reminders are excluded + + */ + virtual void deleteMarks( + const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, + std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, // Ugly: SaveBookmark is core-internal + const SwIndex* pSttIdx, + const SwIndex* pEndIdx) =0; + + /** Deletes a mark. + + @param ppMark + [in] an iterator pointing to the Mark to be deleted. + */ + virtual std::unique_ptr<ILazyDeleter> + deleteMark(const IDocumentMarkAccess::const_iterator_t& ppMark) =0; + + /** Deletes a mark. + + @param ppMark + [in] the name of the mark to be deleted. + */ + virtual void deleteMark(const ::sw::mark::IMark* const pMark) =0; + + /** Clear (deletes) all marks. + */ + virtual void clearAllMarks() =0; + + virtual void assureSortedMarkContainers() const = 0; + + /** returns a STL-like random access iterator to the begin of the sequence of marks. + */ + virtual const_iterator_t getAllMarksBegin() const =0; + + /** returns a STL-like random access iterator to the end of the sequence of marks. + */ + virtual const_iterator_t getAllMarksEnd() const =0; + + /** returns the number of marks. + + Note: annotation marks are excluded + */ + virtual sal_Int32 getAllMarksCount() const =0; + + /** Finds a mark by name. + + @param rName + [in] the name of the mark to find. + + @returns + an iterator pointing to the mark, or pointing to getAllMarksEnd() if nothing was found. + */ + virtual const_iterator_t findMark(const OUString& rMark) const =0; + + // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK ) + + /** check if the selection would delete a BOOKMARK */ + virtual bool isBookmarkDeleted(SwPaM const& rPaM) const =0; + + /** returns a STL-like random access iterator to the begin of the sequence the IBookmarks. + */ + virtual const_iterator_t getBookmarksBegin() const =0; + + /** returns a STL-like random access iterator to the end of the sequence of IBookmarks. + */ + virtual const_iterator_t getBookmarksEnd() const =0; + + /** returns the number of IBookmarks. + */ + virtual sal_Int32 getBookmarksCount() const =0; + + /** Finds a bookmark by name. + + @param rName + [in] the name of the bookmark to find. + + @returns + an iterator pointing to the bookmark, or getBookmarksEnd() if nothing was found. + */ + virtual const_iterator_t findBookmark(const OUString& rMark) const =0; + + /** Finds the first mark that is starting after. + + @returns + an iterator pointing to the mark, or pointing to getBookmarksEnd() if nothing was found. + */ + virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition& rPos) const =0; + + + // Fieldmarks + /// get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos + virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) const =0; + virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) const =0; + virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0; + virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0; + + virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition& pos) const=0; + virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const=0; + + virtual void deleteFieldmarkAt(const SwPosition& rPos) = 0; + virtual ::sw::mark::IFieldmark* changeFormFieldmarkType(::sw::mark::IFieldmark* pFieldmark, const OUString& rNewType) = 0; + + virtual void NotifyCursorUpdate(const SwCursorShell& rCursorShell) = 0; + virtual void ClearFieldActivation() = 0; + + // Annotation Marks + virtual const_iterator_t getAnnotationMarksBegin() const = 0; + virtual const_iterator_t getAnnotationMarksEnd() const = 0; + virtual sal_Int32 getAnnotationMarksCount() const = 0; + virtual const_iterator_t findAnnotationMark( const OUString& rName ) const = 0; + virtual sw::mark::IMark* getAnnotationMarkFor(const SwPosition& rPosition) const = 0; + /** Finds the first mark that is starting after. + + @returns + an iterator pointing to the mark, or pointing to getAnnotationMarksEnd() if nothing was found. + */ + virtual const_iterator_t findFirstAnnotationStartsAfter(const SwPosition& rPos) const =0; + + /** Returns the MarkType used to create the mark + */ + static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark& rMark); + + static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix(); + static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark( const SwPaM& rPaM ); + static void DeleteFieldmarkCommand(::sw::mark::IFieldmark const& rMark); + + protected: + virtual ~IDocumentMarkAccess() {}; +}; + +#endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentOutlineNodes.hxx b/sw/inc/IDocumentOutlineNodes.hxx new file mode 100644 index 000000000..f76276835 --- /dev/null +++ b/sw/inc/IDocumentOutlineNodes.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTOUTLINENODES_HXX +#define INCLUDED_SW_INC_IDOCUMENTOUTLINENODES_HXX + +#include <rtl/ustring.hxx> +#include <vector> + +class SwTextNode; +class SwRootFrame; + +/** Provides outline nodes of a document. +*/ +class IDocumentOutlineNodes +{ +public: + typedef std::vector< const SwTextNode* > tSortedOutlineNodeList; + + virtual tSortedOutlineNodeList::size_type getOutlineNodesCount() const = 0; + + virtual int getOutlineLevel( const tSortedOutlineNodeList::size_type nIdx ) const = 0; + virtual OUString getOutlineText( const tSortedOutlineNodeList::size_type nIdx, + SwRootFrame const* pLayout, + const bool bWithNumber = true, + const bool bWithSpacesForLevel = false, + const bool bWithFootnote = true ) const = 0; + virtual SwTextNode* getOutlineNode( const tSortedOutlineNodeList::size_type nIdx ) const = 0; + + virtual bool isOutlineInLayout(tSortedOutlineNodeList::size_type nIdx, + SwRootFrame const& rLayout) const = 0; + + virtual void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const = 0; + +protected: + virtual ~IDocumentOutlineNodes() {}; +}; + + #endif // INCLUDED_SW_INC_IDOCUMENTOUTLINENODES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx new file mode 100644 index 000000000..395fae8d4 --- /dev/null +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -0,0 +1,224 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX + +#include <sal/config.h> + +#include <cstddef> + +#include <sal/types.h> + +#include <com/sun/star/uno/Sequence.h> +#include <o3tl/typed_flags_set.hxx> +#include <svx/ctredlin.hxx> + +#include "docary.hxx" + +class SwRangeRedline; +class SwTableRowRedline; +class SwTableCellRedline; +class SwPaM; +struct SwPosition; +class SwStartNode; +class SwNode; + +enum class RedlineFlags +{ + NONE = 0x000, ///< no RedlineFlags + On = 0x001, ///< RedlineFlags on + Ignore = 0x002, ///< ignore Redlines + ShowInsert = 0x010, ///< show all inserts + ShowDelete = 0x020, ///< show all deletes + ShowMask = ShowInsert | ShowDelete, + + // For internal management: + // remove the original Redlines together with their content + // (Clipboard/text modules). + DeleteRedlines = 0x100, + // don't combine any redlines. This flag may be only used in Undo. + DontCombineRedlines = 0x400, +}; +namespace o3tl +{ + template<> struct typed_flags<RedlineFlags> : is_typed_flags<RedlineFlags, 0x533> {}; +} + +inline OUString SwRedlineTypeToOUString(RedlineType eType) +{ + OUString sRet; + switch(eType) + { + case RedlineType::Insert: sRet = "Insert"; break; + case RedlineType::Delete: sRet = "Delete"; break; + case RedlineType::Format: sRet = "Format"; break; + case RedlineType::ParagraphFormat: sRet = "ParagraphFormat"; break; + case RedlineType::Table: sRet = "TextTable"; break; + case RedlineType::FmtColl:sRet = "Style"; break; + default: break; + } + return sRet; +}; + +class IDocumentRedlineAccess +{ + // Static helper functions +public: + static bool IsShowChanges(const RedlineFlags eM) + { return (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete) == (eM & RedlineFlags::ShowMask); } + + static bool IsHideChanges(const RedlineFlags eM) + { return RedlineFlags::ShowInsert == (eM & RedlineFlags::ShowMask); } + + static bool IsShowOriginal(const RedlineFlags eM) + { return RedlineFlags::ShowDelete == (eM & RedlineFlags::ShowMask); } + + static bool IsRedlineOn(const RedlineFlags eM) + { return RedlineFlags::On == (eM & (RedlineFlags::On | RedlineFlags::Ignore )); } + +public: + + /** Query the currently set redline mode + + @returns + the currently set redline mode + */ + virtual RedlineFlags GetRedlineFlags() const = 0; + + /** Set a new redline mode. + + @param eMode + [in] the new redline mode. + */ + virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode) = 0; + + /** Set a new redline mode. + + @param eMode + [in] the new redline mode. + */ + virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode) = 0; + + /** Query if redlining is on. + + @returns + <TRUE/> if redlining is on <FALSE/> otherwise + */ + virtual bool IsRedlineOn() const = 0; + + virtual bool IsIgnoreRedline() const = 0; + + virtual const SwRedlineTable& GetRedlineTable() const = 0; + virtual SwRedlineTable& GetRedlineTable() = 0; + virtual const SwExtraRedlineTable& GetExtraRedlineTable() const = 0; + virtual SwExtraRedlineTable& GetExtraRedlineTable() = 0; + virtual bool HasExtraRedlineTable() const = 0; + + virtual bool IsInRedlines(const SwNode& rNode) const = 0; + + enum class AppendResult { IGNORED, MERGED, APPENDED }; + /** Append a new redline + + @param pNewRedl redline to insert + + @param bCallDelete + if set, then for a new DELETE redline that is inserted so that it + overlaps an existing INSERT redline with the same author, the + overlapping range is deleted, i.e. the new DELETE removes + existing INSERT for that range + + @returns + APPENDED if pNewRedl is still alive and was appended + MERGED if pNewRedl was deleted but has been merged with existing one + IGNORED if pNewRedl was deleted and ignored/invalid + */ + virtual AppendResult AppendRedline(/*[in]*/SwRangeRedline* pNewRedl, /*[in]*/bool bCallDelete) = 0; + + virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr) = 0; + virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr) = 0; + + virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0; + + virtual bool DeleteRedline( + /*[in]*/const SwPaM& rPam, + /*[in]*/bool bSaveInUndo, + /*[in]*/RedlineType nDelType) = 0; + + virtual bool DeleteRedline( + /*[in]*/const SwStartNode& rSection, + /*[in]*/bool bSaveInUndo, + /*[in]*/RedlineType nDelType) = 0; + + virtual SwRedlineTable::size_type GetRedlinePos( + /*[in]*/const SwNode& rNode, + /*[in]*/RedlineType nType) const = 0; + + virtual void CompressRedlines() = 0; + + virtual const SwRangeRedline* GetRedline( + /*[in]*/const SwPosition& rPos, + /*[in]*/SwRedlineTable::size_type* pFndPos) const = 0; + + virtual bool IsRedlineMove() const = 0; + + virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0; + + virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; + + virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; + + virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam ) = 0; + + virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; + + virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; + + virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0; + + virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0; + + virtual void AcceptAllRedline(/*[in]*/bool bAcceptReject) = 0; + + // Representation has changed, invalidate all Redlines. + virtual void UpdateRedlineAttr() = 0; + + // Create a new Author if required. + virtual std::size_t GetRedlineAuthor() = 0; + + // For Readers etc.: register new Author in table. + virtual std::size_t InsertRedlineAuthor(const OUString& rAuthor) = 0; + + // Place a comment at Redline at given position. + virtual bool SetRedlineComment( + /*[in]*/const SwPaM& rPam, + /*[in]*/const OUString& rComment) = 0; + + virtual const css::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0; + + virtual void SetRedlinePassword( + /*[in]*/const css::uno::Sequence <sal_Int8>& rNewPassword) = 0; + +protected: + virtual ~IDocumentRedlineAccess() {}; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx new file mode 100644 index 000000000..2388b3ad4 --- /dev/null +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -0,0 +1,252 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTSETTINGACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTSETTINGACCESS_HXX + +#include <sal/types.h> +#include "fldupde.hxx" +#include <i18nlangtag/lang.h> +#include <memory> + +class SvxForbiddenCharactersTable; +namespace com::sun::star::i18n { struct ForbiddenCharacters; } +enum class CharCompressType; + +enum class DocumentSettingId +{ + // COMPATIBILITY FLAGS START + PARA_SPACE_MAX, + PARA_SPACE_MAX_AT_PAGES, + + TAB_COMPAT, + + ADD_FLY_OFFSETS, + ADD_VERTICAL_FLY_OFFSETS, + + OLD_NUMBERING, + + ADD_EXT_LEADING, + USE_VIRTUAL_DEVICE, + USE_HIRES_VIRTUAL_DEVICE, + OLD_LINE_SPACING, + ADD_PARA_SPACING_TO_TABLE_CELLS, + ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, + USE_FORMER_OBJECT_POS, + USE_FORMER_TEXT_WRAPPING, + CONSIDER_WRAP_ON_OBJECT_POSITION, + + IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, + DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, + TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, + DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, + + DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, + TABLE_ROW_KEEP, + IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, + CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME, + + // tdf#104349 tdf#104668 + MS_WORD_COMP_TRAILING_BLANKS, + // tdf#128197 MS Word in some modes can have line height based on shape height, not on font + MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY, + UNIX_FORCE_ZERO_EXT_LEADING, + TABS_RELATIVE_TO_INDENT, + PROTECT_FORM, + // #i89181# + TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, + INVERT_BORDER_SPACING, + COLLAPSE_EMPTY_CELL_PARA, + SMALL_CAPS_PERCENTAGE_66, + TAB_OVERFLOW, + UNBREAKABLE_NUMBERINGS, + CLIPPED_PICTURES, + BACKGROUND_PARA_OVER_DRAWINGS, + TAB_OVER_MARGIN, + // MS Word still wraps text around objects with less space than LO would. + SURROUND_TEXT_WRAP_SMALL, + PROP_LINE_SPACING_SHRINKS_FIRST_LINE, + SUBTRACT_FLYS, + // tdf#112443 disable off-page content positioning + DISABLE_OFF_PAGE_POSITIONING, + EMPTY_DB_FIELD_HIDES_PARA, + // COMPATIBILITY FLAGS END + BROWSE_MODE, + HTML_MODE, + GLOBAL_DOCUMENT, + GLOBAL_DOCUMENT_SAVE_LINKS, + LABEL_DOCUMENT, + PURGE_OLE, + KERN_ASIAN_PUNCTUATION, + MATH_BASELINE_ALIGNMENT, + STYLES_NODEFAULT, + FLOATTABLE_NOMARGINS, + EMBED_FONTS, + EMBED_USED_FONTS, + EMBED_LATIN_SCRIPT_FONTS, + EMBED_ASIAN_SCRIPT_FONTS, + EMBED_COMPLEX_SCRIPT_FONTS, + EMBED_SYSTEM_FONTS, + APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, + CONTINUOUS_ENDNOTES, + PROTECT_BOOKMARKS, + PROTECT_FIELDS, + HEADER_SPACING_BELOW_LAST_PARA, +}; + + /** Provides access to settings of a document + */ + class IDocumentSettingAccess + { + public: + /** Return the specified document setting. + + @param id + [in] the identifier of the document setting to be returned. + See above for a list of valid document setting identifiers. + + @returns + the value of the requested document setting. + */ + virtual bool get(/*[in]*/ DocumentSettingId id) const = 0; + + /** Set the specified document setting. + + @param id + [in] the identifier of the document setting to be set. + See above for a list of valid document setting identifiers. + + @param value + [in] the new value of the specified document setting. + */ + virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) = 0; + + /** Return the forbidden characters. + + @param nLang + [in] the language for which the forbidden character list is returned. + + @param bLocaleData + [in] if set and there is no user defined forbidden character list for + language lang, the default list for language lang will be returned. + + @returns + a list of forbidden characters. + */ + virtual const css::i18n::ForbiddenCharacters* + getForbiddenCharacters(/*[in]*/ LanguageType nLang, /*[in]*/ bool bLocaleData ) const = 0; + + /** Set the forbidden characters. + + @param nLang + [in] the language for which the forbidden character list should be set. + + @param rForbiddenCharacters + [in] the new list of forbidden characters for language lang. + */ + virtual void setForbiddenCharacters(/*[in]*/ LanguageType nLang, + /*[in]*/ const css::i18n::ForbiddenCharacters& rForbiddenCharacters ) = 0; + + /** Get the forbidden character table and creates one if necessary. + + @returns + the forbidden characters table. + */ + virtual std::shared_ptr<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() = 0; + + /** Get the forbidden character table. + + @returns + the forbidden characters table. + */ + virtual const std::shared_ptr<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const = 0; + + /** Get the current link update mode. + + @param bGlobalSettings + [in] if set, the link update mode is obtained from the module, + if it is set to GLOBALSETTING + + @returns + the current link update mode. + */ + virtual sal_uInt16 getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const = 0; + + /** Set the current link update mode. + + @param nMode + [in] the new link update mode. + */ + virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode ) = 0; + + /** Get the current field update mode. + + @param bGlobalSettings + [in] if set, the field update mode is obtained from the module, + if it is set to GLOBALSETTING + + @returns + the current field update mode. + */ + virtual SwFieldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const = 0; + + /** Set the current field update mode. + + @param nMode + [in] the new field update mode. + */ + virtual void setFieldUpdateFlags( /*[in]*/ SwFieldUpdateFlags nMode ) = 0; + + /** Get the character compression type for Asian characters. + + @returns + the current character compression mode. + */ + virtual CharCompressType getCharacterCompressionType() const = 0; + + /** Set the character compression type for Asian characters. + + @param nMode + [in] the new character compression type. + */ + virtual void setCharacterCompressionType( /*[in]*/CharCompressType nType ) = 0; + + /** Get the n32DummyCompatabilityOptions1 + */ + virtual sal_uInt32 Getn32DummyCompatibilityOptions1() const = 0; + + /** Set the n32DummyCompatabilityOptions1 + */ + virtual void Setn32DummyCompatibilityOptions1( const sal_uInt32 CompatibilityOptions1 ) = 0; + + /** Get the n32DummyCompatabilityOptions2 + */ + virtual sal_uInt32 Getn32DummyCompatibilityOptions2() const = 0; + + /** Set the n32DummyCompatabilityOptions2 + */ + virtual void Setn32DummyCompatibilityOptions2( const sal_uInt32 CompatibilityOptions2 ) = 0; + +protected: + virtual ~IDocumentSettingAccess() {}; + }; + +#endif // INCLUDED_SW_INC_IDOCUMENTSETTINGACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx new file mode 100644 index 000000000..6374842bd --- /dev/null +++ b/sw/inc/IDocumentState.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTSTATE_HXX +#define INCLUDED_SW_INC_IDOCUMENTSTATE_HXX + +/** Get information about the current document state + */ +class IDocumentState +{ +public: + /** Must be called manually at changes of format. + */ + virtual void SetModified() = 0; + + virtual void ResetModified() = 0; + + /** Changes of document? + */ + virtual bool IsModified() const = 0; + + virtual bool IsInCallModified() const = 0; + + virtual bool IsUpdateExpField() const = 0; + + virtual bool IsNewDoc() const = 0; + + virtual void SetNewDoc(bool b) = 0; + + virtual void SetUpdateExpFieldStat(bool b) = 0; + + virtual bool IsEnableSetModified() const = 0; + virtual void SetEnableSetModified(bool bEnableSetModified) = 0; + +protected: + virtual ~IDocumentState() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTSTATE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentStatistics.hxx b/sw/inc/IDocumentStatistics.hxx new file mode 100644 index 000000000..9f953d485 --- /dev/null +++ b/sw/inc/IDocumentStatistics.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTSTATISTICS_HXX +#define INCLUDED_SW_INC_IDOCUMENTSTATISTICS_HXX + +struct SwDocStat; + +/** Document statistics information + */ +class IDocumentStatistics +{ +public: + + /** DocInfo has changed (notify via DocShell): + make required fields update. + */ + virtual void DocInfoChgd(bool isEnableSetModified) = 0; + + /** Document - Statistics + */ + /// Returns a reference to the existing document statistics + virtual const SwDocStat &GetDocStat() const = 0; + + /** + * Updates the document statistics if the document has been + * modified and returns a reference to the result. + * \param bCompleteAsync if true will return a partial result, + * and potentially trigger a timeout to complete the work. + * \param bFields if stat. fields should be updated + */ + virtual const SwDocStat &GetUpdatedDocStat(bool bCompleteAsync, bool bFields) = 0; + + /// Set the document statistics + virtual void SetDocStat(const SwDocStat& rStat) = 0; + + /** + * Updates the internal document's statistics + * \param bCompleteAsync if true it may do part of the + * work and trigger a timeout to complete it. + * \param bFields if stat. fields should be updated + */ + virtual void UpdateDocStat(bool bCompleteAsync, bool bFields) = 0; + +protected: + virtual ~IDocumentStatistics() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTSTATISTICS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentStylePoolAccess.hxx b/sw/inc/IDocumentStylePoolAccess.hxx new file mode 100644 index 000000000..c56104b32 --- /dev/null +++ b/sw/inc/IDocumentStylePoolAccess.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTSTYLEPOOLACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTSTYLEPOOLACCESS_HXX + +#include <sal/types.h> + +class SwTextFormatColl; +class SwCharFormat; +class SwFormat; +class SwFrameFormat; +class SwNumRule; +class SwPageDesc; + +/** Access to the style pool + */ +class IDocumentStylePoolAccess +{ +public: + + /** Return "Auto-Collection with ID. + Create, if it does not yet exist. + If string pointer is defined request only description + of attributes, do not create style sheet! + */ + virtual SwTextFormatColl* GetTextCollFromPool( sal_uInt16 nId, bool bRegardLanguage = true ) = 0; + + /** Return required automatic format base class. + */ + virtual SwFormat* GetFormatFromPool( sal_uInt16 nId ) = 0; + + /** Return required automatic format. + */ + virtual SwFrameFormat* GetFrameFormatFromPool( sal_uInt16 nId ) = 0; + + virtual SwCharFormat* GetCharFormatFromPool( sal_uInt16 nId ) = 0; + + /** Return required automatic page style. + */ + virtual SwPageDesc* GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage = true ) = 0; + + virtual SwNumRule* GetNumRuleFromPool( sal_uInt16 nId ) = 0; + + /** Check whether this "auto-collection" is used in document. + */ + virtual bool IsPoolTextCollUsed( sal_uInt16 nId ) const = 0; + virtual bool IsPoolFormatUsed( sal_uInt16 nId ) const = 0; + virtual bool IsPoolPageDescUsed( sal_uInt16 nId ) const = 0; + +protected: + virtual ~IDocumentStylePoolAccess() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTSTYLEPOOLACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentTimerAccess.hxx b/sw/inc/IDocumentTimerAccess.hxx new file mode 100644 index 000000000..f3e273848 --- /dev/null +++ b/sw/inc/IDocumentTimerAccess.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTTIMERACCESS_HXX +#define INCLUDED_SW_INC_IDOCUMENTTIMERACCESS_HXX + +/** + * Handle the background jobs of a Writer document. + * + * Initially it's disabled and unblocked. + * + * Jobs include: + * * grammar checking + * * field updating + * * document layouting + */ +class IDocumentTimerAccess +{ +public: + /** + * Start the idle task. + * + * Depends on the block count and various document states. + */ + virtual void StartIdling() = 0; + + /** + * Stop idle processing. + */ + virtual void StopIdling() = 0; + + /** + * Increment block count. + * + * Prevents further background idle processing. + * This doesn't guarantee the Idle task is not currently running! + */ + virtual void BlockIdling() = 0; + + /** + * Decrement block count. + * + * May re-start the idle task, if active. + */ + virtual void UnblockIdling() = 0; + + /** + * Is the document ready to be processed? + */ + virtual bool IsDocIdle() const = 0; + +protected: + virtual ~IDocumentTimerAccess() {}; +}; + +#endif // INCLUDED_SW_INC_IDOCUMENTTIMERACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx new file mode 100644 index 000000000..b533a7e64 --- /dev/null +++ b/sw/inc/IDocumentUndoRedo.hxx @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IDOCUMENTUNDOREDO_HXX +#define INCLUDED_SW_INC_IDOCUMENTUNDOREDO_HXX + +#include <sal/types.h> + +#include "swundo.hxx" +#include <memory> + +class SwRewriter; +class SwNodes; +class SwUndo; +class SwView; + +namespace sw { + class RepeatContext; +} + +class IDocumentUndoRedo +{ +public: + + /** Enable/Disable Undo. + */ + virtual void DoUndo(bool const bDoUndo) = 0; + + /** Is Undo enabled? + */ + virtual bool DoesUndo() const = 0; + + /** Enable/Disable Group Undo. + This determines whether successive Insert/Delete/Overwrite + actions are combined. + */ + virtual void DoGroupUndo(bool const bDoUndo) = 0; + + /** Is Group Undo enabled? + */ + virtual bool DoesGroupUndo() const = 0; + + /** Enable/Disable Undo for Drawing objects. + */ + virtual void DoDrawUndo(bool const bDoUndo) = 0; + + /** Is Undo for Drawing objects enabled? + for Draw-Undo: writer wants to handle actions on Flys on its own. + */ + virtual bool DoesDrawUndo() const = 0; + + /// Enable repair mode. + virtual void DoRepair(bool bRepair) = 0; + /// Is repair mode active? + virtual bool DoesRepair() const = 0; + + /** Set the position at which the document is in the "unmodified" state + to the current position in the Undo stack. + */ + virtual void SetUndoNoModifiedPosition() = 0; + + /** Prevent updates to the "unmodified" state position + via SetUndoNoResetModified(). + */ + virtual void LockUndoNoModifiedPosition() = 0; + + /** Allow updates to the "unmodified" state position + via SetUndoNoResetModified(). + */ + virtual void UnLockUndoNoModifiedPosition() = 0; + + /** Disable (re)setting the document modified flag on Undo/Redo. + */ + virtual void SetUndoNoResetModified() = 0; + + /** Is setting the document modified flag on Undo/Redo disabled? + */ + virtual bool IsUndoNoResetModified() const = 0; + + /** Execute Undo. + + @return true if executing the last Undo action was successful. + */ + virtual bool Undo() = 0; + + /** Opens undo block. + + @remark StartUndo() and EndUndo() do nothing if !DoesUndo(). + + @param nUndoId undo ID for the list action + @param pRewriter rewriter for comments @see SwUndo::GetComment + + If the given nUndoId is equal to zero an undo object with ID + SwUndoId::START will be generated. + + @return the undo ID of the created object + */ + virtual SwUndoId StartUndo(SwUndoId const eUndoId, + SwRewriter const*const pRewriter) = 0; + + /** + Closes undo block. + + @remark StartUndo() and EndUndo() do nothing if !DoesUndo(). + + @param nUndoId undo ID for the list action + @param pRewriter rewriter for comments @see SwUndo::GetComment + + If the given nUndoId is not SwUndoId::EMPTY or SwUndoId::END, the comment of + the resulting list action will be set via the nUndoId, applying the + given pRewriter (if not 0). Otherwise the comment of the resulting + list action is unchanged if it has an UndoId that is not SwUndoId::START + set by StartUndo, and in case the UndoId is SwUndoId::START the comment + of the list action defaults to the comment of the last action + contained in the list action. + */ + virtual SwUndoId EndUndo(SwUndoId const eUndoId, + SwRewriter const*const pRewriter) = 0; + + /** + Delete all Undo actions. + Of course Undo will be disabled during deletion. + */ + virtual void DelAllUndoObj() = 0; + + /** Get Id and comment of last Undo action. + @param o_pStr if not 0, receives comment of last Undo action. + @param o_pId if not 0, receives Id of last Undo action. + @param pView if not nullptr, get the info for this view + @return true if there is a Undo action, false if none + */ + virtual bool GetLastUndoInfo(OUString *const o_pStr, + SwUndoId *const o_pId, + const SwView* pView = nullptr) const = 0; + + /** Get comments of Undo actions. + @return comments of all top-level Undo actions. + */ + virtual SwUndoComments_t GetUndoComments() const = 0; + + /** Execute Redo. + + @return true if executing the first Redo action was successful. + */ + virtual bool Redo() = 0; + + /** Get Id and comment of first Redo action. + @param o_pStr if not 0, receives comment of first Redo action. + @param o_pId if not 0, receives Id of first Redo action. + @param pView if not nullptr, get the info for this view + @return true if there is a Redo action, false if none + */ + virtual bool GetFirstRedoInfo(OUString *const o_pStr, + SwUndoId *const o_pId, + const SwView* pView = nullptr) const = 0; + + /** Get comments of Redo actions. + @return comments of all top-level Redo actions. + */ + virtual SwUndoComments_t GetRedoComments() const = 0; + + /** Repeat the last Undo action. + @return true if repeating the last Undo Redo action was attempted. + */ + virtual bool Repeat(::sw::RepeatContext & rContext, + sal_uInt16 const nRepeatCnt) = 0; + + /** Get Id and comment of last Undo action, if it is Repeat capable. + @param o_pStr if not 0, receives comment of last Undo action + if it is Repeat capable. + @return Id of last Undo action if it is Repeat capable, + or SwUndoId::EMPTY if there is none or it is not Repeat capable. + */ + virtual SwUndoId GetRepeatInfo(OUString *const o_pStr) const = 0; + + /** Add new Undo action. + Takes over ownership of pUndo. + @remark calls ClearRedo(), except for SwUndoId::START/SwUndoId::END. + @remark does nothing if !DoesUndo(). + */ + virtual void AppendUndo(std::unique_ptr<SwUndo> pUndo) = 0; + + /** Delete all Redo actions. + */ + virtual void ClearRedo() = 0; + + /* Is the given nodes array the Undo nodes array? + */ + virtual bool IsUndoNodes(SwNodes const& rNodes) const = 0; + + /** Get the number of Undo actions. + */ + virtual size_t GetUndoActionCount(const bool bCurrentLevel = true) const = 0; + + /** Return undo/redo info for this view. + */ + virtual void SetView(SwView* pView) = 0; + +protected: + virtual ~IDocumentUndoRedo() {}; +}; + +namespace sw { + +class UndoGuard +{ +public: + + UndoGuard(IDocumentUndoRedo & rUndoRedo) + : m_rUndoRedo(rUndoRedo) + , m_bUndoWasEnabled(rUndoRedo.DoesUndo()) + { + m_rUndoRedo.DoUndo(false); + } + ~UndoGuard() + { + m_rUndoRedo.DoUndo(m_bUndoWasEnabled); + } + + bool UndoWasEnabled() const + { + return m_bUndoWasEnabled; + } + +private: + IDocumentUndoRedo & m_rUndoRedo; + bool const m_bUndoWasEnabled; +}; + +class GroupUndoGuard +{ +public: + + GroupUndoGuard(IDocumentUndoRedo & rUndoRedo) + : m_rUndoRedo(rUndoRedo) + , m_bGroupUndoWasEnabled(rUndoRedo.DoesGroupUndo()) + { + m_rUndoRedo.DoGroupUndo(false); + } + ~GroupUndoGuard() + { + m_rUndoRedo.DoGroupUndo(m_bGroupUndoWasEnabled); + } + +private: + IDocumentUndoRedo & m_rUndoRedo; + bool const m_bGroupUndoWasEnabled; +}; + +class DrawUndoGuard +{ +public: + + DrawUndoGuard(IDocumentUndoRedo & rUndoRedo) + : m_rUndoRedo(rUndoRedo) + , m_bDrawUndoWasEnabled(rUndoRedo.DoesDrawUndo()) + { + m_rUndoRedo.DoDrawUndo(false); + } + ~DrawUndoGuard() + { + m_rUndoRedo.DoDrawUndo(m_bDrawUndoWasEnabled); + } + +private: + IDocumentUndoRedo & m_rUndoRedo; + bool const m_bDrawUndoWasEnabled; +}; + +} // namespace sw + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IGrammarContact.hxx b/sw/inc/IGrammarContact.hxx new file mode 100644 index 000000000..83d0c59c8 --- /dev/null +++ b/sw/inc/IGrammarContact.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IGRAMMARCONTACT_HXX +#define INCLUDED_SW_INC_IGRAMMARCONTACT_HXX + +struct SwPosition; +class SwTextNode; +class SwGrammarMarkUp; + +/** Organizer of the contact between SwTextNodes and grammar checker +*/ +class IGrammarContact +{ +public: + + /** Update cursor position reacts to a change of the current input cursor + As long as the cursor in inside a paragraph, the grammar checking does + not show new grammar faults. When the cursor leaves the paragraph, these + faults are shown. + @returns void + */ + virtual void updateCursorPosition( const SwPosition& rNewPos ) = 0; + + /** getGrammarCheck checks if the given text node is blocked by the current cursor + if not, the normal markup list is returned + if blocked, it will return a markup list "proxy" + @returns a markup list (grammar) for the given SwTextNode + */ + virtual SwGrammarMarkUp* getGrammarCheck( SwTextNode& rTextNode, bool bCreate ) = 0; + + /** finishGrammarCheck() has to be called if a grammar checking has been completed + for a text node. If this text node has not been hidden by the current proxy list + it will be repainted. Otherwise the proxy list replaces the old list and the + repaint will be triggered by a timer + @returns void + */ + virtual void finishGrammarCheck( SwTextNode& rTextNode ) = 0; + +public: + virtual ~IGrammarContact() {} +}; + +/** Factory for a grammar contact +@returns a new created grammar contact object +*/ +IGrammarContact* createGrammarContact(); + +/* Helper functions */ + +/** getGrammarContact() delivers the grammar contact of the document (for a given textnode) +@returns grammar contact +*/ +IGrammarContact* getGrammarContact( const SwTextNode& ); + +/** finishGrammarCheck() calls the same function of the grammar contact of the document (for a given textnode) +@returns void +*/ +void finishGrammarCheck( SwTextNode& ); + +#endif // INCLUDED_SW_INC_IGRAMMARCONTACT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx new file mode 100644 index 000000000..151c9a933 --- /dev/null +++ b/sw/inc/IMark.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_IMARK_HXX +#define INCLUDED_SW_INC_IMARK_HXX + +#include <vcl/keycod.hxx> +#include "calbck.hxx" +#include "pam.hxx" +#include <map> +#include <memory> +#include "swdllapi.h" + +namespace sw::mark +{ + enum class InsertMode + { + New, + CopyText, + }; + + class SW_DLLPUBLIC IMark + : virtual public sw::BroadcastingModify // inherited as interface + { + protected: + IMark() = default; + + public: + //getters + virtual const SwPosition& GetMarkPos() const =0; + // GetOtherMarkPos() is only guaranteed to return a valid + // reference if IsExpanded() returned true + virtual const SwPosition& GetOtherMarkPos() const =0; + virtual const SwPosition& GetMarkStart() const =0; + virtual const SwPosition& GetMarkEnd() const =0; + virtual const OUString& GetName() const =0; + virtual bool IsExpanded() const =0; + virtual bool IsCoveringPosition(const SwPosition& rPos) const =0; + + //setters + // not available in IMark + // inside core, you can cast to MarkBase and use its setters, + // make sure to update the sorting in Markmanager in this case + + virtual OUString ToString( ) const =0; + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const = 0; + private: + IMark(IMark const &) = delete; + IMark &operator =(IMark const&) = delete; + }; + + class SW_DLLPUBLIC IBookmark + : virtual public IMark + { + protected: + IBookmark() = default; + + public: + virtual const OUString& GetShortName() const =0; + virtual const vcl::KeyCode& GetKeyCode() const =0; + virtual void SetShortName(const OUString&) =0; + virtual void SetKeyCode(const vcl::KeyCode&) =0; + virtual bool IsHidden() const =0; + virtual const OUString& GetHideCondition() const =0; + virtual void Hide(bool hide) =0; + virtual void SetHideCondition(const OUString&) =0; + private: + IBookmark(IBookmark const &) = delete; + IBookmark &operator =(IBookmark const&) = delete; + }; + + class SW_DLLPUBLIC IFieldmark + : virtual public IMark + { + protected: + IFieldmark() = default; + + public: + typedef std::map< OUString, css::uno::Any> parameter_map_t; + //getters + virtual OUString GetFieldname() const =0; + virtual OUString GetFieldHelptext() const =0; + virtual parameter_map_t* GetParameters() =0; + virtual const parameter_map_t* GetParameters() const =0; + + //setters + virtual void SetFieldname(const OUString& rFieldname) =0; + virtual void SetFieldHelptext(const OUString& rFieldHelptext) =0; + virtual void Invalidate() = 0; + private: + IFieldmark(IFieldmark const &) = delete; + IFieldmark &operator =(IFieldmark const&) = delete; + }; + + class SW_DLLPUBLIC ICheckboxFieldmark + : virtual public IFieldmark + { + protected: + ICheckboxFieldmark() = default; + + public: + virtual bool IsChecked() const =0; + virtual void SetChecked(bool checked) =0; + private: + ICheckboxFieldmark(ICheckboxFieldmark const &) = delete; + ICheckboxFieldmark &operator =(ICheckboxFieldmark const&) = delete; + }; + + class SW_DLLPUBLIC IDateFieldmark + : virtual public IFieldmark + { + protected: + IDateFieldmark() = default; + + public: + virtual OUString GetContent() const = 0; + virtual void ReplaceContent(const OUString& sNewContent) = 0; + + virtual std::pair<bool, double> GetCurrentDate() const = 0; + virtual void SetCurrentDate(double fDate) = 0; + virtual OUString GetDateInStandardDateFormat(double fDate) const = 0; + + private: + IDateFieldmark(ICheckboxFieldmark const &) = delete; + IDateFieldmark &operator =(ICheckboxFieldmark const&) = delete; + }; + + OUString ExpandFieldmark(IFieldmark* pBM); + +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/IShellCursorSupplier.hxx b/sw/inc/IShellCursorSupplier.hxx new file mode 100644 index 000000000..e1c8085ae --- /dev/null +++ b/sw/inc/IShellCursorSupplier.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_ISHELLCURSORSUPPLIER_HXX +#define INCLUDED_SW_INC_ISHELLCURSORSUPPLIER_HXX + +class SwPaM; + +namespace sw { + +/** The Undo actions need to create new Shell cursors. + Just creating new SwPaMs in the Undo actions is not sufficient, + because only Shell cursors are corrected by doccorr.cxx. + */ +class IShellCursorSupplier +{ +public: + virtual ~IShellCursorSupplier() { } + virtual SwPaM & CreateNewShellCursor() = 0; + virtual SwPaM & GetCurrentShellCursor() = 0; +}; + +} // namespace sw + +#endif // INCLUDED_SW_INC_ISHELLCURSORSUPPLIER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageColumnPopup.hxx b/sw/inc/PageColumnPopup.hxx new file mode 100644 index 000000000..784f75786 --- /dev/null +++ b/sw/inc/PageColumnPopup.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PAGECOLUMNPOPUP_HXX +#define INCLUDED_SW_INC_PAGECOLUMNPOPUP_HXX + +#include <svtools/popupwindowcontroller.hxx> +#include "swdllapi.h" + +class PageColumnPopup final : public svt::PopupWindowController +{ +public: + PageColumnPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext); + virtual ~PageColumnPopup() override; + + virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override; + virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override; +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageMarginPopup.hxx b/sw/inc/PageMarginPopup.hxx new file mode 100644 index 000000000..160684d69 --- /dev/null +++ b/sw/inc/PageMarginPopup.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PAGEMARGINPOPUP_HXX +#define INCLUDED_SW_INC_PAGEMARGINPOPUP_HXX + +#include <svtools/popupwindowcontroller.hxx> +#include "swdllapi.h" + +class PageMarginPopup final : public svt::PopupWindowController +{ +public: + PageMarginPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext); + virtual ~PageMarginPopup() override; + + virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override; + virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageOrientationPopup.hxx b/sw/inc/PageOrientationPopup.hxx new file mode 100644 index 000000000..a9d2f677f --- /dev/null +++ b/sw/inc/PageOrientationPopup.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PAGEORIENTATIONPOPUP_HXX +#define INCLUDED_SW_INC_PAGEORIENTATIONPOPUP_HXX + +#include <svtools/popupwindowcontroller.hxx> +#include "swdllapi.h" + +class PageOrientationPopup final : public svt::PopupWindowController +{ +public: + PageOrientationPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext); + virtual ~PageOrientationPopup() override; + + virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override; + virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PageSizePopup.hxx b/sw/inc/PageSizePopup.hxx new file mode 100644 index 000000000..5b528b1ac --- /dev/null +++ b/sw/inc/PageSizePopup.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PAGESIZEPOPUP_HXX +#define INCLUDED_SW_INC_PAGESIZEPOPUP_HXX + +#include <svtools/popupwindowcontroller.hxx> +#include "swdllapi.h" + +class PageSizePopup final : public svt::PopupWindowController +{ +public: + PageSizePopup(const css::uno::Reference<css::uno::XComponentContext>& rContext); + virtual ~PageSizePopup() override; + + virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override; + virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override; +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx new file mode 100644 index 000000000..9108fac28 --- /dev/null +++ b/sw/inc/PostItMgr.hxx @@ -0,0 +1,282 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_POSTITMGR_HXX +#define INCLUDED_SW_INC_POSTITMGR_HXX + +#include <sal/config.h> +#include "swdllapi.h" + +#include <cstddef> +#include <memory> +#include <vector> +#include <rtl/ustring.hxx> +#include <sal/log.hxx> +#include <tools/link.hxx> +#include "swrect.hxx" +#include <unotools/configitem.hxx> +#include <com/sun/star/uno/Any.hxx> +#include "SidebarWindowsTypes.hxx" +#include <svl/lstner.hxx> +#include <vcl/vclptr.hxx> + +class OutputDevice; +class SwWrtShell; +class SwView; +class SwPostItField; +class SwFormatField; +class SfxBroadcaster; +class SfxHint; +class SwEditWin; +class Color; +class SfxItemSet; +class SvxSearchItem; +namespace sw::annotation { class SwAnnotationWin; } +namespace sw::sidebarwindows { class SwFrameSidebarWinContainer; } +class SwSidebarItem; +class SwFrame; +namespace vcl { class Window; } +struct ImplSVEvent; +class OutlinerParaObject; +namespace i18nutil { struct SearchOptions2; } + +#define COL_NOTES_SIDEPANE_ARROW_ENABLED Color(0,0,0) +#define COL_NOTES_SIDEPANE_ARROW_DISABLED Color(172,168,153) + +struct SwPostItPageItem +{ + bool bScrollbar; + sw::sidebarwindows::SidebarPosition eSidebarPosition; + long lOffset; + SwRect mPageRect; + std::vector<SwSidebarItem*> mvSidebarItems; + SwPostItPageItem(): bScrollbar(false), eSidebarPosition( sw::sidebarwindows::SidebarPosition::LEFT ), lOffset(0) + { + } +}; + +struct FieldShadowState +{ + const SwPostItField* mpShadowField; + bool bCursor; + bool bMouse; + FieldShadowState(): mpShadowField(nullptr),bCursor(false),bMouse(false) + { + } +}; + +class SwNoteProps final : public utl::ConfigItem +{ + private: + bool m_bIsShowAnchor; + + virtual void ImplCommit() override; + + public: + SwNoteProps() + : ConfigItem("Office.Writer/Notes") + , m_bIsShowAnchor(false) + { + const css::uno::Sequence< OUString >& rNames = GetPropertyNames(); + css::uno::Sequence< css::uno::Any > aValues = GetProperties(rNames); + const css::uno::Any* pValues = aValues.getConstArray(); + SAL_WARN_IF(aValues.getLength() != rNames.getLength(), "sw", "GetProperties failed"); + if (aValues.hasElements()) + pValues[0]>>=m_bIsShowAnchor; + } + + bool IsShowAnchor() const + { + return m_bIsShowAnchor; + } + static css::uno::Sequence< OUString >& GetPropertyNames() + { + static css::uno::Sequence< OUString > aNames; + if(!aNames.hasElements()) + { + aNames.realloc(1); + OUString* pNames = aNames.getArray(); + pNames[0] = "ShowAnkor"; + } + return aNames; + } + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; +}; + +class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener +{ + private: + SwView* mpView; + SwWrtShell* mpWrtShell; + VclPtr<SwEditWin> mpEditWin; + std::vector<std::unique_ptr<SwSidebarItem>> mvPostItFields; + std::vector<std::unique_ptr<SwPostItPageItem>> mPages; + ImplSVEvent * mnEventId; + bool mbWaitingForCalcRects; + VclPtr<sw::annotation::SwAnnotationWin> mpActivePostIt; + bool mbLayout; + long mbLayoutHeight; + bool mbLayouting; + bool mbReadOnly; + bool mbDeleteNote; + FieldShadowState mShadowState; + OutlinerParaObject* mpAnswer; + OUString maAnswerText; + bool mbIsShowAnchor; + + // data structure to collect the <SwAnnotationWin> instances for certain <SwFrame> instances. + std::unique_ptr<sw::sidebarwindows::SwFrameSidebarWinContainer> mpFrameSidebarWinContainer; + + void AddPostIts(bool bCheckExistence = true,bool bFocus = true); + void RemoveSidebarWin(); + void PreparePageContainer(); + void Scroll(const long lScroll,const unsigned long aPage ); + void AutoScroll(const sw::annotation::SwAnnotationWin* pPostIt,const unsigned long aPage ); + bool ScrollbarHit(const unsigned long aPage,const Point &aPoint); + bool LayoutByPage( std::vector<sw::annotation::SwAnnotationWin*> &aVisiblePostItList, + const tools::Rectangle& rBorder, + long lNeededHeight); + void CheckForRemovedPostIts(); + bool ArrowEnabled(sal_uInt16 aDirection,unsigned long aPage) const; + bool BorderOverPageBorder(unsigned long aPage) const; + bool HasScrollbars() const; + void Focus(SfxBroadcaster& rBC); + + sal_Int32 GetInitialAnchorDistance() const; + sal_Int32 GetScrollSize() const; + sal_Int32 GetSpaceBetween() const; + void SetReadOnlyState(); + DECL_LINK( CalcHdl, void*, void); + + sw::annotation::SwAnnotationWin* GetSidebarWin(const SfxBroadcaster* pBroadcaster) const; + + SwSidebarItem* InsertItem( SfxBroadcaster* pItem, bool bCheckExistence, bool bFocus); + void RemoveItem( SfxBroadcaster* pBroadcast ); + + public: + SwPostItMgr(SwView* aDoc); + virtual ~SwPostItMgr() override; + + typedef std::vector< std::unique_ptr<SwSidebarItem> >::const_iterator const_iterator; + const_iterator begin() const { return mvPostItFields.begin(); } + const_iterator end() const { return mvPostItFields.end(); } + + void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + void LayoutPostIts(); + bool CalcRects(); + + void MakeVisible( const sw::annotation::SwAnnotationWin* pPostIt); + + bool ShowScrollbar(const unsigned long aPage) const; + bool HasNotes() const ; + bool ShowNotes() const; + bool IsShowAnchor() const { return mbIsShowAnchor;} + unsigned long GetSidebarWidth(bool bPx = false) const; + unsigned long GetSidebarBorderWidth(bool bPx = false) const; + + void PrepareView(bool bIgnoreCount = false); + + void CorrectPositions(); + + void SetLayout() { mbLayout = true; }; + void Delete(const OUString& aAuthor); + void Delete(sal_uInt32 nPostItId); + void Delete(); + void ToggleResolved(sal_uInt32 nPostItId); + void ToggleResolvedForThread(sal_uInt32 nPostItId); + + void ExecuteFormatAllDialog(SwView& rView); + void FormatAll(const SfxItemSet &rNewAttr); + + void Hide( const OUString& rAuthor ); + void Hide(); + void Show(); + void UpdateResolvedStatus(const sw::annotation::SwAnnotationWin* topNote); + void ShowHideResolvedNotes(bool visible); + + void Rescale(); + + tools::Rectangle GetBottomScrollRect(const unsigned long aPage) const; + tools::Rectangle GetTopScrollRect(const unsigned long aPage) const; + + bool IsHit(const Point &aPointPixel); + /// Get the matching window that is responsible for handling mouse events of rPointLogic, if any. + vcl::Window* IsHitSidebarWindow(const Point& rPointLogic); + Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const; + + sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pField) const; + sw::annotation::SwAnnotationWin* GetAnnotationWin(const sal_uInt32 nPostItId) const; + + sw::annotation::SwAnnotationWin* GetNextPostIt( sal_uInt16 aDirection, + sw::annotation::SwAnnotationWin* aPostIt); + long GetNextBorder(); + + sw::annotation::SwAnnotationWin* GetActiveSidebarWin() { return mpActivePostIt; } + void SetActiveSidebarWin( sw::annotation::SwAnnotationWin* p); + SW_DLLPUBLIC bool HasActiveSidebarWin() const; + bool HasActiveAnnotationWin() const; + void GrabFocusOnActiveSidebarWin(); + SW_DLLPUBLIC void UpdateDataOnActiveSidebarWin(); + void DeleteActiveSidebarWin(); + void HideActiveSidebarWin(); + void ToggleInsModeOnActiveSidebarWin(); + + sal_Int32 GetMinimumSizeWithMeta() const; + sal_Int32 GetSidebarScrollerHeight() const; + + void SetShadowState(const SwPostItField* pField,bool bCursor = true); + + void SetSpellChecking(); + + static Color GetColorDark(std::size_t aAuthorIndex); + static Color GetColorLight(std::size_t aAuthorIndex); + static Color GetColorAnchor(std::size_t aAuthorIndex); + + void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;} + OutlinerParaObject* IsAnswer() {return mpAnswer;} + void RegisterAnswerText(const OUString& aAnswerText) { maAnswerText = aAnswerText; } + const OUString& GetAnswerText() const { return maAnswerText; } + void CheckMetaText(); + + sal_uInt16 Replace(SvxSearchItem const * pItem); + sal_uInt16 SearchReplace(const SwFormatField &pField, const i18nutil::SearchOptions2& rSearchOptions,bool bSrchForward); + sal_uInt16 FinishSearchReplace(const i18nutil::SearchOptions2& rSearchOptions,bool bSrchForward); + + void AssureStdModeAtShell(); + + void ConnectSidebarWinToFrame( const SwFrame& rFrame, + const SwFormatField& rFormatField, + sw::annotation::SwAnnotationWin& rSidebarWin ); + void DisconnectSidebarWinFromFrame( const SwFrame& rFrame, + sw::annotation::SwAnnotationWin& rSidebarWin ); + bool HasFrameConnectedSidebarWins( const SwFrame& rFrame ); + vcl::Window* GetSidebarWinForFrameByIndex( const SwFrame& rFrame, + const sal_Int32 nIndex ); + void GetAllSidebarWinForFrame( const SwFrame& rFrame, + std::vector< vcl::Window* >* pChildren ); + + void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage); + void PaintTile(OutputDevice& rRenderContext); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SidebarWindowsTypes.hxx b/sw/inc/SidebarWindowsTypes.hxx new file mode 100644 index 000000000..f41414fc9 --- /dev/null +++ b/sw/inc/SidebarWindowsTypes.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#pragma once + +namespace sw::sidebarwindows { + +enum class ViewState +{ + NORMAL, + VIEW, + EDIT +}; + +enum class SidebarPosition +{ + LEFT, // sidebar on left side + RIGHT, // sidebar on right side + NONE // sidebar on neither side +}; + +} // end of namespace sw::sidebarwindows + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwAppletImpl.hxx b/sw/inc/SwAppletImpl.hxx new file mode 100644 index 000000000..615dbee0a --- /dev/null +++ b/sw/inc/SwAppletImpl.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWAPPLETIMPL_HXX +#define INCLUDED_SW_INC_SWAPPLETIMPL_HXX + +#include <config_java.h> + +#include <svl/itemset.hxx> +#include <svl/ownlist.hxx> + +namespace com::sun::star::embed { class XEmbeddedObject; } + +enum class SwHtmlOptType { + IGNORE = 0, + TAG = 1, + PARAM = 2, + SIZE = 3 +}; + +#define OOO_STRING_SW_HTML_O_Hidden "HIDDEN" + +class SwApplet_Impl +{ + css::uno::Reference < css::embed::XEmbeddedObject > xApplet; + SvCommandList aCommandList; + SfxItemSet aItemSet; + OUString sAlt; + +public: + static SwHtmlOptType GetOptionType( const OUString& rName, bool bApplet ); + SwApplet_Impl( SfxItemPool& rPool ); + SwApplet_Impl( SfxItemSet const & rSet ): aItemSet ( rSet) {} + ~SwApplet_Impl(); + void CreateApplet( const OUString& rCode, const OUString& rName, + bool bMayScript, const OUString& rCodeBase, + const OUString& rBaseURL ); +#if HAVE_FEATURE_JAVA + bool CreateApplet( const OUString& rBaseURL ); + void AppendParam( const OUString& rName, const OUString& rValue ); +#endif + void FinishApplet(); + const css::uno::Reference < css::embed::XEmbeddedObject >& GetApplet() const { return xApplet; } + SfxItemSet& GetItemSet() { return aItemSet; } + const OUString& GetAltText() const { return sAlt; } + void SetAltText( const OUString& rAlt ) {sAlt = rAlt;} +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwCapObjType.hxx b/sw/inc/SwCapObjType.hxx new file mode 100644 index 000000000..abae5349f --- /dev/null +++ b/sw/inc/SwCapObjType.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWCAPOBJTYPE_HXX +#define INCLUDED_SW_INC_SWCAPOBJTYPE_HXX + +enum SwCapObjType +{ + FRAME_CAP, GRAPHIC_CAP, TABLE_CAP, OLE_CAP +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwDocIdle.hxx b/sw/inc/SwDocIdle.hxx new file mode 100644 index 000000000..ac15b34ee --- /dev/null +++ b/sw/inc/SwDocIdle.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWDOCIDLE_HXX +#define INCLUDED_SW_INC_SWDOCIDLE_HXX + +#include <vcl/idle.hxx> + +class SwDoc; + +namespace sw { + +/** + * An Idle, which is just ready to be scheduled for idle documents. + * + * Currently it's missing the notification, when busy documents become idle + * again, so it relies on any task being triggered to recheck, which is + * quite probably not a problem, as busy documents have a high chance to have + * generated idle tasks. + */ +class SwDocIdle final : public Idle +{ +private: + SwDoc &m_rDoc; + + virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nTimeNow ) const override; + +public: + SwDocIdle( SwDoc &doc ); + virtual ~SwDocIdle() override; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwGetPoolIdFromName.hxx b/sw/inc/SwGetPoolIdFromName.hxx new file mode 100644 index 000000000..2a42fae6f --- /dev/null +++ b/sw/inc/SwGetPoolIdFromName.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWGETPOOLIDFROMNAME_HXX +#define INCLUDED_SW_INC_SWGETPOOLIDFROMNAME_HXX + +#include <sal/types.h> + +/* When using the NameMapper to translate pool ids to UI or programmatic + * names, this enum is used to define which family is required */ + +enum class SwGetPoolIdFromName : sal_uInt16 { + TxtColl = 0x01, + ChrFmt = 0x02, + FrmFmt = 0x04, + PageDesc = 0x08, + NumRule = 0x10, + TabStyle = 0x20, + CellStyle= 0x40 +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwNodeNum.hxx b/sw/inc/SwNodeNum.hxx new file mode 100644 index 000000000..a29099dbf --- /dev/null +++ b/sw/inc/SwNodeNum.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWNODENUM_HXX +#define INCLUDED_SW_INC_SWNODENUM_HXX + +#include "SwNumberTree.hxx" + +class SwTextNode; +struct SwPosition; +class SwNumRule; + +class SAL_DLLPUBLIC_RTTI SwNodeNum : public SwNumberTreeNode +{ +public: + + explicit SwNodeNum( SwTextNode* pTextNode, bool isHiddenRedlines ); + // note: this is only for creating phantom nodes and root nodes; these + // never have a text node + explicit SwNodeNum( SwNumRule* pNumRule ); + virtual ~SwNodeNum() override; + + SwNumRule* GetNumRule() const { return mpNumRule;} + void ChangeNumRule( SwNumRule& rNumRule ); + SwTextNode* GetTextNode() const { return mpTextNode;} + + virtual bool IsNotificationEnabled() const override; + + virtual bool IsContinuous() const override; + + virtual bool IsCounted() const override; + + virtual bool LessThan(const SwNumberTreeNode & rNode) const override; + + virtual bool IsRestart() const override; + + virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const override; + + SwPosition GetPosition() const; + + // The number tree root node is deleted, when the corresponding numbering + // rule is deleted. In this situation the number tree should be empty - + // still registered text nodes aren't allowed. But it is possible, that + // text nodes of the undo nodes array are still registered. These will be + // unregistered. + // Text nodes of the document nodes array aren't allowed to be registered + // in this situation - this will be asserted. + static void HandleNumberTreeRootNodeDelete( SwNodeNum& rNodeNum ); + + /** determines the <SwNodeNum> instance, which is preceding the given text node + + #i81002# + */ + const SwNodeNum* GetPrecedingNodeNumOf( const SwTextNode& rTextNode ) const; + +protected: + virtual SwNumberTreeNode * Create() const override; + + // --> #i64010# + virtual bool HasCountedChildren() const override; + virtual bool IsCountedForNumbering() const override; + + // method called before this tree node has been added to the list tree + virtual void PreAdd() override; + // method called at a child after this child has been removed from the list tree + virtual void PostRemove() override; +private: + SwTextNode *const mpTextNode; + SwNumRule * mpNumRule; + bool m_isHiddenRedlines; + + static void UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum ); + + SwNodeNum( const SwNodeNum& ) = delete; + SwNodeNum& operator=( const SwNodeNum& ) = delete; + + virtual bool IsCountPhantoms() const override; + + virtual bool IsNotifiable() const override; + + virtual void NotifyNode() override; +}; + +#endif // INCLUDED_SW_INC_SWNODENUM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx new file mode 100644 index 000000000..9323d3df5 --- /dev/null +++ b/sw/inc/SwNumberTree.hxx @@ -0,0 +1,604 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#pragma once + +#include <set> +#include <vector> +#include "swdllapi.h" +#include "SwNumberTreeTypes.hxx" + +class SwNumberTreeNode; + +bool SwNumberTreeNodeLessThan (const SwNumberTreeNode * pA, + const SwNumberTreeNode * pB); + +struct compSwNumberTreeNodeLessThan +{ + bool operator()(const SwNumberTreeNode * pA, + const SwNumberTreeNode * pB) const + { return SwNumberTreeNodeLessThan(pA, pB); } +}; + +/** + A tree of numbered nodes. + + Simple example: + + <pre> + 1. kshdkjfs + 1.1. lskjf + 2. sdfjlksaf + 3. fkaoslk + 3.1. lfjlaskf + 3.2. jaslkjflsf + 3.2.1. hkljhkjhk + + + R + + 1 kshdkjfs + | + 1 lskjf + + 2 sdfjlksaf + + 3 fkaoslk + + 1 lfjlaskf + + 2 jaslkjflsf + + 1 hkljhkjhk + </pre> + + The root contains the nodes of the first level. Each node A of the + first level contains those nodes of the second level that have the + same first level number as A and so on for the subsidiary levels. + + The numbering label of a node A is resolved by concatenating the + numbers of the nodes on the path from the root to A. + + ------------------------------------------ + + Phantoms + + A phantom is an auxiliary node that is used to emulate numberings + starting with nodes not at top level. The phantom contains the + number for the level but is not considered part of the numbering. + + Constraint 1: A phantom is always the first child node. + Constraint 2: At each node there is at most one child that is a phantom. + Constraint 3: A phantom is the smallest of all numbering nodes. + + Uncounted Phantoms + + 0.1. dljflskjlasf + 5. abcdagaha + 5.1. + + + R (nStart = 5) + + 0 (phantom, not counted) + | + 1 dljflskjlasf + + 5 abcdagaha + + 1 + + The phantom gets numbered with 0. The first non-phantom node gets + numbered with the start value. + + ----------------------------------------- + + Counted Phantoms + + 5.1. lgkjjgklg + 6. lkjfalskjflsaf + 6.1. ljdflaksjflkjasflkjsf + + + R (nStart = 5) + + 5 (phantom, counted) + | + 1 lgkjjgklg + + 6 lkjfalskjflsaf + + 1 ljdflaksjflkjasflkjsf + + The phantom gets numbered with the start value. +*/ +class SAL_DLLPUBLIC_RTTI SwNumberTreeNode +{ +protected: + typedef std::set<SwNumberTreeNode *, compSwNumberTreeNodeLessThan> + tSwNumberTreeChildren; + +public: + SwNumberTreeNode(); + + virtual ~SwNumberTreeNode(); + + /** + Add a child. + + @param pChild child to add + @param nDepth depth in which to add the child + */ + void AddChild( SwNumberTreeNode* pChild, + const int nDepth ); + + /** + Remove a child. + + @param pChild child to be removed + */ + void RemoveChild( SwNumberTreeNode* pChild ); + + /** + Remove this child from the tree. + */ + void RemoveMe(); + + /** + Returns the parent of this node. + + @return the parent + */ + SwNumberTreeNode* GetParent() const + { + return mpParent; + } + + /** + Returns number of this node. + + @param bValidate validate the number? + + @return number of this node + */ + SwNumberTree::tSwNumTreeNumber GetNumber( bool bValidate = true ) const; + + bool IsContinueingPreviousSubTree() const { return mbContinueingPreviousSubTree;} + + /** + Returns level numbers of this node. + + @return level numbers of this node + */ + SwNumberTree::tNumberVector GetNumberVector() const; + + /** + Return if numbering is restarted at this node. + */ + virtual bool IsRestart() const = 0; + + /** + Return start value. + + @return start value + */ + virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const = 0; + + /** + Return if this node is counted. + + @retval true this node is counted + @retval false this node is NOT counted + */ + virtual bool IsCounted() const; + + /** + Return if this node is counted continuous. + + @retval true This node is counted continuous. + @retval false else + */ + virtual bool IsContinuous() const = 0; + + /** + Return if a node is first non-phantom child of this node. + + @param pNode the node to check + + @retval true pNode is first child of this node + @retval false else + */ + bool IsFirst(const SwNumberTreeNode * pNode) const; + + /** + Return if this node if the first non-phantom node in the tree. + + @retval true this node is the first non-phantom node in the tree + @retval false else + */ + bool IsFirst() const; + + /** + Return if this node is a phantom. + + @retval true this node is a phantom + @retval false this node is NOT a phantom + */ + bool IsPhantom() const { return mbPhantom;} + + /** set level of this node + + precondition: node is already member of a list tree + */ + void SetLevelInListTree( const int nLevel ); + + /** + Return level of this node. + + The level of this node is the length of the path from the root + to this node. + + @return the level of this node + */ + int GetLevelInListTree() const; + + /** + Returns if this node is less than another node. + + @param rTreeNode node to compare with + + @attention A phantom node is considered the least element with + respect to lessThan. + + @retval true this node is less than rTreeNode + @retval false else + */ + virtual bool LessThan(const SwNumberTreeNode & rTreeNode) const; + + /** + Invalidate this node and all its descendants. + + All iterators holding the last valid node in the according list + of children are set to the end of this list, thereby stating all + children in the list are invalid. + #i83479# - made public + */ + void InvalidateTree() const; + + /** + Notifies all invalid children of this node. + #i83479# - made public + */ + void NotifyInvalidChildren(); + + /** + Notifies the node. + + Calls Invalidate(this) on parent. + */ + void InvalidateMe(); + + /** + Validates this node. + + Calls Validate(this) on parent. + */ + void ValidateMe(); + + /** Notifies all invalid siblings of this node. */ + void NotifyInvalidSiblings(); + + /** notification of all nodes in the list tree on certain list level */ + void NotifyNodesOnListLevel( const int nListLevel ); + + /** Invalidation and notification of complete numbering tree + + #i64010# + Usage: on <IsCounted()> state change it's needed to invalidate the + complete numbering tree due to wide influence of this change. + */ + void InvalidateAndNotifyTree() + { + if ( GetRoot() ) + { + GetRoot()->InvalidateTree(); + GetRoot()->Notify(); + } + } + + /** + Returns the greatest descendant of the root that is smaller than + this node, aka the predecessor of this node. + + @return the predecessor + */ + SwNumberTreeNode* GetPred( bool bSibling = false ) const; + + /** determines the node, which is preceding the node + + #i81002# + The search for the preceding node is performed for the tree below the + <this> node. To search the complete tree, the method has been called for + the root of the tree. + */ + const SwNumberTreeNode* GetPrecedingNodeOf( const SwNumberTreeNode& rNode ) const; + +#ifdef DBG_UTIL + /** + Sanity check. + + @param bRecursive descend to children + + @retval true the structure of this node is sane + @retval false else + */ + void IsSane(bool bRecursive) const; +#endif // DBG_UTIL + +protected: + /** the children */ + tSwNumberTreeChildren mChildren; + + /** + Returns the root node of the tree this node is part of. + + Important note: method call <GetRoot()->GetRoot()> returns NULL. + + @return the root + */ + SwNumberTreeNode* GetRoot() const; + + /** + Return if the notification is not disabled on global conditions + + @retval true Notification enabled in general. + @retval false else + */ + virtual bool IsNotificationEnabled() const = 0; + + /** + Returns how many children this node has got. + + @return number of children + */ + tSwNumberTreeChildren::size_type GetChildCount() const; + + // #i64010# - made pure virtual + virtual bool HasCountedChildren() const = 0; + + // #i64010# + virtual bool IsCountedForNumbering() const = 0; + + // method called before this tree node has been added to the list tree + virtual void PreAdd() = 0; + // method called after this tree node has been removed from the list tree + virtual void PostRemove() = 0; + +#ifdef DBG_UTIL + /** Sanity check with loop detection. + + @param bRecursive descend to children + @param rParents vector for recording path + */ + void IsSane(bool bRecursive, std::vector<const SwNumberTreeNode *> rParents) const; +#endif // DBG_UTIL + + /** he parent node */ + SwNumberTreeNode * mpParent; + + /** the number of the node */ + mutable SwNumberTree::tSwNumTreeNumber mnNumber; + + // boolean indicating, that a node of a not counted parent node is continuing + // the numbering of parent's previous node sub tree. + // Example: + // 1. kshdkjfs + // 1.1. lskjf + // sdfjlksaf <-- not counted parent node + // 1.2. lfjlaskf <-- <mbContinueingPreviousSubTree = true> + mutable bool mbContinueingPreviousSubTree; + + /** + true this node is a phantom + false this node is NOT a phantom + */ + bool mbPhantom; + + /** + Iterator to the last valid element. All children that are less + than or equal to the referenced child are valid. All children + greater than the referenced child are invalid. + */ + mutable tSwNumberTreeChildren::const_iterator mItLastValid; + + SwNumberTreeNode(const SwNumberTreeNode& ); + SwNumberTreeNode& operator=( const SwNumberTreeNode& ); + + /** + Calls GetNumberVector_ on parent and adds number of this node + at the end. + + @param rVector return value + @param bValidate validate the number? + */ + void GetNumberVector_( SwNumberTree::tNumberVector& rVector, + bool bValidate = true ) const; + + /** + Invalidates a child. + + Calls SetLastValid for the preceding sibling of the child and + notifies all invalid children. + + @param pChild the child to invalidate + */ + void Invalidate( SwNumberTreeNode const * pChild ); + + /** Invalidation of all children + + Usage: on <IsCounted()> state change the children have to be invalidated + */ + void InvalidateChildren() + { + SetLastValid( mChildren.end() ); + } + + /** + Set the last valid child of this node. + + @param aItLastValid iterator pointing to the new last valid child + @param bValidating - true always set the last valid node to + aItLastValid + - false only set if aItLastValid is preceding + the current last valid node + */ + void SetLastValid(const tSwNumberTreeChildren::const_iterator& aItLastValid, + bool bValidating = false) const; + + /** + Return if this node is notifiable. + + @attention If a not is not notifiable a notify request is *not* + forwarded to its descendants. + + @retval true This node is notifiable. + @retval false else + */ + virtual bool IsNotifiable() const = 0; + + /** + Notifies the node. + + Called when the number of the node got invalid. + */ + virtual void NotifyNode() = 0; + + /** Notifies this node (NotifyNode) and all descendants.*/ + void Notify(); + + /** notification of children nodes on certain depth */ + void NotifyChildrenOnDepth( const int nDepth ); + + /** + Returns if a child A this node is valid. + + A is valid if aItLastValid in parent refers to a node + greater than of equal to A. + + @param pChild child to be tested + + @retval true this node is valid + @retval false this node is NOT valid + */ + bool IsValid(const SwNumberTreeNode * pChild) const; + + /** + Returns if this node is valid. + + @retval true this node is valid + @retval false else + */ + bool IsValid() const; + + /** + Validates a child. + + @param pNode child to be validated + + @attention All invalid children preceding pNode are validated, too. + */ + void Validate(const SwNumberTreeNode * pNode) const; + + /** + Validates a child using hierarchical numbering. + + @param pNode child to be validated + + @attention All invalid children preceding pNode are validated, too. + */ + void ValidateHierarchical(const SwNumberTreeNode * pNode) const; + + /** + Validates a child using continuous numbering. + + @param pNode child to be validated + + @attention All invalid children preceding pNode are validated, too. + */ + void ValidateContinuous(const SwNumberTreeNode * pNode) const; + + /** + Creates a new node of the same class. + + @return the new node + */ + virtual SwNumberTreeNode * Create() const = 0; + + /** + Creates a phantom. + + @return the created phantom + */ + SwNumberTreeNode * CreatePhantom(); + + /** + Return if phantoms are counted. + */ + virtual bool IsCountPhantoms() const = 0; + + /** Return if all descendants of this node are phantoms. */ + bool HasOnlyPhantoms() const; + + bool HasPhantomCountedParent() const; + + /** + HB, OD : return node, if it isn't a phantom, otherwise return first + non-phantom descendant. + Returns the first child of this node that is NOT a phantom. + + @return the first non phantom child + */ + SwNumberTreeNode* GetFirstNonPhantomChild(); + + /** + Removes recursively phantoms that have no children. + + The resulting tree has no phantoms that either have no children or + whose descendancy consist entirely of phantoms. + */ + void ClearObsoletePhantoms(); + + tSwNumberTreeChildren::const_iterator GetIterator(const SwNumberTreeNode * pChild) const; + + /** + Moves all children to a given destination node. + + @param pDest the destination node + */ + void MoveChildren(SwNumberTreeNode * pDest); + + /** Moves all children of this node that are greater than a given node + to the destination node. + + distinguish between node for comparing, whose children are greater, + and the destination node. + + @param _rCompareNode + input parameter - reference to the node, which is used to determine + the greater children + + @param _rDestNode + input parameter - reference to the node, which is the destination for + the greater children + */ + void MoveGreaterChildren( SwNumberTreeNode& _rCompareNode, + SwNumberTreeNode& _rDestNode ); + + /** + Returns the last descendant of a node, if it has children. + + @return last descendant of the node + */ + SwNumberTreeNode* GetLastDescendant() const; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwNumberTreeTypes.hxx b/sw/inc/SwNumberTreeTypes.hxx new file mode 100644 index 000000000..e05fa667f --- /dev/null +++ b/sw/inc/SwNumberTreeTypes.hxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWNUMBERTREETYPES_HXX +#define INCLUDED_SW_INC_SWNUMBERTREETYPES_HXX + +#include <vector> + +namespace SwNumberTree +{ + typedef long tSwNumTreeNumber; + typedef std::vector<tSwNumTreeNumber> tNumberVector; +} + +#endif // INCLUDED_SW_INC_SWNUMBERTREETYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwRewriter.hxx b/sw/inc/SwRewriter.hxx new file mode 100644 index 000000000..0adc40e87 --- /dev/null +++ b/sw/inc/SwRewriter.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWREWRITER_HXX +#define INCLUDED_SW_INC_SWREWRITER_HXX + +#include <vector> +#include <rtl/ustring.hxx> +#include "swdllapi.h" + +enum SwUndoArg +{ + UndoArg1, + UndoArg2, + UndoArg3 +}; + +typedef std::pair<SwUndoArg, OUString> SwRewriteRule; + +class SW_DLLPUBLIC SwRewriter +{ + std::vector<SwRewriteRule> mRules; + +public: + SwRewriter(); + + void AddRule(SwUndoArg eWhat, const OUString & rWith); + + OUString Apply(const OUString & rStr) const; + + static OUString GetPlaceHolder(SwUndoArg eId); +}; + +#endif // INCLUDED_SW_INC_SWREWRITER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwSmartTagMgr.hxx b/sw/inc/SwSmartTagMgr.hxx new file mode 100644 index 000000000..3a9c1dbe5 --- /dev/null +++ b/sw/inc/SwSmartTagMgr.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWSMARTTAGMGR_HXX +#define INCLUDED_SW_INC_SWSMARTTAGMGR_HXX + +#include <svx/SmartTagMgr.hxx> + +// Wrapper for the svx SmartTagMgr +class SwSmartTagMgr final : public SmartTagMgr +{ +private: + static SwSmartTagMgr* spTheSwSmartTagMgr; + + SwSmartTagMgr( const OUString& rModuleName ); + virtual ~SwSmartTagMgr() override; + +public: + static SwSmartTagMgr& Get(); + + // css::util::XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + // css::util::XChangesListener + virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& Event ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx new file mode 100644 index 000000000..139f09c97 --- /dev/null +++ b/sw/inc/SwStyleNameMapper.hxx @@ -0,0 +1,158 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWSTYLENAMEMAPPER_HXX +#define INCLUDED_SW_INC_SWSTYLENAMEMAPPER_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include "SwGetPoolIdFromName.hxx" +#include "swdllapi.h" + +#include <unordered_map> +#include <vector> + +/** This class holds all data about the names of styles used in the user + * interface (UI names...these are localised into different languages). + * These UI names are loaded from the resource files on demand. + * + * It also holds all information about the 'Programmatic' names of styles + * which remain static (and are hardcoded in the corresponding cxx file) + * for all languages. + * + * This class also provides static functions which can be used for the + * following conversions: + * + * 1. Programmatic Name -> UI Name + * 2. Programmatic Name -> Pool ID + * 3. UI Name -> Programmatic Name + * 4. UI Name -> Pool ID + * 5. Pool ID -> UI Name + * 6. Pool ID -> Programmatic Name + * + * The relationship of these tables to the style families is as follows: + * + * 1. Paragraph contains the Text, Lists, Extra, Register, Doc and HTML + * name arrays. + * 2. Character contains the ChrFormat and HTMLChrFormat name arrays. + * 3. Page contains the PageDesc name array. + * 4. Frame contains the FrameFormat name array. + * 5. Numbering Rule contains the NumRule name array. + */ + +/** + * There is a further complication that came to light later. If someone enters + * a user-defined style name which is the same as a programmatic name, this + * name clash must be handled. + * + * Therefore, when there is a danger of a nameclash, the boolean bDisambiguate + * must be set to true in the SwStyleNameMapper call (it defaults to false). + * This will cause the following to happen: + * + * If the UI style name either equals a programmatic name or already ends + * with " (user)", then it must append " (user)" to the end. + * + * When a programmatic name is being converted to a UI name, if it ends in + * " (user)", we simply remove it. + */ + +typedef std::unordered_map<OUString, sal_uInt16> NameToIdHash; + +class SwStyleNameMapper final +{ + friend void InitCore(); + friend void FinitCore(); + + static void fillNameFromId(sal_uInt16 nId, OUString &rName, bool bProgName); + static const OUString& getNameFromId(sal_uInt16 nId, const OUString &rName, + bool bProgName); + static const NameToIdHash& getHashTable ( SwGetPoolIdFromName, bool bProgName ); +#ifdef _NEED_TO_DEBUG_MAPPING + static void testNameTable( SwGetPoolIdFromName const nFamily, sal_uInt16 const nStartIndex, sal_uInt16 const nEndIndex ); +#endif + +public: + // This gets the UI Name from the programmatic name + static const OUString& GetUIName(const OUString& rName, SwGetPoolIdFromName); + static void FillUIName(const OUString& rName, OUString& rFillName, + SwGetPoolIdFromName); + + // Get the programmatic Name from the UI name + static const OUString& GetProgName(const OUString& rName, + SwGetPoolIdFromName); + static void FillProgName(const OUString& rName, OUString& rFillName, + SwGetPoolIdFromName); + + // This gets the UI Name from the Pool ID + SW_DLLPUBLIC static void FillUIName(sal_uInt16 nId, OUString& rFillName); + SW_DLLPUBLIC static const OUString& GetUIName(sal_uInt16 nId, + const OUString& rName); + + // This gets the programmatic Name from the Pool ID + static void FillProgName(sal_uInt16 nId, OUString& rFillName); + SW_DLLPUBLIC static const OUString& GetProgName(sal_uInt16 nId, + const OUString& rName); + + // This gets the PoolId from the UI Name + SW_DLLPUBLIC static sal_uInt16 GetPoolIdFromUIName(const OUString& rName, + SwGetPoolIdFromName); + + // Get the Pool ID from the programmatic name + static sal_uInt16 GetPoolIdFromProgName(const OUString& rName, + SwGetPoolIdFromName); + + // used to convert the 4 special ExtraProg/UINames for + // RES_POOLCOLL_LABEL_DRAWING, RES_POOLCOLL_LABEL_ABB, + // RES_POOLCOLL_LABEL_TABLE, RES_POOLCOLL_LABEL_FRAME + // forth and back. + // Non-matching names remain unchanged. + SW_DLLPUBLIC static const OUString & GetSpecialExtraProgName( + const OUString& rExtraUIName); + static const OUString & GetSpecialExtraUIName(const OUString& rExtraProgName); + + static const std::vector<OUString>& GetTextUINameArray(); + static const std::vector<OUString>& GetListsUINameArray(); + static const std::vector<OUString>& GetExtraUINameArray(); + static const std::vector<OUString>& GetRegisterUINameArray(); + static const std::vector<OUString>& GetDocUINameArray(); + static const std::vector<OUString>& GetHTMLUINameArray(); + static const std::vector<OUString>& GetFrameFormatUINameArray(); + static const std::vector<OUString>& GetChrFormatUINameArray(); + static const std::vector<OUString>& GetHTMLChrFormatUINameArray(); + static const std::vector<OUString>& GetPageDescUINameArray(); + static const std::vector<OUString>& GetNumRuleUINameArray(); + static const std::vector<OUString>& GetTableStyleUINameArray(); + static const std::vector<OUString>& GetCellStyleUINameArray(); + + static const std::vector<OUString>& GetTextProgNameArray(); + static const std::vector<OUString>& GetListsProgNameArray(); + static const std::vector<OUString>& GetExtraProgNameArray(); + static const std::vector<OUString>& GetRegisterProgNameArray(); + static const std::vector<OUString>& GetDocProgNameArray(); + static const std::vector<OUString>& GetHTMLProgNameArray(); + static const std::vector<OUString>& GetFrameFormatProgNameArray(); + static const std::vector<OUString>& GetChrFormatProgNameArray(); + static const std::vector<OUString>& GetHTMLChrFormatProgNameArray(); + static const std::vector<OUString>& GetPageDescProgNameArray(); + static const std::vector<OUString>& GetNumRuleProgNameArray(); + static const std::vector<OUString>& GetTableStyleProgNameArray(); + static const std::vector<OUString>& GetCellStyleProgNameArray(); +}; +#endif // _NAME_MAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx new file mode 100644 index 000000000..5b62429a1 --- /dev/null +++ b/sw/inc/SwUndoField.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWUNDOFIELD_HXX +#define INCLUDED_SW_INC_SWUNDOFIELD_HXX + +#include "undobj.hxx" + +#include <com/sun/star/uno/Any.h> + +class SwDoc; +class SwField; +class SwMsgPoolItem; + +class SwUndoField : public SwUndo +{ + sal_uLong nNodeIndex; + sal_Int32 nOffset; + +protected: + SwDoc * pDoc; + SwPosition GetPosition(); + +public: + SwUndoField(const SwPosition & rPos ); + virtual ~SwUndoField() override; +}; + +class SwUndoFieldFromDoc final : public SwUndoField +{ + std::unique_ptr<SwField> pOldField, pNewField; + SwMsgPoolItem * pHint; + bool bUpdate; + + void DoImpl(); + +public: + SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField, + const SwField & aNewField, + SwMsgPoolItem * pHint, bool bUpdate); + + virtual ~SwUndoFieldFromDoc() override; + + virtual void UndoImpl( ::sw::UndoRedoContext & ) override; + virtual void RedoImpl( ::sw::UndoRedoContext & ) override; + virtual void RepeatImpl( ::sw::RepeatContext & ) override; +}; + +class SwUndoFieldFromAPI final : public SwUndoField +{ + css::uno::Any aOldVal, aNewVal; + sal_uInt16 nWhich; + + void DoImpl(); + +public: + SwUndoFieldFromAPI(const SwPosition & rPos, + const css::uno::Any & rOldVal, + const css::uno::Any & rNewVal, + sal_uInt16 nWhich); + virtual ~SwUndoFieldFromAPI() override; + + virtual void UndoImpl( ::sw::UndoRedoContext & ) override; + virtual void RedoImpl( ::sw::UndoRedoContext & ) override; + virtual void RepeatImpl( ::sw::RepeatContext & ) override; +}; + +#endif // INCLUDED_SW_INC_SWUNDOFIELD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/SwXMLSectionList.hxx b/sw/inc/SwXMLSectionList.hxx new file mode 100644 index 000000000..99255b85d --- /dev/null +++ b/sw/inc/SwXMLSectionList.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWXMLSECTIONLIST_HXX +#define INCLUDED_SW_INC_SWXMLSECTIONLIST_HXX + +#include <xmloff/xmlimp.hxx> + +class SwXMLSectionList final : public SvXMLImport +{ +public: + std::vector<OUString> & m_rSectionList; + + SwXMLSectionList( + const css::uno::Reference< css::uno::XComponentContext >& rContext, + std::vector<OUString> & rNewSectionList); + + virtual ~SwXMLSectionList ( ) throw() override; + +private: + virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/TextCursorHelper.hxx b/sw/inc/TextCursorHelper.hxx new file mode 100644 index 000000000..3f15248a6 --- /dev/null +++ b/sw/inc/TextCursorHelper.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TEXTCURSORHELPER_HXX +#define INCLUDED_SW_INC_TEXTCURSORHELPER_HXX + +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase1.hxx> + +class SwDoc; +class SwPaM; + +class OTextCursorHelper : public ::cppu::ImplHelper1< css::lang::XUnoTunnel> +{ +public: + + OTextCursorHelper(){} + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + virtual const SwPaM* GetPaM() const = 0; + virtual SwPaM* GetPaM() = 0; + virtual const SwDoc* GetDoc() const = 0; + virtual SwDoc* GetDoc() = 0; + +protected: + ~OTextCursorHelper() {} +}; + +#endif // INCLUDED_SW_INC_TEXTCURSORHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxLinkProcessor.hxx b/sw/inc/ToxLinkProcessor.hxx new file mode 100644 index 000000000..e53c537b7 --- /dev/null +++ b/sw/inc/ToxLinkProcessor.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#ifndef SW_TOXLINKPROCESSOR_HXX_ +#define SW_TOXLINKPROCESSOR_HXX_ + +#include "fmtinfmt.hxx" +#include <rtl/ustring.hxx> + +#include <memory> +#include <vector> + +class SwTextNode; + +class ToxLinkProcessorTest; + +namespace sw { + +/** A helper class for ToxTextGenerator. + * It collects information about encountered link tokens and allows access in a processed form. + */ +class ToxLinkProcessor { +public: + ToxLinkProcessor() {} + virtual ~ToxLinkProcessor() {} + + void + StartNewLink(sal_Int32 startPosition, const OUString& characterStyle); + + /** Close a link which has been found during processing. + * + * @internal + * If you close more links than were opened, then the method will behave + * as if a start link was opened at position 0 with the character style + * STR_POOLCHR_TOXJUMP. + */ + void + CloseLink(sal_Int32 endPosition, const OUString& url); + + /** Insert the found links as attributes to a text node */ + void + InsertLinkAttributes(SwTextNode& node); + +private: + /** Obtain the pool id which belongs to a character style. + * + * @internal + * This method is overridden in the unittests. You should not override it yourself. + */ + virtual sal_uInt16 + ObtainPoolId(const OUString& characterStyle) const; + + /** Information about a started link */ + struct StartedLink { + StartedLink(sal_Int32 startPosition, const OUString& characterStyle) : + mStartPosition(startPosition), mCharacterStyle(characterStyle) { + } + sal_Int32 mStartPosition; + OUString mCharacterStyle; + }; + + /** A link that has been encountered while parsing a tox. + * A link is closed if it has both a start and an end token. + */ + struct ClosedLink { + ClosedLink(const OUString& url, sal_Int32 startPosition, sal_Int32 endPosition) + : mINetFormat(url, OUString()) + , mStartTextPos(startPosition) + , mEndTextPos(endPosition) + { + } + SwFormatINetFormat mINetFormat; + sal_Int32 mStartTextPos; + sal_Int32 mEndTextPos; + }; + + std::vector<std::unique_ptr<ClosedLink>> m_ClosedLinks; + + std::unique_ptr<StartedLink> m_pStartedLink; + + friend class ::ToxLinkProcessorTest; +}; + +} + +#endif /* SW_TOXLINKPROCESSOR_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxTabStopTokenHandler.hxx b/sw/inc/ToxTabStopTokenHandler.hxx new file mode 100644 index 000000000..5282f6897 --- /dev/null +++ b/sw/inc/ToxTabStopTokenHandler.hxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + + +#ifndef TOXTABSTOPTOKENHANDLER_HXX_ +#define TOXTABSTOPTOKENHANDLER_HXX_ + +#include <rtl/ustring.hxx> + +#include <editeng/tstpitem.hxx> + +struct SwFormToken; +class SwPageDesc; +class SwRootFrame; +class SwTextNode; + +namespace sw { + +/** This class handles tab stop tokens in the pattern for tox entries. + * + * @internal + * This is an interface class. It allows to mock the class in unit tests + */ +class ToxTabStopTokenHandler +{ +public: + virtual ~ToxTabStopTokenHandler() {} + + /** Return value of HandleTabStopToken */ + struct HandledTabStopToken { + OUString text; + SvxTabStop tabStop; + }; + + /** Handle a tab stop token. + * + * @returns A HandledTabStopToken. Make sure to append the text field to the text of the target node + * and to provide the returned SvxTabStop to the attributes of the node. + */ + virtual HandledTabStopToken + HandleTabStopToken(const SwFormToken& aToken, const SwTextNode& targetNode, + const SwRootFrame *currentLayout) const = 0; +}; + +/** The default implementation of ToxTabStopTokenHandler */ +class DefaultToxTabStopTokenHandler final : public ToxTabStopTokenHandler +{ +public: + + enum TabStopReferencePolicy {TABSTOPS_RELATIVE_TO_INDENT, TABSTOPS_RELATIVE_TO_PAGE}; + + /** + * @param indexOfSectionNode + * The index of the section node. It is needed to determine whether a page description was given by a node + * before the tox section. + * + * @param defaultPageDescription + * Which page description shall be used if we do not find one or the found page description was provided by + * a node before the tox section + * + * @param tabPositionIsRelativeToParagraphIndent + * Whether the tab position is relative to the paragraph indent. (toxForm.IsRelTabPos() is true or false.) + * + * @param tabstopReferencePolicy + * How tab stops are positioned. (#i21237) The default behavior is to place tab stops relative to the page. + */ + DefaultToxTabStopTokenHandler(sal_uInt32 indexOfSectionNode, const SwPageDesc& defaultPageDescription, + bool tabPositionIsRelativeToParagraphIndent, + TabStopReferencePolicy referencePolicy); + + /** Handle a tab stop token. + * + * If the token contains tab alignment information, that is used to create the SvxTabStop. + * Else, the information about the tab stop is taken from a page description. + * Depending on the TabStopReferencePolicy provided in the constructor, the + * method behaves differently when deriving the tab stop position. + */ + ToxTabStopTokenHandler::HandledTabStopToken + HandleTabStopToken(const SwFormToken& aToken, const SwTextNode& targetNode, + const SwRootFrame *currentLayout) const override; + +private: + /** Test whether the page layout can be obtained by a layout rectangle. + * + * Is used to determine how to find tab stop position. + */ + static bool + CanUseLayoutRectangle(const SwTextNode& targetNode, const SwRootFrame *currentLayout); + + /** Calculate the page margin from the page description. + * + * This is the fallback method to determine the position of a tab stop. + */ + long + CalculatePageMarginFromPageDescription(const SwTextNode& targetNode) const; + + sal_uInt32 mIndexOfSectionNode; + const SwPageDesc& mDefaultPageDescription; + bool mTabPositionIsRelativeToParagraphIndent; + TabStopReferencePolicy mTabStopReferencePolicy; +}; + +} + +#endif /* TOXTABSTOPTOKENHANDLER_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx new file mode 100644 index 000000000..675835573 --- /dev/null +++ b/sw/inc/ToxTextGenerator.hxx @@ -0,0 +1,172 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef SW_TOXTEXTGENERATOR_HXX_ +#define SW_TOXTEXTGENERATOR_HXX_ + +#include <rtl/ustring.hxx> +#include <sal/types.h> + +#include "fmtautofmt.hxx" + +#include <memory> +#include <vector> + +class SfxItemSet; +class SwAttrPool; +class SwFormatAutoFormat; +class SwChapterField; +class SwChapterFieldType; +class SwContentFrame; +class SwRootFrame; +class SwContentNode; +class SwDoc; +class SwForm; +struct SwFormToken; +class SwTextAttr; +class SwTextNode; +struct SwTOXSortTabBase; +class ToxTextGeneratorTest; + +namespace sw { + +class ToxLinkProcessor; +class ToxTabStopTokenHandler; +class ToxWhitespaceStripper; + +/** This class generates text for the entries of a table of x. + * + * You can control its behavior by calling @link SetTabstopPolicy() and specifying the desired behavior. + */ +class ToxTextGenerator +{ +public: + ToxTextGenerator(const SwForm& toxForm, std::shared_ptr<ToxTabStopTokenHandler> const & tabStopHandler); + + virtual ~ToxTextGenerator(); + + /** Generate the text for an entry of a table of X (X is, e.g., content). + * + * This method will process the entries in @p entries, starting at @p indexOfEntryToProcess and + * process @p numberOfEntriesToProcess entries. + */ + void + GenerateText(SwDoc *doc, const std::vector<std::unique_ptr<SwTOXSortTabBase>>& entries, + sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess, + SwRootFrame const* pLayout); + +private: + const SwForm& mToxForm; + std::shared_ptr<ToxLinkProcessor> mLinkProcessor; + std::shared_ptr<ToxTabStopTokenHandler> mTabStopTokenHandler; + + /** A handled text token. + * It contains the information which should be added to the target text node. + */ + struct HandledTextToken { + OUString text; + std::vector<std::unique_ptr<SwFormatAutoFormat>> autoFormats; + std::vector<sal_Int32> startPositions; + std::vector<sal_Int32> endPositions; + }; + + static void GetAttributesForNode( + HandledTextToken & rResult, + sal_Int32 & rOffset, + SwTextNode const& rNode, + ToxWhitespaceStripper const& rStripper, + SwAttrPool & rPool, + SwRootFrame const*const pLayout); + + /** Append text (and selected attributes) to a target node. + * + * Will take the text of @p source, and return the text and the attributes which should be added to the + * target text node. @see CollectAttributesForTox() for the criteria of the attributes which are taken. + */ + static HandledTextToken + HandleTextToken(const SwTOXSortTabBase& source, SwAttrPool& attrPool, + SwRootFrame const*const pLayout); + + /** Applies the result of a handled text token to a target node. */ + static void + ApplyHandledTextToken(const HandledTextToken& htt, SwTextNode& targetNode); + + /** Handle a page number token. + * + * Will return a string of @p numberOfToxSources concatenated '@' signs, separated by commas, and + * finished by a '~'. + * (The '@' sign is the magic character C_NUM_REPL, the '~' sign is the magic character C_END_PAGE_NUM. + * + * @internal + * The count of similar entries, i.e., nodes in aTOXSources of SwTOXSortTabBase gives the PagerNumber + * pattern. + */ + static OUString + ConstructPageNumberPlaceholder(size_t numberOfToxSources); + + /** Collect the attributes of a hint that shall be copied over to the TOX. + * + * Some text attributes are used in the TOX entries. This method defines which attributes are used. + * + * @param hint The hint from which the attributes are taken + * @param pool The attribute pool for the new items + */ + static std::shared_ptr<SfxItemSet> + CollectAttributesForTox(const SwTextAttr& hint, SwAttrPool& pool); + + /** This method will call GetNumStringOfFirstNode() of the first node in the provided SwTOXSortTabBase. + * + * The parameters @p bUsePrefix and @p nLevel are passed to SwTextNode::GetNumString() + * + * @internal + * The method is only called if several preconditions for @p rBase are true. Check the implementation + * for details. + */ + static OUString + GetNumStringOfFirstNode(const SwTOXSortTabBase& rBase, bool bUsePrefix, + sal_uInt8 nLevel, SwRootFrame const* pLayout); + + /** Handle a chapter token. + */ + OUString + HandleChapterToken(const SwTOXSortTabBase& rBase, const SwFormToken& aToken, + SwRootFrame const* pLayout) const; + + /** Generate the text for a chapter token. + */ + OUString + GenerateTextForChapterToken(const SwFormToken& chapterToken, const SwContentFrame* contentFrame, + const SwContentNode *contentNode, SwRootFrame const* pLayout) const; + + /** Obtain a ChapterField to use for the text generation. + * @internal + * This method is overridden in the unittests. Do not override it yourself. + */ + virtual SwChapterField + ObtainChapterField(SwChapterFieldType* chapterFieldType, const SwFormToken* chapterToken, + const SwContentFrame* contentFrame, const SwContentNode *contentNode) const; + + friend class ::ToxTextGeneratorTest; +}; + +} + +#endif /* SW_TOXTEXTGENERATOR_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ToxWhitespaceStripper.hxx b/sw/inc/ToxWhitespaceStripper.hxx new file mode 100644 index 000000000..9185fa5a4 --- /dev/null +++ b/sw/inc/ToxWhitespaceStripper.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + + +#ifndef TOXWHITESPACESTRIPPER_HXX_ +#define TOXWHITESPACESTRIPPER_HXX_ + +#include <rtl/ustring.hxx> +#include <vector> + +namespace sw { + +/** This class helps to remove unwanted whitespaces from a string to use in a Tox. + * + * The new string will have + * - Newlines changed to spaces + * - Consecutive spaces merged + * - Trailing spaces removed + * + * It also allows to find the corresponding new positions of the input string in the stripped string. + * This is important for attributes which might have to be imported, e.g., it helps to answer the question: + * The 3rd character of the input string is subscript, which character in the output string is that? + * + * @note One leading whitespace is preserved. + */ +class ToxWhitespaceStripper +{ +public: + ToxWhitespaceStripper(const OUString&); + + sal_Int32 + GetPositionInStrippedString(sal_Int32 pos) const; + + const OUString& + GetStrippedString() const { return mStripped;} + +private: + OUString mStripped; + std::vector<sal_Int32> mNewPositions; +}; + +} // end namespace sw + + +#endif /* TOXWHITESPACESTRIPPER_HXX_ */ diff --git a/sw/inc/UndoParagraphSignature.hxx b/sw/inc/UndoParagraphSignature.hxx new file mode 100644 index 000000000..1c9c60f58 --- /dev/null +++ b/sw/inc/UndoParagraphSignature.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNDOPARAGRAPHSIGNATURE_HXX +#define INCLUDED_SW_INC_UNDOPARAGRAPHSIGNATURE_HXX + +#include "undobj.hxx" +#include <rtl/ustring.hxx> + +#include <com/sun/star/uno/Reference.hxx> + +class SwDoc; + +namespace com::sun::star::text { class XTextContent; } +namespace com::sun::star::text { class XTextField; } + +/// Undo/Redo Paragraph Signature. +class SwUndoParagraphSigning final : public SwUndo +{ +private: + SwDoc* m_pDoc; + css::uno::Reference<css::text::XTextField> m_xField; + css::uno::Reference<css::text::XTextContent> m_xParent; + OUString m_signature; + OUString m_usage; + OUString m_display; + const bool m_bRemove; + +public: + SwUndoParagraphSigning(SwDoc* pDoc, + const css::uno::Reference<css::text::XTextField>& xField, + const css::uno::Reference<css::text::XTextContent>& xParent, + const bool bRemove); + + virtual void UndoImpl(::sw::UndoRedoContext&) override; + virtual void RedoImpl(::sw::UndoRedoContext&) override; + virtual void RepeatImpl(::sw::RepeatContext&) override; + +private: + void Insert(); + void Remove(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/accessibilityoptions.hxx b/sw/inc/accessibilityoptions.hxx new file mode 100644 index 000000000..92ec871b5 --- /dev/null +++ b/sw/inc/accessibilityoptions.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_ACCESSIBILITYOPTIONS_HXX +#define INCLUDED_SW_INC_ACCESSIBILITYOPTIONS_HXX + +struct SwAccessibilityOptions +{ + bool bIsAlwaysAutoColor :1; + bool bIsStopAnimatedGraphics :1; + + SwAccessibilityOptions() : + bIsAlwaysAutoColor(false), + bIsStopAnimatedGraphics(false) {} + + bool IsAlwaysAutoColor() const { return bIsAlwaysAutoColor; } + void SetAlwaysAutoColor( bool b ) { bIsAlwaysAutoColor = b; } + + bool IsStopAnimatedGraphics() const { return bIsStopAnimatedGraphics;} + void SetStopAnimatedGraphics( bool b ) { bIsStopAnimatedGraphics = b; } +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx new file mode 100644 index 000000000..29e5fbfd3 --- /dev/null +++ b/sw/inc/accmap.hxx @@ -0,0 +1,313 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_ACCMAP_HXX +#define INCLUDED_SW_INC_ACCMAP_HXX + +#include <cppuhelper/weakref.hxx> +#include <rtl/ref.hxx> +#include <osl/mutex.hxx> +#include <svx/IAccessibleViewForwarder.hxx> +#include <svx/IAccessibleParent.hxx> + +#include <svx/AccessibleControlShape.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <vector> +#include <memory> +#include <o3tl/sorted_vector.hxx> + +class SwAccessibleParagraph; +class SwViewShell; +class SwFrame; +class SwTextFrame; +class SwPageFrame; +class SwAccessibleContext; +class SwAccessibleContextMap_Impl; +class SwAccessibleEventList_Impl; +class SwAccessibleEventMap_Impl; +class SdrObject; +namespace accessibility { class AccessibleShape; } +class SwAccessibleShapeMap_Impl; +struct SwAccessibleEvent_Impl; +class SwAccessibleSelectedParas_Impl; +class SwRect; +class MapMode; +class SwAccPreviewData; +class SwFEShell; +class Fraction; +struct PreviewPage; +namespace vcl { class Window; } +namespace com::sun::star::accessibility { class XAccessible; } + +// The shape list is filled if an accessible shape is destroyed. It +// simply keeps a reference to the accessible shape's XShape. These +// references are destroyed within the EndAction when firing events. +// There are two reason for this. First of all, a new accessible shape +// for the XShape might be created soon. It's then cheaper if the XShape +// still exists. The other reason are situations where an accessible shape +// is destroyed within an SwFrameFormat::Modify. In this case, destroying +// the XShape at the same time (indirectly by destroying the accessible +// shape) leads to an assert, because a client of the Modify is destroyed +// within a Modify call. +using SwShapeList_Impl = std::vector<css::uno::Reference<css::drawing::XShape>>; + +enum class AccessibleStates +{ + NONE = 0x0000, + // real states for events + EDITABLE = 0x0001, + OPAQUE = 0x0002, + // pseudo states for events + TEXT_ATTRIBUTE_CHANGED = 0x0200, + TEXT_SELECTION_CHANGED = 0x0100, + CARET = 0x0080, + RELATION_FROM = 0x0040, + RELATION_TO = 0x0020, +}; +namespace o3tl +{ + template<> struct typed_flags<AccessibleStates> : is_typed_flags<AccessibleStates, 0x3e3> {}; +} + +class SwAccessibleMap final : public ::accessibility::IAccessibleViewForwarder, + public ::accessibility::IAccessibleParent + , public std::enable_shared_from_this<SwAccessibleMap> +{ + mutable ::osl::Mutex maMutex; + ::osl::Mutex maEventMutex; + std::unique_ptr<SwAccessibleContextMap_Impl> mpFrameMap; + std::unique_ptr<SwAccessibleShapeMap_Impl> mpShapeMap; + SwShapeList_Impl mvShapes; + std::unique_ptr<SwAccessibleEventList_Impl> mpEvents; + std::unique_ptr<SwAccessibleEventMap_Impl> mpEventMap; + // #i27301 data structure to keep information about + // accessible paragraph, which have a selection. + std::unique_ptr<SwAccessibleSelectedParas_Impl> mpSelectedParas; + SwViewShell *mpVSh; + /// for page preview: store preview data, VisArea, and mapping of + /// preview-to-display coordinates + std::unique_ptr<SwAccPreviewData> mpPreview; + + css::uno::WeakReference < css::accessibility::XAccessible > mxCursorContext; + + bool mbShapeSelected; + + void FireEvent( const SwAccessibleEvent_Impl& rEvent ); + + void AppendEvent( const SwAccessibleEvent_Impl& rEvent ); + + void InvalidateCursorPosition( const css::uno::Reference<css::accessibility::XAccessible>& rAcc ); + void DoInvalidateShapeSelection(bool bInvalidateFocusMode = false); + + void InvalidateShapeSelection(); + + //mpSelectedFrameMap contains the old selected objects. + std::unique_ptr<SwAccessibleContextMap_Impl> mpSeletedFrameMap; + + OUString maDocName; + + //InvalidateShapeInParaSelection() method is responsible for the updating the selected states of the objects. + void InvalidateShapeInParaSelection(); + + void InvalidateRelationSet_( const SwFrame* pFrame, bool bFrom ); + + css::uno::Reference<css::accessibility::XAccessible> + GetDocumentView_( bool bPagePreview ); + + /** method to build up a new data structure of the accessible paragraphs, + which have a selection + + Important note: method has to used inside a mutual exclusive section + */ + std::unique_ptr<SwAccessibleSelectedParas_Impl> BuildSelectedParas(); + +public: + + SwAccessibleMap( SwViewShell *pSh ); + virtual ~SwAccessibleMap() override; + + css::uno::Reference<css::accessibility::XAccessible> GetDocumentView(); + + css::uno::Reference<css::accessibility::XAccessible> GetDocumentPreview( + const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages, + const Fraction& _rScale, + const SwPageFrame* _pSelectedPageFrame, + const Size& _rPreviewWinSize ); + + ::rtl::Reference < SwAccessibleContext > GetContextImpl( + const SwFrame *pFrame, + bool bCreate = true ); + css::uno::Reference<css::accessibility::XAccessible> GetContext( + const SwFrame *pFrame, + bool bCreate = true ); + + ::rtl::Reference < ::accessibility::AccessibleShape > GetContextImpl( + const SdrObject *pObj, + SwAccessibleContext *pParentImpl, + bool bCreate = true ); + css::uno::Reference<css::accessibility::XAccessible> GetContext( + const SdrObject *pObj, + SwAccessibleContext *pParentImpl, + bool bCreate = true ); + + SwViewShell* GetShell() const + { + return mpVSh; + } + static bool IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh); + void AddShapeContext(const SdrObject *pObj, + css::uno::Reference < css::accessibility::XAccessible > const & xAccShape); + + void AddGroupContext(const SdrObject *pParentObj, + css::uno::Reference < css::accessibility::XAccessible > const & xAccParent); + void RemoveGroupContext(const SdrObject *pParentObj); + + const SwRect& GetVisArea() const; + + /** get size of a dedicated preview page + + @param _nPreviewPageNum + input parameter - physical page number of page visible in the page preview + + @return an object of class <Size> + */ + Size GetPreviewPageSize( sal_uInt16 _nPreviewPageNum ) const; + + void RemoveContext( const SwFrame *pFrame ); + void RemoveContext( const SdrObject *pObj ); + + // Dispose frame and its children if bRecursive is set + void A11yDispose( const SwFrame* pFrame, + const SdrObject* pObj, + vcl::Window* pWindow, + bool bRecursive = false, + bool bCanSkipInvisible = true ); + + void InvalidatePosOrSize( const SwFrame* pFrame, + const SdrObject* pObj, + vcl::Window* pWindow, + const SwRect& rOldFrame ); + + void InvalidateContent( const SwFrame *pFrame ); + + void InvalidateAttr( const SwTextFrame& rTextFrame ); + + void InvalidateCursorPosition( const SwFrame *pFrame ); + void InvalidateFocus(); + void SetCursorContext( + const ::rtl::Reference < SwAccessibleContext >& rCursorContext ); + + // Invalidate state of whole tree. If an action is open, this call + // is processed when the last action ends. + void InvalidateEditableStates( const SwFrame* _pFrame ); + + void InvalidateRelationSet( const SwFrame* pMaster, const SwFrame* pFollow ); + + /** invalidation CONTENT_FLOWS_FROM/_TO relation of a paragraph + + @param _rTextFrame + input parameter - reference to paragraph, whose CONTENT_FLOWS_FROM/_TO + has to be invalidated. + + @param _bFrom + input parameter - boolean indicating, if relation CONTENT_FLOWS_FROM + (value <true>) or CONTENT_FLOWS_TO (value <false>) has to be invalidated. + */ + void InvalidateParaFlowRelation( const SwTextFrame& _rTextFrame, + const bool _bFrom ); + + /** invalidation of text selection of a paragraph */ + void InvalidateParaTextSelection( const SwTextFrame& _rTextFrame ); + + /** invalidation of text selection of all paragraphs */ + void InvalidateTextSelectionOfAllParas(); + + sal_Int32 GetChildIndex( const SwFrame& rParentFrame, + vcl::Window& rChild ) const; + + // update preview data (and fire events if necessary) + void UpdatePreview( const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages, + const Fraction& _rScale, + const SwPageFrame* _pSelectedPageFrame, + const Size& _rPreviewWinSize ); + + void InvalidatePreviewSelection( sal_uInt16 nSelPage ); + bool IsPageSelected( const SwPageFrame *pPageFrame ) const; + + void FireEvents(); + + const OUString& GetDocName() const { return maDocName; } + + // IAccessibleViewForwarder + + virtual tools::Rectangle GetVisibleArea() const override; + virtual Point LogicToPixel (const Point& rPoint) const override; + virtual Size LogicToPixel (const Size& rSize) const override; + + // IAccessibleParent + virtual bool ReplaceChild ( + ::accessibility::AccessibleShape* pCurrentChild, + const css::uno::Reference< css::drawing::XShape >& _rxShape, + const long _nIndex, + const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo + ) override; + virtual ::accessibility::AccessibleControlShape* GetAccControlShapeFromModel + (css::beans::XPropertySet* pSet) override; + virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessibleCaption ( + const css::uno::Reference< css::drawing::XShape > & xShape) override; + + // additional Core/Pixel conversions for internal use; also works + // for preview + Point PixelToCore (const Point& rPoint) const; + tools::Rectangle CoreToPixel (const tools::Rectangle& rRect) const; + + // is there a known accessibility impl cached for the frame + bool Contains(const SwFrame *pFrame) const; + +private: + /** get mapping mode for LogicToPixel and PixelToLogic conversions + + Replacement method <PreviewAdjust(..)> by new method <GetMapMode>. + Method returns mapping mode of current output device and adjusts it, + if the shell is in page/print preview. + Necessary, because <PreviewAdjust(..)> changes mapping mode at current + output device for mapping logic document positions to page preview window + positions and vice versa and doesn't take care to recover its changes. + + @param _rPoint + input parameter - constant reference to point to determine the mapping + mode adjustments for page/print preview. + + @param _orMapMode + output parameter - reference to the mapping mode, which is determined + by the method + */ + void GetMapMode( const Point& _rPoint, + MapMode& _orMapMode ) const; +public: + virtual bool IsDocumentSelAll() override; + + //Para Container for InvalidateCursorPosition + typedef o3tl::sorted_vector< SwAccessibleParagraph* > SET_PARA; + SET_PARA m_setParaAdd; + SET_PARA m_setParaRemove; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/acmplwrd.hxx b/sw/inc/acmplwrd.hxx new file mode 100644 index 000000000..78b62b4be --- /dev/null +++ b/sw/inc/acmplwrd.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_ACMPLWRD_HXX +#define INCLUDED_SW_INC_ACMPLWRD_HXX + +#include <deque> +#include <memory> + +#include <editeng/swafopt.hxx> +#include <editeng/Trie.hxx> +#include <rtl/ustring.hxx> + +class SwDoc; +class SwAutoCompleteWord_Impl; +class SwAutoCompleteString; + +typedef std::deque<SwAutoCompleteString*> SwAutoCompleteStringPtrDeque; + +class SwAutoCompleteWord +{ + friend class SwAutoCompleteClient; + + /// contains extended strings carrying source information + editeng::SortedAutoCompleteStrings m_WordList; + editeng::Trie m_LookupTree; + SwAutoCompleteStringPtrDeque m_aLRUList; + + std::unique_ptr<SwAutoCompleteWord_Impl> m_pImpl; + editeng::SortedAutoCompleteStrings::size_type m_nMaxCount; + sal_uInt16 m_nMinWordLen; + bool m_bLockWordList; + + void DocumentDying(const SwDoc& rDoc); +public: + SwAutoCompleteWord( + editeng::SortedAutoCompleteStrings::size_type nWords, + sal_uInt16 nMWrdLen ); + ~SwAutoCompleteWord(); + + bool InsertWord( const OUString& rWord, SwDoc& rDoc ); + + bool IsLockWordLstLocked() const { return m_bLockWordList; } + void SetLockWordLstLocked( bool bFlag ) { m_bLockWordList = bFlag; } + + void SetMaxCount( editeng::SortedAutoCompleteStrings::size_type n ); + + sal_uInt16 GetMinWordLen() const { return m_nMinWordLen; } + void SetMinWordLen( sal_uInt16 n ); + + const editeng::SortedAutoCompleteStrings& GetWordList() const + { return m_WordList; } + + void CheckChangedList(const editeng::SortedAutoCompleteStrings& rNewLst); + + // Returns all words matching a given prefix aMatch. + bool GetWordsMatching(const OUString& aMatch, std::vector<OUString>& aWords) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/anchoreddrawobject.hxx b/sw/inc/anchoreddrawobject.hxx new file mode 100644 index 000000000..bd74d6ea4 --- /dev/null +++ b/sw/inc/anchoreddrawobject.hxx @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_ANCHOREDDRAWOBJECT_HXX +#define INCLUDED_SW_INC_ANCHOREDDRAWOBJECT_HXX + +#include "anchoredobject.hxx" +#include <optional> + +namespace tools { class Rectangle; } + +/** class for the positioning of drawing objects */ +class SwAnchoredDrawObject final : public SwAnchoredObject +{ + private: + // boolean, indicating that the object position has been invalidated + // and that a positioning has to be performed. + bool mbValidPos; + + // rectangle, keeping the last object rectangle after the positioning + std::optional<tools::Rectangle> maLastObjRect; + + // boolean, indicating that anchored drawing object hasn't been attached + // to an anchor frame yet. Once, it is attached to an anchor frame the + // boolean changes its state. + bool mbNotYetAttachedToAnchorFrame; + + // boolean, indicating that anchored + // drawing object hasn't been positioned yet. Once, it's positioned the + // boolean changes its state. + bool mbNotYetPositioned; + + // boolean, indicating that after change of layout direction the + // anchored drawing object has to be captured on the page, if it exceeds + // the left or right page margin. + // Needed for compatibility option <DoNotCaptureDrawObjsOnPage> + bool mbCaptureAfterLayoutDirChange; + + /** method for the intrinsic positioning of an at-paragraph|at-character + anchored drawing object + + helper method for method <MakeObjPos> */ + void MakeObjPosAnchoredAtPara(); + + /** method for the intrinsic positioning of an at-page|at-frame anchored + drawing object + + helper method for method <MakeObjPos> */ + void MakeObjPosAnchoredAtLayout(); + + /** method to set positioning attributes (not for as-character anchored) + + During load the positioning attributes aren't set. + Thus, the positioning attributes are set by the current object geometry. + This method is also used for the conversion for drawing objects + (not anchored as-character) imported from OpenOffice.org file format + once and directly before the first positioning. */ + void SetPositioningAttr(); + + /** method to set internal anchor position of <SdrObject> instance + of the drawing object + + For drawing objects the internal anchor position of the <SdrObject> + instance has to be set. + Note: This adjustment is not be done for as-character anchored + drawing object - the positioning code takes care of this. + #i31698# - API for drawing objects in Writer has + been adjusted. Thus, this method will only set the internal anchor + position of the <SdrObject> instance to the anchor position given + by its anchor frame. */ + void SetDrawObjAnchor(); + + /** method to invalidate the given page frame */ + void InvalidatePage_( SwPageFrame* _pPageFrame ); + + virtual void ObjectAttachedToAnchorFrame() override; + + /** method to assure that anchored object is registered at the correct + page frame + */ + virtual void RegisterAtCorrectPage() override; + + virtual bool SetObjTop_( const SwTwips _nTop) override; + virtual bool SetObjLeft_( const SwTwips _nLeft) override; + + virtual SwRect GetObjBoundRect() const override; + + public: + + SwAnchoredDrawObject(); + virtual ~SwAnchoredDrawObject() override; + + // declaration of pure virtual methods of base class <SwAnchoredObject> + virtual void MakeObjPos() override; + virtual void InvalidateObjPos() override; + bool IsValidPos() const + { + return mbValidPos; + } + + // accessors to the format + virtual SwFrameFormat& GetFrameFormat() override; + virtual const SwFrameFormat& GetFrameFormat() const override; + + // accessors to the object area and its position + virtual SwRect GetObjRect() const override; + + std::optional<tools::Rectangle> const & GetLastObjRect() const { return maLastObjRect;} + void SetLastObjRect( const tools::Rectangle& _rNewObjRect ); + + /** adjust positioning and alignment attributes for new anchor frame + + Set horizontal and vertical position/alignment to manual position + relative to anchor frame area using the anchor position of the + new anchor frame and the current absolute drawing object position. + Note: For correct Undo/Redo method should only be called inside a + Undo-/Redo-action. + + @param <_pNewAnchorFrame> + input parameter - new anchor frame for the anchored object. + + @param <_pNewObjRect> + optional input parameter - proposed new object rectangle. If not + provided the current object rectangle is taken. + */ + void AdjustPositioningAttr( const SwFrame* _pNewAnchorFrame, + const SwRect* _pNewObjRect = nullptr ); + + /** method to notify background of drawing object */ + virtual void NotifyBackground( SwPageFrame* _pPageFrame, + const SwRect& _rRect, + PrepareHint _eHint ) override; + + bool NotYetPositioned() const + { + return mbNotYetPositioned; + } + + // change of layout direction needs to be tracked + // for setting <mbCaptureAfterLayoutDirChange>. + virtual void UpdateLayoutDir() override; + bool IsOutsidePage() const; + + // new Loop control + void ValidateThis() { mbValidPos = true; } + + /** The element name to show in the XML dump. */ + virtual const char* getElementName( ) const override { return "SwAnchoredDrawObject"; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx new file mode 100644 index 000000000..0c5c24950 --- /dev/null +++ b/sw/inc/anchoredobject.hxx @@ -0,0 +1,502 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_ANCHOREDOBJECT_HXX +#define INCLUDED_SW_INC_ANCHOREDOBJECT_HXX + +#include "swtypes.hxx" +#include "swrect.hxx" +#include <libxml/xmlwriter.h> + +struct SwPosition; +class SdrObject; +class SwFrame; +class SwLayoutFrame; +class SwTextFrame; + +class SwPageFrame; + +class SwFrameFormat; +class SwFormatAnchor; +enum class RndStdIds; + +/** wrapper class for the positioning of Writer fly frames and drawing objects + + Purpose of this class is to provide a unified interface for the positioning + of Writer fly frames (derived classes of <SwFlyFrame>) and of drawing objects + (derived classes of <SwAnchoredDrawObject>). +*/ +class SW_DLLPUBLIC SwAnchoredObject +{ + private: + // drawing object representing the anchored object in the drawing layer + SdrObject* mpDrawObj; + // frame the object is anchored at + SwFrame* mpAnchorFrame; + // #i28701 - page frame the object is registered at + // note: no page frame for as-character anchored objects + SwPageFrame* mpPageFrame; + // current relative position (relative to anchor position of anchor frame) + Point maRelPos; + + // for to-character anchored objects: + // Last known anchor character rectangle. + // Used to decide, if invalidation has to been performed, if anchor position + // has changed, and used to position object. + SwRect maLastCharRect; + + // for to-character anchored objects: + // Last known top of line, in which the anchor character is in. + // Used to decide, if invalidation has to been performed, if anchor position + // has changed, and used to position object. + SwTwips mnLastTopOfLine; + + // for to-paragraph and to-character anchored objects: + // Layout frame vertical position is orient at - typically it's the upper + // of the anchor frame, but it could also by the upper of a follow or + // a following layout frame in the text flow. + const SwLayoutFrame* mpVertPosOrientFrame; + + // i#i28701 boolean, indicating that the object + // positioning algorithm is in progress. + bool mbPositioningInProgress; + + // Booleans needed for the layout process. + // Values only of relevance for to-paragraph and to-character anchored + // floating screen object, for whose the 'straight-forward positioning + // process are applied + // Otherwise value of <mbConsiderForTextWrap> is treated as <true>, + // value of <mbPositionLocked> is treated as <false> and + // value of <mbRestartLayoutProcess> is treated as <false>. + // i#35911 - add boolean <mbClearEnvironment> + // Indicates that due to its position and wrapping style its layout + // environment is cleared - all content is moved forward. + // Treated as <false>, if not the 'straight-forward positioning process" + // is applied. + bool mbConsiderForTextWrap; + bool mbPositionLocked; + // boolean needed to keep position of + // anchored object locked due to special object positioning for sections. + bool mbKeepPositionLockedForSection; + + bool mbRestartLayoutProcess; + bool mbClearedEnvironment; + + // i#i3317 - boolean, indicating that temporarily + // the wrapping style influence of the anchored object has to be + // considered during its positioning. + // This boolean is used, if compatibility option 'Consider wrapping style + // influence on object positioning' is OFF and a positioning loop is + // detected in method <SwFlyAtContentFrame::MakeAll()> or method + // <SwAnchoredDrawObject::MakeObjPosAnchoredAtPara()>. + // The boolean is reset to <false>, when the layout process for a + // page frame starts. + bool mbTmpConsiderWrapInfluence; + + mutable SwRect maObjRectWithSpaces; + mutable bool mbObjRectWithSpacesValid; + mutable SwRect maLastObjRect; + + /** method to indicate, that positioning of anchored object is in progress + + note: method is implemented empty + */ + friend class SwObjPositioningInProgress; + void SetPositioningInProgress( const bool _bPosInProgress ) + { + mbPositioningInProgress = _bPosInProgress; + } + + /** check anchor character rectangle + + helper method for method <CheckCharRectAndTopOfLine()> + For to-character anchored Writer fly frames the member <maLastCharRect> + is updated. This is checked for change and depending on the applied + positioning, it's decided, if the Writer fly frame has to be invalidated. + improvement - add second parameter <_rAnchorCharFrame> + + @param _rAnch + input parameter - reference to anchor position + + @param _rAnchorCharFrame + input parameter - reference to the text frame containing the anchor + character. + */ + void CheckCharRect( const SwFormatAnchor& _rAnch, + const SwTextFrame& _rAnchorCharFrame ); + + /** check top of line + + helper method for method <CheckCharRectAndTopOfLine()> + For to-character anchored Writer fly frames the member <mnLastTopOfLine> + is updated. This is checked for change and depending on the applied + positioning, it's decided, if the Writer fly frame has to be invalidated. + + @param _rAnch + input parameter - reference to anchor position + + @param _rAnchorCharFrame + input parameter - reference to the text frame containing the anchor + character. + */ + void CheckTopOfLine( const SwFormatAnchor& _rAnch, + const SwTextFrame& _rAnchorCharFrame ); + + // method <sw_HideObj(..)> sets needed data structure values for the + // object positioning + friend bool sw_HideObj( const SwTextFrame& _rFrame, + const RndStdIds _eAnchorType, + SwPosition const& rAnchorPos, + SwAnchoredObject* _pAnchoredObj ); + protected: + SwAnchoredObject(); + + void SetVertPosOrientFrame( const SwLayoutFrame& _rVertPosOrientFrame ); + + /** method to assure that anchored object is registered at the correct + page frame + */ + virtual void RegisterAtCorrectPage() = 0; + + /** method to indicate, that anchored object is attached to an anchor frame */ + virtual void ObjectAttachedToAnchorFrame(); + + /** method to determine, if other anchored objects, also attached at + to the anchor frame, have to consider its wrap influence. + */ + bool ConsiderObjWrapInfluenceOfOtherObjs() const; + + /** method to apply temporary consideration of wrapping style influence + to the anchored objects, which are anchored at the same anchor frame + */ + void SetTmpConsiderWrapInfluenceOfOtherObjs(); + + virtual bool SetObjTop_( const SwTwips _nTop) = 0; + virtual bool SetObjLeft_( const SwTwips _nLeft) = 0; + + virtual SwRect GetObjBoundRect() const = 0; + public: + + virtual ~SwAnchoredObject(); + + // accessors to member <mpDrawObj> + void SetDrawObj( SdrObject& _rDrawObj ); + const SdrObject* GetDrawObj() const { return mpDrawObj; } + SdrObject* DrawObj() { return mpDrawObj; } + + // accessors to member <mpAnchorFrame> + const SwFrame* GetAnchorFrame() const { return mpAnchorFrame; } + SwFrame* AnchorFrame() { return mpAnchorFrame; } + void ChgAnchorFrame( SwFrame* _pNewAnchorFrame ); + /** determine anchor frame containing the anchor position + + the anchor frame, which is determined, is <mpAnchorFrame> + for an at-page, at-frame or at-paragraph anchored object + and the anchor character frame for an at-character and as-character + anchored object. + */ + SwFrame* GetAnchorFrameContainingAnchPos(); + + SwPageFrame* GetPageFrame() { return mpPageFrame; } + const SwPageFrame* GetPageFrame() const { return mpPageFrame; } + void SetPageFrame( SwPageFrame* _pNewPageFrame ); + + /** method to determine the page frame, on which the 'anchor' of + the given anchored object is. + + Adjust meaning of method and thus its name: If the anchored object + or its anchor isn't correctly inserted in the layout, no page frame + can be found. Thus, the return type changed to be a pointer and can + be NULL. + + @param _rAnchoredObj + input parameter - anchored object, for which the page frame of its + 'anchor' has to be determined. + + @return SwPageFrame& + page frame, the 'anchor' of the given anchored object is on + */ + SwPageFrame* FindPageFrameOfAnchor(); + + /** get frame, which contains the anchor character, if the object + is anchored at-character or as-character. + + @return SwTextFrame* + text frame containing the anchor character. It's NULL, if the object + isn't anchored at-character resp. as-character. + */ + SwTextFrame* FindAnchorCharFrame(); + + // accessors to data of position calculation: + // frame vertical position is orient at + const SwLayoutFrame* GetVertPosOrientFrame() const + { + return mpVertPosOrientFrame; + } + // method to clear member <mpVertPosOrientFrame> + void ClearVertPosOrientFrame(); + + /** check anchor character rectangle and top of line + + For to-character anchored Writer fly frames the members <maLastCharRect> + and <maLastTopOfLine> are updated. These are checked for change and + depending on the applied positioning, it's decided, if the Writer fly + frame has to be invalidated. + + @param _bCheckForParaPorInf + input parameter - boolean indicating, if check on paragraph portion + information has to be done. + */ + void CheckCharRectAndTopOfLine( const bool _bCheckForParaPorInf ); + + // accessors to member <maLastCharRect> + const SwRect& GetLastCharRect() const { return maLastCharRect;} + SwTwips GetRelCharX( const SwFrame* pFrame ) const; + SwTwips GetRelCharY( const SwFrame* pFrame ) const; + void AddLastCharY( long nDiff ); + void ResetLastCharRectHeight(); + + // accessor to member <nmLastTopOfLine> + SwTwips GetLastTopOfLine() const { return mnLastTopOfLine;} + void AddLastTopOfLineY( SwTwips _nDiff ); + + /** reset members <maLastCharRect> and <mnLastTopOfLine> */ + void ClearCharRectAndTopOfLine(); + + /** method to determine position for the object and set the position + at the object + */ + virtual void MakeObjPos() = 0; + + /** is positioning of anchored object in progress */ + bool IsPositioningInProgress() const + { + return mbPositioningInProgress; + } + + /** method to determine, if invalidation of position is allowed */ + bool InvalidationOfPosAllowed() const; + + /** method to invalidate position of the anchored object */ + virtual void InvalidateObjPos() = 0; + + /** method to perform necessary invalidations for the positioning of + objects, for whose the wrapping style influence has to be considered + on the object positioning. + */ + void InvalidateObjPosForConsiderWrapInfluence(); + + /** method to trigger notification of 'background' */ + virtual void NotifyBackground( SwPageFrame* _pPageFrame, + const SwRect& _rRect, + PrepareHint _eHint ) = 0; + + // accessors to the current relative position (relative to anchor + // position of anchor frame) + const Point& GetCurrRelPos() const { return maRelPos;} + void SetCurrRelPos( Point _aRelPos ); + + // accessors to the format + virtual SwFrameFormat& GetFrameFormat() = 0; + virtual const SwFrameFormat& GetFrameFormat() const = 0; + + // accessors to the object area and its position + virtual SwRect GetObjRect() const = 0; + + void SetObjTop( const SwTwips _nTop); + void SetObjLeft( const SwTwips _nLeft); + + /** method update layout direction the layout direction, the anchored + object is assigned to + + method has typically to be called, if the anchored object gets its + anchor frame assigned and if the anchor frame changes its layout direction + */ + virtual void UpdateLayoutDir(); + + /** method to determine object area inclusive its spacing */ + const SwRect& GetObjRectWithSpaces() const; + + void InvalidateObjRectWithSpaces() const + { + mbObjRectWithSpacesValid = false; + } + + /** method to determine, if wrapping style influence of the anchored + object has to be considered on the object positioning + + Note: result of this method also decides, if the boolean for the + layout process are of relevance. + */ + bool ConsiderObjWrapInfluenceOnObjPos() const; + + // accessors to booleans for layout process + bool ConsiderForTextWrap() const; + void SetConsiderForTextWrap( const bool _bConsiderForTextWrap ); + bool PositionLocked() const; + void LockPosition() + { + mbPositionLocked = true; + } + void UnlockPosition() + { + if ( !mbKeepPositionLockedForSection ) + { + mbPositionLocked = false; + } + } + + void SetKeepPosLocked( const bool _bKeepPosLocked ) + { + mbKeepPositionLockedForSection = _bKeepPosLocked; + } + + bool RestartLayoutProcess() const; + void SetRestartLayoutProcess( const bool _bRestartLayoutProcess ); + // accessors for <mbClearedEnvironment> + bool ClearedEnvironment() const; + void SetClearedEnvironment( const bool _bClearedEnvironment ); + + // reset booleans for layout process + void ResetLayoutProcessBools() + { + mbPositioningInProgress = false; + mbConsiderForTextWrap = false; + mbPositionLocked = false; + mbKeepPositionLockedForSection = false; + mbRestartLayoutProcess = false; + mbClearedEnvironment = false; + mbTmpConsiderWrapInfluence = false; + } + + /** method to determine, if due to anchored object size and wrapping + style, its layout environment is cleared. + */ + bool HasClearedEnvironment() const; + + /** method to update anchored object in the <SwSortedObjs> lists + + Method is not proposed to be called during a layout process is + running. It has been used on the change of the anchored object + attributes, which belongs the sort criteria of <SwSortedObjs>. + If document compatibility option 'Consider wrapping style influence + on object positioning' is ON, additionally all anchored objects + at the anchor frame and all following anchored objects on the page + frame are invalidated. + */ + void UpdateObjInSortedList(); + + /** method to determine, if a format on the anchored object is possible + + A format isn't possible, if anchored object is in an invisible layer. + Note: method is virtual to refine the conditions for the sub-classes. + */ + virtual bool IsFormatPossible() const; + + // accessors to member <mbTmpConsiderWrapInfluence> + void SetTmpConsiderWrapInfluence( const bool _bTmpConsiderWrapInfluence ); + bool IsTmpConsiderWrapInfluence() const { return mbTmpConsiderWrapInfluence;} + void ClearTmpConsiderWrapInfluence(); + + /** method to determine, if the anchored object is overlapping with a + previous column + + overlapping with a previous column means, that the object overlaps + with a column, which is a previous one of the column its anchor + frame is in. + Only applied for at-paragraph and at-character anchored objects. + */ + bool OverlapsPrevColumn() const; + + /** method to determine position of anchored object relative to + anchor frame + + Usage: Needed layout information for WW8 export + + @return Point - determined relative position + */ + Point GetRelPosToAnchorFrame() const; + + /** method to determine position of anchored object relative to + page frame + + Usage: Needed layout information for WW8 export + + If <_bFollowTextFlow> is set and object is anchored inside table, + the position relative to the table cell is determined. Output + parameter <_obRelToTableCell> reflects this situation + + @param _bFollowTextFlow + input parameter - boolean indicating, if the anchored object has to + follow the text flow. + + @param _obRelToTableCell + output parameter - boolean indicating, the determine position is + relative to the table cell + + @return Point - determined relative position + */ + Point GetRelPosToPageFrame( const bool _bFollowTextFlow, + bool& _obRelToTableCell ) const; + + /** method to determine position of anchored object relative to + anchor character + + Usage: Needed layout information for WW8 export + + @return Point - determined relative position + */ + Point GetRelPosToChar() const; + + /** method to determine position of anchored object relative to + top of line + + Usage: Needed layout information for WW8 export + + @return Point - determined relative position + */ + Point GetRelPosToLine() const; + + /** Dump a bunch of useful data to an XML representation to ease + layout understanding, debugging and testing. + */ + virtual void dumpAsXml( xmlTextWriterPtr pWriter ) const; + + /** The element name to show in the XML dump. */ + virtual const char* getElementName( ) const { return "SwAnchoredObject"; } +}; + +/// Helper class for notify that positioning of an anchored object is in progress. +class SwObjPositioningInProgress +{ + private: + SwAnchoredObject* mpAnchoredObj; + // boolean indicating old state + // of anchored object regarding positioning in progress in order to + // consider nested usage of class <SwObjPositioningInProgress> + bool mbOldObjPositioningInProgress; + + public: + SwObjPositioningInProgress( SdrObject& _rSdrObj ); + SwObjPositioningInProgress( SwAnchoredObject& _rAnchoredObj ); + ~SwObjPositioningInProgress(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/app.hrc b/sw/inc/app.hrc new file mode 100644 index 000000000..9b195c02e --- /dev/null +++ b/sw/inc/app.hrc @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_APP_HRC +#define INCLUDED_SW_INC_APP_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +#include <svl/style.hxx> + +const std::pair<const char*, SfxStyleSearchBits> RID_PARAGRAPHSTYLEFAMILY[] = +{ + { NC_("RID_PARAGRAPHSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Automatic") , SfxStyleSearchBits::Auto }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Text Styles") , SfxStyleSearchBits::SwText }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Chapter Styles") , SfxStyleSearchBits::SwChapter }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "List Styles") , SfxStyleSearchBits::SwList }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Index Styles") , SfxStyleSearchBits::SwIndex }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Special Styles") , SfxStyleSearchBits::SwExtra }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "HTML Styles") , SfxStyleSearchBits::SwHtml }, + { NC_("RID_PARAGRAPHSTYLEFAMILY", "Conditional Styles") , SfxStyleSearchBits::SwCondColl }, + { nullptr, SfxStyleSearchBits::Auto } +}; + +const std::pair<const char*, SfxStyleSearchBits> RID_CHARACTERSTYLEFAMILY[] = +{ + { NC_("RID_CHARACTERSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_CHARACTERSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_CHARACTERSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_CHARACTERSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } +}; + +const std::pair<const char*, SfxStyleSearchBits> RID_FRAMESTYLEFAMILY[] = +{ + { NC_("RID_FRAMESTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_FRAMESTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_FRAMESTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_FRAMESTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } +}; + +const std::pair<const char*, SfxStyleSearchBits> RID_PAGESTYLEFAMILY[] = +{ + { NC_("RID_PAGESTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_PAGESTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_PAGESTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_PAGESTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } +}; + +const std::pair<const char*, SfxStyleSearchBits> RID_LISTSTYLEFAMILY[] = +{ + { NC_("RID_LISTSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_LISTSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_LISTSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_LISTSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } +}; + +const std::pair<const char*, SfxStyleSearchBits> RID_TABLESTYLEFAMILY[] = +{ + { NC_("RID_TABLESTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible }, + { NC_("RID_TABLESTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden }, + { NC_("RID_TABLESTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used }, + { NC_("RID_TABLESTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined }, + { nullptr, SfxStyleSearchBits::Auto } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx new file mode 100644 index 000000000..be11b793f --- /dev/null +++ b/sw/inc/authfld.hxx @@ -0,0 +1,195 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_AUTHFLD_HXX +#define INCLUDED_SW_INC_AUTHFLD_HXX + +#include "swdllapi.h" +#include "fldbas.hxx" +#include "toxe.hxx" +#include <rtl/ref.hxx> +#include <sal/log.hxx> +#include <salhelper/simplereferenceobject.hxx> + +#include <memory> +#include <vector> + +class SwAuthEntry final : public salhelper::SimpleReferenceObject +{ +friend class SwAuthorityFieldType; + OUString m_aAuthFields[AUTH_FIELD_END]; +public: + SwAuthEntry() = default; + SwAuthEntry( const SwAuthEntry& rCopy ); + bool operator==(const SwAuthEntry& rComp) const; + + inline OUString const & GetAuthorField(ToxAuthorityField ePos) const; + inline void SetAuthorField(ToxAuthorityField ePos, + const OUString& rField); +}; + +struct SwTOXSortKey +{ + ToxAuthorityField eField; + bool bSortAscending; + SwTOXSortKey() : + eField(AUTH_FIELD_END), + bSortAscending(true){} +}; + +typedef std::vector<SwTOXSortKey> SortKeyArr; +typedef std::vector<rtl::Reference<SwAuthEntry>> SwAuthDataArr; + +class SW_DLLPUBLIC SwAuthorityFieldType final : public SwFieldType +{ + SwDoc* m_pDoc; + SwAuthDataArr m_DataArr; + std::vector<SwAuthEntry*> m_SequArr; + std::vector<SwAuthEntry*> m_SequArrRLHidden; ///< hidden redlines + SortKeyArr m_SortKeyArr; + sal_Unicode m_cPrefix; + sal_Unicode m_cSuffix; + bool m_bIsSequence :1; + bool m_bSortByDocument :1; + LanguageType m_eLanguage; + OUString m_sSortAlgorithm; + + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) override; + +public: + SwAuthorityFieldType(SwDoc* pDoc); + virtual ~SwAuthorityFieldType() override; + + virtual std::unique_ptr<SwFieldType> Copy() const override; + + virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const override; + virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ) override; + + void SetDoc(SwDoc* pNewDoc) { m_pDoc = pNewDoc; } + SwDoc* GetDoc(){ return m_pDoc; } + void RemoveField(const SwAuthEntry* nHandle); + SwAuthEntry* AddField(const OUString& rFieldContents); + void DelSequenceArray() + { + m_SequArr.clear(); + m_SequArrRLHidden.clear(); + } + + void GetAllEntryIdentifiers( std::vector<OUString>& rToFill ) const; + SwAuthEntry* GetEntryByIdentifier(const OUString& rIdentifier) const; + + bool ChangeEntryContent(const SwAuthEntry* pNewEntry); + // import interface + sal_uInt16 AppendField(const SwAuthEntry& rInsert); + + sal_uInt16 GetSequencePos(const SwAuthEntry* pAuthEntry, SwRootFrame const* pLayout); + + bool IsSequence() const {return m_bIsSequence;} + void SetSequence(bool bSet) + { + DelSequenceArray(); + m_bIsSequence = bSet; + } + + void SetPreSuffix( sal_Unicode cPre, sal_Unicode cSuf) + { + m_cPrefix = cPre; + m_cSuffix = cSuf; + } + sal_Unicode GetPrefix() const { return m_cPrefix;} + sal_Unicode GetSuffix() const { return m_cSuffix;} + + bool IsSortByDocument() const {return m_bSortByDocument;} + void SetSortByDocument(bool bSet) + { + DelSequenceArray(); + m_bSortByDocument = bSet; + } + + sal_uInt16 GetSortKeyCount() const ; + const SwTOXSortKey* GetSortKey(sal_uInt16 nIdx) const ; + void SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const nKeys[]); + + //initui.cxx + static OUString const & GetAuthFieldName(ToxAuthorityField eType); + static OUString const & GetAuthTypeName(ToxAuthorityType eType); + + LanguageType GetLanguage() const {return m_eLanguage;} + void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;} + + const OUString& GetSortAlgorithm() const {return m_sSortAlgorithm;} + void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;} + +}; + +/** invariant for SwAuthorityField is that it is always registered at its + SwAuthorityFieldType via AddField()/RemoveField() & therefore has m_nHandle + set - but it's possible that multiple SwAuthorityField have the same + m_nHandle & so the number of instances is an upper bound on + SwAuthorityField::m_DataArr.size() - it's not clear to me if more than one + one of the instances with the same m_nHandle is actually in the document, + they're all cloned via CopyField()... + */ +class SAL_DLLPUBLIC_RTTI SwAuthorityField final : public SwField +{ + rtl::Reference<SwAuthEntry> m_xAuthEntry; + mutable sal_IntPtr m_nTempSequencePos; + mutable sal_IntPtr m_nTempSequencePosRLHidden; ///< hidden redlines + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + /// For internal use only, in general continue using ExpandField() instead. + OUString ConditionalExpandAuthIdentifier(SwRootFrame const* pLayout) const; + + //To handle Citation + SW_DLLPUBLIC OUString ExpandCitation(ToxAuthorityField eField, SwRootFrame const* pLayout) const; + + SwAuthorityField(SwAuthorityFieldType* pType, const OUString& rFieldContents); + SwAuthorityField(SwAuthorityFieldType* pType, SwAuthEntry* pAuthEntry); + virtual ~SwAuthorityField() override; + + const OUString & GetFieldText(ToxAuthorityField eField) const; + + virtual void SetPar1(const OUString& rStr) override; + virtual SwFieldType* ChgTyp( SwFieldType* ) override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ) override; + + SwAuthEntry* GetAuthEntry() const { return m_xAuthEntry.get(); } + + virtual OUString GetDescription() const override; +}; + +inline OUString const & SwAuthEntry::GetAuthorField(ToxAuthorityField ePos) const +{ + SAL_WARN_IF(AUTH_FIELD_END <= ePos, "sw", "wrong index"); + return m_aAuthFields[ePos]; +} +inline void SwAuthEntry::SetAuthorField(ToxAuthorityField ePos, const OUString& rField) +{ + SAL_WARN_IF(AUTH_FIELD_END <= ePos, "sw", "wrong index"); + if(AUTH_FIELD_END > ePos) + m_aAuthFields[ePos] = rField; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/authratr.hxx b/sw/inc/authratr.hxx new file mode 100644 index 000000000..2c6836921 --- /dev/null +++ b/sw/inc/authratr.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_AUTHRATR_HXX +#define INCLUDED_SW_INC_AUTHRATR_HXX + +#include <tools/color.hxx> +#include "swdllapi.h" + +class SW_DLLPUBLIC AuthorCharAttr +{ +public: + sal_uInt16 m_nItemId; + sal_uInt16 m_nAttr; + Color m_nColor; + + AuthorCharAttr(); + + bool operator == ( const AuthorCharAttr& rAttr ) const + { + return m_nItemId == rAttr.m_nItemId && m_nAttr == rAttr.m_nAttr && + m_nColor == rAttr.m_nColor; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst new file mode 100644 index 000000000..4f5d5e985 --- /dev/null +++ b/sw/inc/bitmaps.hlst @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_INC_BITMAPS_HRC +#define INCLUDED_SW_INC_BITMAPS_HRC + +#define BMP_PAGE_SHADOW_MASK "sw/res/page-shadow-mask.png" + +#define BMP_STYLES_FAMILY_PARA "sw/res/sf01.png" +#define BMP_STYLES_FAMILY_CHAR "sw/res/sf02.png" +#define BMP_STYLES_FAMILY_FRAME "sw/res/sf03.png" +#define BMP_STYLES_FAMILY_PAGE "sw/res/sf04.png" +#define BMP_STYLES_FAMILY_LIST "sw/res/sf05.png" +#define BMP_STYLES_FAMILY_TABLE "sw/res/sf06.png" +#define RID_GRAPHIC_REPLACEBMP "res/grafikei.png" +#define RID_GRAPHIC_ERRORBMP "res/grafikde.png" + +#define BMP_REDLINE_INSERTED "sw/res/redline_inserted.png" +#define BMP_REDLINE_DELETED "sw/res/redline_deleted.png" +#define BMP_REDLINE_FORMATTED "sw/res/redline_formatted.png" +#define BMP_REDLINE_TABLECHG "sw/res/redline_tablechg.png" +#define BMP_REDLINE_FMTCOLLSET "sw/res/redline_fmtcollset.png" + +#define RID_BMP_COLLAPSE "res/sx18002.png" +#define RID_BMP_EXPAND "res/sx18003.png" +#define RID_BMP_DB "sw/res/sx01.png" +#define RID_BMP_DBTABLE "sw/res/sx02.png" +#define RID_BMP_DBQUERY "sw/res/sx03.png" +#define RID_BMP_VIEWLAYOUT_AUTOMATIC "sw/res/twopages_10x24.png" +#define RID_BMP_VIEWLAYOUT_AUTOMATIC_ACTIVE "sw/res/twopages_a_10x24.png" +#define RID_BMP_VIEWLAYOUT_BOOKMODE "sw/res/doublepage_10x22.png" +#define RID_BMP_VIEWLAYOUT_BOOKMODE_ACTIVE "sw/res/doublepage_a_10x22.png" +#define RID_BMP_VIEWLAYOUT_SINGLECOLUMN "sw/res/emptypage_10x14.png" +#define RID_BMP_VIEWLAYOUT_SINGLECOLUMN_ACTIVE "sw/res/emptypage_a_10x14.png" +#define RID_BMP_PAGE_BREAK "sw/res/page_break.png" + +#define RID_BMP_FORMULA_CALC "sw/res/sc20556.png" +#define RID_BMP_FORMULA_CANCEL "sw/res/sc20557.png" +#define RID_BMP_FORMULA_APPLY "sw/res/sc20558.png" + +#define RID_BMP_HIDE "sw/res/re01.png" +#define RID_BMP_NO_HIDE "sw/res/re02.png" +#define RID_BMP_PROT_HIDE "sw/res/re03.png" +#define RID_BMP_PROT_NO_HIDE "sw/res/re04.png" + +#define BMP_INFO_16 "res/info_16.png" + +#define RID_BMP_RIBBAR_NEXT "sw/res/sr20000.png" +#define RID_BMP_RIBBAR_PREV "sw/res/sr20001.png" +#define RID_BMP_RIBBAR_TBL "sw/res/sr20002.png" +#define RID_BMP_RIBBAR_FRM "sw/res/sr20003.png" +#define RID_BMP_RIBBAR_PGE "sw/res/sr20004.png" +#define RID_BMP_RIBBAR_DRW "sw/res/sr20005.png" +#define RID_BMP_RIBBAR_CTRL "sw/res/sr20006.png" +#define RID_BMP_RIBBAR_REG "sw/res/sr20007.png" +#define RID_BMP_RIBBAR_BKM "sw/res/sr20008.png" +#define RID_BMP_RIBBAR_GRF "sw/res/sr20009.png" +#define RID_BMP_RIBBAR_OLE "sw/res/sr20010.png" +#define RID_BMP_RIBBAR_OUTL "sw/res/sr20011.png" +#define RID_BMP_RIBBAR_SEL "sw/res/sr20012.png" +#define RID_BMP_RIBBAR_FTN "sw/res/sr20013.png" +#define RID_BMP_RIBBAR_MARK "sw/res/sr20014.png" +#define RID_BMP_RIBBAR_POSTIT "sw/res/sr20015.png" +#define RID_BMP_RIBBAR_REP "sw/res/sr20016.png" +#define RID_BMP_RIBBAR_ENTRY "sw/res/sr20017.png" +#define RID_BMP_RIBBAR_FORMULA "sw/res/sr20018.png" +#define RID_BMP_RIBBAR_ERROR "sw/res/sr20019.png" + +#define RID_BMP_NAVI_OUTLINE "sw/res/nc20000.png" +#define RID_BMP_NAVI_TABLE "sw/res/nc20001.png" +#define RID_BMP_NAVI_FRAME "sw/res/nc20002.png" +#define RID_BMP_NAVI_GRAPHIC "sw/res/nc20003.png" +#define RID_BMP_NAVI_OLE "sw/res/nc20004.png" +#define RID_BMP_NAVI_BOOKMARK "sw/res/nc20005.png" +#define RID_BMP_NAVI_REGION "sw/res/nc20006.png" +#define RID_BMP_NAVI_URLFIELD "sw/res/nc20007.png" +#define RID_BMP_NAVI_REFERENCE "sw/res/nc20008.png" +#define RID_BMP_NAVI_INDEX "sw/res/nc20009.png" +#define RID_BMP_NAVI_POSTIT "sw/res/nc20010.png" +#define RID_BMP_NAVI_DRAWOBJECT "sw/res/nc20011.png" +#define RID_BMP_DROP_REGION "sw/res/sc20235.png" +#define RID_BMP_DROP_LINK "sw/res/sc20238.png" +#define RID_BMP_DROP_COPY "sw/res/sc20239.png" + +#define RID_BMP_WRAP_RIGHT "sw/res/wr03.png" +#define RID_BMP_WRAP_CONTOUR_RIGHT "sw/res/wr09.png" +#define RID_BMP_WRAP_LEFT "sw/res/wr02.png" +#define RID_BMP_WRAP_CONTOUR_LEFT "sw/res/wr08.png" +#define RID_BMP_WRAP_NONE "sw/res/wr01.png" +#define RID_BMP_WRAP_CONTOUR_NONE "sw/res/wr07.png" +#define RID_BMP_WRAP_IDEAL "sw/res/wr06.png" +#define RID_BMP_WRAP_CONTOUR_IDEAL "sw/res/wr011.png" +#define RID_BMP_WRAP_THROUGH "sw/res/wr05.png" +#define RID_BMP_WRAP_PARALLEL "sw/res/wr04.png" +#define RID_BMP_WRAP_CONTOUR_PARALLEL "sw/res/wr010.png" + +#define RID_BMP_PREVIEW_FALLBACK "sw/res/image-example.png" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx new file mode 100644 index 000000000..0730a5c5a --- /dev/null +++ b/sw/inc/bparr.hxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_BPARR_HXX +#define INCLUDED_SW_INC_BPARR_HXX + +#include <assert.h> + +#include <tools/solar.h> +#include "swdllapi.h" +#include <array> +#include <memory> + +struct BlockInfo; +class BigPtrArray; + +class BigPtrEntry +{ + friend class BigPtrArray; + BlockInfo* m_pBlock; + sal_uInt16 m_nOffset; +public: + BigPtrEntry() : m_pBlock(nullptr), m_nOffset(0) {} + virtual ~BigPtrEntry() = default; + + inline sal_uLong GetPos() const; + inline BigPtrArray& GetArray() const; +}; + +// 1000 entries per Block = a bit less than 4K +#define MAXENTRY 1000 + +// number of entries that may remain free during compression +// this value is for the worst case; because we defined MAXBLOCK with ca 25% +// overhead, 80% = 800 entries are enough +// if complete compression is desired, 100 has to be specified +#define COMPRESSLVL 80 + +struct BlockInfo final +{ + BigPtrArray* pBigArr; ///< in this array the block is located + std::array<BigPtrEntry*, MAXENTRY> + mvData; ///< data block + sal_uLong nStart, nEnd; ///< start- and end index + sal_uInt16 nElem; ///< number of elements +}; + +class SW_DLLPUBLIC BigPtrArray +{ +protected: + std::unique_ptr<BlockInfo*[]> + m_ppInf; ///< block info + sal_uLong m_nSize; ///< number of elements + sal_uInt16 m_nMaxBlock; ///< current max. number of blocks + sal_uInt16 m_nBlock; ///< number of blocks + mutable + sal_uInt16 m_nCur; ///< last used block + + sal_uInt16 Index2Block( sal_uLong ) const; ///< block search + BlockInfo* InsBlock( sal_uInt16 ); ///< insert block + void BlockDel( sal_uInt16 ); ///< some blocks were deleted + void UpdIndex( sal_uInt16 ); ///< recalculate indices + + // fill all blocks + sal_uInt16 Compress(); + +public: + BigPtrArray(); + ~BigPtrArray(); + + sal_uLong Count() const { return m_nSize; } + + void Insert( BigPtrEntry* p, sal_uLong pos ); + void Remove( sal_uLong pos, sal_uLong n = 1 ); + void Move( sal_uLong from, sal_uLong to ); + void Replace( sal_uLong pos, BigPtrEntry* p); + + BigPtrEntry* operator[]( sal_uLong ) const; +}; + +inline sal_uLong BigPtrEntry::GetPos() const +{ + assert(this == m_pBlock->mvData[ m_nOffset ]); // element not in the block + return m_pBlock->nStart + m_nOffset; +} + +inline BigPtrArray& BigPtrEntry::GetArray() const +{ + return *m_pBlock->pBigArr; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx new file mode 100644 index 000000000..7795e8b07 --- /dev/null +++ b/sw/inc/breakit.hxx @@ -0,0 +1,128 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_BREAKIT_HXX +#define INCLUDED_SW_INC_BREAKIT_HXX + +#include <memory> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/ForbiddenCharacters.hpp> +#include <i18nlangtag/languagetag.hxx> +#include "swdllapi.h" + +enum class SvtScriptType; +namespace com::sun::star::i18n { class XBreakIterator; } +namespace com::sun::star::uno { class XComponentContext; } + +class SW_DLLPUBLIC SwBreakIt +{ + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference<css::i18n::XBreakIterator> m_xBreak; + + std::unique_ptr<LanguageTag> m_xLanguageTag; ///< language tag of the current locale + std::unique_ptr<css::i18n::ForbiddenCharacters> m_xForbidden; + + LanguageType m_aForbiddenLang; ///< language of the current forbiddenChar struct + + void GetLocale_( const LanguageType aLang ); + void GetLocale_( const LanguageTag& rLanguageTag ); + void GetForbidden_( const LanguageType aLang ); + + SwBreakIt(SwBreakIt const&) = delete; + SwBreakIt& operator=(SwBreakIt const&) = delete; + + // private (see @ Create_, Delete_). + explicit SwBreakIt(const css::uno::Reference<css::uno::XComponentContext> & rxContext); + +public: + // private (see @ source/core/bastyp/init.cxx). + static void Create_( + const css::uno::Reference< css::uno::XComponentContext > & rxContext); + static void Delete_(); + +public: + static SwBreakIt * Get(); + + css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const + { + return m_xBreak; + } + + const css::lang::Locale& GetLocale( const LanguageType aLang ) + { + if (!m_xLanguageTag || m_xLanguageTag->getLanguageType() != aLang) + GetLocale_(aLang); + return m_xLanguageTag->getLocale(); + } + + const css::lang::Locale& GetLocale( const LanguageTag& rLanguageTag ) + { + // Use LanguageType comparison instead of LanguageTag::operator!=() + // because here the LanguageTag is already a known LanguageType value + // assigned, so LanguageTag does not need to convert to BCP47 for + // comparison. + if (!m_xLanguageTag || m_xLanguageTag->getLanguageType() != rLanguageTag.getLanguageType()) + GetLocale_(rLanguageTag); + return m_xLanguageTag->getLocale(); + } + + const LanguageTag& GetLanguageTag( const LanguageType aLang ) + { + if (!m_xLanguageTag || m_xLanguageTag->getLanguageType() != aLang) + GetLocale_(aLang); + return *m_xLanguageTag; + } + + const LanguageTag& GetLanguageTag( const LanguageTag& rLanguageTag ) + { + // Use LanguageType comparison instead of LanguageTag::operator!=() + // because here the LanguageTag is already a known LanguageType value + // assigned, so LanguageTag does not need to convert to BCP47 for + // comparison. + if (!m_xLanguageTag || m_xLanguageTag->getLanguageType() != rLanguageTag.getLanguageType()) + GetLocale_( rLanguageTag ); + return *m_xLanguageTag; + } + + const css::i18n::ForbiddenCharacters& GetForbidden( const LanguageType aLang ) + { + if (!m_xForbidden || m_aForbiddenLang != aLang) + GetForbidden_( aLang ); + return *m_xForbidden; + } + + sal_uInt16 GetRealScriptOfText( const OUString& rText, sal_Int32 nPos ) const; + SvtScriptType GetAllScriptsOfText( const OUString& rText ) const; + + sal_Int32 getGraphemeCount(const OUString& rStr, + sal_Int32 nStart, sal_Int32 nEnd) const; + sal_Int32 getGraphemeCount(const OUString& rStr) const + { + return getGraphemeCount(rStr, 0, rStr.getLength()); + } +}; + +#define SW_BREAKITER() SwBreakIt::Get() + +// @@@ backward compatibility @@@ +SW_DLLPUBLIC extern SwBreakIt* g_pBreakIt; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx new file mode 100644 index 000000000..fc17b826f --- /dev/null +++ b/sw/inc/calbck.hxx @@ -0,0 +1,404 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_CALBCK_HXX +#define INCLUDED_SW_INC_CALBCK_HXX + +#include <cassert> + +#include <svl/hint.hxx> +#include <svl/broadcast.hxx> +#include "swdllapi.h" +#include "ring.hxx" +#include <type_traits> +#include <vector> +#include <memory> + +class SwModify; +class SfxPoolItem; + +/* + SwModify and SwClient cooperate in propagating attribute changes. + If an attribute changes, the change is notified to all dependent + formats and other interested objects, e.g. Nodes. The clients will detect + if the change affects them. It could be that the changed attribute is + overruled in the receiving object so that its change does not become + effective or that the receiver is not interested in the particular attribute + in general (though probably in other attributes of the SwModify object they + are registered in). + As SwModify objects are derived from SwClient, they can create a chain of SwClient + objects where changes can get propagated through. + Each SwClient can be registered at only one SwModify object, while each SwModify + object is connected to a list of SwClient objects. If an object derived from SwClient + wants to get notifications from more than one SwModify object, it must create additional + SwClient objects. The SwDepend class allows to handle their notifications in the same + notification callback as it forwards the Modify() calls it receives to a "master" + SwClient implementation. + The SwIterator class allows to iterate over the SwClient objects registered at an + SwModify. For historical reasons its ability to use TypeInfo to restrict this iteration + to objects of a particular type created a lot of code that misuses SwClient-SwModify + relationships that basically should be used only for Modify/Notify callbacks. + This is still subject to refactoring. + */ + +namespace sw +{ + class ClientIteratorBase; + struct LegacyModifyHint final: SfxHint + { + LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : m_pOld(pOld), m_pNew(pNew) {}; + virtual ~LegacyModifyHint() override; + const SfxPoolItem* m_pOld; + const SfxPoolItem* m_pNew; + }; + struct ModifyChangedHint final: SfxHint + { + ModifyChangedHint(const SwModify* pNew) : m_pNew(pNew) {}; + virtual ~ModifyChangedHint() override; + const SwModify* m_pNew; + }; + // Observer pattern using svl implementation + // use this instead of SwClient/SwModify wherever possible + // In writer layout, this might not always be possible, + // but for listeners outside of it (e.g. unocore) this should be used. + // The only "magic" signal this class issues is a ModifyChangedHint + // proclaiming its death. It does NOT however provide a new SwModify for + // listeners to switch to like the old SwModify/SwClient did, as that leads + // to madness. + class SW_DLLPUBLIC BroadcasterMixin { + SvtBroadcaster m_aNotifier; + public: + BroadcasterMixin() = default; + BroadcasterMixin(BroadcasterMixin const &) = default; + BroadcasterMixin& operator=(const BroadcasterMixin&) + { + return *this; // Listeners are never copied or moved. + } + SvtBroadcaster& GetNotifier() { return m_aNotifier; } + }; + /// refactoring out the same of the more sane SwClient functionality + class SW_DLLPUBLIC WriterListener + { + friend class ::SwModify; + friend class ::sw::ClientIteratorBase; + private: + WriterListener* m_pLeft; + WriterListener* m_pRight; ///< double-linked list of other clients + + WriterListener(WriterListener const&) = delete; + WriterListener& operator=(WriterListener const&) = delete; + + protected: + WriterListener() + : m_pLeft(nullptr), m_pRight(nullptr) + {} + virtual ~WriterListener() COVERITY_NOEXCEPT_FALSE {} + virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) =0; + public: + bool IsLast() const { return !m_pLeft && !m_pRight; } + }; + enum class IteratorMode { Exact, UnwrapMulti }; +} + +// SwClient +class SW_DLLPUBLIC SwClient : public ::sw::WriterListener +{ + // avoids making the details of the linked list and the callback method public + friend class SwModify; + friend class sw::ClientIteratorBase; + template<typename E, typename S, sw::IteratorMode> friend class SwIterator; + + SwModify *m_pRegisteredIn; ///< event source + +protected: + // single argument ctors shall be explicit. + inline explicit SwClient( SwModify* pToRegisterIn ); + + // write access to pRegisteredIn shall be granted only to the object itself (protected access) + SwModify* GetRegisteredInNonConst() const { return m_pRegisteredIn; } + +public: + SwClient() : m_pRegisteredIn(nullptr) {} + SwClient(SwClient&&) noexcept; + virtual ~SwClient() override; + // callbacks received from SwModify (friend class - so these methods can be private) + // should be called only from SwModify the client is registered in + // mba: IMHO this method should be pure virtual + // DO NOT USE IN NEW CODE! use SwClientNotify instead. + virtual void Modify(const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue); + // when overriding this, you MUST call SwClient::SwClientModify() in the override! + virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; + + // in case an SwModify object is destroyed that itself is registered in another SwModify, + // its SwClient objects can decide to get registered to the latter instead by calling this method + std::unique_ptr<sw::ModifyChangedHint> CheckRegistration( const SfxPoolItem* pOldValue ); + + // controlled access to Modify method + // mba: this is still considered a hack and it should be fixed; the name makes grep-ing easier + virtual void ModifyNotification( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ) { Modify ( pOldValue, pNewValue ); } + void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { SwClientNotify( rModify, rHint ); } + + const SwModify* GetRegisteredIn() const { return m_pRegisteredIn; } + SwModify* GetRegisteredIn() { return m_pRegisteredIn; } + void EndListeningAll(); + void StartListeningToSameModifyAs(const SwClient&); + + + // get information about attribute + virtual bool GetInfo( SfxPoolItem& ) const { return true; } +}; + + +// SwModify + +// class has a doubly linked list for dependencies +class SW_DLLPUBLIC SwModify: public SwClient +{ + friend class sw::ClientIteratorBase; + template<typename E, typename S, sw::IteratorMode> friend class SwIterator; + sw::WriterListener* m_pWriterListeners; // the start of the linked list of clients + bool m_bModifyLocked : 1; // don't broadcast changes now + bool m_bLockClientList : 1; // may be set when this instance notifies its clients + bool m_bInCache : 1; + bool m_bInSwFntCache : 1; + + // mba: IMHO this method should be pure virtual + // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override + { NotifyClients( pOld, pNew ); }; + + SwModify(SwModify const &) = delete; + SwModify &operator =(const SwModify&) = delete; +public: + SwModify() + : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), m_bLockClientList(false), m_bInCache(false), m_bInSwFntCache(false) + {} + + // broadcasting: send notifications to all clients + // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. + void NotifyClients( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ); + // the same, but without setting m_bModifyLocked or checking for any of the flags + // DO NOT USE IN NEW CODE! use CallSwClientNotify instead. + void ModifyBroadcast( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue) + { CallSwClientNotify( sw::LegacyModifyHint{ pOldValue, pNewValue } ); }; + + // a more universal broadcasting mechanism + virtual void CallSwClientNotify( const SfxHint& rHint ) const; + + virtual ~SwModify() override; + + void Add(SwClient *pDepend); + SwClient* Remove(SwClient *pDepend); + bool HasWriterListeners() const { return m_pWriterListeners; } + + // get information about attribute + virtual bool GetInfo( SfxPoolItem& ) const override; + + void LockModify() { m_bModifyLocked = true; } + void UnlockModify() { m_bModifyLocked = false; } + void SetInCache( bool bNew ) { m_bInCache = bNew; } + void SetInSwFntCache( bool bNew ) { m_bInSwFntCache = bNew; } + void SetInDocDTOR(); + bool IsModifyLocked() const { return m_bModifyLocked; } + bool IsInCache() const { return m_bInCache; } + bool IsInSwFntCache() const { return m_bInSwFntCache; } + + void CheckCaching( const sal_uInt16 nWhich ); + bool HasOnlyOneListener() const { return m_pWriterListeners && m_pWriterListeners->IsLast(); } +}; + +template<typename TElementType, typename TSource, sw::IteratorMode eMode> class SwIterator; + +namespace sw +{ + // this class is part of the migration: it still forwards the "old" + // SwModify events and announces them both to the old SwClients still + // registered and also to the new SvtListeners. + // Still: in the long run the SwClient/SwModify interface should not be + // used anymore, in which case a BroadcasterMixin should be enough instead + // then. + class SW_DLLPUBLIC BroadcastingModify : public SwModify, public BroadcasterMixin { + public: + virtual void CallSwClientNotify(const SfxHint& rHint) const override; + }; + // this should be hidden but sadly SwIterator template needs it... + class ListenerEntry final : public SwClient + { + private: + template<typename E, typename S, sw::IteratorMode> friend class ::SwIterator; + SwClient *m_pToTell; + + public: + ListenerEntry(SwClient *const pTellHim, SwModify *const pDepend) + : SwClient(pDepend), m_pToTell(pTellHim) + {} + ListenerEntry(ListenerEntry const &) = delete; + ListenerEntry& operator=(ListenerEntry const&) = delete; + ListenerEntry(ListenerEntry&& other) noexcept + : SwClient(std::move(other)) + , m_pToTell(other.m_pToTell) + { } + ListenerEntry& operator=(ListenerEntry&& other) noexcept + { + m_pToTell = other.m_pToTell; + other.GetRegisteredIn()->Add(this); + other.EndListeningAll(); + return *this; + } + + /** get Client information */ + virtual bool GetInfo( SfxPoolItem& rInfo) const override; + private: + virtual void Modify(const SfxPoolItem* pOldValue, const SfxPoolItem *pNewValue) override; + virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) override; + }; + + class SW_DLLPUBLIC WriterMultiListener final + { + SwClient& m_rToTell; + std::vector<ListenerEntry> m_vDepends; + public: + WriterMultiListener(SwClient& rToTell); + WriterMultiListener& operator=(WriterMultiListener const&) = delete; // MSVC2015 workaround + WriterMultiListener(WriterMultiListener const&) = delete; // MSVC2015 workaround + ~WriterMultiListener(); + void StartListening(SwModify* pDepend); + void EndListening(SwModify* pDepend); + bool IsListeningTo(const SwModify* const pDepend) const; + void EndListeningAll(); + }; + class ClientIteratorBase : public sw::Ring< ::sw::ClientIteratorBase > + { + friend SwClient* SwModify::Remove(SwClient*); + friend void SwModify::Add(SwClient*); + protected: + const SwModify& m_rRoot; + // the current object in an iteration + WriterListener* m_pCurrent; + // in case the current object is already removed, the next object in the list + // is marked down to become the current object in the next step + // this is necessary because iteration requires access to members of the current object + WriterListener* m_pPosition; + static SW_DLLPUBLIC ClientIteratorBase* s_pClientIters; + + ClientIteratorBase( const SwModify& rModify ) + : m_rRoot(rModify) + { + MoveTo(s_pClientIters); + s_pClientIters = this; + m_pCurrent = m_pPosition = m_rRoot.m_pWriterListeners; + } + WriterListener* GetLeftOfPos() { return m_pPosition->m_pLeft; } + WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; } + WriterListener* GoStart() + { + m_pPosition = m_rRoot.m_pWriterListeners; + if(m_pPosition) + while( m_pPosition->m_pLeft ) + m_pPosition = m_pPosition->m_pLeft; + m_pCurrent = m_pPosition; + return m_pCurrent; + } + ~ClientIteratorBase() override + { + assert(s_pClientIters); + if(s_pClientIters == this) + s_pClientIters = unique() ? nullptr : GetNextInRing(); + MoveTo(nullptr); + } + // return "true" if an object was removed from a client chain in iteration + // adding objects to a client chain in iteration is forbidden + // SwModify::Add() asserts this + bool IsChanged() const { return m_pPosition != m_pCurrent; } + // ensures the iterator to point at a current client + WriterListener* Sync() { m_pCurrent = m_pPosition; return m_pCurrent; } + }; +} + +template<typename TElementType, typename TSource, + sw::IteratorMode eMode = sw::IteratorMode::Exact> class SwIterator final + : private sw::ClientIteratorBase +{ + //static_assert(!std::is_base_of<SwPageDesc,TSource>::value, "SwPageDesc as TSource is deprecated."); + static_assert(std::is_base_of<SwClient,TElementType>::value, "TElementType needs to be derived from SwClient."); + static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify."); +public: + SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} + TElementType* First() + { + GoStart(); + if(!m_pPosition) + return nullptr; + m_pCurrent = nullptr; + return Next(); + } + TElementType* Next() + { + if(!IsChanged()) + m_pPosition = GetRightOfPos(); + sw::WriterListener *pCurrent(m_pPosition); + while (m_pPosition) + { + if (eMode == sw::IteratorMode::UnwrapMulti) + { + if (auto const pLE = dynamic_cast<sw::ListenerEntry const*>(m_pPosition)) + { + pCurrent = pLE->m_pToTell; + } + } + if (dynamic_cast<const TElementType *>(pCurrent) == nullptr) + { + m_pPosition = GetRightOfPos(); + pCurrent = m_pPosition; + } + else + break; + } + Sync(); + return static_cast<TElementType*>(pCurrent); + } + using sw::ClientIteratorBase::IsChanged; +}; + +template< typename TSource > class SwIterator<SwClient, TSource> final : private sw::ClientIteratorBase +{ + static_assert(std::is_base_of<SwModify,TSource>::value, "TSource needs to be derived from SwModify"); +public: + SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {} + SwClient* First() + { return static_cast<SwClient*>(GoStart()); } + SwClient* Next() + { + if(!IsChanged()) + m_pPosition = GetRightOfPos(); + return static_cast<SwClient*>(Sync()); + } + using sw::ClientIteratorBase::IsChanged; +}; + +SwClient::SwClient( SwModify* pToRegisterIn ) + : m_pRegisteredIn( nullptr ) +{ + if(pToRegisterIn) + pToRegisterIn->Add(this); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx new file mode 100644 index 000000000..86e33f4cb --- /dev/null +++ b/sw/inc/calc.hxx @@ -0,0 +1,251 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_CALC_HXX +#define INCLUDED_SW_INC_CALC_HXX + +#include <memory> +#include <vector> +#include <basic/sbxvar.hxx> +#include <unotools/syslocale.hxx> +#include <rtl/ustrbuf.hxx> +#include <tools/solar.h> +#include "swdllapi.h" + +class CharClass; +class LocaleDataWrapper; +class SwFieldType; +class SwDoc; +class SwUserFieldType; + +#define TBLSZ 47 // should be a prime, because of hash table + +const sal_Unicode cListDelim = '|'; + +enum SwCalcOper +{ + CALC_NAME, CALC_NUMBER, CALC_ENDCALC, + CALC_PLUS='+', CALC_MINUS='-', CALC_MUL='*', + CALC_DIV='/', CALC_PRINT=';', CALC_ASSIGN='=', + CALC_LP='(', CALC_RP=')', CALC_PHD='%', + CALC_POW='^', + CALC_NOT=256, CALC_AND=257, CALC_OR=258, + CALC_XOR=259, CALC_EQ=260, CALC_NEQ=261, + CALC_LEQ=262, CALC_GEQ=263, CALC_LES=264, + CALC_GRE=265, CALC_SUM=266, CALC_MEAN=267, + CALC_SQRT=268, CALC_MIN=269, CALC_MIN_IN=270, + CALC_MAX=271, CALC_MAX_IN=272, CALC_SIN=273, + CALC_COS=274, CALC_TAN=275, CALC_ASIN=276, + CALC_ACOS=278, CALC_ATAN=279, CALC_TDIF=280, + CALC_ROUND=281, CALC_DATE=282, CALC_MONTH=283, + CALC_DAY=284 +}; + +// Calculate Operations Strings +extern const char sCalc_Add[]; +extern const char sCalc_Sub[]; +extern const char sCalc_Mul[]; +extern const char sCalc_Div[]; +extern const char sCalc_Phd[]; +extern const char sCalc_Sqrt[]; +extern const char sCalc_Pow[]; +extern const char sCalc_Or[]; +extern const char sCalc_Xor[]; +extern const char sCalc_And[]; +extern const char sCalc_Not[]; +extern const char sCalc_Eq[]; +extern const char sCalc_Neq[]; +extern const char sCalc_Leq[]; +extern const char sCalc_Geq[]; +extern const char sCalc_L[]; +extern const char sCalc_G[]; +extern const char sCalc_Sum[]; +extern const char sCalc_Mean[]; +extern const char sCalc_Min[]; +extern const char sCalc_Max[]; +extern const char sCalc_Sin[]; +extern const char sCalc_Cos[]; +extern const char sCalc_Tan[]; +extern const char sCalc_Asin[]; +extern const char sCalc_Acos[]; +extern const char sCalc_Atan[]; +extern const char sCalc_Tdif[]; +extern const char sCalc_Round[]; +extern const char sCalc_Date[]; + +// Calculate ErrorCodes +enum class SwCalcError +{ + NONE=0, + Syntax, // syntax error + DivByZero, // division by zero + FaultyBrackets, // faulty brackets + OverflowInPower, // overflow in power function + Overflow, // overflow +}; + +class SwSbxValue final : public SbxValue +{ + bool m_bVoid; + bool m_bDBvalue; +public: + // always default to a number. otherwise it will become a SbxEMPTY + SwSbxValue( long n = 0 ) : m_bVoid(false), m_bDBvalue(false) { PutLong( n ); } + SwSbxValue( const double& rD ) : m_bVoid(false), m_bDBvalue(false) { PutDouble( rD ); } + + bool GetBool() const; + double GetDouble() const; + SwSbxValue& MakeDouble(); + + bool IsVoidValue() const {return m_bVoid;} + void SetVoidValue(bool bSet) {m_bVoid = bSet;} + + bool IsDBvalue() const {return m_bDBvalue;} + void SetDBvalue(bool bSet) {m_bDBvalue = bSet;} +}; + +// Calculate HashTables for VarTable and Operations +struct SwHash +{ + SwHash( const OUString& rStr ); + virtual ~SwHash(); + OUString aStr; + std::unique_ptr<SwHash> pNext; +}; + +struct SwCalcExp final : public SwHash +{ + SwSbxValue nValue; + const SwFieldType* pFieldType; + + SwCalcExp( const OUString& rStr, const SwSbxValue& rVal, + const SwFieldType* pFieldType ); +}; + +/// T should be a subclass of SwHash +template<class T> +class SwHashTable +{ + std::vector<std::unique_ptr<T>> m_aData; +public: + SwHashTable(size_t nSize) : m_aData(nSize) {} + std::unique_ptr<T> & operator[](size_t idx) { return m_aData[idx]; } + std::unique_ptr<T> const & operator[](size_t idx) const { return m_aData[idx]; } + void resize(size_t nSize) { m_aData.resize(nSize); } + + T* Find( const OUString& rStr, sal_uInt16* pPos = nullptr ) const + { + size_t nTableSize = m_aData.size(); + sal_uLong ii = 0; + for( sal_Int32 n = 0; n < rStr.getLength(); ++n ) + { + ii = ii << 1 ^ rStr[n]; + } + ii %= nTableSize; + + if( pPos ) + *pPos = static_cast<sal_uInt16>(ii); + + for( T* pEntry = m_aData[ii].get(); pEntry; pEntry = static_cast<T*>(pEntry->pNext.get()) ) + { + if( rStr == pEntry->aStr ) + { + return pEntry; + } + } + return nullptr; + } + +}; + + +// if CalcOp != 0, this is a valid operator +struct CalcOp; +CalcOp* FindOperator( const OUString& rSearch ); + +extern "C" typedef double (*pfCalc)(double); + +class SwCalc +{ + SwHashTable<SwCalcExp> m_aVarTable; + OUStringBuffer m_aVarName; + OUString m_sCurrSym; + OUString m_sCommand; + std::vector<const SwUserFieldType*> m_aRekurStack; + SwSbxValue m_nLastLeft; + SwSbxValue m_nNumberValue; + SwCalcExp m_aErrExpr; + sal_Int32 m_nCommandPos; + + SwDoc& m_rDoc; + SvtSysLocale m_aSysLocale; + const LocaleDataWrapper* m_pLocaleDataWrapper; + CharClass* m_pCharClass; + + sal_uInt16 m_nListPor; + SwCalcOper m_eCurrOper; + SwCalcOper m_eCurrListOper; + SwCalcError m_eError; + + SwCalcOper GetToken(); + SwSbxValue Expr(); + SwSbxValue Term(); + SwSbxValue PrimFunc(bool &rChkPow); + SwSbxValue Prim(); + SwSbxValue StdFunc(pfCalc pFnc, bool bChkTrig); + + static OUString GetColumnName( const OUString& rName ); + OUString GetDBName( const OUString& rName ); + + SwCalc( const SwCalc& ) = delete; + SwCalc& operator=( const SwCalc& ) = delete; + +public: + SwCalc(SwDoc& rD); + ~SwCalc() COVERITY_NOEXCEPT_FALSE; + + SwSbxValue Calculate( const OUString &rStr ); + OUString GetStrResult( const SwSbxValue& rValue ); + OUString GetStrResult( double ); + + SwCalcExp* VarInsert( const OUString& r ); + SwCalcExp* VarLook( const OUString &rStr, bool bIns = false ); + void VarChange( const OUString& rStr, const SwSbxValue& rValue ); + void VarChange( const OUString& rStr, double ); + SwHashTable<SwCalcExp> & GetVarTable() { return m_aVarTable; } + + bool Push(const SwUserFieldType* pUserFieldType); + void Pop(); + CharClass* GetCharClass(); + + void SetCalcError( SwCalcError eErr ) { m_eError = eErr; } + bool IsCalcError() const { return SwCalcError::NONE != m_eError; } + + static bool Str2Double( const OUString& rStr, sal_Int32& rPos, + double& rVal ); + static bool Str2Double( const OUString& rStr, sal_Int32& rPos, + double& rVal, SwDoc const *const pDoc ); + + SW_DLLPUBLIC static bool IsValidVarName( const OUString& rStr, + OUString* pValidName = nullptr ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ccoll.hxx b/sw/inc/ccoll.hxx new file mode 100644 index 000000000..29eafc112 --- /dev/null +++ b/sw/inc/ccoll.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_CCOLL_HXX +#define INCLUDED_SW_INC_CCOLL_HXX + +#include <rtl/ustring.hxx> +#include <svl/poolitem.hxx> +#include <tools/solar.h> +#include "swdllapi.h" + +enum class Master_CollCondition; + +#define COND_COMMAND_COUNT 28 + +struct CommandStruct +{ + Master_CollCondition nCnd; + sal_uLong nSubCond; +}; + +sal_Int16 GetCommandContextIndex( const OUString &rContextName ); +OUString GetCommandContextByIndex( sal_Int16 nIndex ); + +class SW_DLLPUBLIC SwCondCollItem final : public SfxPoolItem +{ + static const CommandStruct aCmds[COND_COMMAND_COUNT]; + + OUString m_sStyles[COND_COMMAND_COUNT]; + +public: + SwCondCollItem(); + virtual ~SwCondCollItem() override; + + SwCondCollItem(SwCondCollItem const &) = default; + SwCondCollItem(SwCondCollItem &&) = default; + SwCondCollItem & operator =(SwCondCollItem const &) = delete; // due to SfxPoolItem + SwCondCollItem & operator =(SwCondCollItem &&) = delete; // due to SfxPoolItem + + virtual SwCondCollItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + static const CommandStruct* GetCmds() { return aCmds; } + + OUString GetStyle(sal_uInt16 nPos) const; + void SetStyle(const OUString* pStyle, sal_uInt16 nPos); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx new file mode 100644 index 000000000..9c4c8a582 --- /dev/null +++ b/sw/inc/cellatr.hxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_CELLATR_HXX +#define INCLUDED_SW_INC_CELLATR_HXX + +#include <svl/intitem.hxx> +#include <svl/zforlist.hxx> +#include "swdllapi.h" +#include "format.hxx" +#include "hintids.hxx" +#include "cellfml.hxx" + +/** The number formatter's default locale's @ Text format. + Not necessarily system locale, but the locale the formatter was constructed + with. For this SvNumberFormatter::IsTextFormat() always returns true. + */ +constexpr sal_uInt32 getSwDefaultTextFormat() { return NF_STANDARD_FORMAT_TEXT; } + +class SW_DLLPUBLIC SwTableBoxNumFormat : public SfxUInt32Item +{ +public: + SwTableBoxNumFormat( sal_uInt32 nFormat = getSwDefaultTextFormat() ); + + // "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwTableBoxNumFormat* Clone( SfxItemPool* pPool = nullptr ) const override; + + SwTableBoxNumFormat& operator=( const SwTableBoxNumFormat& rAttr ) + { + SetValue( rAttr.GetValue() ); + return *this; + } +}; + +class SwTableBoxFormula : public SfxPoolItem, public SwTableFormula +{ + SwModify* m_pDefinedIn; // Modify object where the formula is located + // can only be TableBoxFormat + +public: + SwTableBoxFormula( const OUString& rFormula ); + + // "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwTableBoxFormula* Clone( SfxItemPool* pPool = nullptr ) const override; + + const SwModify* GetDefinedIn() const { return m_pDefinedIn; } + void ChgDefinedIn( const SwModify* pNew ) + { m_pDefinedIn = const_cast<SwModify*>(pNew); } + // BoxAttribut -> BoxStartNode + virtual const SwNode* GetNodeOfFormula() const override; + + SwTableBox* GetTableBox(); + const SwTableBox* GetTableBox() const + { return const_cast<SwTableBoxFormula*>(this)->GetTableBox(); } + + void ChangeState( const SfxPoolItem* pItem ); + void Calc( SwTableCalcPara& rCalcPara, double& rValue ); +}; + +class SW_DLLPUBLIC SwTableBoxValue : public SfxPoolItem +{ + double m_nValue; +public: + SwTableBoxValue(); + SwTableBoxValue( const double aVal ); + + // "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwTableBoxValue* Clone( SfxItemPool* pPool = nullptr ) const override; + + SwTableBoxValue& operator=( const SwTableBoxValue& rCmp ) + { + m_nValue = rCmp.m_nValue; + return *this; + } + + double GetValue() const { return m_nValue; } +}; + +inline const SwTableBoxNumFormat &SwAttrSet::GetTableBoxNumFormat(bool bInP) const + { return Get( RES_BOXATR_FORMAT,bInP); } +inline const SwTableBoxFormula &SwAttrSet::GetTableBoxFormula(bool bInP) const + { return Get( RES_BOXATR_FORMULA,bInP); } +inline const SwTableBoxValue &SwAttrSet::GetTableBoxValue(bool bInP) const + { return Get( RES_BOXATR_VALUE, bInP); } + +inline const SwTableBoxNumFormat &SwFormat::GetTableBoxNumFormat(bool bInP) const + { return m_aSet.GetTableBoxNumFormat(bInP); } +inline const SwTableBoxFormula &SwFormat::GetTableBoxFormula(bool bInP) const + { return m_aSet.GetTableBoxFormula(bInP); } +inline const SwTableBoxValue &SwFormat::GetTableBoxValue(bool bInP) const + { return m_aSet.GetTableBoxValue(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx new file mode 100644 index 000000000..e37b9304b --- /dev/null +++ b/sw/inc/cellfml.hxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_CELLFML_HXX +#define INCLUDED_SW_INC_CELLFML_HXX + +#include <memory> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.hxx> + +class SwTable; +class SwNode; +class SwTableSortBoxes; +class SwSelBoxes; +class SwCalc; +class SwTableBox; +class SwTableFormulaUpdate; +class SwDoc; +class SwRootFrame; + +class SwTableCalcPara +{ + const SwTableBox* m_pLastTableBox; + sal_uInt16 m_nStackCount, m_nMaxSize; + +public: + SwRootFrame const*const m_pLayout; ///< layout to access text field results + std::unique_ptr<SwTableSortBoxes> m_pBoxStack; ///< stack for recognizing recursion + SwCalc& m_rCalc; ///< current Calculator + const SwTable* m_pTable; ///< current table + + SwTableCalcPara(SwCalc& rCalculator, const SwTable& rTable, SwRootFrame const* pLayout); + ~SwTableCalcPara(); + + bool CalcWithStackOverflow(); + bool IsStackOverflow() const { return m_nMaxSize == m_nStackCount; } + bool IncStackCnt() { return m_nMaxSize == ++m_nStackCount; } + void DecStackCnt() { if( m_nStackCount ) --m_nStackCount; } + void SetLastTableBox( const SwTableBox* pBox ) { m_pLastTableBox = pBox; } +}; + +class SwTableFormula +{ +typedef void (SwTableFormula:: *FnScanFormula)( const SwTable&, OUStringBuffer&, + OUString&, OUString*, void* ) const; + + void BoxNmsToPtr( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void PtrToBoxNms( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void RelNmsToBoxNms( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void RelBoxNmsToPtr( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void BoxNmsToRelNm( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void MakeFormula_( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void GetFormulaBoxes( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void HasValidBoxes_( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + void SplitMergeBoxNm_( const SwTable&, OUStringBuffer&, OUString&, OUString*, + void* pPara ) const; + + static void GetBoxes( const SwTableBox& rStt, const SwTableBox& rEnd, + SwSelBoxes& rBoxes ); + OUString ScanString( FnScanFormula fnFormula, const SwTable& rTable, + void*) const; + + static const SwTable* FindTable( SwDoc& rDoc, const OUString& rNm ); + +protected: + enum NameType { EXTRNL_NAME, INTRNL_NAME, REL_NAME }; + + OUString m_sFormula; ///< current formula + NameType m_eNmType; ///< current display method + bool m_bValidValue; ///< true: recalculate formula + + // find the node in which the formula is located + // TextField -> TextNode, + // BoxAttribut -> BoxStartNode + // !!! every derived class must override this !!! + virtual const SwNode* GetNodeOfFormula() const = 0; + + SwTableFormula( const OUString& rFormula ); + + OUString MakeFormula( SwTableCalcPara& rCalcPara ) const + { + return ScanString( &SwTableFormula::MakeFormula_, + *rCalcPara.m_pTable, &rCalcPara ); + } + + static sal_uInt16 GetLnPosInTable( const SwTable& rTable, const SwTableBox* pBox ); + +public: + + virtual ~SwTableFormula(); + + SwTableFormula(SwTableFormula const &) = default; + SwTableFormula(SwTableFormula &&) = default; + SwTableFormula & operator =(SwTableFormula const &) = default; + SwTableFormula & operator =(SwTableFormula &&) = default; + + /// create from the internal formula (for CORE) the external formula (for UI) + SW_DLLPUBLIC void PtrToBoxNm( const SwTable* pTable ); + /// create from the external formula the internal + void BoxNmToPtr( const SwTable* pTable ); + /// create from the external/internal formula the relative formula + void ToRelBoxNm( const SwTable* pTable ); + /// gets called before/after merging/splitting of tables + void ToSplitMergeBoxNm( SwTableFormulaUpdate& rTableUpd ); + + bool IsIntrnlName() const { return m_eNmType == INTRNL_NAME; } + NameType GetNameType() const { return m_eNmType; } + + bool IsValid() const { return m_bValidValue; } + void ChgValid( bool bNew ) { m_bValidValue = bNew; } + + const OUString& GetFormula() const { return m_sFormula; } + void SetFormula( const OUString& rNew ) + { + m_sFormula = rNew; + m_eNmType = EXTRNL_NAME; + m_bValidValue = false; + } + + void GetBoxesOfFormula(const SwTable& rTable, SwSelBoxes& rBoxes); + // are all boxes valid which this formula relies on? + bool HasValidBoxes() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/charatr.hxx b/sw/inc/charatr.hxx new file mode 100644 index 000000000..a49cd5017 --- /dev/null +++ b/sw/inc/charatr.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_CHARATR_HXX +#define INCLUDED_SW_INC_CHARATR_HXX + +#include "format.hxx" +#include "hintids.hxx" +#include <editeng/postitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/autokernitem.hxx> +#include <editeng/wrlmitem.hxx> +#include <editeng/contouritem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/cmapitem.hxx> +#include <editeng/nhypitem.hxx> +#include <editeng/blinkitem.hxx> +#include <editeng/emphasismarkitem.hxx> +#include <editeng/twolinesitem.hxx> +#include <editeng/charscaleitem.hxx> +#include <editeng/charrotateitem.hxx> +#include <editeng/charreliefitem.hxx> +#include <editeng/charhiddenitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/colritem.hxx> + +// implementation of the character attribute methods of SwAttrSet + +inline const SvxPostureItem &SwAttrSet::GetPosture(bool bInP) const + { return Get( RES_CHRATR_POSTURE,bInP); } +inline const SvxPostureItem &SwAttrSet::GetCJKPosture(bool bInP) const + { return Get( RES_CHRATR_CJK_POSTURE,bInP); } +inline const SvxPostureItem &SwAttrSet::GetCTLPosture(bool bInP) const + { return Get( RES_CHRATR_CTL_POSTURE,bInP); } +inline const SvxWeightItem &SwAttrSet::GetWeight(bool bInP) const + { return Get( RES_CHRATR_WEIGHT,bInP); } +inline const SvxWeightItem &SwAttrSet::GetCJKWeight(bool bInP) const + { return Get( RES_CHRATR_CJK_WEIGHT,bInP); } +inline const SvxWeightItem &SwAttrSet::GetCTLWeight(bool bInP) const + { return Get( RES_CHRATR_CTL_WEIGHT,bInP); } +inline const SvxShadowedItem &SwAttrSet::GetShadowed(bool bInP) const + { return Get( RES_CHRATR_SHADOWED,bInP); } +inline const SvxAutoKernItem &SwAttrSet::GetAutoKern(bool bInP) const + { return Get( RES_CHRATR_AUTOKERN,bInP); } +inline const SvxWordLineModeItem &SwAttrSet::GetWordLineMode(bool bInP) const + { return Get( RES_CHRATR_WORDLINEMODE,bInP); } +inline const SvxContourItem &SwAttrSet::GetContour(bool bInP) const + { return Get( RES_CHRATR_CONTOUR,bInP); } +inline const SvxKerningItem &SwAttrSet::GetKerning(bool bInP) const + { return Get( RES_CHRATR_KERNING,bInP); } +inline const SvxUnderlineItem &SwAttrSet::GetUnderline(bool bInP) const + { return Get( RES_CHRATR_UNDERLINE,bInP); } +inline const SvxOverlineItem &SwAttrSet::GetOverline(bool bInP) const + { return Get( RES_CHRATR_OVERLINE,bInP); } +inline const SvxCrossedOutItem &SwAttrSet::GetCrossedOut(bool bInP) const + { return Get( RES_CHRATR_CROSSEDOUT,bInP); } +inline const SvxFontHeightItem &SwAttrSet::GetSize(bool bInP) const + { return Get( RES_CHRATR_FONTSIZE,bInP); } +inline const SvxFontHeightItem &SwAttrSet::GetCJKSize(bool bInP) const + { return Get( RES_CHRATR_CJK_FONTSIZE,bInP); } +inline const SvxFontHeightItem &SwAttrSet::GetCTLSize(bool bInP) const + { return Get( RES_CHRATR_CTL_FONTSIZE,bInP); } +inline const SvxFontItem &SwAttrSet::GetFont(bool bInP) const + { return Get( RES_CHRATR_FONT,bInP); } +inline const SvxFontItem &SwAttrSet::GetCJKFont(bool bInP) const + { return Get( RES_CHRATR_CJK_FONT,bInP); } +inline const SvxFontItem &SwAttrSet::GetCTLFont(bool bInP) const + { return Get( RES_CHRATR_CTL_FONT,bInP); } +inline const SvxColorItem &SwAttrSet::GetColor(bool bInP) const + { return Get( RES_CHRATR_COLOR,bInP); } +inline const SvxLanguageItem &SwAttrSet::GetLanguage(bool bInP) const + { return Get( RES_CHRATR_LANGUAGE,bInP); } +inline const SvxLanguageItem &SwAttrSet::GetCJKLanguage(bool bInP) const + { return Get( RES_CHRATR_CJK_LANGUAGE,bInP); } +inline const SvxLanguageItem &SwAttrSet::GetCTLLanguage(bool bInP) const + { return Get( RES_CHRATR_CTL_LANGUAGE,bInP); } +inline const SvxEscapementItem &SwAttrSet::GetEscapement(bool bInP) const + { return Get( RES_CHRATR_ESCAPEMENT,bInP); } +inline const SvxCaseMapItem &SwAttrSet::GetCaseMap(bool bInP) const + { return Get( RES_CHRATR_CASEMAP,bInP); } +inline const SvxNoHyphenItem &SwAttrSet::GetNoHyphenHere(bool bInP) const + { return Get( RES_CHRATR_NOHYPHEN,bInP); } +inline const SvxEmphasisMarkItem &SwAttrSet::GetEmphasisMark( bool bInP ) const + { return Get( RES_CHRATR_EMPHASIS_MARK, bInP ); } +inline const SvxTwoLinesItem &SwAttrSet::Get2Lines( bool bInP ) const + { return Get( RES_CHRATR_TWO_LINES, bInP ); } +inline const SvxCharScaleWidthItem &SwAttrSet::GetCharScaleW( bool bInP ) const + { return Get( RES_CHRATR_SCALEW, bInP ); } +inline const SvxCharRotateItem &SwAttrSet::GetCharRotate( bool bInP ) const + { return Get( RES_CHRATR_ROTATE, bInP ); } +inline const SvxCharReliefItem &SwAttrSet::GetCharRelief( bool bInP ) const + { return Get( RES_CHRATR_RELIEF, bInP ); } +inline const SvxCharHiddenItem &SwAttrSet::GetCharHidden( bool bInP ) const + { return Get( RES_CHRATR_HIDDEN, bInP ); } + +// implementation of the character attribute methods of SwFormat + +inline const SvxUnderlineItem &SwFormat::GetUnderline(bool bInP) const + { return m_aSet.GetUnderline(bInP); } +inline const SvxFontHeightItem &SwFormat::GetSize(bool bInP) const + { return m_aSet.GetSize(bInP); } +inline const SvxFontItem &SwFormat::GetFont(bool bInP) const + { return m_aSet.GetFont(bInP); } +inline const SvxFontItem &SwFormat::GetCJKFont(bool bInP) const + { return m_aSet.GetCJKFont(bInP); } +inline const SvxFontItem &SwFormat::GetCTLFont(bool bInP) const + { return m_aSet.GetCTLFont(bInP); } +inline const SvxColorItem &SwFormat::GetColor(bool bInP) const + { return m_aSet.GetColor(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx new file mode 100644 index 000000000..a2f1ff69c --- /dev/null +++ b/sw/inc/charfmt.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_CHARFMT_HXX +#define INCLUDED_SW_INC_CHARFMT_HXX + +#include "format.hxx" +#include "hintids.hxx" + +class SwCharFormat final : public SwFormat +{ + friend class SwDoc; + friend class SwTextFormatColl; + + SwCharFormat( SwAttrPool& rPool, const char* pFormatName, + SwCharFormat *pDerivedFrom ) + : SwFormat( rPool, pFormatName, aCharFormatSetRange, pDerivedFrom, RES_CHRFMT ) + {} + SwCharFormat( SwAttrPool& rPool, const OUString &rFormatName, + SwCharFormat *pDerivedFrom ) + : SwFormat( rPool, rFormatName, aCharFormatSetRange, pDerivedFrom, RES_CHRFMT ) + {} + +public: + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +namespace CharFormat +{ + SW_DLLPUBLIC extern const SfxItemSet* GetItemSet( const SfxPoolItem& rAttr ); + extern const SfxPoolItem* GetItem( const SwTextAttr& rAttr, sal_uInt16 nWhich ); + template<class T> const T* GetItem( const SwTextAttr& rAttr, TypedWhichId<T> nWhich ) + { + return static_cast<const T*>(GetItem(rAttr, sal_uInt16(nWhich))); + } + extern bool IsItemIncluded( const sal_uInt16 nWhich, const SwTextAttr *pAttr ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/checkit.hxx b/sw/inc/checkit.hxx new file mode 100644 index 000000000..2423072bf --- /dev/null +++ b/sw/inc/checkit.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#pragma once + +#include <com/sun/star/uno/Reference.h> + +namespace com::sun::star::i18n { class XExtendedInputSequenceChecker; } + +// Wrapper for the XInputSequenceChecker +class SwCheckIt +{ +public: + css::uno::Reference < css::i18n::XExtendedInputSequenceChecker > xCheck; + + SwCheckIt(); +}; + +extern SwCheckIt* pCheckIt; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx new file mode 100644 index 000000000..305831911 --- /dev/null +++ b/sw/inc/chpfld.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_CHPFLD_HXX +#define INCLUDED_SW_INC_CHPFLD_HXX + +#include "fldbas.hxx" + +class SwFrame; +class SwContentNode; +class SwTextNode; +class SwRootFrame; + +enum SwChapterFormat +{ + CF_BEGIN, + CF_NUMBER = CF_BEGIN, ///< only the chapter number + CF_TITLE, ///< only the title + CF_NUM_TITLE, ///< number and title + CF_NUMBER_NOPREPST, ///< only chapter number without post-/prefix + CF_NUM_NOPREPST_TITLE, ///< chapter number without post-/prefix and title +}; + +class SAL_DLLPUBLIC_RTTI SwChapterFieldType final : public SwFieldType +{ +public: + SwChapterFieldType(); + + virtual std::unique_ptr<SwFieldType> Copy() const override; + +}; + +class SW_DLLPUBLIC SwChapterField final : public SwField +{ + friend class SwChapterFieldType; + friend class ToxTextGeneratorTest; // the unittest needs to mock the chapter fields. + + struct State + { + sal_uInt8 nLevel; + OUString sTitle; + OUString sNumber; + OUString sPre; + OUString sPost; + State() : nLevel(0) {} + }; + State m_State; + State m_StateRLHidden; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwChapterField(SwChapterFieldType*, sal_uInt32 nFormat = 0); + + // #i53420# + void ChangeExpansion( const SwFrame&, + const SwContentNode*, + bool bSrchNum = false); + void ChangeExpansion(const SwTextNode &rNd, bool bSrchNum, SwRootFrame const* pLayout = nullptr); + + sal_uInt8 GetLevel(SwRootFrame const* pLayout = nullptr) const; + void SetLevel(sal_uInt8); + + const OUString& GetNumber(SwRootFrame const* pLayout = nullptr) const; + const OUString& GetTitle(SwRootFrame const* pLayout = nullptr) const; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +#endif // INCLUDED_SW_INC_CHPFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h new file mode 100644 index 000000000..6513bf503 --- /dev/null +++ b/sw/inc/cmdid.h @@ -0,0 +1,894 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_CMDID_H +#define INCLUDED_SW_INC_CMDID_H + +#include <sfx2/sfxsids.hrc> +#include <svx/svxids.hrc> +#include <svl/solar.hrc> + +#define FN_FILE SID_SW_START +//#define FN_EDIT (SID_SW_START + 100) defined in svxids.hrc +#define FN_VIEW (SID_SW_START + 200) +//#define FN_INSERT (SID_SW_START + 300) defined in svxids.hrc +//#define FN_FORMAT (SID_SW_START + 400) defined in svxids.hrc +//#define FN_EXTRA (SID_SW_START + 600) defined in svxids.hrc +//#define FN_SELECTION (SID_SW_START + 900) defined in svxids.hrc +#define FN_QUERY (SID_SW_START + 1000) +#define FN_ENVELP (SID_SW_START + 1050) +#define FN_PARAM (SID_SW_START + 1100) +#define FN_STAT (SID_SW_START + 1180) +//#define FN_PGPREVIEW (SID_SW_START + 1250) defined in svxids.hrc +#define FN_FRAME (SID_SW_START + 1300) +#define FN_INSERT2 (SID_SW_START + 1400) +#define FN_FORMAT2 (SID_SW_START + 1600) +//#define FN_EDIT2 (SID_SW_START + 1800) defined in svxids.hrc +#define FN_QUERY2 (SID_SW_START + 2000) +#define FN_EXTRA2 (SID_SW_START + 2200) +#define FN_PARAM2 (SID_SW_START + 2400) +#define FN_NOTES (SID_SW_START + 2500) +#define FN_SIDEBAR (SID_SW_START + 2550) +#define FN_HEADERFOOTER (SID_SW_START + 2600) +#define FN_PAGEBREAK (SID_SW_START + 2610) + + /* More accurately, this range should be from FN_EXTRA2 to FN_PARAM2-1, but + * FN_NUMBER_NEWSTART comes from FN_FORMAT2, and FN_PARAM_LINK_DISPLAY_NAME + * comes from FN_PARAM2 so we need to include FORMAT2, + * EDIT2 and QUERY2 and PARAM2 in the range...hopefully this will be fixed + * soon */ + +#define FN_UNO_RANGE_BEGIN FN_FORMAT2 +#define FN_UNO_RANGE_END (FN_PARAM2 + 199) + +// Region: File +#define FN_NEW_GLOBAL_DOC (FN_FILE + 4 ) /* Create Global Document */ +#define FN_OPEN_FILE (FN_FILE + 7 ) /* Open */ + +#define FN_OUTLINE_TO_IMPRESS (FN_FILE + 36) /* Send outline to impress */ +#define FN_OUTLINE_TO_CLIPBOARD (FN_FILE + 37) /* Send outline to clipboard */ + +#define FN_NEW_HTML_DOC (FN_FILE + 40 ) /* Create HTML document */ + +// Region: Edit +#define FN_EDIT_FIELD (FN_EDIT + 4 ) /* Edit field */ +#define FN_EDIT_LINK_DLG (FN_EDIT + 9 ) /* Edit link dialog */ + +#define FN_NUMBER_BULLETS (FN_EDIT + 21) /* Bullets */ +#define FN_EDIT_IDX_ENTRY_DLG (FN_EDIT + 23) /* Edit Index-Entry */ +#define FN_UPDATE_FIELDS (FN_EDIT + 26) /* Update fields */ +#define FN_EXECUTE_MACROFIELD (FN_EDIT + 27) /* Execute macrofield */ +#define FN_EDIT_FORMULA (FN_EDIT + 28) /* Edit formula in RibbonBar */ +#define FN_CALC_TABLE (FN_EDIT + 29) + +// Region: Bullets +#define FN_NUM_BULLET_DOWN (FN_EDIT + 30) /* Bullet down */ +#define FN_NUM_BULLET_UP (FN_EDIT + 31) /* Bullet up */ +#define FN_NUM_BULLET_PREV (FN_EDIT + 32) /* to previous bullet */ +#define FN_NUM_BULLET_NEXT (FN_EDIT + 33) /* to next bullet */ +#define FN_NUM_BULLET_MOVEUP (FN_EDIT + 34) /* move bullet up */ +#define FN_NUM_BULLET_MOVEDOWN (FN_EDIT + 35) /* move bullet down */ +#define FN_NUM_BULLET_NONUM (FN_EDIT + 36) /* bullet without number */ +#ifndef FN_NUM_BULLET_OFF //in SVX already +#define FN_NUM_BULLET_OFF (FN_EDIT + 37) /* turn off numbering */ +#endif + +#define FN_NUM_BULLET_OUTLINE_DOWN (FN_EDIT + 39) /* reduce in rank with sub points */ +#define FN_NUM_BULLET_OUTLINE_UP (FN_EDIT + 40) /* increase in rank with sub-items */ +#define FN_NUM_BULLET_OUTLINE_MOVEUP (FN_EDIT + 41) /* Push up with sub-items */ +#define FN_NUM_BULLET_OUTLINE_MOVEDOWN (FN_EDIT + 42) /* Push down with sub-items */ +#define FN_UPDATE_INPUTFIELDS (FN_EDIT + 43) /* Update input fields */ + +#define FN_NUM_OR_NONUM (FN_EDIT + 46) /* Number on/off */ + +#define FN_GOTO_NEXT_INPUTFLD (FN_EDIT + 47) /* go to next inputfield */ +#define FN_GOTO_PREV_INPUTFLD (FN_EDIT + 48) /* go to previous inputfield */ + +#define FN_REPEAT_SEARCH (FN_EDIT + 50) /* Search again */ + +#define FN_REPAGINATE (FN_EDIT + 61) /* Force repagination */ +#define FN_EDIT_FOOTNOTE (FN_EDIT + 62) /* Edit footnote */ + +#define FN_EDIT_REGION (FN_EDIT + 65) /* Edit region */ +#define FN_GOTO_REFERENCE (FN_EDIT + 66) /* From Refmark to the reference */ +#define FN_EDIT_CURRENT_REGION (FN_EDIT + 67) /* Edit current region*/ + +// already defined in SVX +#define FN_NEXT_BOOKMARK (FN_EDIT + 68) /* */ +#define FN_PREV_BOOKMARK (FN_EDIT + 69) /* */ + +#define FN_PAGENUMBER (FN_EDIT + 80) /**/ + +#define FN_SELECT_PARA (FN_EDIT + 97) /* select paragraph*/ + +#define FN_UPDATE_ALL_LINKS (FN_EDIT2 + 24) /* update all links */ + +#define FN_REDLINE_SHOW (FN_EDIT2 + 26) /* show Redlining */ +#define FN_REDLINE_COMMENT (FN_EDIT2 + 27) /* comment Redlining */ + +#define FN_UPDATE_ALL (FN_EDIT2 + 28) /* FN_UPDATE_ALL_LINKS, + FN_UPDATE_FIELDS, + FN_UPDATE_TOX, + CalcLayout */ + +#define FN_REDLINE_ACCEPT (FN_EDIT2 + 29) /* Redlining Accept/Reject */ +#define FN_ATTR_COLUMNS (FN_EDIT2 + 31) /* SlotId for SwFormatCol */ +#define FN_EDIT_CURRENT_TOX (FN_EDIT2 + 32) /* edit current index */ +#define FN_EDIT_AUTH_ENTRY_DLG (FN_EDIT2 + 33) /* edit authorities entry*/ +#define FN_UPDATE_CHARTS (FN_EDIT2 + 34) /* update all charts */ +// free +#define FN_NUM_CONTINUE (FN_EDIT2 + 36) /* continue previous numbering */ +#define FN_REDLINE_ACCEPT_DIRECT (FN_EDIT2 + 37) /* accept redline at current position*/ +#define FN_REDLINE_REJECT_DIRECT (FN_EDIT2 + 38) /* reject redline at current position*/ +// free +// free +#define FN_REDLINE_NEXT_CHANGE (FN_EDIT2 + 41) /* Go to the next change */ +#define FN_REDLINE_PREV_CHANGE (FN_EDIT2 + 42) /* Go to the previous change */ +#define FN_REDLINE_ACCEPT_ALL (FN_EDIT2 + 43) /* Redlining Accept All*/ +#define FN_REDLINE_REJECT_ALL (FN_EDIT2 + 44) /* Redlining Reject All*/ +#define FN_REDLINE_ACCEPT_TONEXT (FN_EDIT2 + 45) /* Redlining Accept and jump to next*/ +#define FN_REDLINE_REJECT_TONEXT (FN_EDIT2 + 46) /* Redlining Reject and jump to next*/ + +// Region: Edit +#define FN_REFRESH_VIEW (FN_VIEW + 1) /* Refresh/Redraw */ + +#define FN_DRAW_WRAP_DLG (FN_VIEW + 3) /* Draw wrapping dlg */ +#define FN_RULER (FN_VIEW + 11) /* Horizontal ruler */ + +#define FN_VIEW_GRAPHIC (FN_VIEW + 13) /* View graphic */ +#define FN_VIEW_BOUNDS (FN_VIEW + 14) /* View bounds */ +#define FN_VIEW_FIELDS (FN_VIEW + 15) /* View fields */ +#define FN_VLINEAL (FN_VIEW + 16) /* Vertical Liner */ +#define FN_VSCROLLBAR (FN_VIEW + 17) /* Vertical Scrollbar */ +#define FN_HSCROLLBAR (FN_VIEW + 18) /* Horizontal Scrollbar */ + +#define FN_VIEW_META_CHARS (FN_VIEW + 24) /* View meta chars */ +#define FN_VIEW_MARKS (FN_VIEW + 25) /* View marks */ +#define FN_VIEW_FIELDNAME (FN_VIEW + 26) /* View field names */ +#define FN_VIEW_TABLEGRID (FN_VIEW + 27) /* View tablegrid */ + +#define FN_SET_PAGE (FN_VIEW + 29) /* Set page template to paragraph */ + +#define FN_PRINT_LAYOUT (FN_VIEW + 37) /* print layout */ + +#define FN_SCROLL_NAVIGATION (FN_VIEW + 40) /* Navigation Controller */ + +#define FN_VIEW_HIDDEN_PARA (FN_VIEW + 42) /* View hidden paragraphs */ +#define FN_VIEW_SMOOTH_SCROLL (FN_VIEW + 43) + +#define FN_PREVIEW_ZOOM (FN_VIEW + 51) /* create table controller for zoom */ + +#define FN_SET_MODOPT_TBLNUMFMT (FN_VIEW + 52) /* Number recognition in tables */ +#define FN_HSCROLL_METRIC (FN_VIEW + 53) /* Metric horizontal scrollbar */ +#define FN_VSCROLL_METRIC (FN_VIEW + 54) /* Metric vertical scrollbar */ + +#define FN_NAV_ELEMENT (FN_VIEW + 55) /* Navigate By drop down controller */ +#define FN_SCROLL_PREV (FN_VIEW + 57) /* uno:ScrollToPrevious */ +#define FN_SCROLL_NEXT (FN_VIEW + 58) /* uno:ScrollToNext */ +#define FN_VIEW_HIDE_WHITESPACE (FN_VIEW + 59) /* Hide header, footer, and pagebreak */ +#define FN_SHOW_INLINETOOLTIPS (FN_VIEW + 60) /* Show tooltips for tracked changes */ +#define FN_USE_HEADERFOOTERMENU (FN_VIEW + 61) /* Show advanced header/footer menu */ +#define FN_VIEW_SHOW_WHITESPACE (FN_VIEW + 62) /* Show header, footer, and pagebreak */ + + +// Region: Insert +#define FN_INSERT_BOOKMARK (FN_INSERT + 2 ) /* Bookmark */ + +#define FN_INSERT_BREAK_DLG (FN_INSERT + 4 ) /* Break */ +#define FN_INSERT_COLUMN_BREAK (FN_INSERT + 5 ) /* Column break */ +#define FN_INSERT_FIELD (FN_INSERT + 8 ) /* Textcommand */ +#define FN_CHANGE_DBFIELD (FN_INSERT + 9 ) /* Change the database field */ + +#define FN_INSERT_CAPTION (FN_INSERT + 10) /* Caption */ +#define FN_INSERT_DBFIELD (FN_INSERT + 11) /* Insert database field - for recording */ +#define FN_INSERT_FOOTNOTE_DLG (FN_INSERT + 12) /* Footnote Dialog */ + +#define FN_INSERT_REF_FIELD (FN_INSERT + 13) /* Insert Reference Field */ + +#define FN_INSERT_HYPERLINK (FN_INSERT + 14) /* Character dialogue / hyperlink page */ + +#define FN_INSERT_LINEBREAK (FN_INSERT + 18) /* Newline */ +#define FN_INSERT_FIELD_DATA_ONLY (FN_INSERT + 19) /* Field dialog for mail merge*/ +#define FN_INSERT_OBJECT_DLG (FN_INSERT + 22) /* Object */ +#define FN_INSERT_PAGEBREAK (FN_INSERT + 23) /* Page break*/ +#define FN_POSTIT (FN_INSERT + 29) /* Insert/edit PostIt */ +#define FN_INSERT_TABLE (FN_INSERT + 30) /* Insert Table */ +#define FN_INSERT_STRING (FN_INSERT+31) +#define FN_INSERT_FRAME_INTERACT (FN_INSERT + 33) /* Insert interactive frame */ +#define FN_INSERT_FRAME (FN_INSERT + 34) /* Insert Frame */ + +#define FN_INSERT_IDX_ENTRY_DLG (FN_INSERT + 35) /* insert index entry */ +#define FN_INSERT_FRAME_INTERACT_NOCOL (FN_INSERT + 36) /*insert interactive non column frame*/ + +#define FN_TOOL_ANCHOR_PAGE (FN_INSERT + 50) /* anchor Draw object to page */ +#define FN_TOOL_ANCHOR_PARAGRAPH (FN_INSERT + 51) /* anchor Draw object to paragraph */ +#define FN_TOOL_HIERARCHIE (FN_INSERT + 52) /* change hierarchy */ + +#define FN_MAILMERGE_WIZARD (FN_INSERT + 64) /* mail merge wizard */ +#define FN_TOOL_ANCHOR_FRAME (FN_INSERT + 66) /* anchor Draw-Object to frame*/ +#define FN_QRY_MERGE (FN_INSERT + 67) /* insert record (serial letter) */ +#define FN_INSERT_SMA (FN_INSERT + 69) /* insert StarMath */ + +#define FN_MAILMERGE_FIRST_ENTRY (FN_INSERT + 70) /* mail merge toolbar - go to the first entry */ +#define FN_MAILMERGE_PREV_ENTRY (FN_INSERT + 71) /* mail merge toolbar - go to the previous entry */ +#define FN_MAILMERGE_NEXT_ENTRY (FN_INSERT + 72) /* mail merge toolbar - go to the next entry */ +#define FN_MAILMERGE_LAST_ENTRY (FN_INSERT + 73) /* mail merge toolbar - go to the next entry */ +#define FN_MAILMERGE_CURRENT_ENTRY (FN_INSERT + 74) /* mail merge toolbar - show or change the current entry */ +#define FN_MAILMERGE_EXCLUDE_ENTRY (FN_INSERT + 75) /* mail merge toolbar - checkbox to exclude the current entry */ + +#define FN_DRAWTEXT_ATTR_DLG (FN_INSERT + 76) /* position DrawText */ + +#define FN_MAILMERGE_CREATE_DOCUMENTS (FN_INSERT + 77) /* mail merge toolbar - create the merged document */ +#define FN_MAILMERGE_SAVE_DOCUMENTS (FN_INSERT + 78) /* mail merge toolbar - save merged documents */ +#define FN_MAILMERGE_PRINT_DOCUMENTS (FN_INSERT + 79) /* mail merge toolbar - print merged documents */ +#define FN_MAILMERGE_EMAIL_DOCUMENTS (FN_INSERT + 80) /* mail merge toolbar - email merged documents */ + +#define FN_TOOL_ANCHOR_CHAR (FN_INSERT + 84) /* anchor Draw object to character */ + +#define FN_QRY_INSERT (FN_INSERT + 86) /* insert record selection in to text */ +#define FN_QRY_MERGE_FIELD (FN_INSERT + 87) /* insert record selection into fields */ +#define FN_QRY_INSERT_FIELD (FN_INSERT + 88) /* insert database field */ + +#define FN_INSERT_CTRL (FN_INSERT + 89) /* toolbar controller insert*/ +#define FN_INSERT_OBJ_CTRL (FN_INSERT + 90) /* toolbar controller (insert/object) */ +#define FN_INSERT_FIELD_CTRL (FN_INSERT + 91) /* toolbar controller insert/field commands */ + +#define FN_INSERT_FLD_DATE (FN_INSERT + 92) +#define FN_INSERT_FLD_TIME (FN_INSERT + 93) +#define FN_INSERT_FLD_PGNUMBER (FN_INSERT + 94) +#define FN_INSERT_FLD_PGCOUNT (FN_INSERT + 95) +#define FN_INSERT_FLD_TOPIC (FN_INSERT + 96) +#define FN_INSERT_FLD_TITLE (FN_INSERT + 97) +#define FN_INSERT_FLD_AUTHOR (FN_INSERT + 98) +#define FN_INSERT_FOOTNOTE (FN_INSERT + 99) + +#define FN_SET_REMINDER (FN_INSERT + 100) + +// Region: Paste (Part 2) +#define FN_MAILMERGE_SENDMAIL_CHILDWINDOW (FN_INSERT2 + 5) /* child window provided by mailmerge */ + +#define FN_SBA_BRW_UPDATE (FN_INSERT2 + 7) /* insert records into fields */ +#define FN_SBA_BRW_INSERT (FN_INSERT2 + 8) /* insert records into text */ +#define FN_SBA_BRW_MERGE (FN_INSERT2 + 9) /* serial letter print */ +#define FN_JAVAEDIT (FN_INSERT2 + 10) /* edit script field */ +#define FN_TOOL_ANCHOR_AT_CHAR (FN_INSERT2 + 12) /* anchor object to character*/ + +#define FN_INSERT_PAGEHEADER (FN_INSERT2 + 13) /* insert default header */ +#define FN_INSERT_PAGEFOOTER (FN_INSERT2 + 14) /* insert default footer */ + +#define FN_INSERT_ENDNOTE (FN_INSERT2 + 18) /* insert endnote*/ +#define FN_INSERT_REGION (FN_INSERT2 + 19) /* Insert section */ + +#define FN_INSERT_MULTI_TOX (FN_INSERT2 + 20) /* insert any TOX */ +#define FN_INSERT_AUTH_ENTRY_DLG (FN_INSERT2 + 21) /* insert entry for table of authorities*/ + +// MSO legacy form fields +#define FN_INSERT_TEXT_FORMFIELD (FN_INSERT2 + 22) +#define FN_INSERT_CHECKBOX_FORMFIELD (FN_INSERT2 + 23) +#define FN_INSERT_DROPDOWN_FORMFIELD (FN_INSERT2 + 24) + +// MSO content controls +#define FN_INSERT_DATE_FORMFIELD (FN_INSERT2 + 25) + +#define FN_PROTECT_FIELDS (FN_INSERT2 + 26) +#define FN_PROTECT_BOOKMARKS (FN_INSERT2 + 27) + +// clipboard table content +#define FN_PASTE_NESTED_TABLE (FN_INSERT2 + 30) /* instead of the cell-by-cell copy between source and target tables */ +#define FN_TABLE_PASTE_ROW_BEFORE (FN_INSERT2 + 31) /* paste table as new table rows */ +#define FN_TABLE_PASTE_COL_BEFORE (FN_INSERT2 + 32) /* paste table as new table columns */ + +// Region: Format +#define FN_AUTOFORMAT_APPLY (FN_FORMAT + 1 ) /* apply autoformat options */ +#define FN_AUTOFORMAT_AUTO (FN_FORMAT + 2 ) /* apply autoformat during user input */ +#define FN_GROW_FONT_SIZE (FN_FORMAT + 3 ) /* size */ +#define FN_SHRINK_FONT_SIZE (FN_FORMAT + 4 ) /* size */ +#define FN_AUTOFORMAT_REDLINE_APPLY (FN_FORMAT + 5 ) /* apply autoformat with Redlining */ +#define FN_SET_SUPER_SCRIPT (FN_FORMAT + 11) /* superscript */ +#define FN_SET_SUB_SCRIPT (FN_FORMAT + 12) /* subscript */ +#define FN_SET_SMALL_CAPS (FN_FORMAT + 13) /* small caps */ + +#define FN_FORMAT_PAGE_SETTING_DLG (FN_FORMAT + 42) /* */ +#define FN_NUM_FORMAT_TABLE_DLG (FN_FORMAT + 45) /* number format in table */ +#define FN_FORMAT_BORDER_DLG (FN_FORMAT + 48) /* */ +#define FN_FORMAT_PAGE_COLUMN_DLG (FN_FORMAT + 49) /* columns per page */ +#define FN_FORMAT_BACKGROUND_DLG (FN_FORMAT + 50) /* background */ +#define FN_FORMAT_PAGE_DLG (FN_FORMAT + 52) /* page */ +#define FN_FORMAT_COLUMN (FN_FORMAT + 53) /* columns */ +#define FN_FORMAT_DROPCAPS (FN_FORMAT + 54) /* initials */ +#define FN_FORMAT_FRAME_DLG (FN_FORMAT + 56) /* frame */ +#define FN_FORMAT_GRAFIC_DLG (FN_FORMAT + 58) /* graphic */ +#define FN_FORMAT_TABLE_DLG (FN_FORMAT + 60) /* table */ + +#define FN_UPDATE_STYLE_BY_EXAMPLE (FN_FORMAT + 63) /* update style */ +#define FN_FORMAT_FOOTNOTE_DLG (FN_FORMAT + 68) /* footnote dialog */ +#define FN_FORMAT_CURRENT_FOOTNOTE_DLG (FN_FORMAT + 64) /* Contextual footnote dialog */ + +#define FN_FRAME_NOWRAP (FN_FORMAT + 72) +#define FN_FRAME_WRAP (FN_FORMAT + 73) +#define FN_FRAME_WRAPTHRU (FN_FORMAT + 74) + +#define FN_FRAME_ALIGN_HORZ_LEFT (FN_FORMAT + 75) +#define FN_FRAME_ALIGN_HORZ_RIGHT (FN_FORMAT + 76) +#define FN_FRAME_ALIGN_HORZ_CENTER (FN_FORMAT + 77) +#define FN_FRAME_ALIGN_VERT_TOP (FN_FORMAT + 78) +#define FN_FRAME_ALIGN_VERT_BOTTOM (FN_FORMAT + 79) +#define FN_FRAME_ALIGN_VERT_CENTER (FN_FORMAT + 80) + +#define FN_SET_FRM_POSITION (FN_FORMAT + 82)/* frame position -- " -- */ + +#define FN_SET_PAGE_STYLE (FN_FORMAT + 93) /* apply page style */ + +#define FN_FORMAT_TITLEPAGE_DLG (FN_FORMAT + 98) /* Title Page */ + +#define FN_TABLE_REP (FN_FORMAT + 99) /* TableRepresentation */ +#define FN_CONVERT_TEXT_TABLE (FN_FORMAT + 100) /* convert text <-> table */ +#define FN_TABLE_INSERT_ROW (FN_FORMAT + 101) /* */ +#define FN_TABLE_INSERT_COL (FN_FORMAT + 102) /* */ +#define FN_TABLE_DELETE_ROW (FN_FORMAT + 103) /* */ +#define FN_TABLE_DELETE_COL (FN_FORMAT + 104) /* */ +#define FN_TABLE_SPLIT_CELLS (FN_FORMAT + 105) /* */ +#define FN_TABLE_MERGE_CELLS (FN_FORMAT + 106) /* */ +#define FN_TABLE_SET_ROW_HEIGHT (FN_FORMAT + 107) /* */ +#define FN_TABLE_SET_COL_WIDTH (FN_FORMAT + 108) /* */ +#define FN_TABLE_INSERT_ROW_AFTER (FN_FORMAT + 109) /* */ +#define FN_OPTIMIZE_TABLE (FN_FORMAT + 110) /* ToolBoxItem for optimizing tables */ +#define FN_TABLE_INSERT_ROW_BEFORE (FN_FORMAT + 111) /* */ +#define FN_TABLE_INSERT_COL_BEFORE (FN_FORMAT + 112) /* */ +#define FN_TABLE_SELECT_ROW (FN_FORMAT + 113) /* */ +#define FN_TABLE_SELECT_COL (FN_FORMAT + 114) /* */ +#define FN_TABLE_SELECT_ALL (FN_FORMAT + 115) /* */ +#define FN_TABLE_INSERT_COL_AFTER (FN_FORMAT + 116) /* */ +#define FN_TABLE_SET_READ_ONLY_CELLS (FN_FORMAT + 117) /* protect table cells */ +#define FN_TABLE_UNSET_READ_ONLY_CELLS (FN_FORMAT + 119) /* undo table cell protection */ +#define FN_TABLE_HEADLINE_REPEAT (FN_FORMAT + 120) /* also used in SwXTextTable*/ +#define FN_TABLE_ADJUST_CELLS (FN_FORMAT + 121) /* */ + +#define FN_FRAME_UP (FN_FORMAT + 122) /* frame by one level up */ +#define FN_FRAME_DOWN (FN_FORMAT + 123) /* frame by one level down */ + +#define FN_TABLE_OPTIMAL_HEIGHT (FN_FORMAT + 128) /* optimal cell height */ +#define FN_TABLE_DELETE_TABLE (FN_FORMAT + 129) /* remove current table*/ +#define FN_TABLE_SELECT_CELL (FN_FORMAT + 130) /* selects the current table cell */ +#define FN_CONVERT_TEXT_TO_TABLE (FN_FORMAT + 131) /* convert selected text to table */ +#define FN_CONVERT_TABLE_TO_TEXT (FN_FORMAT + 132) /* convert a table to text */ +#define FN_TABLE_SORT_DIALOG (FN_FORMAT + 133) /* sorting in tables*/ + +// Region: Page Template +#define FN_PAGE_STYLE_SET_LR_MARGIN (FN_FORMAT + 130) /* left / right margin */ +#define FN_PAGE_STYLE_SET_UL_MARGIN (FN_FORMAT + 131) /* upper / lower margin */ +#define FN_PAGE_STYLE_SET_PAPER_SIZE (FN_FORMAT + 135) /* */ +#define FN_PAGE_STYLE_SET_PAPER_BIN (FN_FORMAT + 136) /* paper tray */ +#define FN_PAGE_STYLE_SET_NUMBER_FORMAT (FN_FORMAT + 137) /* */ +#define FN_PAGE_STYLE_SET_COLS (FN_FORMAT + 138) /* number of columns */ + +/* these Ids are only required by Help and are replaced by the Ids without _DLG + * for the dialog */ +#define FN_TABLE_INSERT_COL_DLG (FN_FORMAT + 142) /* */ +#define FN_TABLE_INSERT_ROW_DLG (FN_FORMAT + 143) /* */ + +#define FN_GOTO_NEXT_CELL (FN_FORMAT + 145) /* Table: go to next cell */ +#define FN_GOTO_PREV_CELL (FN_FORMAT + 146) /* Table: go to previous cell */ + +#define FN_TABLE_HEADLINE_COUNT (FN_FORMAT + 147) /* number of repeated headlines of tables */ + +// Region: Ribbon +#define FN_FORMULA_CALC (FN_FORMAT + 156) /* select formula */ +#define FN_FORMULA_CANCEL (FN_FORMAT + 157) /* don't apply formula */ +#define FN_FORMULA_APPLY (FN_FORMAT + 158) /* apply formula */ +#define FN_TABLE_UNSET_READ_ONLY (FN_FORMAT + 159) /* undo cell protection for table */ + +#define FN_FRAME_WRAP_IDEAL (FN_FORMAT + 162) /* frame ideal wrapping */ +#define FN_FRAME_WRAPTHRU_TOGGLE (FN_FORMAT + 163) /* toggle frame transparent wrapping */ +#define FN_FRAME_WRAPTHRU_TRANSP (FN_FORMAT + 164) /* frame transparent wrapping */ + +#define FN_FRAME_ALIGN_VERT_ROW_TOP (FN_FORMAT + 165) /* */ +#define FN_FRAME_ALIGN_VERT_ROW_BOTTOM (FN_FORMAT + 166) /* */ +#define FN_FRAME_ALIGN_VERT_ROW_CENTER (FN_FORMAT + 167) /* */ + +#define FN_FRAME_ALIGN_VERT_CHAR_TOP (FN_FORMAT + 168) /* */ +#define FN_FRAME_ALIGN_VERT_CHAR_BOTTOM (FN_FORMAT + 169) /* */ +#define FN_FRAME_ALIGN_VERT_CHAR_CENTER (FN_FORMAT + 170) /* */ + +#define FN_FRAME_WRAP_LEFT (FN_FORMAT + 172) /* */ +#define FN_FRAME_WRAP_RIGHT (FN_FORMAT + 173) /* */ + +#define FN_WRAP_ANCHOR_ONLY (FN_FORMAT + 181) /* wrap only for first paragraph */ + +#define FN_TABLE_BALANCE_CELLS (FN_FORMAT + 182) /* evenly distribute columns */ +#define FN_TABLE_BALANCE_ROWS (FN_FORMAT + 183) /* evenly distribute rows */ + +#define FN_FRAME_WRAP_CONTOUR (FN_FORMAT + 184) /* */ + +// +185..+187 removed in favor of corresponding globally available slot + +#define FN_TABLE_SET_VERT_ALIGN (FN_FORMAT + 188) /* vertical alignment in Writer table cells */ +#define FN_TABLE_MODE_FIX (FN_FORMAT + 189) /* table mode */ +#define FN_TABLE_MODE_FIX_PROP (FN_FORMAT + 190) /* -"- */ +#define FN_TABLE_MODE_VARIABLE (FN_FORMAT + 191) /* -"- */ +#define FN_TABLE_BOX_TEXTORIENTATION (FN_FORMAT + 192) /* text orientation of table cells */ +#define SID_ATTR_TABLE_ROW_HEIGHT (FN_FORMAT + 193) +#define SID_ATTR_TABLE_COLUMN_WIDTH (FN_FORMAT2 + 194) + +#define FN_TABLE_AUTOSUM (FN_FORMAT + 195) /* */ + +#define FN_GOTO_NEXT_REGION (FN_FORMAT2 + 9) /* */ +#define FN_GOTO_PREV_REGION (FN_FORMAT2 + 10) /* */ + +#define FN_ABSTRACT_NEWDOC (FN_FORMAT2 + 12) /* abstract in new document */ +#define FN_ABSTRACT_STARIMPRESS (FN_FORMAT2 + 13) /* abstract to StarImpress */ + +#define FN_NAME_SHAPE (FN_FORMAT2 + 14) /* Name shapes */ + +#define FN_TITLE_DESCRIPTION_SHAPE (FN_FORMAT2 + 15) /* shape title and description */ + +#define FN_NUMBER_FORMAT (FN_FORMAT2 + 120) /* set Boxes/NumberFormatter */ +#define FN_NUMBER_STANDARD (FN_FORMAT2 + 121) +#define FN_NUMBER_TWODEC (FN_FORMAT2 + 123) +#define FN_NUMBER_SCIENTIFIC (FN_FORMAT2 + 124) +#define FN_NUMBER_DATE (FN_FORMAT2 + 125) +#define FN_NUMBER_TIME (FN_FORMAT2 + 126) +#define FN_NUMBER_CURRENCY (FN_FORMAT2 + 127) +#define FN_NUMBER_PERCENT (FN_FORMAT2 + 128) + +#define FN_FRAME_CHAIN (FN_FORMAT2 + 136) +#define FN_FRAME_UNCHAIN (FN_FORMAT2 + 137) + +#define FN_NUMBER_NEWSTART (FN_FORMAT2 + 138) +#define FN_NUMBER_NEWSTART_AT (FN_FORMAT2 + 139) + +#define FN_FRAME_MIRROR_ON_EVEN_PAGES (FN_FORMAT2 + 140) +#define FN_GRAPHIC_MIRROR_ON_EVEN_PAGES (FN_FORMAT2 + 141) + +#define FN_TABLE_SPLIT_TABLE (FN_FORMAT2 + 142) +#define FN_SYNC_LABELS (FN_FORMAT2 + 143) + +#define FN_FORMAT_LINENUMBER (FN_FORMAT2 + 144) + +#define FN_TABLE_RELATIVE_WIDTH (FN_FORMAT2 + 147) /* UNO */ +#define FN_TABLE_WIDTH (FN_FORMAT2 + 148) /* UNO */ +#define FN_TABLE_IS_RELATIVE_WIDTH (FN_FORMAT2 + 149) /* UNO */ + +#define FN_INC_INDENT_OFFSET (FN_FORMAT2 + 150) +#define FN_DEC_INDENT_OFFSET (FN_FORMAT2 + 151) + +#define FN_TABLE_MERGE_TABLE (FN_FORMAT2 + 152) +#define FN_TABLE_ROW_SPLIT (FN_FORMAT2 + 153) + +#define FN_FORMAT_APPLY_HEAD1 (FN_FORMAT2 + 154) +#define FN_FORMAT_APPLY_HEAD2 (FN_FORMAT2 + 155) +#define FN_FORMAT_APPLY_HEAD3 (FN_FORMAT2 + 156) +#define FN_FORMAT_APPLY_DEFAULT (FN_FORMAT2 + 157) +#define FN_FORMAT_APPLY_TEXTBODY (FN_FORMAT2 + 158) +#define FN_REMOVE_DIRECT_CHAR_FORMATS (FN_FORMAT2 + 159) +//free (160) + +// Region: Extras +#define FN_LINE_NUMBERING_DLG (FN_EXTRA + 2 ) /* */ +#define FN_HYPHENATE_OPT_DLG (FN_EXTRA + 5 ) /* */ +#define FN_ADD_UNKNOWN (FN_EXTRA + 6 ) /* learn words */ +#define FN_NUMBERING_OUTLINE_DLG (FN_EXTRA + 12) /* */ +#define FN_SORTING_DLG (FN_EXTRA + 14) /* */ +#define FN_CALCULATE (FN_EXTRA + 15) /* */ +#define FN_GLOSSARY_DLG (FN_EXTRA + 20) /* text building blocks */ + +#define FN_EXPAND_GLOSSARY (FN_EXTRA + 28) /* expand text building blocks */ +#define FN_CHANGE_PAGENUM (FN_EXTRA + 34) /* change page numbers*/ +#define FN_ADD_TEXT_BOX (FN_EXTRA + 35) /* add text box to draw shape */ +#define FN_REMOVE_TEXT_BOX (FN_EXTRA + 36) /* remove text box of draw shape */ + +// Region: Glossary + +#define FN_AUTO_CORRECT (FN_EXTRA + 49 ) /* Autocorrect from Basic */ + +#define FN_UPDATE_TOX (FN_EXTRA + 53) /* update all indices */ +#define FN_UPDATE_CUR_TOX (FN_EXTRA + 54) /* update current index */ +#define FN_REMOVE_CUR_TOX (FN_EXTRA + 55) /* remove the current TOX*/ + +#define FN_GOTO_PAGE (FN_EXTRA + 59 ) /* goto page */ + +#define FN_COLL_TYPE (FN_EXTRA + 98) /* type for GlobalDoc-Collection*/ +#define FN_COLL_ADD (FN_EXTRA + 99) + +#define FN_COLL_TITLE (FN_EXTRA2 + 1) /* area name or index title */ +#define FN_SHADOWCURSOR (FN_EXTRA2 + 4) /* enable/disable Shadow Cursor */ + +#define FN_UNO_PARA_STYLE (FN_EXTRA2 + 9) // starting here are UNI-Ids for the PropertyMap listed +#define FN_UNO_PAGE_STYLE (FN_EXTRA2 + 10) + +#define FN_UNO_PARA_NUM_AUTO_FORMAT (FN_EXTRA2 + 11) +#define FN_UNO_FRAME_STYLE_NAME (FN_EXTRA2 + 12) +#define FN_UNO_NUM_START_VALUE (FN_EXTRA2 + 13) +#define FN_UNO_NUM_LEVEL (FN_EXTRA2 + 14) +#define FN_UNO_NUM_RULES (FN_EXTRA2 + 15) +#define FN_UNO_DOCUMENT_INDEX_MARK (FN_EXTRA2 + 16) +#define FN_UNO_DOCUMENT_INDEX (FN_EXTRA2 + 17) +#define FN_UNO_TEXT_FIELD (FN_EXTRA2 + 18) +#define FN_UNO_TEXT_TABLE (FN_EXTRA2 + 19) +#define FN_UNO_CELL (FN_EXTRA2 + 20) +#define FN_UNO_TEXT_FRAME (FN_EXTRA2 + 21) +#define FN_UNO_REFERENCE_MARK (FN_EXTRA2 + 22) +#define FN_UNO_TEXT_SECTION (FN_EXTRA2 + 23) +#define FN_UNO_FOOTNOTE (FN_EXTRA2 + 24) +#define FN_UNO_ENDNOTE (FN_EXTRA2 + 25) +#define FN_UNO_RANGE_COL_LABEL (FN_EXTRA2 + 26) +#define FN_UNO_RANGE_ROW_LABEL (FN_EXTRA2 + 27) +#define FN_UNO_TABLE_BORDER (FN_EXTRA2 + 29) +#define FN_UNO_TABLE_COLUMN_SEPARATORS (FN_EXTRA2 + 30) +#define FN_UNO_TABLE_COLUMN_RELATIVE_SUM (FN_EXTRA2 + 31) +#define FN_UNO_TABLE_CELL_BACKGROUND (FN_EXTRA2 + 32) +#define FN_UNO_ROW_HEIGHT (FN_EXTRA2 + 33) +#define FN_UNO_ROW_AUTO_HEIGHT (FN_EXTRA2 + 34) +#define FN_UNO_HEADER (FN_EXTRA2 + 35) +#define FN_UNO_HEADER_LEFT (FN_EXTRA2 + 36) +#define FN_UNO_HEADER_RIGHT (FN_EXTRA2 + 37) +#define FN_UNO_FOOTER (FN_EXTRA2 + 38) +#define FN_UNO_FOOTER_LEFT (FN_EXTRA2 + 39) +#define FN_UNO_FOOTER_RIGHT (FN_EXTRA2 + 40) +#define FN_UNO_TEXT_PARAGRAPH (FN_EXTRA2 + 41) +#define FN_UNO_PARENT_TEXT (FN_EXTRA2 + 42) +#define FN_UNO_FOLLOW_STYLE (FN_EXTRA2 + 59) + +#define FN_API_CALL (FN_EXTRA2 + 60) + +#define FN_UNO_IS_PHYSICAL (FN_EXTRA2 + 61) +#define FN_UNO_IS_AUTO_UPDATE (FN_EXTRA2 + 62) +#define FN_UNO_DISPLAY_NAME (FN_EXTRA2 + 63) + +#define FN_UNO_WRAP (FN_EXTRA2 + 64) +#define FN_UNO_ANCHOR_TYPES (FN_EXTRA2 + 65) +#define FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL (FN_EXTRA2 + 66) +#define FN_UNO_PARA_CONDITIONAL_STYLE_NAME (FN_EXTRA2 + 67) + +#define FN_UNO_CATEGORY (FN_EXTRA2 + 68) +#define FN_UNO_IS_NUMBER (FN_EXTRA2 + 69) +#define FN_UNO_TEXT_WRAP (FN_EXTRA2 + 70) +#define FN_UNO_ANCHOR_TYPE (FN_EXTRA2 + 71) +#define FN_SKIP_HIDDEN_TEXT (FN_EXTRA2 + 72) +#define FN_SKIP_PROTECTED_TEXT (FN_EXTRA2 + 73) +#define FN_UNO_Z_ORDER (FN_EXTRA2 + 74) +#define FN_UNO_REDLINE_NODE_START (FN_EXTRA2 + 75) +#define FN_UNO_REDLINE_NODE_END (FN_EXTRA2 + 76) +#define FN_UNO_TEXT_PORTION_TYPE (FN_EXTRA2 + 77) +#define FN_UNO_CONTROL_CHARACTER (FN_EXTRA2 + 78) +#define FN_UNO_BOOKMARK (FN_EXTRA2 + 79) +#define FN_UNO_IS_COLLAPSED (FN_EXTRA2 + 80) +#define FN_UNO_IS_START (FN_EXTRA2 + 81) +#define FN_UNO_IS_AUTOMATIC_CONTOUR (FN_EXTRA2 + 82) +#define FN_UNO_IS_PIXEL_CONTOUR (FN_EXTRA2 + 83) +#define FN_UNO_ALTERNATIVE_TEXT (FN_EXTRA2 + 84) +#define FN_UNO_ACTUAL_SIZE (FN_EXTRA2 + 85) +#define FN_UNO_GRAPHIC_URL (FN_EXTRA2 + 86) +#define FN_UNO_GRAPHIC_FILTER (FN_EXTRA2 + 87) +#define FN_UNO_CELL_NAME (FN_EXTRA2 + 88) +#define FN_INSERT_GLOSSARY (FN_EXTRA2 + 89) +#define FN_NEW_GLOSSARY (FN_EXTRA2 + 90) +#define FN_SET_ACT_GLOSSARY (FN_EXTRA2 + 91) + +#define FN_UNO_CHARFMT_SEQUENCE (FN_EXTRA2 + 94) +#define FN_UNO_CLSID (FN_EXTRA2 + 95) +#define FN_UNO_MODEL (FN_EXTRA2 + 96) +#define FN_UNO_COMPONENT (FN_EXTRA2 + 97) +#define FN_WORDCOUNT_DIALOG (FN_EXTRA2 + 98) + +#define FN_XFORMS_DESIGN_MODE (FN_EXTRA2 + 99) + +#define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 100) +#define FN_UNO_GRAPHIC (FN_EXTRA2 + 101) + +#define FN_UNO_REPLACEMENT_GRAPHIC_URL (FN_EXTRA2 + 102) +#define FN_UNO_CELL_ROW_SPAN (FN_EXTRA2 + 103) +#define FN_UNO_TABLE_BORDER_DISTANCES (FN_EXTRA2 + 104) +#define FN_SPELL_GRAMMAR_DIALOG (FN_EXTRA2 + 105) +#define FN_UNO_STREAM_NAME (FN_EXTRA2 + 106) +#define FN_UNO_LIST_ID (FN_EXTRA2 + 107) +#define FN_UNO_REPLACEMENT_GRAPHIC (FN_EXTRA2 + 108) + +#define FN_UNO_PARA_CONT_PREV_SUBTREE (FN_EXTRA2 + 109) +#define FN_UNO_PARA_NUM_STRING (FN_EXTRA2 + 110) +#define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111) +#define FN_UNO_META (FN_EXTRA2 + 112) +#define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113) + +/* Navigation buttons */ +#define FN_NAVIGATION_BACK (FN_EXTRA2 + 115) +#define FN_NAVIGATION_FORWARD (FN_EXTRA2 + 116) + +// #i972: bool items to be passed to SwFramePage for evaluation +#define FN_OLE_IS_MATH (FN_EXTRA2 + 114) +#define FN_MATH_BASELINE_ALIGNMENT (FN_EXTRA2 + 115) + +#define FN_EMBEDDED_OBJECT (FN_EXTRA2 + 116) +#define FN_UNO_DRAW_ASPECT (FN_EXTRA2 + 117) +#define FN_UNO_HEADER_FIRST (FN_EXTRA2 + 118) +#define FN_UNO_FOOTER_FIRST (FN_EXTRA2 + 119) +#define FN_UNO_TABLE_BORDER2 (FN_EXTRA2 + 120) + +// #define free (FN_EXTRA2 + 121) +#define FN_UNO_HIDDEN (FN_EXTRA2 + 122) +#define FN_UNO_STYLE_INTEROP_GRAB_BAG (FN_EXTRA2 + 123) +#define FN_UNO_TABLE_TEMPLATE_NAME (FN_EXTRA2 + 124) +#define FN_UNO_VISIBLE_AREA_WIDTH (FN_EXTRA2 + 125) +#define FN_UNO_VISIBLE_AREA_HEIGHT (FN_EXTRA2 + 126) + +#define FN_UNO_TRANSFORMED_GRAPHIC (FN_EXTRA2 + 125) + +// Area: Help +// Region: Traveling & Selection +#define FN_CHAR_LEFT (FN_SELECTION + 1 ) /* */ +#define FN_CHAR_RIGHT (FN_SELECTION + 2 ) /* */ +#define FN_LINE_UP (FN_SELECTION + 3 ) /* */ +#define FN_LINE_DOWN (FN_SELECTION + 4 ) /* */ +#define FN_START_OF_LINE (FN_SELECTION + 5 ) /* StartOfLine */ +#define FN_END_OF_LINE (FN_SELECTION + 6 ) /* EndOfLine */ +#define FN_START_OF_DOCUMENT (FN_SELECTION + 7 ) /* StartOfDocument */ +#define FN_START_OF_NEXT_PAGE (FN_SELECTION + 9 ) /* StartOfNextPage ??? */ +#define FN_END_OF_NEXT_PAGE (FN_SELECTION + 10) /* ??? */ +#define FN_START_OF_PREV_PAGE (FN_SELECTION + 11) /* StartOfPrevPage ??? */ +#define FN_END_OF_PREV_PAGE (FN_SELECTION + 12) /* ??? */ +#define FN_START_OF_PAGE (FN_SELECTION + 13) /* StartOfPage */ +#define FN_END_OF_PAGE (FN_SELECTION + 14) /* EndOfPage */ +#define FN_START_OF_COLUMN (FN_SELECTION + 17) /* StartOfColumn */ +#define FN_END_OF_COLUMN (FN_SELECTION + 18) /* EndOfColumn */ +#define FN_START_OF_PARA (FN_SELECTION + 19) /* StartOfPara */ +#define FN_END_OF_PARA (FN_SELECTION + 20) /* EndOfPara */ +#define FN_NEXT_WORD (FN_SELECTION + 21) /* NextWord */ +#define FN_PREV_WORD (FN_SELECTION + 22) /* PrevWord */ +#define FN_NEXT_SENT (FN_SELECTION + 23) /* NextSentence */ +#define FN_PREV_SENT (FN_SELECTION + 24) /* PrevSentence */ +#define FN_DELETE (FN_SELECTION + 25) /* Delete */ +#define FN_BACKSPACE (FN_SELECTION + 26) /* Backspace */ +#define FN_DELETE_SENT (FN_SELECTION + 27) /* DeleteToEndOfSentence */ +#define FN_DELETE_BACK_SENT (FN_SELECTION + 28) /* DeleteToStartOfSentence */ +#define FN_DELETE_WORD (FN_SELECTION + 29) /* DeleteToEndOfWord */ +#define FN_DELETE_BACK_WORD (FN_SELECTION + 30) /* DeleteToStartOfWord */ +#define FN_DELETE_LINE (FN_SELECTION + 31) /* DeleteToEndOfLine */ +#define FN_DELETE_BACK_LINE (FN_SELECTION + 32) /* DeleteToStartOfLine */ +#define FN_DELETE_PARA (FN_SELECTION + 33) /* DeleteToEndOfPara */ +#define FN_DELETE_BACK_PARA (FN_SELECTION + 34) /* DeleteToStartOfPara */ +#define FN_DELETE_WHOLE_LINE (FN_SELECTION + 35) /* DeleteLine ??? */ +#define FN_PAGEUP (FN_SELECTION + 37) /* PageUpWithCursor */ +#define FN_PAGEDOWN (FN_SELECTION + 38) /* PageDownWithCursor */ +#define FN_SET_ADD_MODE (FN_SELECTION + 39) /* Selectionmode */ +#define FN_SET_EXT_MODE (FN_SELECTION + 40) /* Selectionmode */ +#define FN_ESCAPE (FN_SELECTION + 41) /* Normal */ +#define FN_SHIFT_BACKSPACE (FN_SELECTION + 42) /* like Backspace */ +#define FN_SELECT_WORD (FN_SELECTION + 43) /* select word*/ + +#define FN_GOTO_NEXT_OBJ (FN_SELECTION + 44) /* Goto next object */ +#define FN_GOTO_PREV_OBJ (FN_SELECTION + 45) /* Go to previous object */ + +#define FN_START_TABLE (FN_SELECTION + 47) /* to the beginning of the table */ +#define FN_END_TABLE (FN_SELECTION + 48) /* to the end of the table */ +#define FN_NEXT_TABLE (FN_SELECTION + 49) /* to the next table */ +#define FN_PREV_TABLE (FN_SELECTION + 50) /* to the previous table */ + +#define FN_START_OF_NEXT_COLUMN (FN_SELECTION + 51) /* to the start of the next column */ +#define FN_END_OF_NEXT_COLUMN (FN_SELECTION + 52) /* to the end of the next column */ +#define FN_START_OF_PREV_COLUMN (FN_SELECTION + 53) /* to the start of the previous column */ +#define FN_END_OF_PREV_COLUMN (FN_SELECTION + 54) /* to the end of the previous column */ + +#define FN_FOOTNOTE_TO_ANCHOR (FN_SELECTION + 55) /* from the footnote to the anchor */ +#define FN_NEXT_FOOTNOTE (FN_SELECTION + 56) /* to the next footnote */ +#define FN_PREV_FOOTNOTE (FN_SELECTION + 57) /* to the previous footnote */ + +#define FN_CNTNT_TO_NEXT_FRAME (FN_SELECTION + 58) /* from content to the next frame */ +#define FN_FRAME_TO_ANCHOR (FN_SELECTION + 59) /* from frame to the anchor */ + +#define FN_TO_HEADER (FN_SELECTION + 60) /* toggle between content and header */ +#define FN_TO_FOOTER (FN_SELECTION + 61) /* toggle between content and footer */ + +#define FN_IDX_MARK_TO_IDX (FN_SELECTION + 62) /* from the index mark to the index */ + +#define FN_TO_FOOTNOTE_AREA (FN_SELECTION + 63) /* jump into the appropriate footnote area */ + +#define FN_SET_BLOCK_MODE (FN_SELECTION + 64) /* selection mode: block */ + +#define FN_PREV_PARA (FN_SELECTION + 74) +#define FN_NEXT_PARA (FN_SELECTION + 75) + +#define FN_GOTO_NEXT_MARK (FN_SELECTION + 76) /* Go to next marker */ +#define FN_GOTO_PREV_MARK (FN_SELECTION + 77) /* Go to previous marker */ + +#define FN_NEXT_TOXMARK (FN_SELECTION + 83) /* to the next index mark */ +#define FN_PREV_TOXMARK (FN_SELECTION + 84) /* to the previous index mark */ +#define FN_NEXT_TBLFML (FN_SELECTION + 85) /* to the next table formula */ +#define FN_PREV_TBLFML (FN_SELECTION + 86) /* to the previous table formula */ +#define FN_NEXT_TBLFML_ERR (FN_SELECTION + 87) /* to the next broken table formula */ +#define FN_PREV_TBLFML_ERR (FN_SELECTION + 88) /* to the previous broken table formula */ + +#define FN_READONLY_SELECTION_MODE (FN_SELECTION + 89) /* switches text selection mode in readonly documents*/ +#define FN_SELECTION_MODE_DEFAULT (FN_SELECTION + 90) /* use default selection mode - not block mode */ +#define FN_SELECTION_MODE_BLOCK (FN_SELECTION + 91) /* switch on block selection */ +#define SID_JUMP_TO_SPECIFIC_PAGE (FN_SELECTION + 92) +#define SID_TRACK_CHANGES_BAR (FN_SELECTION + 93) /* shows/hides track changes bar */ + +#define FN_SELECT_SENTENCE (FN_SELECTION + 94) /* select paragraph*/ + +// QUERY-Block +#define FN_TXTATR_INET (FN_QUERY +29) /* INet-Attribute */ + +#define FN_GET_PRINT_AREA (FN_QUERY +32) /* Get attribute for printable area of page */ +#define FN_DB_CONNECTION_ANY (FN_QUERY2 + 3) +#define FN_DB_COLUMN_ANY (FN_QUERY2 + 4) +#define FN_DB_DATA_SOURCE_ANY (FN_QUERY2 + 5) +#define FN_DB_DATA_COMMAND_ANY (FN_QUERY2 + 6) +#define FN_DB_DATA_COMMAND_TYPE_ANY (FN_QUERY2 + 7) +#define FN_DB_DATA_COLUMN_NAME_ANY (FN_QUERY2 + 8) +#define FN_DB_DATA_SELECTION_ANY (FN_QUERY2 + 9) +#define FN_DB_DATA_CURSOR_ANY (FN_QUERY2 + 10) + +// Region: Envelope +#define FN_ENVELOP (FN_ENVELP ) + +#define FN_DELETE_NOTE_AUTHOR (FN_NOTES+1) +#define FN_DELETE_ALL_NOTES (FN_NOTES+2) +#define FN_HIDE_NOTE (FN_NOTES+3) +#define FN_HIDE_NOTE_AUTHOR (FN_NOTES+4) +#define FN_HIDE_ALL_NOTES (FN_NOTES+5) + +#define FN_DELETE_COMMENT (FN_NOTES+6) +#define FN_REPLY (FN_NOTES+7) +#define FN_FORMAT_ALL_NOTES (FN_NOTES+8) +#define FN_RESOLVE_NOTE (FN_NOTES+9) + +// Region: Parameter +#define FN_PARAM_MOVE_COUNT (FN_PARAM+2) +#define FN_PARAM_MOVE_SELECTION (FN_PARAM+3) + +#define FN_PARAM_ADDPRINTER (FN_PARAM+18) +#define FN_PARAM_DOCDISP (FN_PARAM+20) +#define FN_PARAM_ELEM (FN_PARAM+21) +#define FN_PARAM_SWTEST (FN_PARAM+22) + +#define FN_PARAM_FTN_INFO (FN_PARAM+23) + +#define FN_PARAM_REGION_NAME (FN_PARAM+24) +#define FN_PARAM_REGION_CONDITION (FN_PARAM+25) +#define FN_PARAM_REGION_HIDDEN (FN_PARAM+26) +#define FN_PARAM_REGION_PROTECT (FN_PARAM+27) +#define FN_PARAM_REGION_EDIT_IN_READONLY (FN_PARAM+28) + +#define FN_PARAM_INSERT_AFTER (FN_PARAM+29) + +#define FN_PARAM_TABLE_NAME (FN_PARAM+44) +#define FN_PARAM_TABLE_HEADLINE (FN_PARAM+50) +#define FN_PARAM_TABLE_SPACE (FN_PARAM+51) + +#define FN_PARAM_GRF_CONNECT (FN_PARAM+53) +#define FN_PARAM_FIELD_TYPE (FN_PARAM+54) +#define FN_PARAM_FIELD_SUBTYPE (FN_PARAM+56) +#define FN_PARAM_FIELD_FORMAT (FN_PARAM+57) + +#define FN_PARAM_GRF_REALSIZE (FN_PARAM+70) +#define FN_PARAM_GRF_DIALOG (FN_PARAM+71) +#define FN_INET_FIELD_MACRO (FN_PARAM+77) /* Id for URL-Field-Macros*/ + +#define FN_PARAM_PRINTER (FN_PARAM+78) /* Printer */ +#define FN_PARAM_STDFONTS (FN_PARAM+79) /* ConfigItem Standardfonts */ + +#define FN_PARAM_WRTSHELL (FN_PARAM2) /* SwWrtShell */ + +#define FN_COND_COLL (FN_PARAM2+1) /* Item for conditional templates */ +#define FN_PARAM_SELECTION (FN_PARAM2+2) /* selected word for format/character/hyperlink */ + +#define FN_PARAM_ACT_NUMBER (FN_PARAM2+3) /* PointerItem the current NumRule */ + +#define FN_PARAM_NUM_PRESET (FN_PARAM2+5) /* predefined numbering */ + +#define FN_PARAM_SHADOWCURSOR (FN_PARAM2+8) /* for ShadowCursor options */ + +#define FN_TEXT_RANGE (FN_PARAM2+12) /* TextRange Property*/ + +#define FN_PARAM_CRSR_IN_PROTECTED (FN_PARAM2+13) /* Cursor in protected areas */ +#define FN_PARAM_TOX_TYPE (FN_PARAM2+14) /* TOX type in tox dialog*/ +#define FN_PARAM_LINK_DISPLAY_NAME (FN_PARAM2+15) /* LinkDisplayName property*/ +#define FN_PARAM_NUM_LEVEL (FN_PARAM2+16) /* rtf filter*/ +#define FN_PARAM_CONTOUR_PP (FN_PARAM2+17) /* contour PolyPolygon*/ + +#define FN_ANCHOR_POSITION (FN_PARAM2+18) /* AnchorPosition property */ +#define FN_DROP_TEXT (FN_PARAM2+18) /* text set in drop caps tab page - for recording */ +#define FN_DROP_CHAR_STYLE_NAME (FN_PARAM2+19) /* character style of drop caps - for recording */ +#define FN_PARAM_CHAIN_PREVIOUS (FN_PARAM2+20) /* Name of frame to be added as chain successor */ +#define FN_PARAM_CHAIN_NEXT (FN_PARAM2+21) /* Name of frame to be added as chain predecessor */ +#define FN_PARAM_DATABASE_PROPERTIES (FN_PARAM2+22) /* transport a Sequence<PropertyValue> containing database properties*/ +#define FN_SHAPE_TRANSFORMATION_IN_HORI_L2R (FN_PARAM2+23) +#define FN_SHAPE_POSITION_LAYOUT_DIR (FN_PARAM2+24) +#define FN_SHAPE_STARTPOSITION_IN_HORI_L2R (FN_PARAM2+25) +#define FN_SHAPE_ENDPOSITION_IN_HORI_L2R (FN_PARAM2+26) +#define FN_PARAM_PAM (FN_PARAM2+27) /* Point and Mark */ +#define FN_TEXT_BOX (FN_PARAM2+28) /* TextBox Property*/ +#define FN_BOOKMARK_HIDDEN (FN_PARAM2+29) /* Hidden Property of bookmarks*/ +#define FN_BOOKMARK_CONDITION (FN_PARAM2+30) /* Condition Property of bookmarks*/ + +// Status: not more than 19! +#define FN_STAT_PAGE (FN_STAT + 1) +#define FN_STAT_TEMPLATE (FN_STAT + 2) +#define FN_STAT_ZOOM (FN_STAT + 3) +#define FN_STAT_SELMODE (FN_STAT + 5) +#define FN_STAT_BOOKMARK (FN_STAT + 8) /* For Popup Bookmarks*/ +#define FN_STAT_WORDCOUNT (FN_STAT + 9) + +// Region: Page preview +#define FN_SHOW_TWO_PAGES (FN_PGPREVIEW + 1) +#ifndef FN_SHOW_MULTIPLE_PAGES +#define FN_SHOW_MULTIPLE_PAGES (FN_PGPREVIEW + 2) +#endif +#define FN_PRINT_PAGEPREVIEW (FN_PGPREVIEW + 3) +#define FN_CLOSE_PAGEPREVIEW (FN_PGPREVIEW + 4) +#define FN_SHOW_BOOKVIEW (FN_PGPREVIEW + 5) +#define FN_SHOW_SINGLE_PAGE (FN_PGPREVIEW + 6) + +// Region: Setting Attributes +#define FN_OPAQUE (FN_FRAME + 1) +#define FN_SET_PROTECT (FN_FRAME + 2) +#define FN_SURROUND (FN_FRAME + 3) +#define FN_VERT_ORIENT (FN_FRAME + 4) +#define FN_HORI_ORIENT (FN_FRAME + 5) +#define FN_SET_FRM_NAME (FN_FRAME + 6) +#define FN_KEEP_ASPECT_RATIO (FN_FRAME + 7) + +#define FN_SET_FRM_ALT_NAME (FN_FRAME + 18) +#define FN_UNO_TITLE (FN_FRAME + 19) +#define FN_UNO_DESCRIPTION (FN_FRAME + 20) + +#define SID_ATTR_PAGE_COLUMN (FN_SIDEBAR + 0) +#define SID_ATTR_PAGE_HEADER (FN_SIDEBAR + 3) +#define SID_ATTR_PAGE_HEADER_LRMARGIN (FN_SIDEBAR + 4) +#define SID_ATTR_PAGE_HEADER_SPACING (FN_SIDEBAR + 5) +#define SID_ATTR_PAGE_HEADER_LAYOUT (FN_SIDEBAR + 6) +#define SID_ATTR_PAGE_FOOTER (FN_SIDEBAR + 7) +#define SID_ATTR_PAGE_FOOTER_LRMARGIN (FN_SIDEBAR + 8) +#define SID_ATTR_PAGE_FOOTER_SPACING (FN_SIDEBAR + 9) +#define SID_ATTR_PAGE_FOOTER_LAYOUT (FN_SIDEBAR + 10) +#define SID_ATTR_PAGE_MARGIN (FN_SIDEBAR + 11) + +//Member IDs for Fill / SetVariable of items +#define MID_STYLE 0xe0 +#define MID_PWIDTH 0xe1 +#define MID_ADJUST 0xe2 +#define MID_TDIST 0xe3 +#define MID_BDIST 0xe4 +#define MID_LINES 0xe5 +#define MID_CHARS 0xe6 +#define MID_DIST 0xe7 + +#define MID_1 0xe8 +#define MID_2 0xe9 +#define MID_3 0xea +#define MID_4 0xeb +#define MID_5 0xec +#define MID_6 0xed +#define MID_7 0xee +#define MID_8 0xef +#define MID_9 0xf0 +#define MID_A 0xf1 +#define MID_B 0xf2 +#define MID_C 0xf3 +#define MID_D 0xf4 +#define MID_E 0xf5 +#define MID_F 0xf6 +#define MID_10 0xf7 +#define MID_11 0xf8 +#define MID_12 0xf9 +#define MID_13 0xfa + +#endif // INCLUDED_SW_INC_CMDID_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cnttab.hrc b/sw/inc/cnttab.hrc new file mode 100644 index 000000000..f0823fd24 --- /dev/null +++ b/sw/inc/cnttab.hrc @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_CNTTAB_HRC +#define INCLUDED_SW_INC_CNTTAB_HRC + +#include "tox.hxx" + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const std::pair<const char*, SwTOOElements> RES_SRCTYPES[] = +{ + { NC_("RES_SRCTYPES", "%PRODUCTNAME Math"), SwTOOElements::Math}, + { NC_("RES_SRCTYPES", "%PRODUCTNAME Chart"), SwTOOElements::Chart}, + { NC_("RES_SRCTYPES", "%PRODUCTNAME Calc"), SwTOOElements::Calc}, + { NC_("RES_SRCTYPES", "%PRODUCTNAME Draw/%PRODUCTNAME Impress"), SwTOOElements::DrawImpress}, + { NC_("RES_SRCTYPES", "Other OLE Objects"), SwTOOElements::Other}, +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/colwd.hxx b/sw/inc/colwd.hxx new file mode 100644 index 000000000..4feacc6c4 --- /dev/null +++ b/sw/inc/colwd.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_COLWD_HXX +#define INCLUDED_SW_INC_COLWD_HXX + +#include <vcl/weld.hxx> + +class SwTableFUNC; + +class SwTableWidthDlg final : public weld::GenericDialogController +{ +private: + SwTableFUNC &m_rFnc; + + std::unique_ptr<weld::SpinButton> m_xColNF; + std::unique_ptr<weld::MetricSpinButton> m_xWidthMF; + + DECL_LINK(LoseFocusHdl, weld::SpinButton&, void); + + void Apply(); + +public: + SwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc); + virtual short run() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/comcore.hxx b/sw/inc/comcore.hxx new file mode 100644 index 000000000..2fda83a3c --- /dev/null +++ b/sw/inc/comcore.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_COMCORE_HXX +#define INCLUDED_SW_INC_COMCORE_HXX + +// defines for the Autoformat Redline Comments +#define STR_AUTOFMTREDL_DEL_EMPTY_PARA 0 +#define STR_AUTOFMTREDL_USE_REPLACE 1 +#define STR_AUTOFMTREDL_CPTL_STT_WORD 2 +#define STR_AUTOFMTREDL_CPTL_STT_SENT 3 +#define STR_AUTOFMTREDL_TYPO 4 +#define STR_AUTOFMTREDL_USER_STYLE 5 +#define STR_AUTOFMTREDL_BULLET 6 +#define STR_AUTOFMTREDL_UNDER 7 +#define STR_AUTOFMTREDL_BOLD 8 +#define STR_AUTOFMTREDL_FRACTION 9 +#define STR_AUTOFMTREDL_DETECT_URL 10 +#define STR_AUTOFMTREDL_DASH 11 +#define STR_AUTOFMTREDL_ORDINAL 12 +#define STR_AUTOFMTREDL_RIGHT_MARGIN 13 +#define STR_AUTOFMTREDL_SET_TMPL_TEXT 14 +#define STR_AUTOFMTREDL_SET_TMPL_INDENT 15 +#define STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT 16 +#define STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT 17 +#define STR_AUTOFMTREDL_SET_TMPL_HEADLINE 18 +#define STR_AUTOFMTREDL_SET_NUMBER_BULLET 19 +#define STR_AUTOFMTREDL_DEL_MORELINES 20 +#define STR_AUTOFMTREDL_NON_BREAK_SPACE 21 +#define STR_AUTOFMTREDL_TRANSLITERATE_RTL 22 +// !!!!!!!!!!!!!!!!!!!!!!!!!! always set the correct end !!!!!!!!!!!! +#define STR_AUTOFMTREDL_END 23 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx new file mode 100644 index 000000000..78b32299f --- /dev/null +++ b/sw/inc/crsrsh.hxx @@ -0,0 +1,922 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_CRSRSH_HXX +#define INCLUDED_SW_INC_CRSRSH_HXX + +#include <com/sun/star/i18n/WordType.hpp> + +#include <rtl/ustring.hxx> +#include <tools/link.hxx> +#include <vcl/keycod.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include "IShellCursorSupplier.hxx" +#include "swdllapi.h" +#include "docary.hxx" +#include "viewsh.hxx" +#include "calbck.hxx" +#include "cshtyp.hxx" +#include "crstate.hxx" +#include "toxe.hxx" +#include "tblsel.hxx" +#include "viscrs.hxx" +#include "node.hxx" +#include "fldbas.hxx" +#include "IDocumentMarkAccess.hxx" + +class SfxItemSet; +class SfxPoolItem; +class SwContentFrame; +class SwUnoCursor; +class SwFormatField; +class SwTextFormatColl; +class SwTextINetFormat; +class SwFormatINetFormat; +class SwTextAttr; +class SwTableBox; +class SwTOXMark; +class SwRangeRedline; +class SwBlockCursor; +class SwPostItField; +class SwTextField; + +namespace i18nutil { + struct SearchOptions2; +} +namespace com::sun::star::text { class XTextRange; } +namespace com::sun::star::container { class XStringKeyMap; } + +// enum and struct to get information via the Doc-Position + +enum class IsAttrAtPos +{ + NONE = 0x0000, + Field = 0x0001, + ClickField = 0x0002, + Ftn = 0x0004, + InetAttr = 0x0008, + TableBoxFml = 0x0010, + Redline = 0x0020, + Outline = 0x0040, + ToxMark = 0x0080, + RefMark = 0x0100, + NumLabel = 0x0200, + ContentCheck = 0x0400, + SmartTag = 0x0800, + FormControl = 0x1000 +#ifdef DBG_UTIL + ,CurrAttrs = 0x2000 ///< only for debugging + ,TableBoxValue = 0x4000 ///< only for debugging +#endif +}; +namespace o3tl { + template<> struct typed_flags<IsAttrAtPos> : is_typed_flags<IsAttrAtPos, 0x7fff> {}; +} + +struct SwContentAtPos +{ + union { + const SwField* pField; + const SfxPoolItem* pAttr; + const SwRangeRedline* pRedl; + SwContentNode * pNode; + const sw::mark::IFieldmark* pFieldmark; + } aFnd; + IsAttrAtPos eContentAtPos; + int nDist; + OUString sStr; + const SwTextAttr* pFndTextAttr; + + SwContentAtPos( IsAttrAtPos eGetAtPos ) + : eContentAtPos( eGetAtPos ) + { + aFnd.pField = nullptr; + pFndTextAttr = nullptr; + nDist = 0; // #i23726# + } + + bool IsInProtectSect() const; + bool IsInRTLText() const; +}; + +// return values of SetCursor (can be combined via ||) +const int CRSR_POSOLD = 0x01, // cursor stays at old position + CRSR_POSCHG = 0x02; // position changed by the layout + +namespace sw { + +bool ReplaceImpl(SwPaM & rCursor, OUString const& rReplacement, + bool const bRegExp, SwDoc & rDoc, SwRootFrame const*const pLayout); + +/// Helperfunction to resolve backward references in regular expressions +std::optional<OUString> ReplaceBackReferences(const i18nutil::SearchOptions2& rSearchOpt, + SwPaM* pPam, SwRootFrame const* pLayout ); + +bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges, + SwDoc & rDoc, SwPaM const& rDelPam); + +} // namespace sw + +class SW_DLLPUBLIC SwCursorShell + : public SwViewShell + , public SwModify + , public ::sw::IShellCursorSupplier +{ + friend class SwCallLink; + friend class SwVisibleCursor; + friend class SwSelPaintRects; + + // requires the Cursor as InternalCursor + friend bool GetAutoSumSel( const SwCursorShell&, SwCellFrames& ); + +public: + + /** for calling UpdateCursor */ + enum CursorFlag { + UPDOWN = (1 << 0), ///< keep Up/Down on columns + SCROLLWIN = (1 << 1), ///< scroll window + CHKRANGE = (1 << 2), ///< check overlapping PaMs + READONLY = (1 << 3) ///< make visible in spite of Readonly + }; + + SAL_DLLPRIVATE void UpdateCursor( + sal_uInt16 eFlags = SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, + bool bIdleEnd = false ); + +private: + + SwRect m_aCharRect; ///< Char-SRectangle on which the cursor is located + Point m_aCursorHeight; ///< height & offset from visible Cursor + Point m_aOldRBPos; ///< Right/Bottom of last VisArea + // (used in Invalidate by Cursor) + + Link<const SwFlyFrameFormat*,void> m_aFlyMacroLnk; /**< Link will be called, if the Cursor is set + into a fly. A macro can then be called */ + Link<LinkParamNone*,void> m_aChgLnk; /**< link will be called by every attribute/ + format changes at cursor position.*/ + Link<SwCursorShell&,void> m_aGrfArrivedLnk; ///< Link calls to UI if a graphic is arrived + + SwShellCursor* m_pCurrentCursor; ///< current cursor + SwShellCursor* m_pStackCursor; ///< stack for the cursor + SwVisibleCursor *m_pVisibleCursor; ///< the visible cursor + + SwBlockCursor *m_pBlockCursor; ///< interface of cursor for block (=rectangular) selection + + SwShellTableCursor* m_pTableCursor; /**< table Cursor; only in tables when the + selection lays over 2 columns */ + + SwNodeIndex* m_pBoxIdx; ///< for recognizing of the changed + SwTableBox* m_pBoxPtr; ///< table row + + long m_nUpDownX; /**< try to move the cursor on up/down always + in the same column */ + long m_nLeftFramePos; + sal_uLong m_nCurrentNode; // save CursorPos at Start-Action + sal_Int32 m_nCurrentContent; + SwNodeType m_nCurrentNdTyp; + + /* + * Via the Method SttCursorMove and EndCursorMove this counter gets + * incremented/decremented. As long as the counter is inequal to 0, the + * current Cursor gets no update. This way, "complicated" cursor movements + * (via Find()) can be realised. + */ + sal_uInt16 m_nCursorMove; + CursorMoveState m_eMvState; ///< Status for Cursor-Travelling - GetModelPositionForViewPoint + SwTable::SearchType m_eEnhancedTableSel; /// table rows or columns selected by not cell by cell + + OUString m_sMarkedListId; + int m_nMarkedListLevel; + + bool m_bHasFocus : 1; ///< Shell is "active" in a window + bool m_bSVCursorVis : 1; ///< SV-Cursor visible/invisible + bool m_bChgCallFlag : 1; ///< attribute change inside Start- and EndAction + bool m_bVisPortChgd : 1; ///< in VisPortChg-Call + // (used in Invalidate by the Cursor) + + bool m_bCallChgLnk : 1; ///< flag for derived classes + // true -> call ChgLnk + // access only via SwChgLinkFlag + bool m_bAllProtect : 1; ///< Flag for areas + // true -> everything protected / hidden + bool m_bInCMvVisportChgd : 1; ///< Flag for CursorMoves + // true -> view was moved + bool m_bGCAttr : 1; // true -> non expanded attributes exist. + bool m_bIgnoreReadonly : 1; // true -> make the cursor visible on next + // EndAction in spite of Readonly + bool m_bSelTableCells : 1; // true -> select cells over the InputWin + bool m_bAutoUpdateCells : 1; // true -> autoformat cells + bool m_bBasicHideCursor : 1; // true -> HideCursor from Basic + bool m_bSetCursorInReadOnly : 1;// true -> Cursor is allowed in ReadOnly-Areas + bool m_bOverwriteCursor : 1; // true -> show Overwrite Cursor + + bool m_bMacroExecAllowed : 1; + + SwFrame* m_oldColFrame; + + SAL_DLLPRIVATE void MoveCursorToNum(); + + SAL_DLLPRIVATE void ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ); + + /** Mark a certain list level of a certain list + + levels of a certain lists are marked now + + @param sListId list Id of the list whose level is marked + @param nLevel to be marked list level + + An empty sListId denotes that no level of a list is marked. + */ + SAL_DLLPRIVATE void MarkListLevel( const OUString& sListId, + const int nLevel ); + + // private method(s) accessed from public inline method(s) must be exported. + bool LeftRight( bool, sal_uInt16, sal_uInt16, bool ); + SAL_DLLPRIVATE bool UpDown( bool, sal_uInt16 ); + SAL_DLLPRIVATE bool LRMargin( bool, bool bAPI = false ); + SAL_DLLPRIVATE bool IsAtLRMargin( bool, bool bAPI = false ) const; + + SAL_DLLPRIVATE bool isInHiddenTextFrame(SwShellCursor* pShellCursor); + + SAL_DLLPRIVATE bool GoStartWordImpl(); + SAL_DLLPRIVATE bool GoEndWordImpl(); + SAL_DLLPRIVATE bool GoNextWordImpl(); + SAL_DLLPRIVATE bool GoPrevWordImpl(); + SAL_DLLPRIVATE bool GoNextSentenceImpl(); + SAL_DLLPRIVATE bool GoEndSentenceImpl(); + SAL_DLLPRIVATE bool GoStartSentenceImpl(); + + typedef bool (SwCursor::*FNCursor)(); + typedef bool (SwCursorShell::*FNCursorShell)(); + SAL_DLLPRIVATE bool CallCursorFN( FNCursor ); + SAL_DLLPRIVATE bool CallCursorShellFN( FNCursorShell ); + + SAL_DLLPRIVATE const SwRangeRedline* GotoRedline_( SwRedlineTable::size_type nArrPos, bool bSelect ); + + SAL_DLLPRIVATE void sendLOKCursorUpdates(); +protected: + + inline SwMoveFnCollection const & MakeFindRange( SwDocPositions, SwDocPositions, SwPaM* ) const; + + /* + * Compare-Method for the StackCursor and the current Cursor. + * The Methods return -1, 0, 1 for lower, equal, greater. + */ + int CompareCursorStackMkCurrPt() const; + + bool SelTableRowOrCol( bool bRow, bool bRowSimple = false ); + + bool SetInFrontOfLabel( bool bNew ); + + void RefreshBlockCursor(); + + /** Updates the marked list level according to the cursor. + */ + SAL_DLLPRIVATE void UpdateMarkedListLevel(); + +protected: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; + +public: + SwCursorShell( SwDoc& rDoc, vcl::Window *pWin, const SwViewOption *pOpt ); + // disguised copy constructor + SwCursorShell( SwCursorShell& rShell, vcl::Window *pWin ); + virtual ~SwCursorShell() override; + + // create new cursor and append the old one + virtual SwPaM & CreateNewShellCursor() override; + virtual SwPaM & GetCurrentShellCursor() override; + + SwPaM * CreateCursor(); + ///< delete the current cursor and make the following into the current + void DestroyCursor(); + ///< transform TableCursor to normal cursor, nullify Tablemode + void TableCursorToCursor(); + ///< enter block mode, change normal cursor into block cursor + void CursorToBlockCursor(); + ///< leave block mode, change block cursor into normal cursor + void BlockCursorToCursor(); + + // SelAll() selects the document body content + // if ExtendedSelect() is called afterwards, the whole nodes array is selected + // only for usage in special cases allowed! + void ExtendedSelectAll(bool bFootnotes = true); + /// If ExtendedSelectAll() was called and selection didn't change since then. + bool ExtendedSelectedAll(); + /// If document body starts with a table. + bool StartsWithTable(); + + SwPaM* GetCursor( bool bMakeTableCursor = true ) const; + inline SwCursor* GetSwCursor() const; + // return only the current cursor + SwShellCursor* GetCursor_() { return m_pCurrentCursor; } + const SwShellCursor* GetCursor_() const { return m_pCurrentCursor; } + + // show passed cursor - for UNO + void SetSelection(const SwPaM& rCursor); + + // remove all cursors from ContentNodes and set to 0 + void ParkCursor( const SwNodeIndex &rIdx ); + + // return the current cursor stack + // (required in EditShell when deleting contents) + inline SwPaM* GetStackCursor() const; + + // start parenthesing, hide SV-Cursor and selected areas + void StartAction(); + // end parenthesing, show SV-Cursor and selected areas + void EndAction( const bool bIdleEnd = false, const bool DoSetPosX = false ); + + // basic cursor travelling + long GetUpDownX() const { return m_nUpDownX; } + + bool Left( sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual = false ) + { return LeftRight( true, nCnt, nMode, bAllowVisual ); } + bool Right( sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual = false ) + { return LeftRight( false, nCnt, nMode, bAllowVisual ); } + bool Up( sal_uInt16 nCnt = 1 ) { return UpDown( true, nCnt ); } + bool Down( sal_uInt16 nCnt = 1 ) { return UpDown( false, nCnt ); } + bool LeftMargin() { return LRMargin( true ); } + bool RightMargin(bool bAPI = false) { return LRMargin( false, bAPI ); } + bool SttEndDoc( bool bStt ); + + bool MovePage( SwWhichPage, SwPosPage ); + bool MovePara( SwWhichPara, SwMoveFnCollection const & ); + bool MoveSection( SwWhichSection, SwMoveFnCollection const & ); + bool MoveTable( SwWhichTable, SwMoveFnCollection const & ); + void MoveColumn( SwWhichColumn, SwPosColumn ); + bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & ); + + // note: DO NOT call it FindText because windows.h + sal_uLong Find_Text( const i18nutil::SearchOptions2& rSearchOpt, + bool bSearchInNotes, + SwDocPositions eStart, SwDocPositions eEnd, + bool& bCancel, + FindRanges eRng, bool bReplace = false ); + + sal_uLong FindFormat( const SwTextFormatColl& rFormatColl, + SwDocPositions eStart, SwDocPositions eEnd, + bool& bCancel, + FindRanges eRng, const SwTextFormatColl* pReplFormat ); + + sal_uLong FindAttrs( const SfxItemSet& rSet, bool bNoCollections, + SwDocPositions eStart, SwDocPositions eEnd, + bool& bCancel, + FindRanges eRng, + const i18nutil::SearchOptions2* pSearchOpt, + const SfxItemSet* rReplSet ); + + // Position the Cursor + // return values: + // CRSR_POSCHG: when cursor was corrected from SPoint by the layout + // CRSR_POSOLD: when the cursor was not changed + int SetCursor( const Point &rPt, bool bOnlyText = false, bool bBlock = true ); + + /* + * Notification that the visible area was changed. m_aVisArea is reset, then + * scrolling is done. The passed Rectangle lays on pixel borders to avoid + * pixel errors. + */ + virtual void VisPortChgd( const SwRect & ) override; + + /* + * virtual paint method to make selection visible again after Paint + */ + void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle & rRect) override; + + // Areas + inline void SetMark(); + inline bool HasMark() const; + + void ClearMark(); + + /** + Ensure point and mark of the current PaM are in a specific order. + + @param bPointFirst true: If the point is behind the mark then + swap the PaM. false: If the mark is behind the point then swap + the PaM. + */ + void NormalizePam(bool bPointFirst = true); + + void SwapPam(); + bool TestCurrPam( const Point & rPt, + bool bTstHit = false); // only exact matches + void KillPams(); + + /// store a copy of the current cursor on the cursor stack + void Push(); + enum class PopMode { DeleteCurrent, DeleteStack }; + /* + * Delete a cursor + * - either from the top of the stack + * - or delete the current one and replace it with the cursor from the + * stack + * @return <true> if there was one on the stack, <false> otherwise + */ + bool Pop(PopMode); + /* + * Combine 2 Cursors. + * Delete the topmost from the stack and move its Mark into the current. + */ + void Combine(); + + void SttCursorMove(); + void EndCursorMove( const bool bIdleEnd = false ); + + /* + * When the focus is lost the selected ranges are not displayed anymore. + * On the other hand, on receiving the focus all selected ranges are displayed again + * (ranges must be recalculated!). + */ + bool HasShellFocus() const { return m_bHasFocus; } + void ShellLoseFocus(); + void ShellGetFocus(); + + // Methods for displaying or hiding the visible text cursor. + void ShowCursor(); + void HideCursor(); + // Methods for displaying or hiding the selected ranges with visible cursor. + void ShowCursors( bool bCursorVis ); + void HideCursors(); + + bool IsOverwriteCursor() const { return m_bOverwriteCursor; } + void SetOverwriteCursor( bool bFlag ) { m_bOverwriteCursor = bFlag; } + + // Return current frame in which the cursor is placed. + SwContentFrame *GetCurrFrame( const bool bCalcFrame = true ) const; + + //true if cursor is hidden because of readonly. + //false if it is working despite readonly. + bool IsCursorReadonly() const; + + // Cursor is placed in something that is protected or selection contains + // something that is protected. + bool HasReadonlySel() const; + + // Can the cursor be set to read only ranges? + bool IsReadOnlyAvailable() const { return m_bSetCursorInReadOnly; } + void SetReadOnlyAvailable( bool bFlag ); + bool IsOverReadOnlyPos( const Point& rPt ) const; + + // Methods for aFlyMacroLnk. + void SetFlyMacroLnk( const Link<const SwFlyFrameFormat*,void>& rLnk ) { m_aFlyMacroLnk = rLnk; } + const Link<const SwFlyFrameFormat*,void>& GetFlyMacroLnk() const { return m_aFlyMacroLnk; } + + // Methods returning/altering link for changes of attributes/formats. + void SetChgLnk( const Link<LinkParamNone*,void> &rLnk ) { m_aChgLnk = rLnk; } + const Link<LinkParamNone*,void>& GetChgLnk() const { return m_aChgLnk; } + + // Methods returning/altering link for "graphic completely loaded". + void SetGrfArrivedLnk( const Link<SwCursorShell&,void> &rLnk ) { m_aGrfArrivedLnk = rLnk; } + const Link<SwCursorShell&,void>& GetGrfArrivedLnk() const { return m_aGrfArrivedLnk; } + + //Call ChgLink. When within an action calling will be delayed. + void CallChgLnk(); + + // Check if the current cursor contains a selection, i.e. + // if Mark is set and SPoint and Mark are different. + bool HasSelection() const; + + // Check if a selection exists, i.e. if the current cursor comprises a selection. + inline bool IsSelection() const; + // returns if multiple cursors are available + inline bool IsMultiSelection() const; + + // Check if a complete paragraph was selected. + bool IsSelFullPara() const; + + // Check if selection is within one paragraph. + + //Should WaitPtr be activated for Clipboard. + bool ShouldWait() const; + + // Check if selection is within one paragraph. + bool IsSelOnePara() const; + + /* + * Returns SRectangle, at which the cursor is located. + */ + const SwRect &GetCharRect() const { return m_aCharRect; } + /* + * Returns if cursor is wholly or partly within visible range. + */ + bool IsCursorVisible() const { return VisArea().IsOver( GetCharRect() ); } + /* + * Returns SwRect, at which the character is located. + */ + void GetCharRectAt(SwRect& rRect, const SwPosition* pPos); + + // Return current page number: + // true: in which cursor is located. + // false: which is visible at the upper margin. + void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, + bool bAtCursorPos = true, const bool bCalcFrame = true ); + // Returns current page's sequential number (1-based),in which cursor is located, ignoring autoinserted empty pages. + // Returns 0 on error + sal_uInt16 GetPageNumSeqNonEmpty(); + // Determine how "empty pages" are handled + // (used in PhyPage). + sal_uInt16 GetNextPrevPageNum( bool bNext = true ); + + // Move cursor at the beginning of page "nPage". + bool GotoPage( sal_uInt16 nPage ); + + sal_uInt16 GetPageCnt(); + + bool GoNextCursor(); + + bool GoPrevCursor(); + + bool GoNextPrevCursorSetSearchLabel(const bool bNext); + + // at CurrentCursor.SPoint + ::sw::mark::IMark* SetBookmark( + const vcl::KeyCode&, + const OUString& rName, + IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::MarkType::BOOKMARK); + ::sw::mark::IMark* SetBookmark2( + const vcl::KeyCode&, + const OUString& rName, + bool bHide, + const OUString& rCondition); + bool GotoMark( const ::sw::mark::IMark* const pMark ); // sets CurrentCursor.SPoint + bool GotoMark( const ::sw::mark::IMark* const pMark, bool bAtStart ); + bool GoNextBookmark(); // true, if there was one + bool GoPrevBookmark(); + + bool IsFormProtected(); + ::sw::mark::IFieldmark* GetCurrentFieldmark(); + ::sw::mark::IFieldmark* GetFieldmarkAfter(); + ::sw::mark::IFieldmark* GetFieldmarkBefore(); + bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark ); + + // update Cursr, i.e. reset it into content should only be called when the + // cursor was set to a random position e.g. when deleting frames + void UpdateCursorPos(); + + // get the selected text at the current cursor. It will be filled with + // fields etc. + OUString GetSelText() const; + + // Check of SPoint or Mark of current cursor are placed within a table. + inline const SwTableNode* IsCursorInTable() const; + + bool IsCursorInFootnote() const; + + inline Point& GetCursorDocPos() const; + inline bool IsCursorPtAtEnd() const; + + inline const SwPaM* GetTableCrs() const; + inline SwPaM* GetTableCrs(); + + bool IsTableComplexForChart(); + // get current table selection as text + OUString GetBoxNms() const; + + // set Cursor to the next/previous cell + bool GoNextCell( bool bAppendLine = true ); + bool GoPrevCell(); + // go to this box (if available and inside of table) + bool GotoTable( const OUString& rName ); + + // select a table row, column or box (based on the current cursor) + bool SelTableRow() { return SelTableRowOrCol( true ); } + bool SelTableCol() { return SelTableRowOrCol( false ); } + bool SelTableBox(); + + bool SelTable(); + + void GotoNextNum(); + void GotoPrevNum(); + + bool GotoOutline( const OUString& rName ); + // to the next/previous or the given OutlineNode + void GotoOutline( SwOutlineNodes::size_type nIdx ); + // find the "outline position" in the nodes array of the current chapter + SwOutlineNodes::size_type GetOutlinePos( sal_uInt8 nLevel = UCHAR_MAX ); + // select the given range of OutlineNodes. Optionally including the children + // the sal_uInt16s are the positions in OutlineNodes-Array (EditShell) + bool MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, + bool bWithChildren, bool bKillPams = true ); + + bool GotoNextOutline(); + bool GotoPrevOutline(); + + /** Delivers the current shell cursor + + Some operations have to run on the current cursor ring, + some on the m_pTableCursor (if exist) or the current cursor ring and + some on the m_pTableCursor or m_pBlockCursor or the current cursor ring. + This small function checks the existence and delivers the wished cursor. + + @param bBlock [bool] + if the block cursor is of interest or not + + @return m_pTableCursor if exist, + m_pBlockCursor if exist and of interest (param bBlock) + otherwise m_pCurrentCursor + */ + SwShellCursor* getShellCursor( bool bBlock ); + const SwShellCursor* getShellCursor( bool bBlock ) const + { return const_cast<SwCursorShell*>(this)->getShellCursor( bBlock ); } + + bool IsBlockMode() const { return nullptr != m_pBlockCursor; } + + // is the Cursor in a table and is the selection over 2 columns + bool IsTableMode() const { return nullptr != m_pTableCursor; } + + const SwShellTableCursor* GetTableCursor() const { return m_pTableCursor; } + SwShellTableCursor* GetTableCursor() { return m_pTableCursor; } + size_t UpdateTableSelBoxes(); + + bool GotoFootnoteText(); ///< jump from content to footnote + bool GotoFootnoteAnchor(); ///< jump from footnote to anchor + bool GotoPrevFootnoteAnchor(); + bool GotoNextFootnoteAnchor(); + + void GotoFlyAnchor(); ///< jump from the frame to the anchor + bool GotoHeaderText(); ///< jump from the content to the header + bool GotoFooterText(); ///< jump from the content to the footer + // jump to the header/footer of the given or current PageDesc + bool SetCursorInHdFt( size_t nDescNo, bool bInHeader ); + // is point of cursor in header/footer. pbInHeader return true if it is + // in a headerframe otherwise in a footerframe + bool IsInHeaderFooter( bool* pbInHeader = nullptr ) const; + + bool GotoNextTOXBase( const OUString* = nullptr ); + bool GotoPrevTOXBase( const OUString* = nullptr ); + void GotoTOXMarkBase(); + // jump to the next or previous index entry + bool GotoNxtPrvTOXMark( bool bNext = true ); + // jump to the next/previous index mark of this type + const SwTOXMark& GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir ); + + // jump to the next or previous table formula + // optionally only to broken formulas + bool GotoNxtPrvTableFormula( bool bNext = true, + bool bOnlyErrors = false ); + // jump to the next / previous hyperlink - inside text and also + // on graphics + bool SelectNxtPrvHyperlink( bool bNext ); + + bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType, + sal_uInt16 nSeqNo ); + + // get the nth character from the start or end of the current selection + sal_Unicode GetChar( bool bEnd = true, long nOffset = 0 ); + bool ExtendSelection( bool bEnd = true, sal_Int32 nCount = 1 ); + + // Place only the visible cursor at the given position in the document. + // Return false if SPoint was corrected by layout. + // (This is needed for displaying the Drag&Drop/Copy-Cursor.) + bool SetVisibleCursor( const Point &rPt ); + inline void UnSetVisibleCursor(); + SwVisibleCursor* GetVisibleCursor() const; + + // jump to the next or previous field of the corresponding type + bool MoveFieldType( + const SwFieldType* pFieldType, + const bool bNext, + const SwFieldIds nResType = SwFieldIds::Unknown, + const bool bAddSetExpressionFieldsToInputFields = true ); + + bool GotoFormatField( const SwFormatField& rField ); + + static SwTextField* GetTextFieldAtPos( + const SwPosition* pPos, + const bool bIncludeInputFieldAtStart ); + static SwTextField* GetTextFieldAtCursor( + const SwPaM* pCursor, + const bool bIncludeInputFieldAtStart ); + static SwField* GetFieldAtCursor( + const SwPaM* pCursor, + const bool bIncludeInputFieldAtStart ); + SwField* GetCurField( const bool bIncludeInputFieldAtStart = false ) const; + bool CursorInsideInputField() const; + static bool PosInsideInputField( const SwPosition& rPos ); + bool DocPtInsideInputField( const Point& rDocPt ) const; + static sal_Int32 StartOfInputFieldAtPos( const SwPosition& rPos ); + static sal_Int32 EndOfInputFieldAtPos( const SwPosition& rPos ); + + // Return number of cursors in ring (The flag indicates whether + // only cursors containing selections are requested). + sal_uInt16 GetCursorCnt( bool bAll = true ) const; + + // Char Travelling - methods (in crstrvl1.cxx) + bool GoStartWord(); + bool GoEndWord(); + bool GoNextWord(); + bool GoPrevWord(); + bool GoNextSentence(); + bool GoStartSentence(); + bool GoEndSentence(); + bool SelectWord( const Point* pPt ); + void ExpandToSentenceBorders(); + + // get position from current cursor + bool IsStartWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )const; + bool IsEndWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + bool IsInWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; + bool IsStartSentence() const; + bool IsEndSentence() const; + bool IsSttPara() const; + bool IsEndPara() const; + bool IsEndOfTable() const; ///< at the very last SwPosition inside a table + bool IsStartOfDoc() const; + bool IsEndOfDoc() const; + bool IsInFrontOfLabel() const; + bool IsAtLeftMargin() const { return IsAtLRMargin( true ); } + bool IsAtRightMargin() const { return IsAtLRMargin( false, true/*bAPI*/ ); } + + // delete all created cursors, set the table cursor and the last cursor to + // its TextNode (or StartNode?) + // They all get created on the next ::GetCursor again + // Used for Drag&Drop/Clipboard-Paste in tables + bool ParkTableCursor(); + + // Non expanded attributes? + bool IsGCAttr() const { return m_bGCAttr; } + void ClearGCAttr() { m_bGCAttr = false; } + void UpdateAttr() { m_bGCAttr = true; } + + // is the whole document protected/hidden (for UI...) + bool IsAllProtect() const { return m_bAllProtect; } + + bool GotoRegion( const OUString& rName ); + + // show the current selection + virtual void MakeSelVisible(); + + // set the cursor to a NOT protected/hidden node + bool FindValidContentNode( bool bOnlyText ); + + bool GetContentAtPos( const Point& rPt, + SwContentAtPos& rContentAtPos, + bool bSetCursor = false, + SwRect* pFieldRect = nullptr ); + + const SwPostItField* GetPostItFieldAtCursor() const; + + // get smart tags rectangle for the given point + void GetSmartTagRect( const Point& rPt, SwRect& rSelectRect ); + + // get smart tags at current cursor position + void GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes, + css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps, + css::uno::Reference<css::text::XTextRange>& rRange ) const; + + bool IsPageAtPos( const Point &rPt ) const; + + bool SelectTextAttr( sal_uInt16 nWhich, bool bExpand, const SwTextAttr* pAttr = nullptr ); + bool GotoINetAttr( const SwTextINetFormat& rAttr ); + const SwFormatINetFormat* FindINetAttr( const OUString& rName ) const; + + bool SelectText( const sal_Int32 nStart, + const sal_Int32 nEnd ); + + bool CheckTableBoxContent( const SwPosition* pPos = nullptr ); + void SaveTableBoxContent( const SwPosition* pPos = nullptr ); + void ClearTableBoxContent(); + bool EndAllTableBoxEdit(); + + void SetSelTableCells( bool bFlag ) { m_bSelTableCells = bFlag; } + bool IsSelTableCells() const { return m_bSelTableCells; } + + void UnsetEnhancedTableSelection() { m_eEnhancedTableSel = SwTable::SEARCH_NONE; } + SwTable::SearchType GetEnhancedTableSelection() const { return m_eEnhancedTableSel; } + + bool IsAutoUpdateCells() const { return m_bAutoUpdateCells; } + void SetAutoUpdateCells( bool bFlag ) { m_bAutoUpdateCells = bFlag; } + + bool GetShadowCursorPos( const Point& rPt, SwFillMode eFillMode, + SwRect& rRect, sal_Int16& rOrient ); + bool SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode ); + + const SwRangeRedline* SelNextRedline(); + const SwRangeRedline* SelPrevRedline(); + const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect ); + + SAL_DLLPRIVATE SvxFrameDirection GetTextDirection( const Point* pPt = nullptr ) const; + // is cursor or the point in/over a vertical formatted text? + bool IsInVerticalText( const Point* pPt = nullptr ) const; + // is cursor or the point in/over a right to left formatted text? + bool IsInRightToLeftText() const; + + static void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage); + bool bColumnChange(); + static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection); + static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn); + // If the current cursor position is inside a hidden range, the hidden range + // is selected and true is returned: + bool SelectHiddenRange(); + + // remove all invalid cursors + void ClearUpCursors(); + + void SetMacroExecAllowed( const bool _bMacroExecAllowed ) + { + m_bMacroExecAllowed = _bMacroExecAllowed; + } + bool IsMacroExecAllowed() const + { + return m_bMacroExecAllowed; + } + + /** + Returns textual description of the current selection. + + - If the current selection is a multi-selection the result is + STR_MULTISEL. + - Else the result is the text of the selection. + + @return the textual description of the current selection + */ + OUString GetCursorDescr() const; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; + /// Implementation of lok::Document::getPartPageRectangles() for Writer. + OUString getPageRectangles(); + + /// See SwView::NotifyCursor(). + void NotifyCursor(SfxViewShell* pViewShell) const; +}; + +// Cursor Inlines: +inline SwMoveFnCollection const & SwCursorShell::MakeFindRange( + SwDocPositions nStt, SwDocPositions nEnd, SwPaM* pPam ) const +{ + return m_pCurrentCursor->MakeFindRange( nStt, nEnd, pPam ); +} + +inline SwCursor* SwCursorShell::GetSwCursor() const +{ + return static_cast<SwCursor*>(GetCursor()); +} + +inline SwPaM* SwCursorShell::GetStackCursor() const { return m_pStackCursor; } + +inline void SwCursorShell::SetMark() { m_pCurrentCursor->SetMark(); } + +inline bool SwCursorShell::HasMark() const { return m_pCurrentCursor->HasMark(); } + +inline bool SwCursorShell::IsSelection() const +{ + return IsTableMode() || m_pCurrentCursor->HasMark() || + m_pCurrentCursor->GetNext() != m_pCurrentCursor; +} +inline bool SwCursorShell::IsMultiSelection() const +{ + return m_pCurrentCursor->GetNext() != m_pCurrentCursor; +} + +inline const SwTableNode* SwCursorShell::IsCursorInTable() const +{ + return m_pCurrentCursor->GetNode().FindTableNode(); +} + +inline bool SwCursorShell::IsCursorPtAtEnd() const +{ + return m_pCurrentCursor->End() == m_pCurrentCursor->GetPoint(); +} + +inline Point& SwCursorShell::GetCursorDocPos() const +{ + return m_pCurrentCursor->GetPtPos(); +} + +inline const SwPaM* SwCursorShell::GetTableCrs() const +{ + return m_pTableCursor; +} + +inline SwPaM* SwCursorShell::GetTableCrs() +{ + return m_pTableCursor; +} + +inline void SwCursorShell::UnSetVisibleCursor() +{ + m_pVisibleCursor->Hide(); + m_pVisibleCursor->SetDragCursor( false ); +} + +#endif // _CRSRSH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx new file mode 100644 index 000000000..9b223319f --- /dev/null +++ b/sw/inc/crstate.hxx @@ -0,0 +1,214 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_CRSTATE_HXX +#define INCLUDED_SW_INC_CRSTATE_HXX + +#include <com/sun/star/text/HoriOrientation.hpp> +#include <tools/gen.hxx> +#include "swrect.hxx" + +#include <memory> + +enum class SwFillMode +{ + Tab, ///< default, fill with tabs + TabSpace, ///< fill with spaces and tabs + Space, ///< fill with spaces + Margin, ///< only align left, center, right + Indent ///< by left paragraph indentation +}; + +struct SwFillCursorPos +{ + SwRect aCursor; ///< position and size of the ShadowCursor + sal_uInt16 nParaCnt; ///< number of paragraphs to insert + sal_uInt16 nTabCnt; ///< number of tabs respectively size of indentation + sal_uInt16 nSpaceCnt; ///< number of spaces to insert + sal_uInt16 nSpaceOnlyCnt; ///< number of spaces to insert ("only spaces, no tabs" mode) + sal_uInt16 nColumnCnt; ///< number of necessary column breaks + sal_Int16 eOrient; ///< paragraph alignment + SwFillMode eMode; ///< desired fill-up rule + SwFillCursorPos( SwFillMode eMd ) : + nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nSpaceOnlyCnt(0), nColumnCnt( 0 ), + eOrient( css::text::HoriOrientation::NONE ), eMode( eMd ) + {} +}; + +// Multiportion types: two lines, bidirectional, 270 degrees rotation, +// ruby portion and 90 degrees rotation +enum class MultiPortionType : sal_uInt8 +{ + TWOLINE = 0, + BIDI = 1, + ROT_270 = 3, + RUBY = 4, + ROT_90 = 7, +}; + +struct Sw2LinesPos +{ + SwRect aLine; ///< Position and size of the line + SwRect aPortion; ///< Position and size of the multi portion + SwRect aPortion2; ///< needed for nested multi portions + MultiPortionType nMultiType; ///< Multiportion type +}; + +/** + * SwSpecialPos. This structure is used to pass some additional information + * during the call of SwTextFrame::GetCharRect(). An SwSpecialPos defines a position + * inside a portion which does not have a representation in the core string or + * which is only represented by one position, e.g., field portions, + * number portions, ergo sum and quo vadis portions. + * + * nCharOfst - The offset inside the special portion. Fields and its + * follow fields are treated as one long special portion. + * nLineOfst - The number of lines between the beginning of the special + * portion and nCharOfst. A line offset required to be + * nCharOfst relative to the beginning of the line. + * nExtendRange - Setting this identifies portions which are in front or + * behind the core string (number portion, quo vadis) + * + * Examples 1) + * + * Get the position of the second character inside a number portion: + * nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE; + * Call SwTextFrame:::GetCharRect with core string position 0. + * + * Example 2) + * + * Field A - Length = 5 + * Follow field B - Length = 9 + * Get the position of the third character in follow field B, core position + * of field A is 33. + * nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE; + * Call SwTextFrame:::GetCharRect with core string position 33. + */ + +enum class SwSPExtendRange : sal_uInt8 +{ + NONE, BEFORE, BEHIND +}; + +struct SwSpecialPos +{ + sal_Int32 nCharOfst; + sal_uInt16 nLineOfst; + SwSPExtendRange nExtendRange; + + // #i27615# + SwSpecialPos() : nCharOfst(0), nLineOfst(0), + nExtendRange(SwSPExtendRange::NONE) + {} +}; + +// CursorTravelling-States (for GetModelPositionForViewPoint) +enum class CursorMoveState +{ + NONE, ///< default + UpDown, ///< Cursor Up/Down + RightMargin, ///< at right margin + LeftMargin, ///< at left margin + SetOnlyText, ///< stay with the cursor inside text + TableSel ///< not in repeated headlines +}; + +// struct for later extensions +struct SwCursorMoveState +{ + SwFillCursorPos *m_pFill; ///< for automatic filling with tabs etc + std::unique_ptr<Sw2LinesPos> m_p2Lines; ///< for selections inside/around 2line portions + SwSpecialPos* m_pSpecialPos; ///< for positions inside fields + Point m_aRealHeight; ///< contains then the position/height of the cursor + CursorMoveState m_eState; + sal_uInt8 m_nCursorBidiLevel; + bool m_bStop; + bool m_bRealHeight; ///< should the real height be calculated? + bool m_bFieldInfo; ///< should be fields recognized? + bool m_bPosCorr; ///< Point had to be corrected + bool m_bFootnoteNoInfo; ///< recognized footnote numbering + bool m_bExactOnly; /**< let GetModelPositionForViewPoint look for exact matches only, + i.e. never let it run into GetContentPos */ + bool m_bFillRet; ///< only used temporary in FillMode + bool m_bSetInReadOnly; ///< ReadOnly areas may be entered + bool m_bRealWidth; ///< Calculation of the width required + bool m_b2Lines; ///< Check 2line portions and fill p2Lines + bool m_bNoScroll; ///< No scrolling of undersized textframes + bool m_bPosMatchesBounds; /**< GetModelPositionForViewPoint should not return the next + position if screen position is inside second + have of bound rect */ + + bool m_bContentCheck; // #i43742# Cursor position over content? + + // #i27615# + /** + cursor in front of label + */ + bool m_bInFrontOfLabel; + bool m_bInNumPortion; ///< point is in number portion #i23726# + int m_nInNumPortionOffset; ///< distance from number portion's start + + SwCursorMoveState( CursorMoveState eSt = CursorMoveState::NONE ) : + m_pFill( nullptr ), + m_pSpecialPos( nullptr ), + m_eState( eSt ), + m_nCursorBidiLevel( 0 ), + m_bStop( false ), + m_bRealHeight( false ), + m_bFieldInfo( false ), + m_bPosCorr( false ), + m_bFootnoteNoInfo( false ), + m_bExactOnly( false ), + m_bFillRet( false ), + m_bSetInReadOnly( false ), + m_bRealWidth( false ), + m_b2Lines( false ), + m_bNoScroll( false ), + m_bPosMatchesBounds( false ), + m_bContentCheck( false ), // #i43742# + m_bInFrontOfLabel( false ), // #i27615# + m_bInNumPortion(false), // #i26726# + m_nInNumPortionOffset(0) // #i26726# + {} + SwCursorMoveState( SwFillCursorPos *pInitFill ) : + m_pFill( pInitFill ), + m_pSpecialPos( nullptr ), + m_eState( CursorMoveState::SetOnlyText ), + m_nCursorBidiLevel( 0 ), + m_bStop( false ), + m_bRealHeight( false ), + m_bFieldInfo( false ), + m_bPosCorr( false ), + m_bFootnoteNoInfo( false ), + m_bExactOnly( false ), + m_bFillRet( false ), + m_bSetInReadOnly( false ), + m_bRealWidth( false ), + m_b2Lines( false ), + m_bNoScroll( false ), + m_bPosMatchesBounds( false ), + m_bContentCheck( false ), // #i43742# + m_bInFrontOfLabel( false ), // #i27615# + m_bInNumPortion(false), // #i23726# + m_nInNumPortionOffset(0) // #i23726# + {} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx new file mode 100644 index 000000000..1ecde9f6d --- /dev/null +++ b/sw/inc/cshtyp.hxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_CSHTYP_HXX +#define INCLUDED_SW_INC_CSHTYP_HXX + +#include "swdllapi.h" +#include <o3tl/typed_flags_set.hxx> + +class SwPaM; +class SwContentFrame; +class SwLayoutFrame; + +// Structure for SwPaM. Contains the method-pointers for cursor movement. +struct SwMoveFnCollection; + +// Type definition for CursorShell. +// Direction-parameter for MovePage. +typedef SwLayoutFrame * (*SwWhichPage)( const SwLayoutFrame * ); +SwLayoutFrame *GetPrevFrame( const SwLayoutFrame *pFrame ); +SwLayoutFrame *GetThisFrame( const SwLayoutFrame *pFrame ); +SwLayoutFrame *GetNextFrame( const SwLayoutFrame *pFrame ); +typedef SwContentFrame * (*SwPosPage)( const SwLayoutFrame * ); +SwContentFrame *GetFirstSub( const SwLayoutFrame *pLayout ); +SwContentFrame *GetLastSub( const SwLayoutFrame *pLayout ); + +// Direction-parameter for MovePara. +typedef bool (*SwWhichPara)( SwPaM&, SwMoveFnCollection const & ); +bool GoPrevPara( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoCurrPara( SwPaM&, SwMoveFnCollection const &); +bool GoNextPara( SwPaM&, SwMoveFnCollection const &); +extern SW_DLLPUBLIC SwMoveFnCollection const & fnParaStart; +extern SW_DLLPUBLIC SwMoveFnCollection const & fnParaEnd; + +// Direction-parameter for MoveSection. +typedef bool (*SwWhichSection)( SwPaM&, SwMoveFnCollection const & ); +extern SwMoveFnCollection const & fnSectionStart; +extern SwMoveFnCollection const & fnSectionEnd; + +bool GoCurrSection( SwPaM&, SwMoveFnCollection const &); + +// Direction-parameter for MoveTable +typedef bool (*SwWhichTable)( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +SW_DLLPUBLIC bool GotoPrevTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +SW_DLLPUBLIC bool GotoCurrTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoNextTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +extern SW_DLLPUBLIC SwMoveFnCollection const & fnTableStart; +extern SW_DLLPUBLIC SwMoveFnCollection const & fnTableEnd; + +// Direction-parameter for MoveColumn +typedef SwLayoutFrame * (*SwWhichColumn)( const SwLayoutFrame * ); +typedef SwContentFrame * (*SwPosColumn)( const SwLayoutFrame * ); +SwLayoutFrame* GetPrevColumn( const SwLayoutFrame* pLayFrame ); +SwLayoutFrame* GetCurrColumn( const SwLayoutFrame* pLayFrame ); +SwLayoutFrame* GetNextColumn( const SwLayoutFrame* pLayFrame ); +SwContentFrame* GetColumnStt( const SwLayoutFrame* pColFrame ); +SwContentFrame* GetColumnEnd( const SwLayoutFrame* pColFrame ); + +// Direction-parameter for MoveRegion (ranges!) +typedef bool (*SwWhichRegion)( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoPrevRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoNextRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoCurrRegionAndSkip( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +extern SwMoveFnCollection const & fnRegionStart; +extern SwMoveFnCollection const & fnRegionEnd; + +/* + * The following combinations are allowed: + * - find one in body -> FindRanges::InBody + * - find all in body: -> FindRanges::InBodyOnly | FindRanges::InSelAll + * - find in selections: one/all -> FindRanges::InSel [ | FindRanges::InSelAll ] + * - find not in body: one/all -> FindRanges::InOther [ | FindRanges::InSelAll ] + * - find all everywhere -> FindRanges::InSelAll + */ +enum class FindRanges +{ + InBody = 0x00, ///< Find "one" only in body text. + InSelAll = 0x01, ///< All (only in non-body and selections). + InOther = 0x02, ///< Find "all" in Footer/Header/Fly... + InSel = 0x04, ///< Find in selections. + InBodyOnly = 0x08, ///< Find only in body - only in combination with FindRanges::InSelAll !!! +}; +namespace o3tl +{ + template<> struct typed_flags<FindRanges> : is_typed_flags<FindRanges, 0x0f> {}; +} + +enum class SwDocPositions +{ + Start, + Curr, + End, + OtherStart, + OtherEnd +}; + +#endif // INCLUDED_SW_INC_CSHTYP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx new file mode 100644 index 000000000..1c0d0db2c --- /dev/null +++ b/sw/inc/dbfld.hxx @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DBFLD_HXX +#define INCLUDED_SW_INC_DBFLD_HXX + +#include "swdllapi.h" +#include "fldbas.hxx" +#include "swdbdata.hxx" + +class SwDoc; + +// Database field. +class SW_DLLPUBLIC SwDBFieldType final : public SwValueFieldType +{ + SwDBData m_aDBData; + OUString m_sName; ///< only used in ::GetName() ! + OUString m_sColumn; + long m_nRefCnt; + +public: + + SwDBFieldType(SwDoc* pDocPtr, const OUString& rColumnName, const SwDBData& rDBData); + virtual ~SwDBFieldType() override; + + virtual OUString GetName() const override; + virtual std::unique_ptr<SwFieldType> Copy() const override; + + void AddRef() { m_nRefCnt++; } + void ReleaseRef(); + + const OUString& GetColumnName() const {return m_sColumn;} + const SwDBData& GetDBData() const {return m_aDBData;} + + virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Classes derived from SwFields. They overlay the expand-function. +// Content is formatted according to the format (if available). +class SW_DLLPUBLIC SwDBField final : public SwValueField +{ + OUString m_aContent; + OUString m_sFieldCode; ///< contains Word's field code + sal_uInt16 m_nSubType; + bool m_bIsInBodyText : 1; + bool m_bValidValue : 1; + bool m_bInitialized : 1; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwDBField(SwDBFieldType*, sal_uInt32 nFormat = 0); + virtual ~SwDBField() override; + + virtual SwFieldType* ChgTyp( SwFieldType* ) override; + + /// Current text. + inline void SetExpansion(const OUString& rStr); + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nType) override; + + virtual OUString GetFieldName() const override; + + /// For calculations in expressions. + void ChgValue( double d, bool bVal ); + + /// Get the evaluation via DBManager string. + void Evaluate(); + + /// Evaluation for header and footer. + void InitContent(); + void InitContent(const OUString& rExpansion); + + inline void ChgBodyTextFlag( bool bIsInBody ); + + bool IsInitialized() const { return m_bInitialized; } + void ClearInitialized() { m_bInitialized = false; } + void SetInitialized() { m_bInitialized = true; } + + /// Get name. + virtual OUString GetPar1() const override; + + /// access to the command string + void SetFieldCode(const OUString& rStr) { m_sFieldCode = rStr; } + + /// DBName + const SwDBData& GetDBData() const { return static_cast<SwDBFieldType*>(GetTyp())->GetDBData(); } + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + + static bool FormatValue( SvNumberFormatter const * pDocFormatter, OUString const &aString, sal_uInt32 nFormat, + double &aNumber, sal_Int32 nColumnType, SwDBField *pField = nullptr ); +}; + +inline void SwDBField::SetExpansion(const OUString& rStr) + { m_aContent = rStr; } + +/// set from UpdateExpFields (the Node-Position is known there) +inline void SwDBField::ChgBodyTextFlag( bool bIsInBody ) + { m_bIsInBodyText = bIsInBody; } + +// Base class for all other database fields. +class SW_DLLPUBLIC SwDBNameInfField : public SwField +{ + SwDBData m_aDBData; + sal_uInt16 m_nSubType; + +protected: + const SwDBData& GetDBData() const {return m_aDBData;} + SwDBData& GetDBData() {return m_aDBData;} + + SwDBNameInfField(SwFieldType* pTyp, const SwDBData& rDBData, sal_uInt32 nFormat = 0); + +public: + /// DBName + const SwDBData& GetRealDBData() const { return m_aDBData; } + SwDBData& GetRealDBData() { return m_aDBData; } + + SwDBData GetDBData(SwDoc* pDoc); + void SetDBData(const SwDBData& rDBData); + + virtual OUString GetFieldName() const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nType) override; +}; + +// Database field next record. +class SW_DLLPUBLIC SwDBNextSetFieldType final : public SwFieldType +{ +public: + SwDBNextSetFieldType(); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +// Next data record with condition. +class SW_DLLPUBLIC SwDBNextSetField final : public SwDBNameInfField +{ + OUString m_aCond; + bool m_bCondValid; + +public: + SwDBNextSetField( SwDBNextSetFieldType*, + const OUString& rCond, const SwDBData& rDBData); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + void Evaluate(SwDoc const *); + inline void SetCondValid(bool bCond); + inline bool IsCondValid() const; + + // Condition + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +inline bool SwDBNextSetField::IsCondValid() const + { return m_bCondValid; } + +inline void SwDBNextSetField::SetCondValid(bool bCond) + { m_bCondValid = bCond; } + +// Database field next record. +class SwDBNumSetFieldType final : public SwFieldType +{ +public: + SwDBNumSetFieldType(); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +// Data record with number xxx. +// Number is in nFormat (bit of a misuse!) +class SwDBNumSetField final : public SwDBNameInfField +{ + OUString m_aCond; + OUString m_aPar2; + bool m_bCondValid; + +public: + SwDBNumSetField(SwDBNumSetFieldType*, const OUString& rCond, const OUString& rDBNum, const SwDBData& rDBData); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + inline bool IsCondValid() const; + inline void SetCondValid(bool bCond); + void Evaluate(SwDoc const *); + + // Condition + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + + // Number of data record. + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + + // Number of data record is in nFormat!! + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +inline bool SwDBNumSetField::IsCondValid() const + { return m_bCondValid; } + +inline void SwDBNumSetField::SetCondValid(bool bCond) + { m_bCondValid = bCond; } + +// Database name. +class SwDBNameFieldType final : public SwFieldType +{ + SwDoc *m_pDoc; +public: + SwDBNameFieldType(SwDoc*); + + OUString Expand() const; + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +// Database field. +class SwDBNameField final : public SwDBNameInfField +{ +public: + SwDBNameField(SwDBNameFieldType*, const SwDBData& rDBData); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Number of data record. +class SW_DLLPUBLIC SwDBSetNumberFieldType final : public SwFieldType +{ +public: + SwDBSetNumberFieldType(); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +// Database field. +class SW_DLLPUBLIC SwDBSetNumberField final : public SwDBNameInfField +{ + long m_nNumber; +public: + SwDBSetNumberField(SwDBSetNumberFieldType*, const SwDBData& rDBData, sal_uInt32 nFormat = 0); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + void Evaluate(SwDoc const *); + + inline long GetSetNumber() const; + inline void SetSetNumber(long nNum); + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +inline long SwDBSetNumberField::GetSetNumber() const + { return m_nNumber; } + +inline void SwDBSetNumberField::SetSetNumber(long nNum) + { m_nNumber = nNum; } + +#endif // INCLUDED_SW_INC_DBFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx new file mode 100644 index 000000000..f6a98d1ac --- /dev/null +++ b/sw/inc/dbgoutsw.hxx @@ -0,0 +1,111 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DBGOUTSW_HXX +#define INCLUDED_SW_INC_DBGOUTSW_HXX + +#ifdef DBG_UTIL + +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include "tox.hxx" +#include <cstdio> +#include <unordered_map> + +class SwContentNode; +class SwNode; +class SwTextAttr; +class SwTextNode; +class SwpHints; +class SfxPoolItem; +class SfxItemSet; +struct SwPosition; +class SwPaM; +class SwNodeNum; +class SwUndo; +class SwRect; +class SwFrameFormat; +class SwFrameFormats; +class SwNumRuleTable; +class SwNumRule; +class SwOutlineNodes; +class SwTextFormatColl; +class SwNodeRange; + +extern bool bDbgOutStdErr; +extern bool bDbgOutPrintAttrSet; + +const char * dbg_out(const void * pVoid); +const char * dbg_out(const OUString & aStr); +const char * dbg_out(const SwRect & rRect); +const char * dbg_out(const SwFrameFormat & rFrameFormat); +SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode); +SW_DLLPUBLIC const char * dbg_out(const SwNode * pNode); +const char * dbg_out(const SwContentNode * pNode); +const char * dbg_out(const SwTextNode * pNode); +const char * dbg_out(const SwTextAttr & rAttr); +const char * dbg_out(const SwpHints &rHints); +const char * dbg_out(const SfxPoolItem & rItem); +const char * dbg_out(const SfxPoolItem * pItem); +const char * dbg_out(const SfxItemSet & rSet); +const char * dbg_out(const SwPosition & rPos); +const char * dbg_out(const SwPaM & rPam); +const char * dbg_out(const SwNodeNum & rNum); +const char * dbg_out(const SwUndo & rUndo); +const char * dbg_out(SwOutlineNodes const & rNodes); +const char * dbg_out(const SwNumRule & rRule); +const char * dbg_out(const SwTextFormatColl & rFormat); +const char * dbg_out(const SwFrameFormats & rFrameFormats); +const char * dbg_out(const SwNumRuleTable & rTable); +const char * dbg_out(const SwNodeRange & rRange); + +template<typename tKey, typename tMember, typename fHashFunction> +OUString lcl_dbg_out(const std::unordered_map<tKey, tMember, fHashFunction> & rMap) +{ + OUStringBuffer aResult("["); + + typename std::unordered_map<tKey, tMember, fHashFunction>::const_iterator aIt; + + for (aIt = rMap.begin(); aIt != rMap.end(); ++aIt) + { + if (aIt != rMap.begin()) + aResult.append(", "); + + aResult += aIt->first; + + char sBuffer[256]; + sprintf(sBuffer, "(%p)", aIt->second); + aResult.appendAscii(sBuffer); + } + + aResult.append("]"); + + return aResult.makeStringAndClear(); +} + +template<typename tKey, typename tMember, typename fHashFunction> +const char * dbg_out(const std::unordered_map<tKey, tMember, fHashFunction> & rMap) +{ + return dbg_out(lcl_dbg_out(rMap)); +} +const char * dbg_out(const SwFormToken & rToken); +const char * dbg_out(const SwFormTokens & rTokens); +#endif // DBG_UTIL +#endif // INCLUDED_SW_INC_DBGOUTSW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx new file mode 100644 index 000000000..26c7fee74 --- /dev/null +++ b/sw/inc/dbmgr.hxx @@ -0,0 +1,495 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DBMGR_HXX +#define INCLUDED_SW_INC_DBMGR_HXX + +#include <rtl/ustring.hxx> +#include <tools/solar.h> +#include <i18nlangtag/lang.h> +#include <com/sun/star/util/Date.hpp> +#include "swdllapi.h" +#include "swdbdata.hxx" +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <memory> +#include <vector> + +namespace com::sun::star{ + namespace sdbc{ + class XConnection; + class XStatement; + class XDataSource; + class XResultSet; + } + namespace beans{ + + class XPropertySet; + } + namespace sdbcx{ + class XColumnsSupplier; + } + namespace util{ + class XNumberFormatter; + } + namespace mail{ + class XSmtpService; + } + namespace embed { class XStorage; } + namespace frame { class XStorable; } +} +namespace svx { + class ODataAccessDescriptor; +} + +struct SwDBFormatData +{ + css::util::Date aNullDate; + css::uno::Reference< css::util::XNumberFormatter> xFormatter; + css::lang::Locale aLocale; +}; + +namespace weld { + class ComboBox; + class Window; +} + +class SwView; +class SwWrtShell; +class ListBox; +class SvNumberFormatter; +class SwXMailMerge; +class SwMailMergeConfigItem; +class SwCalc; +class INetURLObject; +class SwDocShell; + +enum DBManagerOptions +{ + DBMGR_MERGE, ///< Data records in fields. + DBMGR_MERGE_PRINTER, ///< Print mail merge. + DBMGR_MERGE_EMAIL, ///< Send mail merge as email. + DBMGR_MERGE_FILE, ///< Save mail merge as files. + DBMGR_MERGE_SHELL ///< Create merge doc and keep the doc shell. +}; + +// Administration of (new) logical databases. +enum class SwDBSelect +{ + UNKNOWN, TABLE, QUERY +}; + +struct SwDSParam : public SwDBData +{ + css::util::Date aNullDate; + + css::uno::Reference<css::util::XNumberFormatter> xFormatter; + css::uno::Reference< css::sdbc::XConnection> xConnection; + css::uno::Reference< css::sdbc::XStatement> xStatement; + css::uno::Reference< css::sdbc::XResultSet> xResultSet; + css::uno::Sequence< css::uno::Any > aSelection; + bool bScrollable; + bool bEndOfDB; + long nSelectionIndex; + + SwDSParam(const SwDBData& rData) : + SwDBData(rData), + bScrollable(false), + bEndOfDB(false), + nSelectionIndex(0) + {} + + SwDSParam(const SwDBData& rData, + const css::uno::Reference< css::sdbc::XResultSet>& xResSet, + const css::uno::Sequence< css::uno::Any >& rSelection) : + SwDBData(rData), + xResultSet(xResSet), + aSelection(rSelection), + bScrollable(true), + bEndOfDB(false), + nSelectionIndex(0) + {} + + bool HasValidRecord() const + { return( !bEndOfDB && xResultSet.is() ); } +}; + +typedef std::vector<std::unique_ptr<SwDSParam>> SwDSParams_t; + +struct SwMergeDescriptor +{ + const DBManagerOptions nMergeType; + SwWrtShell& rSh; + const svx::ODataAccessDescriptor& rDescriptor; + + /** + * Create a single or multiple results + * + * This currently just affects FILE, as EMAIL is always + * multiple and SHELL and PRINTER are always single. + */ + bool bCreateSingleFile; + + /** + * @defgroup save Export filter settings + * @addtogroup save + * @{ */ + OUString sSaveToFilter; + OUString sSaveToFilterOptions; + css::uno::Sequence< css::beans::PropertyValue > aSaveToFilterData; + /** @} */ + + /** + * @defgroup file Mail merge as File settings + * @addtogroup file + * @{ */ + + /** + * Basename incl. the path for the generated files. + * + * The final filename will be created by concatenating a number to prevent + * overwriting an existing file and the extension based on the filter + * settings. + */ + OUString sPrefix; + /** + * Use the sPrefix as the target filename also overwriting an existing + * target file. + * + * Just used for the internal mail merge dialogs as mail merge never + * overwrites existing files (see SwDBManager::ExecuteFormLetter). + */ + bool bPrefixIsFilename; + /** @} */ + + /** + * @defgroup email Mail merge as eMail settings + * @addtogroup email + * @{ */ + OUString sSubject; + OUString sMailBody; + OUString sAttachmentName; + css::uno::Sequence< OUString > aCopiesTo; + css::uno::Sequence< OUString > aBlindCopiesTo; + css::uno::Reference< css::mail::XSmtpService > xSmtpServer; + bool bSendAsHTML; + bool bSendAsAttachment; + /** @} */ + + /** + * @addtogroup file email + * @{ */ + + /** DB column to fetch EMail of Filename from + */ + OUString sDBcolumn; + + /** DB column to fetch password + */ + OUString sDBPasswordColumn; + + /** @} */ + + /** + * @defgroup print Mail merge to Printer + * @addtogroup print + * @{ */ + css::uno::Sequence< css::beans::PropertyValue > aPrintOptions; + /** @} */ + + SwMailMergeConfigItem* pMailMergeConfigItem; + + SwMergeDescriptor( const DBManagerOptions nType, + SwWrtShell& rShell, + const svx::ODataAccessDescriptor& rDesc ) : + nMergeType(nType), + rSh(rShell), + rDescriptor(rDesc), + bCreateSingleFile( false ), + bPrefixIsFilename( false ), + bSendAsHTML( true ), + bSendAsAttachment( false ), + pMailMergeConfigItem( nullptr ) + { + if( nType == DBMGR_MERGE_SHELL || nType == DBMGR_MERGE_PRINTER ) + bCreateSingleFile = true; + } +}; + +class SwDoc; + +class SW_DLLPUBLIC SwDBManager +{ + struct SwDBManager_Impl; + class SAL_DLLPRIVATE ConnectionDisposedListener_Impl; + class MailDispatcherListener_Impl; + + enum class MergeStatus + { + Ok = 0, Cancel, Error + }; + + MergeStatus m_aMergeStatus; ///< current / last merge status + bool m_bInitDBFields : 1; + bool m_bInMerge : 1; ///< merge process active + bool m_bMergeSilent : 1; ///< suppress display of dialogs/boxes (used when called over API) + SwDSParams_t m_DataSourceParams; + std::unique_ptr<SwDBManager_Impl> m_pImpl; + const SwXMailMerge* m_pMergeEvtSrc; ///< != 0 if mail merge events are to be send + /// Name of the embedded database that's included in the current document. + OUString m_sEmbeddedName; + + /// Store last registrations to revoke or commit + static std::vector<std::pair<SwDocShell*, OUString>> m_aUncommittedRegistrations; + + /// Not used connections. + std::vector<OUString> m_aNotUsedConnections; + + /// Set connection as used. + void SetAsUsed(const OUString& rName); + + /// The document that owns this manager. + SwDoc* m_pDoc; + + SAL_DLLPRIVATE SwDSParam* FindDSData(const SwDBData& rData, bool bCreate); + SAL_DLLPRIVATE SwDSParam* FindDSConnection(const OUString& rSource, bool bCreate); + + /// Insert data record as text into document. + SAL_DLLPRIVATE void ImportFromConnection( SwWrtShell* pSh); + + /// Insert a single data record as text into document. + SAL_DLLPRIVATE void ImportDBEntry(SwWrtShell* pSh); + + /// Run the mail merge for defined modes, except DBMGR_MERGE + SAL_DLLPRIVATE bool MergeMailFiles( SwWrtShell* pSh, + const SwMergeDescriptor& rMergeDescriptor ); + + SAL_DLLPRIVATE bool ToNextMergeRecord(); + SAL_DLLPRIVATE bool IsValidMergeRecord() const; + + SwDBManager(SwDBManager const&) = delete; + SwDBManager& operator=(SwDBManager const&) = delete; + +public: + SwDBManager(SwDoc* pDoc); + ~SwDBManager() COVERITY_NOEXCEPT_FALSE; + + /// MailMergeEvent source + const SwXMailMerge * GetMailMergeEvtSrc() const { return m_pMergeEvtSrc; } + void SetMailMergeEvtSrc( const SwXMailMerge *pSrc ) { m_pMergeEvtSrc = pSrc; } + + bool IsMergeSilent() const { return m_bMergeSilent; } + void SetMergeSilent( bool bVal ) { m_bMergeSilent = bVal; } + + /// Merging of data records into fields. + bool Merge( const SwMergeDescriptor& rMergeDesc ); + void MergeCancel(); + + bool IsMergeOk() const { return MergeStatus::Ok == m_aMergeStatus; } + bool IsMergeError() const { return MergeStatus::Error <= m_aMergeStatus; } + + static std::shared_ptr<SwMailMergeConfigItem> PerformMailMerge(SwView const * pView); + + /// Initialize data fields that lack name of database. + bool IsInitDBFields() const { return m_bInitDBFields; } + void SetInitDBFields(bool b) { m_bInitDBFields = b; } + + /// Fill listbox with all table names of a database. + bool GetTableNames(weld::ComboBox& rBox, const OUString& rDBName); + + /// Fill listbox with all column names of a database table. + void GetColumnNames(weld::ComboBox& rBox, + const OUString& rDBName, const OUString& rTableName); + static void GetColumnNames(weld::ComboBox& rBox, + css::uno::Reference< css::sdbc::XConnection> const & xConnection, + const OUString& rTableName); + + static sal_uLong GetColumnFormat( css::uno::Reference< css::sdbc::XDataSource> const & xSource, + css::uno::Reference< css::sdbc::XConnection> const & xConnection, + css::uno::Reference< css::beans::XPropertySet> const & xColumn, + SvNumberFormatter* pNFormatr, + LanguageType nLanguage ); + + sal_uLong GetColumnFormat( const OUString& rDBName, + const OUString& rTableName, + const OUString& rColNm, + SvNumberFormatter* pNFormatr, + LanguageType nLanguage ); + sal_Int32 GetColumnType( const OUString& rDBName, + const OUString& rTableName, + const OUString& rColNm ); + + bool IsInMerge() const { return m_bInMerge; } + + void ExecuteFormLetter(SwWrtShell& rSh, + const css::uno::Sequence< css::beans::PropertyValue>& rProperties); + + static void InsertText(SwWrtShell& rSh, + const css::uno::Sequence< css::beans::PropertyValue>& rProperties); + + /// check if a data source is open + bool IsDataSourceOpen(const OUString& rDataSource, + const OUString& rTableOrQuery, bool bMergeShell); + + /// open the source while fields are updated - for the calculator only! + bool OpenDataSource(const OUString& rDataSource, const OUString& rTableOrQuery); + sal_uInt32 GetSelectedRecordId(const OUString& rDataSource, const OUString& rTableOrQuery, sal_Int32 nCommandType = -1); + bool GetColumnCnt(const OUString& rSourceName, const OUString& rTableName, + const OUString& rColumnName, sal_uInt32 nAbsRecordId, LanguageType nLanguage, + OUString& rResult, double* pNumber); + /** create and store or find an already stored connection to a data source for use + in SwFieldMgr and SwDBTreeList */ + css::uno::Reference< css::sdbc::XConnection> const & + RegisterConnection(OUString const& rSource); + + void CreateDSData(const SwDBData& rData) + { FindDSData(rData, true); } + const SwDSParams_t& GetDSParamArray() const { return m_DataSourceParams; } + + /// close all data sources - after fields were updated + void CloseAll(bool bIncludingMerge = true); + + bool GetMergeColumnCnt(const OUString& rColumnName, LanguageType nLanguage, + OUString &rResult, double *pNumber); + bool FillCalcWithMergeData(SvNumberFormatter *pDocFormatter, + LanguageType nLanguage, SwCalc &aCalc); + void ToNextRecord(const OUString& rDataSource, const OUString& rTableOrQuery); + + sal_uInt32 GetSelectedRecordId(); + bool ToRecordId(sal_Int32 nSet); + + static const SwDBData& GetAddressDBName(); + + static OUString GetDBField( + css::uno::Reference< css::beans::XPropertySet > const & xColumnProp, + const SwDBFormatData& rDBFormatData, + double *pNumber = nullptr); + + static css::uno::Reference< css::sdbc::XConnection> + GetConnection(const OUString& rDataSource, + css::uno::Reference< css::sdbc::XDataSource>& rxSource, + const SwView* pView); + + static css::uno::Reference< css::sdbcx::XColumnsSupplier> + GetColumnSupplier(css::uno::Reference< css::sdbc::XConnection> const & xConnection, + const OUString& rTableOrQuery, + SwDBSelect eTableOrQuery = SwDBSelect::UNKNOWN); + + static css::uno::Sequence<OUString> GetExistingDatabaseNames(); + + /** + Loads a data source from file and registers it. + + This function requires GUI interaction, as it loads the data source from + the filename returned by a file picker and additional settings dialog. + In case of success it returns the registered name, otherwise an empty string. + */ + static OUString LoadAndRegisterDataSource(weld::Window* pParent, SwDocShell* pDocShell = nullptr); + + /** + Loads a data source from file and registers it. + + Convenience function, which calls GetDBunoURI and has just one mandatory parameter. + In case of success it returns the registered name, otherwise an empty string. + */ + static OUString LoadAndRegisterDataSource(const OUString& rURI, const OUString *pDestDir); + + /// Load the embedded data source of the document and also register it. + void LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const SwDocShell& rDocShell); + + /// Unregister a data source. + static void RevokeDataSource(const OUString& rName); + + /** try to get the data source from the given connection through the XChild interface. + If this is not possible, the data source will be created through its name. + @param _xConnection + The connection which should support the XChild interface. (not a must) + @param _sDataSourceName + The data source name will be used to create the data source when the connection can not be used for it. + @return + The data source. + */ + static css::uno::Reference< css::sdbc::XDataSource> + getDataSourceAsParent(const css::uno::Reference< css::sdbc::XConnection>& _xConnection,const OUString& _sDataSourceName); + + /** creates a RowSet, which must be disposed after use. + @param _sDataSourceName + The data source name + @param _sCommand + The command. + @param _nCommandType + The type of the command. + @param _xConnection + The active connection which may be <NULL/>. + @return + The new created RowSet. + + */ + static css::uno::Reference< css::sdbc::XResultSet> + createCursor(const OUString& _sDataSourceName, + const OUString& _sCommand, + sal_Int32 _nCommandType, + const css::uno::Reference< css::sdbc::XConnection>& _xConnection, + const SwView* pView); + + void setEmbeddedName(const OUString& rEmbeddedName, SwDocShell& rDocShell); + const OUString& getEmbeddedName() const; + + // rOwnURL should be taken using INetURLObject::GetMainURL(INetURLObject::DecodeMechanism::NONE) + static void StoreEmbeddedDataSource(const css::uno::Reference<css::frame::XStorable>& xStorable, + const css::uno::Reference<css::embed::XStorage>& xStorage, + const OUString& rStreamRelPath, + const OUString& rOwnURL, bool bCopyTo = false); + + SwDoc* getDoc() const; + /// Stop reacting to removed database registrations. + void releaseRevokeListener(); + + /// Revoke not committed registrations in case of mail merge cancel + void RevokeLastRegistrations(); + + /// Accept not committed registrations + void CommitLastRegistrations(); + + /// Remove not used connections. + void RevokeNotUsedConnections(); +}; + +namespace sw +{ +enum class DBConnURIType +{ + UNKNOWN = 0, + ODB, + CALC, + DBASE, + FLAT, + MSJET, + MSACE, + WRITER +}; + +DBConnURIType SW_DLLPUBLIC GetDBunoType(const INetURLObject &rURL); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc new file mode 100644 index 000000000..778f229ed --- /dev/null +++ b/sw/inc/dbui.hrc @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_DBUI_HRC +#define INCLUDED_SW_INC_DBUI_HRC + +#include <utility> + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +// Elements ----------------------------------------------------------------- +#define MM_PART_TITLE 0 +#define MM_PART_FIRSTNAME 1 +#define MM_PART_LASTNAME 2 +#define MM_PART_COMPANY 3 +#define MM_PART_ADDRESS_1 4 +#define MM_PART_ADDRESS_2 5 +#define MM_PART_CITY 6 +#define MM_PART_REGION 7 +#define MM_PART_ZIP 8 +#define MM_PART_COUNTRY 9 +#define MM_PART_PHONE_PRIVATE 10 +#define MM_PART_PHONE_BUSINESS 11 +#define MM_PART_E_MAIL 12 +#define MM_PART_GENDER 13 + +const std::pair<const char*, int> SA_ADDRESS_HEADER[] = +{ + { NC_("SA_ADDRESS_HEADER", "Title") , MM_PART_TITLE }, + { NC_("SA_ADDRESS_HEADER", "First Name") , MM_PART_FIRSTNAME }, + { NC_("SA_ADDRESS_HEADER", "Last Name") , MM_PART_LASTNAME }, + { NC_("SA_ADDRESS_HEADER", "Company Name") , MM_PART_COMPANY }, + { NC_("SA_ADDRESS_HEADER", "Address Line 1") , MM_PART_ADDRESS_1 }, + { NC_("SA_ADDRESS_HEADER", "Address Line 2") , MM_PART_ADDRESS_2 }, + { NC_("SA_ADDRESS_HEADER", "City") , MM_PART_CITY }, + { NC_("SA_ADDRESS_HEADER", "State") , MM_PART_REGION }, + { NC_("SA_ADDRESS_HEADER", "ZIP") , MM_PART_ZIP }, + { NC_("SA_ADDRESS_HEADER", "Country") , MM_PART_COUNTRY }, + { NC_("SA_ADDRESS_HEADER", "Telephone private") , MM_PART_PHONE_PRIVATE }, + { NC_("SA_ADDRESS_HEADER", "Telephone business") , MM_PART_PHONE_BUSINESS }, + { NC_("SA_ADDRESS_HEADER", "Email Address") , MM_PART_E_MAIL }, + { NC_("SA_ADDRESS_HEADER", "Gender"), MM_PART_GENDER } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx new file mode 100644 index 000000000..daec75ea3 --- /dev/null +++ b/sw/inc/dcontact.hxx @@ -0,0 +1,413 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DCONTACT_HXX +#define INCLUDED_SW_INC_DCONTACT_HXX + +#include <svx/svdobj.hxx> +#include <svx/svdovirt.hxx> +#include "fmtanchr.hxx" +#include "frmfmt.hxx" +#include <list> +#include <vector> +#include <memory> + +#include "calbck.hxx" +#include "anchoreddrawobject.hxx" + +class SwFlyFrame; +class SwFrame; +class SwPageFrame; +class SwVirtFlyDrawObj; +class SwFlyDrawObj; +class SwRect; +class SwDrawContact; +struct SwPosition; +class SdrTextObj; +class SwContact; + +/** The other way round: Search format for given object. + If object is a SwVirtFlyDrawObj the format will be obtained from it. + If not it is a simple DrawObject. It has a UserCall which + is client of the format we are looking for. + Implementation in dcontact.cxx. */ +SW_DLLPUBLIC SwFrameFormat *FindFrameFormat( SdrObject *pObj ); +inline const SwFrameFormat *FindFrameFormat( const SdrObject *pObj ) +{ return ::FindFrameFormat( const_cast<SdrObject*>(pObj) ); } +bool HasWrap( const SdrObject* pObj ); + +void setContextWritingMode( SdrObject* pObj, SwFrame const * pAnchor ); + +/// @return BoundRect plus distance. +SwRect GetBoundRectOfAnchoredObj( const SdrObject* pObj ); + +/// @return UserCall of goup object (if applicable). +SwContact* GetUserCall( const SdrObject* ); + +/// @return TRUE if the SrdObject is a Marquee object. +bool IsMarqueeTextObj( const SdrObject& rObj ); + +/// Base class for the following contact objects (frame + draw objects). +class SAL_DLLPUBLIC_RTTI SwContact : public SdrObjUserCall, public SwClient +{ + /** boolean, indicating destruction of contact object + important note: boolean has to be set at the beginning of each destructor + in the subclasses using method <SetInDTOR()>. */ + bool mbInDTOR; + + /** method to move object to visible/invisible layer + + Implementation for the public method <MoveObjToVisibleLayer(..)> + and <MoveObjToInvisibleLayer(..)> + If object is in invisible respectively visible layer, it's moved to + the corresponding visible respectively invisible layers. + For group object the members are individually moved to the corresponding + layer, because <SdrObjGroup::GetLayer()> does return 0, if members + aren't on the same layer as the group object, and + <SdrObjGroup::SetLayer(..)|NbcSetLayer(..)> sets also the layer of + the members. + + @param _bToVisible + input parameter - boolean indicating, if object has to be moved to + visible (== true) or invisible (== false) layer. + + @param _pDrawObj + input parameter, which will be changed - drawing object, which will + change its layer. + */ + void MoveObjToLayer( const bool _bToVisible, + SdrObject* _pDrawObj ); + +protected: + void SetInDTOR(); + virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; + +public: + + /// For reader. Only the connection is created. + SwContact( SwFrameFormat *pToRegisterIn ); + virtual ~SwContact() override; + + virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const = 0; + virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj ) = 0; + + virtual const SdrObject *GetMaster() const = 0; + virtual SdrObject *GetMaster() = 0; + + SwFrameFormat *GetFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } + const SwFrameFormat *GetFormat() const + { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); } + + bool IsInDTOR() const { return mbInDTOR;} + + /** method to move drawing object to corresponding visible layer + + uses method <MoveObjToLayer(..)> + + @param _pDrawObj + drawing object, which will be moved to the visible layer + */ + virtual void MoveObjToVisibleLayer( SdrObject* _pDrawObj ); + + /** method to move drawing object to corresponding invisible layer + + uses method <MoveObjToLayer(..)> + + @param _pDrawObj + drawing object, which will be moved to the visible layer + */ + virtual void MoveObjToInvisibleLayer( SdrObject* _pDrawObj ); + + /** some virtual helper methods for information + about the object (Writer fly frame resp. drawing object) */ + const SwFormatAnchor& GetAnchorFormat() const + { + assert( GetFormat() ); + + return GetFormat()->GetAnchor(); + } + + RndStdIds GetAnchorId() const { return GetAnchorFormat().GetAnchorId(); } + bool ObjAnchoredAtPage() const { return GetAnchorId() == RndStdIds::FLY_AT_PAGE; } + bool ObjAnchoredAtFly() const { return GetAnchorId() == RndStdIds::FLY_AT_FLY; } + bool ObjAnchoredAtPara() const { return GetAnchorId() == RndStdIds::FLY_AT_PARA; } + bool ObjAnchoredAtChar() const { return GetAnchorId() == RndStdIds::FLY_AT_CHAR; } + bool ObjAnchoredAsChar() const { return GetAnchorId() == RndStdIds::FLY_AS_CHAR; } + + const SwPosition& GetContentAnchor() const + { + assert( GetAnchorFormat().GetContentAnchor() ); + return *(GetAnchorFormat().GetContentAnchor()); + } + + /** get data collection of anchored objects, handled by with contact */ + virtual void GetAnchoredObjs( std::vector<SwAnchoredObject*>& _roAnchoredObjs ) const = 0; + + /** get minimum order number of anchored objects handled by with contact + + */ + sal_uInt32 GetMinOrdNum() const; + + /** get maximum order number of anchored objects handled by with contact + + */ + sal_uInt32 GetMaxOrdNum() const; +}; + +/** ContactObject for connection between frames (or their formats respectively) + in SwClient and the drawobjects of Drawing (DsrObjUserCall). */ + +class SW_DLLPUBLIC SwFlyDrawContact final : public SwContact +{ +private: + typedef std::unique_ptr< SwFlyDrawObj, SdrObjectFreeOp > SwFlyDrawObjPtr; + + SwFlyDrawObjPtr mpMasterObj; + void SwClientNotify(const SwModify&, const SfxHint& rHint) override; + sal_uInt32 GetOrdNumForNewRef(const SwFlyFrame* pFly); + +public: + + /// Creates DrawObject and registers it with the Model. + SwFlyDrawContact(SwFlyFrameFormat* pToRegisterIn, SdrModel& rTargetModel); + static SwVirtFlyDrawObj* CreateNewRef(SwFlyFrame* pFly, SwFlyFrameFormat* pFormat); + virtual ~SwFlyDrawContact() override; + + virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const override; + virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj ) override; + + virtual const SdrObject* GetMaster() const override + { return const_cast<SwFlyDrawContact*>(this)->GetMaster(); }; + virtual SdrObject* GetMaster() override; + + /** override methods to control Writer fly frames, + which are linked, and to assure that all objects anchored at/inside the + Writer fly frame are also made visible/invisible. */ + virtual void MoveObjToVisibleLayer( SdrObject* _pDrawObj ) override; + virtual void MoveObjToInvisibleLayer( SdrObject* _pDrawObj ) override; + + /** get data collection of anchored objects handled by with contact */ + virtual void GetAnchoredObjs( std::vector<SwAnchoredObject*>& _roAnchoredObjs ) const override; +}; + +/** new class for re-direct methods calls at a 'virtual' + drawing object to its referenced object. */ +class SwDrawVirtObj final : public SdrVirtObj +{ + private: + // data for connection to writer layout + /** anchored drawing object instance for the + 'virtual' drawing object */ + SwAnchoredDrawObject maAnchoredDrawObj; + + /** writer-drawing contact object the 'virtual' drawing object is controlled by. + This object is also the <UserCall> of the drawing object, if it's + inserted into the drawing layer. */ + SwDrawContact& mrDrawContact; + + /** AW: Need own sdr::contact::ViewContact since AnchorPos from parent is + not used but something own (top left of new SnapRect minus top left + of original SnapRect) */ + virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override; + + // protected destructor + virtual ~SwDrawVirtObj() override; + + public: + SwDrawVirtObj( + SdrModel& rSdrModel, + SdrObject& _rNewObj, + SwDrawContact& _rDrawContact); + + /// access to offset + virtual Point GetOffset() const override; + + virtual SwDrawVirtObj* CloneSdrObject(SdrModel& rTargetModel) const override; + SwDrawVirtObj& operator= (const SwDrawVirtObj& rObj); + + /// connection to writer layout + const SwAnchoredObject& GetAnchoredObj() const { return maAnchoredDrawObj; } + SwAnchoredObject& AnchoredObj() { return maAnchoredDrawObj; } + const SwFrame* GetAnchorFrame() const; + SwFrame* AnchorFrame(); + void RemoveFromWriterLayout(); + + /// connection to drawing layer + void AddToDrawingPage(); + void RemoveFromDrawingPage(); + + /** is 'virtual' drawing object connected to writer layout and + / to drawing layer. */ + bool IsConnected() const; + + virtual void NbcSetAnchorPos(const Point& rPnt) override; + + /// All overridden methods which need to use the offset + virtual void RecalcBoundRect() override; + virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override; + virtual ::basegfx::B2DPolyPolygon TakeContour() const override; + virtual void AddToHdlList(SdrHdlList& rHdlList) const override; + virtual void NbcMove(const Size& rSiz) override; + virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; + virtual void NbcRotate(const Point& rRef, long nAngle, double sn, double cs) override; + virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; + virtual void NbcShear(const Point& rRef, long nAngle, double tn, bool bVShear) override; + virtual void Move(const Size& rSiz) override; + virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) override; + virtual void Rotate(const Point& rRef, long nAngle, double sn, double cs) override; + virtual void Mirror(const Point& rRef1, const Point& rRef2) override; + virtual void Shear(const Point& rRef, long nAngle, double tn, bool bVShear) override; + virtual void RecalcSnapRect() override; + virtual const tools::Rectangle& GetSnapRect() const override; + virtual void SetSnapRect(const tools::Rectangle& rRect) override; + virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; + virtual const tools::Rectangle& GetLogicRect() const override; + virtual void SetLogicRect(const tools::Rectangle& rRect) override; + virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override; + virtual Point GetSnapPoint(sal_uInt32 i) const override; + virtual Point GetPoint(sal_uInt32 i) const override; + virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i) override; + + virtual bool HasTextEdit() const override; + + virtual SdrLayerID GetLayer() const override; + virtual void NbcSetLayer(SdrLayerID nLayer) override; + virtual void SetLayer(SdrLayerID nLayer) override; + + virtual void SetBoundRectDirty() override; + virtual const tools::Rectangle& GetCurrentBoundRect() const override; + virtual const tools::Rectangle& GetLastBoundRect() const override; +}; + +bool CheckControlLayer( const SdrObject *pObj ); + +/** ContactObject for connection of formats as representatives of draw objects + in SwClient and the objects themselves in Drawing (SDrObjUserCall). */ + +typedef std::unique_ptr< SwDrawVirtObj, SdrObjectFreeOp > SwDrawVirtObjPtr; + +class SAL_DLLPUBLIC_RTTI SwDrawContact final : public SwContact +{ + private: + /** anchored drawing object instance for the + 'master' drawing object */ + SwAnchoredDrawObject maAnchoredDrawObj; + + /** container for 'virtual' drawing object supporting drawing objects in headers/footers. */ + std::vector< SwDrawVirtObjPtr > maDrawVirtObjs; + + /** boolean indicating set 'master' drawing + object has been cleared. */ + bool mbMasterObjCleared : 1; + + /** internal flag to indicate that disconnect + from layout is in progress */ + bool mbDisconnectInProgress : 1; + + /** Needed data for handling of nested <SdrObjUserCall> events in + method <Changed_(..)> */ + bool mbUserCallActive : 1; + /** event type, which is handled for <mpSdrObjHandledByCurrentUserCall>. + Note: value only valid, if <mbUserCallActive> is true. */ + SdrUserCallType meEventTypeOfCurrentUserCall; + + friend class NestedUserCallHdl; + + + void RemoveAllVirtObjs(); + + void InvalidateObjs_( const bool _bUpdateSortedObjsList = false ); + + SwDrawContact( const SwDrawContact& ) = delete; + SwDrawContact& operator=( const SwDrawContact& ) = delete; + + virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; + + public: + + SwDrawContact( SwFrameFormat *pToRegisterIn, SdrObject *pObj ); + virtual ~SwDrawContact() override; + + virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const override; + virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj ) override; + + virtual const SdrObject* GetMaster() const override + { return const_cast<SwDrawContact*>(this)->GetMaster(); }; + virtual SdrObject* GetMaster() override; + + const SwFrame* GetAnchorFrame( const SdrObject* _pDrawObj = nullptr ) const; + SwFrame* GetAnchorFrame( SdrObject const * _pDrawObj = nullptr ); + + const SwPageFrame* GetPageFrame() const + { + return maAnchoredDrawObj.GetPageFrame(); + } + SwPageFrame* GetPageFrame() + { + return maAnchoredDrawObj.GetPageFrame(); + } + void ChkPage(); + SwPageFrame* FindPage( const SwRect &rRect ); + + /** Inserts SdrObject in the arrays of the layout ((SwPageFrame and SwFrame). + The anchor is determined according to the attribute SwFormatAnchor. + If required the object gets unregistered with the old anchor. */ + void ConnectToLayout( const SwFormatAnchor *pAnch = nullptr ); + /** method to insert 'master' drawing object + into drawing page */ + void InsertMasterIntoDrawPage(); + + void DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer = true ); + /** disconnect for a dedicated drawing object - + could be 'master' or 'virtual'. */ + void DisconnectObjFromLayout( SdrObject* _pDrawObj ); + /** method to remove 'master' drawing object + from drawing page. + To be used by the undo for delete of object. Call it after method + <DisconnectFromLayout( bool = true )> is already performed. + Note: <DisconnectFromLayout( bool )> no longer removes the 'master' + drawing object from drawing page. */ + void RemoveMasterFromDrawPage(); + + /** get drawing object ('master' or 'virtual') + by frame. */ + SdrObject* GetDrawObjectByAnchorFrame( const SwFrame& _rAnchorFrame ); + + /// Virtual methods of SdrObjUserCall. + virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect) override; + + /** Used by Changed() and by UndoDraw. + Notifies paragraphs that have to get out of the way. */ + void Changed_(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle* pOldBoundRect); + + /// Moves all SW-connections to new Master) + void ChangeMasterObject( SdrObject *pNewMaster ); + + SwDrawVirtObj* AddVirtObj(); + + void NotifyBackgrdOfAllVirtObjs( const tools::Rectangle* pOldBoundRect ); + + /** get data collection of anchored objects, handled by with contact */ + + static void GetTextObjectsFromFormat( std::list<SdrTextObj*>&, SwDoc* ); + virtual void GetAnchoredObjs( std::vector<SwAnchoredObject*>& _roAnchoredObjs ) const override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx new file mode 100644 index 000000000..03f3ab74d --- /dev/null +++ b/sw/inc/ddefld.hxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DDEFLD_HXX +#define INCLUDED_SW_INC_DDEFLD_HXX + +#include <sfx2/lnkbase.hxx> +#include <svl/hint.hxx> +#include <tools/solar.h> +#include "swdllapi.h" +#include "fldbas.hxx" + +class SwDoc; +class SwNode; +class SwNodes; + +namespace sw +{ + struct LinkAnchorSearchHint final : public SfxHint + { + SwNodes& m_rNodes; + const SwNode*& m_rpFoundNode; + LinkAnchorSearchHint(SwNodes& rNodes, const SwNode*& rpFoundNode) : m_rNodes(rNodes), m_rpFoundNode(rpFoundNode) {}; + virtual ~LinkAnchorSearchHint() override; + }; + struct InRangeSearchHint final : public SfxHint + { + const sal_uLong m_nSttNd, m_nEndNd; + bool& m_rIsInRange; + InRangeSearchHint(const sal_uLong nSttNd, const sal_uLong nEndNd, bool& rIsInRange) + : m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {} + }; +} + +// FieldType for DDE +class SW_DLLPUBLIC SwDDEFieldType final : public SwFieldType +{ + OUString aName; + OUString aExpansion; + + tools::SvRef<sfx2::SvBaseLink> refLink; + SwDoc* pDoc; + + sal_uInt16 nRefCnt; + bool bCRLFFlag : 1; + bool bDeleted : 1; + + SAL_DLLPRIVATE void RefCntChgd(); + +public: + SwDDEFieldType( const OUString& rName, const OUString& rCmd, + SfxLinkUpdateMode ); + virtual ~SwDDEFieldType() override; + + const OUString& GetExpansion() const { return aExpansion; } + void SetExpansion( const OUString& rStr ) { aExpansion = rStr; + bCRLFFlag = false; } + + virtual std::unique_ptr<SwFieldType> Copy() const override; + virtual OUString GetName() const override; + + virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + + OUString const & GetCmd() const; + void SetCmd( const OUString& aStr ); + + SfxLinkUpdateMode GetType() const { return refLink->GetUpdateMode(); } + void SetType( SfxLinkUpdateMode nType ) { refLink->SetUpdateMode( nType ); } + + bool IsDeleted() const { return bDeleted; } + void SetDeleted( bool b ) { bDeleted = b; } + + void Disconnect() { refLink->Disconnect(); } + + const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; } + ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; } + + const SwDoc* GetDoc() const { return pDoc; } + SwDoc* GetDoc() { return pDoc; } + void SetDoc( SwDoc* pDoc ); + + void IncRefCnt() { if( !nRefCnt++ && pDoc ) RefCntChgd(); } + void DecRefCnt() { if( !--nRefCnt && pDoc ) RefCntChgd(); } + + void SetCRLFDelFlag( bool bFlag ) { bCRLFFlag = bFlag; } +}; + +// DDE-field +class SwDDEField final : public SwField +{ +private: + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwDDEField(SwDDEFieldType*); + virtual ~SwDDEField() override; + + /** Get parameter via types. + Name cannot be changed. */ + virtual OUString GetPar1() const override; + + // Command + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; +}; + +#endif // INCLUDED_SW_INC_DDEFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dlelstnr.hxx b/sw/inc/dlelstnr.hxx new file mode 100644 index 000000000..f431bbda8 --- /dev/null +++ b/sw/inc/dlelstnr.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_DLELSTNR_HXX +#define INCLUDED_SW_INC_DLELSTNR_HXX + +#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star { + namespace linguistic2 { + class XLinguServiceManager2; + class XProofreadingIterator; + } + namespace frame { + class XDesktop2; + } +} + +/** EventListener that triggers spellchecking and hyphenation. + + Happens when relevant changes (to the dictionaries of the dictionary list, or + properties) were made. +*/ +class SwLinguServiceEventListener final : + public cppu::WeakImplHelper + < + css::linguistic2::XLinguServiceEventListener, + css::frame::XTerminateListener + > +{ + css::uno::Reference<css::frame::XDesktop2 > xDesktop; + css::uno::Reference<css::linguistic2::XLinguServiceManager2 > xLngSvcMgr; + css::uno::Reference<css::linguistic2::XProofreadingIterator > xGCIterator; + + SwLinguServiceEventListener(const SwLinguServiceEventListener &) = delete; + SwLinguServiceEventListener & operator = (const SwLinguServiceEventListener &) = delete; + +public: + SwLinguServiceEventListener(); + virtual ~SwLinguServiceEventListener() override; + + /// XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObj ) override; + + /// XLinguServiceEventListener + virtual void SAL_CALL processLinguServiceEvent( const css::linguistic2::LinguServiceEvent& rLngSvcEvent ) override; + + /// XTerminateListener + virtual void SAL_CALL queryTermination( const css::lang::EventObject& rEventObj ) override; + virtual void SAL_CALL notifyTermination( const css::lang::EventObject& rEventObj ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dobjfac.hxx b/sw/inc/dobjfac.hxx new file mode 100644 index 000000000..49173cca3 --- /dev/null +++ b/sw/inc/dobjfac.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOBJFAC_HXX +#define INCLUDED_SW_INC_DOBJFAC_HXX + +#include <tools/link.hxx> +#include <svx/svdobj.hxx> + +class SwObjectFactory +{ +public: + DECL_STATIC_LINK( SwObjectFactory, MakeObject, SdrObjCreatorParams, SdrObject* ); +}; + +extern SwObjectFactory aSwObjectFactory; + +#endif // INCLUDED_SW_INC_DOBJFAC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx new file mode 100644 index 000000000..ac257a843 --- /dev/null +++ b/sw/inc/doc.hxx @@ -0,0 +1,1683 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOC_HXX +#define INCLUDED_SW_INC_DOC_HXX + +// SwDoc interfaces +#include <o3tl/deleter.hxx> +#include <o3tl/sorted_vector.hxx> +#include <vcl/idle.hxx> +#include "swdllapi.h" +#include "swtypes.hxx" +#include "toxe.hxx" +#include "flyenum.hxx" +#include "flypos.hxx" +#include "swdbdata.hxx" +#include <sfx2/objsh.hxx> +#include <svl/style.hxx> +#include <editeng/numitem.hxx> +#include "tox.hxx" +#include "frmfmt.hxx" +#include "charfmt.hxx" +#include "docary.hxx" +#include "pagedesc.hxx" +#include "tblenum.hxx" +#include "ndarr.hxx" +#include "ndtyp.hxx" +#include <atomic> +#include <memory> +#include <set> +#include <unordered_map> +#include <vector> + +namespace editeng { class SvxBorderLine; } + +class SwExtTextInput; +class EditFieldInfo; +class Outliner; +class OutputDevice; +class Point; +class SbxArray; +class SdrObject; +class SdrUndoAction; +class SvNumberFormatter; +class SvxMacro; +class SwAutoCompleteWord; +class SwAutoCorrExceptWord; +class SwCellFrame; +class SwCellStyleTable; +class SwCursorShell; +class SwCursor; +class SwDocShell; +class SwDrawView; +class SwEditShell; +class SwFormat; +class SwFormatINetFormat; +class SwFormatRefMark; +class SwFootnoteIdxs; +class SwFootnoteInfo; +class SwEndNoteInfo; +class SwLineNumberInfo; +class SwDBManager; +class SwNodeIndex; +class SwNodeRange; +class SwNumRule; +class SwPagePreviewPrtData; +class SwRootFrame; +class SwRubyListEntry; +class SwSectionFormat; +class SwSectionData; +class SwSelBoxes; +class SwTableAutoFormatTable; +class SwTOXBaseSection; +class SwTabCols; +class SwTable; +class SwTableAutoFormat; +class SwTableBox; +class SwTableBoxFormat; +class SwTableFormat; +class SwTableLineFormat; +class SwTableNode; +class SwTextBlocks; +class SwURLStateChanged; +class SwUnoCursor; +class SwViewShell; +class SwDrawContact; +class SdrView; +class SdrMarkList; +class SwAuthEntry; +class SwLayoutCache; +class IStyleAccess; +struct SwCallMouseEvent; +struct SwDocStat; +struct SwSortOptions; +struct SwDefTOXBase_Impl; +class SwPrintUIOptions; +struct SwConversionArgs; +class IGrammarContact; +class SwRenderData; +class IDocumentUndoRedo; +class IDocumentSettingAccess; +class IDocumentDeviceAccess; +class IDocumentDrawModelAccess; +class IDocumentChartDataProviderAccess; +class IDocumentTimerAccess; +class IDocumentLinksAdministration; +class IDocumentListItems; +class IDocumentListsAccess; +class IDocumentOutlineNodes; +class IDocumentContentOperations; +class IDocumentRedlineAccess; +class IDocumentStatistics; +class IDocumentState; +class IDocumentLayoutAccess; +class IDocumentStylePoolAccess; +class IDocumentExternalData; +class IDocumentMarkAccess; +class SetGetExpFields; +struct SwInsertTableOptions; +enum class SvMacroItemId : sal_uInt16; +enum class SvxFrameDirection; +enum class RndStdIds; + +namespace sw::mark { class MarkManager; } +namespace sw { + enum class RedlineMode; + class MetaFieldManager; + class UndoManager; + class IShellCursorSupplier; + class DocumentSettingManager; + class DocumentDeviceManager; + class DocumentDrawModelManager; + class DocumentChartDataProviderManager; + class DocumentTimerManager; + class DocumentLinksAdministrationManager; + class DocumentListItemsManager; + class DocumentListsManager; + class DocumentOutlineNodesManager; + class DocumentContentOperationsManager; + class DocumentRedlineManager; + class DocumentFieldsManager; + class DocumentStatisticsManager; + class DocumentStateManager; + class DocumentLayoutManager; + class DocumentStylePoolManager; + class DocumentExternalDataManager; +} + +namespace com::sun::star { + namespace container { + class XNameContainer; //< for getXForms()/isXForms()/initXForms() methods + } + namespace embed { class XStorage; } + namespace linguistic2 { class XHyphenatedWord; } + namespace linguistic2 { class XProofreadingIterator; } + namespace linguistic2 { class XSpellChecker1; } + namespace script::vba { class XVBAEventProcessor; } +} + +namespace sfx2 { + class IXmlIdRegistry; +} + +void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ); + +using SwRubyList = std::vector<std::unique_ptr<SwRubyListEntry>>; + +// Represents the model of a Writer document. +class SW_DLLPUBLIC SwDoc final +{ + friend class ::sw::DocumentContentOperationsManager; + + friend void InitCore(); + friend void FinitCore(); + + // private Member + std::unique_ptr<SwNodes> m_pNodes; //< document content (Nodes Array) + SwAttrPool* mpAttrPool; //< the attribute pool + SwPageDescs m_PageDescs; //< PageDescriptors + Link<bool,void> maOle2Link; //< OLE 2.0-notification + /* @@@MAINTAINABILITY-HORROR@@@ + Timer should not be members of the model + */ + Idle maOLEModifiedIdle; //< Timer for update modified OLE-Objects + SwDBData maDBData; //< database descriptor + OUString msTOIAutoMarkURL; //< URL of table of index AutoMark file + std::vector<OUString> m_PatternNames; //< Array for names of document-templates + css::uno::Reference<css::container::XNameContainer> + mxXForms; //< container with XForms models + mutable css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator; + + const std::unique_ptr< ::sw::mark::MarkManager> mpMarkManager; + const std::unique_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager; + const std::unique_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager; + const std::unique_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager; + const std::unique_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager; + const std::unique_ptr< ::sw::UndoManager > m_pUndoManager; + const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager; + const std::unique_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager; + std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess; + const std::unique_ptr< ::sw::DocumentTimerManager > m_pDocumentTimerManager; + const std::unique_ptr< ::sw::DocumentLinksAdministrationManager > m_pDocumentLinksAdministrationManager; + const std::unique_ptr< ::sw::DocumentListItemsManager > m_pDocumentListItemsManager; + const std::unique_ptr< ::sw::DocumentListsManager > m_pDocumentListsManager; + const std::unique_ptr< ::sw::DocumentOutlineNodesManager > m_pDocumentOutlineNodesManager; + const std::unique_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager; + const std::unique_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager; + const std::unique_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager; + const std::unique_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager; + const std::unique_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager; + const std::unique_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager; + + // Pointer + std::unique_ptr<SwFrameFormat> mpDfltFrameFormat; //< Default formats. + std::unique_ptr<SwFrameFormat> mpEmptyPageFormat; //< Format for the default empty page + std::unique_ptr<SwFrameFormat> mpColumnContFormat; //< Format for column container + std::unique_ptr<SwCharFormat> mpDfltCharFormat; + std::unique_ptr<SwTextFormatColl> mpDfltTextFormatColl; //< Defaultformatcollections + std::unique_ptr<SwGrfFormatColl> mpDfltGrfFormatColl; + + std::unique_ptr<SwFrameFormats> mpFrameFormatTable; //< Format table + std::unique_ptr<SwCharFormats> mpCharFormatTable; + std::unique_ptr<SwFrameFormats> mpSpzFrameFormatTable; + std::unique_ptr<SwSectionFormats> mpSectionFormatTable; + std::unique_ptr<SwFrameFormats> mpTableFrameFormatTable; //< For tables + std::unique_ptr<SwTextFormatColls> mpTextFormatCollTable; //< FormatCollections + std::unique_ptr<SwGrfFormatColls> mpGrfFormatCollTable; + + std::unique_ptr<SwTOXTypes> mpTOXTypes; //< Tables/indices + std::unique_ptr<SwDefTOXBase_Impl> mpDefTOXBases; //< defaults of SwTOXBase's + + std::unique_ptr<SwDBManager, o3tl::default_delete<SwDBManager>> m_pOwnDBManager; //< own DBManager + SwDBManager * m_pDBManager; //< DBManager for evaluation of DB-fields. + + SwNumRule *mpOutlineRule; + std::unique_ptr<SwFootnoteInfo> mpFootnoteInfo; + std::unique_ptr<SwEndNoteInfo> mpEndNoteInfo; + std::unique_ptr<SwLineNumberInfo> mpLineNumberInfo; + std::unique_ptr<SwFootnoteIdxs> mpFootnoteIdxs; + + SwDocShell *mpDocShell; //< Ptr to SfxDocShell of Doc. + SfxObjectShellLock mxTmpDocShell; //< A temporary shell that is used to copy OLE-Nodes + + std::unique_ptr<SwAutoCorrExceptWord> mpACEWord; /**< For the automated takeover of + auto-corrected words that are "re-corrected". */ + std::unique_ptr<SwURLStateChanged> mpURLStateChgd; //< SfxClient for changes in INetHistory + std::atomic<SvNumberFormatter*> mpNumberFormatter; //< NumFormatter for tables / fields + + mutable std::unique_ptr<SwNumRuleTable> mpNumRuleTable; //< List of all named NumRules. + + // Hash map to find numrules by name + mutable std::unordered_map<OUString, SwNumRule *> maNumRuleMap; + + std::unique_ptr<SwPagePreviewPrtData> m_pPgPViewPrtData; //< Indenting / spacing for printing of page view. + SwExtTextInput *mpExtInputRing; + + std::unique_ptr<IStyleAccess> mpStyleAccess; //< handling of automatic styles + std::unique_ptr<SwLayoutCache> mpLayoutCache; /**< Layout cache to read and save with the + document for a faster formatting */ + + std::unique_ptr<IGrammarContact> mpGrammarContact; //< for grammar checking in paragraphs during editing + + css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents; + css::uno::Reference<css::container::XNameContainer> m_xTemplateToProjectCache; + + /// Table styles (autoformats that are applied with table changes). + std::unique_ptr<SwTableAutoFormatTable> m_pTableStyles; + /// Cell Styles not assigned to a Table Style + std::unique_ptr<SwCellStyleTable> mpCellStyles; +private: + std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry; + + // other + + sal_uInt32 mnRsid; //< current session ID of the document + sal_uInt32 mnRsidRoot; //< session ID when the document was created + + oslInterlockedCount mReferenceCount; + + bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR. + and unfortunately temporarily also in + SwSwgReader::InLayout() when flawed + frames need deletion. */ + bool mbCopyIsMove : 1; //< TRUE: Copy is a hidden Move. + bool mbInReading : 1; //< TRUE: Document is in the process of being read. + bool mbInWriting : 1; //< TRUE: Document is in the process of being written. + bool mbInMailMerge : 1; //< TRUE: Document is in the process of being written by mail merge. + bool mbInXMLImport : 1; //< TRUE: During xml import, attribute portion building is not necessary. + bool mbInWriterfilterImport : 1; //< TRUE: writerfilter import (DOCX,RTF) + bool mbUpdateTOX : 1; //< TRUE: After loading document, update TOX. + bool mbInLoadAsynchron : 1; //< TRUE: Document is in the process of being loaded asynchronously. + bool mbIsAutoFormatRedline : 1; //< TRUE: Redlines are recorded by Autoformat. + bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of View + notification of OLE-Objects PrtOLENotify() is required. */ + bool mbAllOLENotify : 1; //< True: Notification of all objects is required. + bool mbInsOnlyTextGlssry : 1; //< True: insert 'only text' glossary into doc + bool mbContains_MSVBasic : 1; //< True: MS-VBasic exist is in our storage + bool mbClipBoard : 1; //< TRUE: this document represents the clipboard + bool mbColumnSelection : 1; //< TRUE: this content has been created by a column selection (clipboard docs only) + bool mbIsPrepareSelAll : 1; + + enum MissingDictionary { False = -1, Undefined = 0, True = 1 }; + MissingDictionary meDictionaryMissing; + + // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position. + // Thus, certain adjustment needed during formatting for these kind of anchored objects. + bool mbContainsAtPageObjWithContentAnchor : 1; + + static SwAutoCompleteWord *s_pAutoCompleteWords; //< List of all words for AutoComplete + + // private methods + SwFlyFrameFormat* MakeFlySection_( const SwPosition& rAnchPos, + const SwContentNode& rNode, RndStdIds eRequestId, + const SfxItemSet* pFlyAttrSet, + SwFrameFormat* ); + sal_Int8 SetFlyFrameAnchor( SwFrameFormat& rFlyFormat, SfxItemSet& rSet, bool bNewFrames ); + + typedef SwFormat* (SwDoc:: *FNCopyFormat)( const OUString&, SwFormat*, bool, bool ); + SwFormat* CopyFormat( const SwFormat& rFormat, const SwFormatsBase& rFormatArr, + FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat ); + void CopyFormatArr( const SwFormatsBase& rSourceArr, SwFormatsBase const & rDestArr, + FNCopyFormat fnCopyFormat, SwFormat& rDfltFormat ); + void CopyPageDescHeaderFooterImpl( bool bCpyHeader, + const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat ); + + SwDoc( const SwDoc &) = delete; + + // Database fields: + void AddUsedDBToList( std::vector<OUString>& rDBNameList, + const std::vector<OUString>& rUsedDBNames ); + void AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName ); + static bool IsNameInArray( const std::vector<OUString>& rOldNames, const OUString& rName ); + void GetAllDBNames( std::vector<OUString>& rAllDBNames ); + static OUString ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames, + const OUString& rNewName, const OUString& rFormula ); + static std::vector<OUString>& FindUsedDBs( const std::vector<OUString>& rAllDBNames, + const OUString& rFormula, + std::vector<OUString>& rUsedDBNames ); + + void EnsureNumberFormatter(); + + bool UnProtectTableCells( SwTable& rTable ); + + /** Create sub-documents according to the given collection. + If no collection is given, take chapter style of the 1st level. */ + bool SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, + const SwTextFormatColl* pSplitColl, int nOutlineLevel = 0 ); + + // Update charts of given table. + void UpdateCharts_( const SwTable& rTable, SwViewShell const & rVSh ) const; + + static bool SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry ); + + // CharTimer calls this method. + void DoUpdateAllCharts(); + DECL_LINK( DoUpdateModifiedOLE, Timer *, void ); + +public: + SwFormat *MakeCharFormat_(const OUString &, SwFormat *, bool, bool ); + SwFormat *MakeFrameFormat_(const OUString &, SwFormat *, bool, bool ); + +private: + SwFormat *MakeTextFormatColl_(const OUString &, SwFormat *, bool, bool ); + +private: + OUString msDocAccTitle; + + void InitTOXTypes(); + +public: + enum DocumentType { + DOCTYPE_NATIVE, + DOCTYPE_MSWORD // This doc model comes from MS Word + }; + DocumentType meDocType; + DocumentType GetDocumentType() const { return meDocType; } + void SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; } + + // Life cycle + SwDoc(); + ~SwDoc(); + + bool IsInDtor() const { return mbDtor; } + + /* @@@MAINTAINABILITY-HORROR@@@ + Implementation details made public. + */ + SwNodes & GetNodes() { return *m_pNodes; } + SwNodes const& GetNodes() const { return *m_pNodes; } + +private: + friend class ::rtl::Reference<SwDoc>; + + /** Acquire a reference to an instance. A caller shall release + the instance by calling 'release' when it is no longer needed. + 'acquire' and 'release' calls need to be balanced. + + @returns + the current reference count of the instance for debugging purposes. + */ + sal_Int32 acquire(); + /** Releases a reference to an instance. A caller has to call + 'release' when a before acquired reference to an instance + is no longer needed. 'acquire' and 'release' calls need to + be balanced. + + @returns + the current reference count of the instance for debugging purposes. + */ + sal_Int32 release(); + /** Returns the current reference count. This method should be used for + debugging purposes. Using it otherwise is a signal of a design flaw. + */ +public: + sal_Int32 getReferenceCount() const; + + // IDocumentSettingAccess + IDocumentSettingAccess const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface + IDocumentSettingAccess & getIDocumentSettingAccess(); + ::sw::DocumentSettingManager & GetDocumentSettingManager(); //The implementation of the interface with some additional methods + ::sw::DocumentSettingManager const& GetDocumentSettingManager() const; + sal_uInt32 getRsid() const; + void setRsid( sal_uInt32 nVal ); + sal_uInt32 getRsidRoot() const; + void setRsidRoot( sal_uInt32 nVal ); + + // IDocumentDeviceAccess + IDocumentDeviceAccess const & getIDocumentDeviceAccess() const; + IDocumentDeviceAccess & getIDocumentDeviceAccess(); + + // IDocumentMarkAccess + IDocumentMarkAccess* getIDocumentMarkAccess(); + const IDocumentMarkAccess* getIDocumentMarkAccess() const; + + // IDocumentRedlineAccess + IDocumentRedlineAccess const& getIDocumentRedlineAccess() const; + IDocumentRedlineAccess& getIDocumentRedlineAccess(); + + ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const; + ::sw::DocumentRedlineManager& GetDocumentRedlineManager(); + + // IDocumentUndoRedo + IDocumentUndoRedo & GetIDocumentUndoRedo(); + IDocumentUndoRedo const& GetIDocumentUndoRedo() const; + + // IDocumentLinksAdministration + IDocumentLinksAdministration const & getIDocumentLinksAdministration() const; + IDocumentLinksAdministration & getIDocumentLinksAdministration(); + + ::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const; + ::sw::DocumentLinksAdministrationManager & GetDocumentLinksAdministrationManager(); + + // IDocumentFieldsAccess + IDocumentFieldsAccess const & getIDocumentFieldsAccess() const; + IDocumentFieldsAccess & getIDocumentFieldsAccess(); + + ::sw::DocumentFieldsManager & GetDocumentFieldsManager(); + + // Returns 0 if the field cannot hide para, or a positive integer indicating the field type + // "weight" when several hiding fields' FieldHidesPara() give conflicting results + int FieldCanHideParaWeight(SwFieldIds eFieldId) const; + bool FieldHidesPara(const SwField& rField) const; + + // IDocumentContentOperations + IDocumentContentOperations const & getIDocumentContentOperations() const; + IDocumentContentOperations & getIDocumentContentOperations(); + ::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const; + ::sw::DocumentContentOperationsManager & GetDocumentContentOperationsManager(); + + bool UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal = 0 ); + void UpdateRsid( const SwPaM &rRg, sal_Int32 nLen ); + + // IDocumentStylePoolAccess + IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const; + IDocumentStylePoolAccess & getIDocumentStylePoolAccess(); + + // SwLineNumberInfo + const SwLineNumberInfo& GetLineNumberInfo() const; + void SetLineNumberInfo(const SwLineNumberInfo& rInfo); + + // IDocumentStatistics + IDocumentStatistics const & getIDocumentStatistics() const; + IDocumentStatistics & getIDocumentStatistics(); + + ::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const; + ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager(); + + // IDocumentState + IDocumentState const & getIDocumentState() const; + IDocumentState & getIDocumentState(); + + // IDocumentDrawModelAccess + void AddDrawUndo( std::unique_ptr<SdrUndoAction> ); + IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const; + IDocumentDrawModelAccess & getIDocumentDrawModelAccess(); + + ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const; + ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager(); + + // IDocumentLayoutAccess + IDocumentLayoutAccess const & getIDocumentLayoutAccess() const; + IDocumentLayoutAccess & getIDocumentLayoutAccess(); + + ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const; + ::sw::DocumentLayoutManager & GetDocumentLayoutManager(); + + // IDocumentTimerAccess + // Our own 'IdleTimer' calls the following method + IDocumentTimerAccess const & getIDocumentTimerAccess() const; + IDocumentTimerAccess & getIDocumentTimerAccess(); + + // IDocumentChartDataProviderAccess + IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const; + IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess(); + + // IDocumentListItems + IDocumentListItems const & getIDocumentListItems() const; + IDocumentListItems & getIDocumentListItems(); + + // IDocumentOutlineNodes + IDocumentOutlineNodes const & getIDocumentOutlineNodes() const; + IDocumentOutlineNodes & getIDocumentOutlineNodes(); + + // IDocumentListsAccess + IDocumentListsAccess const & getIDocumentListsAccess() const; + IDocumentListsAccess & getIDocumentListsAccess(); + + //IDocumentExternalData + IDocumentExternalData const & getIDocumentExternalData() const; + IDocumentExternalData & getIDocumentExternalData(); + + //End of Interfaces + + void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; } + const OUString& getDocAccTitle() const { return msDocAccTitle; } + + // INextInterface here + DECL_LINK(CalcFieldValueHdl, EditFieldInfo*, void); + + // OLE ??? + bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; } + inline void SetOLEPrtNotifyPending( bool bSet = true ); + void PrtOLENotify( bool bAll ); // All or only marked + + bool IsPrepareSelAll() const { return mbIsPrepareSelAll; } + void SetPrepareSelAll() { mbIsPrepareSelAll = true; } + + void SetContainsAtPageObjWithContentAnchor( const bool bFlag ) + { + mbContainsAtPageObjWithContentAnchor = bFlag; + } + bool DoesContainAtPageObjWithContentAnchor() + { + return mbContainsAtPageObjWithContentAnchor; + } + + /** Returns positions of all FlyFrames in the document. + If a Pam-Pointer is passed the FlyFrames attached to paragraphs + have to be surrounded completely by css::awt::Selection. + ( Start < Pos < End ) !!! + (Required for Writers.) */ + SwPosFlyFrames GetAllFlyFormats( const SwPaM*, + bool bDrawAlso, + bool bAsCharAlso = false ) const; + + SwFlyFrameFormat *MakeFlyFrameFormat (const OUString &rFormatName, SwFrameFormat *pDerivedFrom); + SwDrawFrameFormat *MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom); + + // From now on this interface has to be used for Flys. + // pAnchorPos must be set, if they are not attached to pages AND + // Anchor is not already set at valid ContentPos + // in FlySet/FrameFormat. + /* new parameter bCalledFromShell + + true: An existing adjust item at pAnchorPos is propagated to + the content node of the new fly section. That propagation only + takes place if there is no adjust item in the paragraph style + for the new fly section. + + false: no propagation + */ + SwFlyFrameFormat* MakeFlySection( RndStdIds eAnchorType, + const SwPosition* pAnchorPos, + const SfxItemSet* pSet = nullptr, + SwFrameFormat *pParent = nullptr, + bool bCalledFromShell = false ); + SwFlyFrameFormat* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, + const SwSelBoxes* pSelBoxes, + SwFrameFormat *pParent ); + + // Helper that checks for unique items for DrawingLayer items of type NameOrIndex + // and evtl. corrects that items to ensure unique names for that type. This call may + // modify/correct entries inside of the given SfxItemSet, and it will apply a name to + // the items in question (what is essential to make the named slots associated with + // these items work for the UNO API and thus e.g. for ODF import/export) + void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet); + + bool SetFlyFrameAttr( SwFrameFormat& rFlyFormat, SfxItemSet& rSet ); + + bool SetFrameFormatToFly( SwFrameFormat& rFlyFormat, SwFrameFormat& rNewFormat, + SfxItemSet* pSet = nullptr, bool bKeepOrient = false ); + void SetFlyFrameTitle( SwFlyFrameFormat& rFlyFrameFormat, + const OUString& sNewTitle ); + void SetFlyFrameDescription( SwFlyFrameFormat& rFlyFrameFormat, + const OUString& sNewDescription ); + + // Footnotes + // Footnote information + const SwFootnoteInfo& GetFootnoteInfo() const { return *mpFootnoteInfo; } + void SetFootnoteInfo(const SwFootnoteInfo& rInfo); + const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; } + void SetEndNoteInfo(const SwEndNoteInfo& rInfo); + SwFootnoteIdxs& GetFootnoteIdxs() { return *mpFootnoteIdxs; } + const SwFootnoteIdxs& GetFootnoteIdxs() const { return *mpFootnoteIdxs; } + /// change footnotes in range + bool SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr, + bool bIsEndNote ); + + /** Operations on the content of the document e.g. + spell-checking/hyphenating/word-counting + */ + css::uno::Any + Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &, + sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck, + SwRootFrame const* pLayout, // for grammar-check + SwConversionArgs *pConvArgs = nullptr ) const; + + css::uno::Reference< css::linguistic2::XHyphenatedWord > + Hyphenate( SwPaM *pPam, const Point &rCursorPos, + sal_uInt16* pPageCnt, sal_uInt16* pPageSt ); + + // count words in pam + static void CountWords( const SwPaM& rPaM, SwDocStat& rStat ); + + // Glossary Document + bool IsInsOnlyTextGlossary() const { return mbInsOnlyTextGlssry; } + + void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress ); + + void ChangeAuthorityData(const SwAuthEntry* pNewData); + + bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const; + SvxFrameDirection GetTextDirection( const SwPosition& rPos, + const Point* pPt = nullptr ) const; + bool IsInVerticalText( const SwPosition& rPos ) const; + + // Database and DB-Manager + void SetDBManager( SwDBManager* pNewMgr ) { m_pDBManager = pNewMgr; } + SwDBManager* GetDBManager() const { return m_pDBManager; } + void ChangeDBFields( const std::vector<OUString>& rOldNames, + const OUString& rNewName ); + void SetInitDBFields(bool b); + + // Find out which databases are used by fields. + void GetAllUsedDB( std::vector<OUString>& rDBNameList, + const std::vector<OUString>* pAllDBNames = nullptr ); + + void ChgDBData( const SwDBData& rNewData ); + SwDBData const & GetDBData(); + const SwDBData& GetDBDesc(); + + // Some helper functions + OUString GetUniqueGrfName() const; + OUString GetUniqueOLEName() const; + OUString GetUniqueFrameName() const; + OUString GetUniqueShapeName() const; + OUString GetUniqueDrawObjectName() const; + + o3tl::sorted_vector<SwRootFrame*> GetAllLayouts(); + + void SetFlyName( SwFlyFrameFormat& rFormat, const OUString& rName ); + const SwFlyFrameFormat* FindFlyByName( const OUString& rName, SwNodeType nNdTyp = SwNodeType::NONE ) const; + + static void GetGrfNms( const SwFlyFrameFormat& rFormat, OUString* pGrfName, OUString* pFltName ); + + // Set a valid name for all Flys that have none (Called by Readers after reading). + void SetAllUniqueFlyNames(); + + /** Reset attributes. All TextHints and (if completely selected) all hard- + formatted stuff (auto-formats) are removed. + Introduce new optional parameter <bSendDataChangedEvents> in order to + control, if the side effect "send data changed events" is triggered or not. */ + void ResetAttrs( const SwPaM &rRg, + bool bTextAttr = true, + const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(), + const bool bSendDataChangedEvents = true, + SwRootFrame const* pLayout = nullptr); + void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false, + bool bExactRange = false, SwRootFrame const* pLayout = nullptr); + + /** Set attribute in given format.1y + * If Undo is enabled, the old values is added to the Undo history. */ + void SetAttr( const SfxPoolItem&, SwFormat& ); + /** Set attribute in given format.1y + * If Undo is enabled, the old values is added to the Undo history. */ + void SetAttr( const SfxItemSet&, SwFormat& ); + + // method to reset a certain attribute at the given format + void ResetAttrAtFormat( const sal_uInt16 nWhichId, + SwFormat& rChangedFormat ); + + /** Set attribute as new default attribute in current document. + If Undo is activated, the old one is listed in Undo-History. */ + void SetDefault( const SfxPoolItem& ); + void SetDefault( const SfxItemSet& ); + + // Query default attribute in this document. + const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const; + template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const + { + return static_cast<const T&>(GetDefault(sal_uInt16(nWhich))); + } + + // Do not expand text attributes. + bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true ); + + // Formats + const SwFrameFormats* GetFrameFormats() const { return mpFrameFormatTable.get(); } + SwFrameFormats* GetFrameFormats() { return mpFrameFormatTable.get(); } + const SwCharFormats* GetCharFormats() const { return mpCharFormatTable.get();} + SwCharFormats* GetCharFormats() { return mpCharFormatTable.get();} + + // LayoutFormats (frames, DrawObjects), sometimes const sometimes not + const SwFrameFormats* GetSpzFrameFormats() const { return mpSpzFrameFormatTable.get(); } + SwFrameFormats* GetSpzFrameFormats() { return mpSpzFrameFormatTable.get(); } + + const SwFrameFormat *GetDfltFrameFormat() const { return mpDfltFrameFormat.get(); } + SwFrameFormat *GetDfltFrameFormat() { return mpDfltFrameFormat.get(); } + const SwFrameFormat *GetEmptyPageFormat() const { return mpEmptyPageFormat.get(); } + SwFrameFormat *GetEmptyPageFormat() { return mpEmptyPageFormat.get(); } + const SwFrameFormat *GetColumnContFormat() const{ return mpColumnContFormat.get(); } + SwFrameFormat *GetColumnContFormat() { return mpColumnContFormat.get(); } + const SwCharFormat *GetDfltCharFormat() const { return mpDfltCharFormat.get();} + SwCharFormat *GetDfltCharFormat() { return mpDfltCharFormat.get();} + + // @return the interface of the management of (auto)styles + IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; } + + // Remove all language dependencies from all existing formats + void RemoveAllFormatLanguageDependencies(); + + static SwFormat* FindFormatByName(const SwFormatsBase& rFormatArr, const OUString& rName); + + SwFrameFormat *MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, + bool bBroadcast = false, bool bAuto = true); + void DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast = false ); + SwFrameFormat* FindFrameFormatByName( const OUString& rName ) const; + + SwCharFormat *MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, + bool bBroadcast = false ); + void DelCharFormat(size_t nFormat, bool bBroadcast = false); + void DelCharFormat(SwCharFormat const * pFormat, bool bBroadcast = false); + SwCharFormat* FindCharFormatByName( const OUString& rName ) const + { return static_cast<SwCharFormat*>(FindFormatByName( *mpCharFormatTable, rName )); } + + // Formatcollections (styles) + // TXT + const SwTextFormatColl* GetDfltTextFormatColl() const { return mpDfltTextFormatColl.get(); } + SwTextFormatColl* GetDfltTextFormatColl() { return mpDfltTextFormatColl.get(); } + const SwTextFormatColls *GetTextFormatColls() const { return mpTextFormatCollTable.get(); } + SwTextFormatColls *GetTextFormatColls() { return mpTextFormatCollTable.get(); } + SwTextFormatColl *MakeTextFormatColl( const OUString &rFormatName, + SwTextFormatColl *pDerivedFrom, + bool bBroadcast = false); + SwConditionTextFormatColl* MakeCondTextFormatColl( const OUString &rFormatName, + SwTextFormatColl *pDerivedFrom, + bool bBroadcast = false); + void DelTextFormatColl(size_t nFormat, bool bBroadcast = false); + void DelTextFormatColl( SwTextFormatColl const * pColl, bool bBroadcast = false ); + /** Add 4th optional parameter <bResetListAttrs>. + 'side effect' of <SetTextFormatColl> with <bReset = true> is that the hard + attributes of the affected text nodes are cleared, except the break + attribute, the page description attribute and the list style attribute. + The new parameter <bResetListAttrs> indicates, if the list attributes + (list style, restart at and restart with) are cleared as well in case + that <bReset = true> and the paragraph style has a list style attribute set. */ + bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, + const bool bReset = true, + const bool bResetListAttrs = false, + SwRootFrame const* pLayout = nullptr); + SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const + { return static_cast<SwTextFormatColl*>(FindFormatByName( *mpTextFormatCollTable, rName )); } + + void ChkCondColls(); + + const SwGrfFormatColl* GetDfltGrfFormatColl() const { return mpDfltGrfFormatColl.get(); } + SwGrfFormatColl* GetDfltGrfFormatColl() { return mpDfltGrfFormatColl.get(); } + const SwGrfFormatColls *GetGrfFormatColls() const { return mpGrfFormatCollTable.get(); } + SwGrfFormatColl *MakeGrfFormatColl(const OUString &rFormatName, + SwGrfFormatColl *pDerivedFrom); + + // Table formatting + const SwFrameFormats* GetTableFrameFormats() const { return mpTableFrameFormatTable.get(); } + SwFrameFormats* GetTableFrameFormats() { return mpTableFrameFormatTable.get(); } + size_t GetTableFrameFormatCount( bool bUsed ) const; + SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const; + SwTableFormat* MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom); + void DelTableFrameFormat( SwTableFormat* pFormat ); + SwTableFormat* FindTableFormatByName( const OUString& rName, bool bAll = false ) const; + + /** Access to frames. + Iterate over Flys - for Basic-Collections. */ + size_t GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes = false ) const; + SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes = false ); + std::vector<SwFrameFormat const*> GetFlyFrameFormats( + FlyCntType eType, + bool bIgnoreTextBoxes); + + // Copy formats in own arrays and return them. + SwFrameFormat *CopyFrameFormat ( const SwFrameFormat& ); + SwCharFormat *CopyCharFormat( const SwCharFormat& ); + SwTextFormatColl* CopyTextColl( const SwTextFormatColl& rColl ); + SwGrfFormatColl* CopyGrfColl( const SwGrfFormatColl& rColl ); + + // Replace all styles with those from rSource. + void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true ); + + // Replace all property defaults with those from rSource. + void ReplaceDefaults( const SwDoc& rSource ); + + // Replace all compatibility options with those from rSource. + void ReplaceCompatibilityOptions( const SwDoc& rSource ); + + /** Replace all user defined document properties with xSourceDocProps. + Convenience function used by ReplaceDocumentProperties to skip some UNO calls. + */ + void ReplaceUserDefinedDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xSourceDocProps ); + + /** Replace document properties with those from rSource. + + This includes the user defined document properties! + */ + void ReplaceDocumentProperties(const SwDoc& rSource, bool mailMerge = false); + + // Query if style (paragraph- / character- / frame- / page-) is used. + bool IsUsed( const SwModify& ) const; + /// Query if table style is used. + bool IsUsed( const SwTableAutoFormat& ) const; + static bool IsUsed( const SwNumRule& ); + + // Set name of newly loaded document template. + size_t SetDocPattern(const OUString& rPatternName); + + // @return name of document template. Can be 0! + const OUString* GetDocPattern(size_t nPos) const; + + // travel over PaM Ring + bool InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, + SwPaM& rPaM, SwCursorShell* pShell = nullptr); + + /** get the set of printable pages for the XRenderable API by + evaluating the respective settings (see implementation) */ + static void CalculatePagesForPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport, + sal_Int32 nDocPageCount ); + static void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions, + sal_Int32 nDocPageCount ); + static void CalculatePagePairsForProspectPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, + sal_Int32 nDocPageCount ); + static void CalculateNonBlankPages( const SwRootFrame& rLayout, sal_uInt16& nDocPageCount, sal_uInt16& nActualPage ); + + // PageDescriptor interface. + size_t GetPageDescCnt() const { return m_PageDescs.size(); } + const SwPageDesc& GetPageDesc(const size_t i) const { return *m_PageDescs[i]; } + SwPageDesc& GetPageDesc(size_t const i) { return *m_PageDescs[i]; } + SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = nullptr) const; + // Just searches the pointer in the m_PageDescs vector! + bool ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos) const; + + /** Copy the complete PageDesc - beyond document and "deep"! + Optionally copying of PoolFormatId, -HlpId can be prevented. */ + void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, + bool bCopyPoolIds = true ); + + /** Copy header (with contents) from SrcFormat to DestFormat + (can also be copied into other document). */ + void CopyHeader( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat ) + { CopyPageDescHeaderFooterImpl( true, rSrcFormat, rDestFormat ); } + + /** Copy footer (with contents) from SrcFormat to DestFormat. + (can also be copied into other document). */ + void CopyFooter( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat ) + { CopyPageDescHeaderFooterImpl( false, rSrcFormat, rDestFormat ); } + + // For Reader + void ChgPageDesc( const OUString & rName, const SwPageDesc& ); + void ChgPageDesc( size_t i, const SwPageDesc& ); + void DelPageDesc( const OUString & rName, bool bBroadcast = false); + void DelPageDesc( size_t i, bool bBroadcast = false ); + void PreDelPageDesc(SwPageDesc const * pDel); + SwPageDesc* MakePageDesc(const OUString &rName, const SwPageDesc* pCpy = nullptr, + bool bRegardLanguage = true, + bool bBroadcast = false); + void BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily, + SfxHintId nOp); + + /** The html import sometimes overwrites the page sizes set in + the page descriptions. This function is used to correct this. */ + void CheckDefaultPageFormat(); + + // Methods for tables/indices + static sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& ); + void DeleteTOXMark( const SwTOXMark* pTOXMark ); + const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark, + SwTOXSearch eDir, bool bInReadOnly ); + + // Insert/Renew table/index + SwTOXBaseSection* InsertTableOf( const SwPosition& rPos, + const SwTOXBase& rTOX, + const SfxItemSet* pSet = nullptr, + bool bExpand = false, + SwRootFrame const* pLayout = nullptr); + SwTOXBaseSection* InsertTableOf( const SwPaM& aPam, + const SwTOXBase& rTOX, + const SfxItemSet* pSet = nullptr, + bool bExpand = false, + SwRootFrame const* pLayout = nullptr ); + void InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd, + const SwTOXBase& rTOX, + const SfxItemSet* pSet ); + static SwTOXBase* GetCurTOX( const SwPosition& rPos ); + static const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX); + + bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ); + OUString GetUniqueTOXBaseName( const SwTOXType& rType, + const OUString& sChkStr ) const; + + bool SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName); + + // After reading file update all tables/indices + void SetUpdateTOX( bool bFlag ) { mbUpdateTOX = bFlag; } + bool IsUpdateTOX() const { return mbUpdateTOX; } + + const OUString& GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;} + void SetTOIAutoMarkURL(const OUString& rSet) {msTOIAutoMarkURL = rSet;} + + bool IsInReading() const { return mbInReading; } + void SetInReading( bool bNew ) { mbInReading = bNew; } + + bool IsInWriting() const { return mbInWriting; } + void SetInWriting(bool bNew) { mbInWriting = bNew; } + + bool IsInMailMerge() const { return mbInMailMerge; } + void SetInMailMerge( bool bNew ) { mbInMailMerge = bNew; } + + bool IsClipBoard() const { return mbClipBoard; } + // N.B.: must be called right after constructor! (@see GetXmlIdRegistry) + void SetClipBoard( bool bNew ) { mbClipBoard = bNew; } + + bool IsColumnSelection() const { return mbColumnSelection; } + void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; } + + bool IsInXMLImport() const { return mbInXMLImport; } + void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; } + bool IsInWriterfilterImport() const { return mbInWriterfilterImport; } + void SetInWriterfilterImport(bool const b) { mbInWriterfilterImport = b; } + + // Manage types of tables/indices + sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const; + const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const; + const SwTOXType* InsertTOXType( const SwTOXType& rTyp ); + const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; } + + const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate ); + void SetDefaultTOXBase(const SwTOXBase& rBase); + + // Key for management of index. + void GetTOIKeys(SwTOIKeyType eTyp, std::vector<OUString>& rArr, + SwRootFrame const& rLayout) const; + + // Sort table text. + bool SortTable(const SwSelBoxes& rBoxes, const SwSortOptions&); + bool SortText(const SwPaM&, const SwSortOptions&); + + // Correct the SwPosition-Objects that are registered with the document + // e. g. Bookmarks or tables/indices. + // If bMoveCursor is set move Cursor too. + + // Set everything in rOldNode on rNewPos + Offset. + void CorrAbs( + const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const sal_Int32 nOffset = 0, + bool bMoveCursor = false ); + + // Set everything in the range of [rStartNode, rEndNode] to rNewPos. + static void CorrAbs( + const SwNodeIndex& rStartNode, + const SwNodeIndex& rEndNode, + const SwPosition& rNewPos, + bool bMoveCursor = false ); + + // Set everything in this range from rRange to rNewPos. + static void CorrAbs( + const SwPaM& rRange, + const SwPosition& rNewPos, + bool bMoveCursor = false ); + + // Set everything in rOldNode to relative Pos. + void CorrRel( + const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const sal_Int32 nOffset = 0, + bool bMoveCursor = false ); + + // Query / set rules for Outline. + SwNumRule* GetOutlineNumRule() const + { + return mpOutlineRule; + } + void SetOutlineNumRule( const SwNumRule& rRule ); + void PropagateOutlineRule(); + + // Outline - promote / demote. + bool OutlineUpDown(const SwPaM& rPam, short nOffset, SwRootFrame const* pLayout = nullptr); + + /// Outline - move up / move down. + bool MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type nOffset); + + bool GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const* = nullptr) const; + + /** Accept changes of outline styles for OutlineRule. + @param bResetIndentAttrs Optional parameter - default value false: + If <bResetIndentAttrs> equals true, the indent attributes "before text" + and "first line indent" are additionally reset at the provided PaM, if + the list style makes use of the new list level attributes. + @param bCreateNewList indicates if a new list is created by applying the given list style. + @param sContinuedListId If bCreateNewList is false, may contain the + list Id of a list which has to be continued by applying the given list style + + @return the set ListId if bSetItem is true */ + OUString SetNumRule( const SwPaM&, + const SwNumRule&, + bool bCreateNewList, + SwRootFrame const* pLayout = nullptr, + const OUString& sContinuedListId = OUString(), + bool bSetItem = true, + const bool bResetIndentAttrs = false ); + void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout); + + void MakeUniqueNumRules(const SwPaM & rPaM); + + void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true ); + void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt ); + + // sw_redlinehide: may set rPos to different node (the one with the NumRule) + static SwNumRule* GetNumRuleAtPos(SwPosition& rPos, SwRootFrame const* pLayout = nullptr); + + const SwNumRuleTable& GetNumRuleTable() const { return *mpNumRuleTable; } + + /** + Add numbering rule to document. + + @param pRule rule to add + */ + void AddNumRule(SwNumRule * pRule); + + // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode> + sal_uInt16 MakeNumRule( const OUString &rName, + const SwNumRule* pCpy = nullptr, + bool bBroadcast = false, + const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode = + SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); + sal_uInt16 FindNumRule( const OUString& rName ) const; + SwNumRule* FindNumRulePtr( const OUString& rName ) const; + + // Deletion only possible if Rule is not used! + bool RenameNumRule(const OUString & aOldName, const OUString & aNewName, + bool bBroadcast = false); + bool DelNumRule( const OUString& rName, bool bBroadCast = false ); + OUString GetUniqueNumRuleName( const OUString* pChkStr = nullptr, bool bAutoNum = true ) const; + + void UpdateNumRule(); // Update all invalids. + void ChgNumRuleFormats( const SwNumRule& rRule ); + bool ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule, + const OUString& rNewRule ); + + // Goto next/previous on same level. + static bool GotoNextNum( SwPosition&, SwRootFrame const* pLayout, + bool bOverUpper = true, + sal_uInt8* pUpper = nullptr, sal_uInt8* pLower = nullptr ); + static bool GotoPrevNum( SwPosition&, SwRootFrame const* pLayout, + bool bOverUpper = true ); + + /** Searches for a text node with a numbering rule. + + add optional parameter <bInvestigateStartNode> + add output parameter <sListId> + + \param rPos position to start search + \param bForward - true: search forward + - false: search backward + \param bNum - true: search for enumeration + - false: search for itemize + \param bOutline - true: search for outline numbering rule + - false: search for non-outline numbering rule + \param nNonEmptyAllowed number of non-empty paragraphs allowed between + rPos and found paragraph + + @param sListId + output parameter - in case a list style is found, <sListId> holds the + list id, to which the text node belongs, which applies the found list style. + + @param bInvestigateStartNode + input parameter - boolean, indicating, if start node, determined by given + start position has to be investigated or not. + */ + const SwNumRule * SearchNumRule(const SwPosition & rPos, + const bool bForward, + const bool bNum, + const bool bOutline, + int nNonEmptyAllowed, + OUString& sListId, + SwRootFrame const* pLayout, + const bool bInvestigateStartNode = false ); + + // Paragraphs without numbering but with indents. + bool NoNum( const SwPaM& ); + + // Delete, splitting of numbering list. + void DelNumRules(const SwPaM&, SwRootFrame const* pLayout = nullptr); + + // Invalidates all numrules + void InvalidateNumRules(); + + bool NumUpDown(const SwPaM&, bool bDown, SwRootFrame const* pLayout = nullptr); + + /** Move selected paragraphs (not only numberings) + according to offsets. (if negative: go to doc start). */ + bool MoveParagraph(SwPaM&, long nOffset, bool bIsOutlMv = false); + bool MoveParagraphImpl(SwPaM&, long nOffset, bool bIsOutlMv, SwRootFrame const*); + + bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false); + + void StopNumRuleAnimations( OutputDevice* ); + + /** Insert new table at position @param rPos (will be inserted before Node!). + For AutoFormat at input: columns have to be set at predefined width. + The array holds the positions of the columns (not their widths). + new @param bCalledFromShell: + true: called from shell -> propagate existing adjust item at + rPos to every new cell. A existing adjust item in the table + heading or table contents paragraph style prevent that + propagation. + false: do not propagate + */ + const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder + const SwPosition& rPos, sal_uInt16 nRows, + sal_uInt16 nCols, sal_Int16 eAdjust, + const SwTableAutoFormat* pTAFormat = nullptr, + const std::vector<sal_uInt16> *pColArr = nullptr, + bool bCalledFromShell = false, + bool bNewModel = true ); + + // If index is in a table, return TableNode, else 0. + SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ); + inline const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const; + + // Create a balanced table out of the selected range. + const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder, + const SwPaM& rRange, sal_Unicode cCh, + sal_Int16 eAdjust, + const SwTableAutoFormat* ); + + // text to table conversion - API support + const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes ); + + bool TableToText( const SwTableNode* pTableNd, sal_Unicode cCh ); + + // Create columns / rows in table. + void InsertCol( const SwCursor& rCursor, + sal_uInt16 nCnt = 1, bool bBehind = true ); + bool InsertCol( const SwSelBoxes& rBoxes, + sal_uInt16 nCnt = 1, bool bBehind = true ); + void InsertRow( const SwCursor& rCursor, + sal_uInt16 nCnt = 1, bool bBehind = true ); + bool InsertRow( const SwSelBoxes& rBoxes, + sal_uInt16 nCnt = 1, bool bBehind = true ); + + // Delete Columns/Rows in table. + bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false ); + void DeleteRow( const SwCursor& rCursor ); + void DeleteCol( const SwCursor& rCursor ); + + // Split / concatenate boxes in table. + bool SplitTable( const SwSelBoxes& rBoxes, bool bVert, + sal_uInt16 nCnt, bool bSameHeight = false ); + + TableMergeErr MergeTable( SwPaM& rPam ); + OUString GetUniqueTableName() const; + bool IsInsTableFormatNum() const; + bool IsInsTableChangeNumFormat() const; + bool IsInsTableAlignNum() const; + bool IsSplitVerticalByDefault() const; + void SetSplitVerticalByDefault(bool value); + + // From FEShell (for Undo and BModified). + static void GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame ); + void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, + const SwCellFrame* pBoxFrame ); + static void GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame ); + void SetTabRows( const SwTabCols &rNew, bool bCurColOnly, + const SwCellFrame* pBoxFrame ); + + // Direct access for UNO. + void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld, + const SwTableBox *pStart, bool bCurRowOnly); + + void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet ); + + /// AutoFormat for table/table selection. + /// @param bResetDirect Reset direct formatting that might be applied to the cells. + bool SetTableAutoFormat(const SwSelBoxes& rBoxes, const SwTableAutoFormat& rNew, bool bResetDirect = false, bool isSetStyleName = false); + + // Query attributes. + bool GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGet ); + + /// Return the available table styles. + SwTableAutoFormatTable& GetTableStyles(); + const SwTableAutoFormatTable& GetTableStyles() const + { + return const_cast<SwDoc*>(this)->GetTableStyles(); + } + /// Counts table styles without triggering lazy-load of them. + bool HasTableStyles() const { return m_pTableStyles != nullptr; } + // Create a new table style. Tracked by Undo. + SwTableAutoFormat* MakeTableStyle(const OUString& rName, bool bBroadcast = false); + // Delete table style named rName. Tracked by undo. + std::unique_ptr<SwTableAutoFormat> DelTableStyle(const OUString& rName, bool bBroadcast = false); + // Change (replace) a table style named rName. Tracked by undo. + void ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFormat); + + const SwCellStyleTable& GetCellStyles() const { return *mpCellStyles; } + SwCellStyleTable& GetCellStyles() { return *mpCellStyles; } + + void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable ); + + bool SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType, + SwTwips nAbsDiff, SwTwips nRelDiff ); + SwTableBoxFormat* MakeTableBoxFormat(); + SwTableLineFormat* MakeTableLineFormat(); + + // helper function: cleanup before checking number value + bool IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, double& fOutNumber); + // Check if box has numerical value. Change format of box if required. + void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate ); + void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet ); + void ClearBoxNumAttrs( const SwNodeIndex& rNode ); + void ClearLineNumAttrs( SwPosition const & rPos ); + + bool InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes, + const SwTable* pCpyTable, bool bCpyName = false, + bool bCorrPos = false ); + + void UnProtectCells( const OUString& rTableName ); + bool UnProtectCells( const SwSelBoxes& rBoxes ); + void UnProtectTables( const SwPaM& rPam ); + bool HasTableAnyProtection( const SwPosition* pPos, + const OUString* pTableName, + bool* pFullTableProtection ); + + // Split table at baseline position, i.e. create a new table. + bool SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eMode, + bool bCalcNewSize ); + + /** And vice versa: rPos must be in the table that remains. The flag indicates + whether the current table is merged with the one before or behind it. */ + bool MergeTable( const SwPosition& rPos, bool bWithPrev, + sal_uInt16 nMode = 0 ); + + // Make charts of given table update. + void UpdateCharts( const OUString &rName ) const; + + // Update all charts, for that exists any table. + void UpdateAllCharts() { DoUpdateAllCharts(); } + + // Table is renamed and refreshes charts. + void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName ); + + // @return the reference in document that is set for name. + const SwFormatRefMark* GetRefMark( const OUString& rName ) const; + + // @return RefMark via index - for UNO. + const SwFormatRefMark* GetRefMark( sal_uInt16 nIndex ) const; + + /** @return names of all references that are set in document. + If array pointer is 0 return only whether a RefMark is set in document. */ + sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const; + + // Insert label. If a FlyFormat is created, return it. + SwFlyFrameFormat* InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator, + const OUString& rNumberingSeparator, + const bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx, + const OUString& rCharacterStyle, + const bool bCpyBrd ); + SwFlyFrameFormat* InsertDrawLabel( + const OUString &rText, const OUString& rSeparator, const OUString& rNumberSeparator, + const sal_uInt16 nId, const OUString& rCharacterStyle, SdrObject& rObj ); + + // Query attribute pool. + const SwAttrPool& GetAttrPool() const { return *mpAttrPool; } + SwAttrPool& GetAttrPool() { return *mpAttrPool; } + + // Search for an EditShell. + SwEditShell const * GetEditShell() const; + SwEditShell* GetEditShell(); + ::sw::IShellCursorSupplier * GetIShellCursorSupplier(); + + // OLE 2.0-notification. + void SetOle2Link(const Link<bool,void>& rLink) {maOle2Link = rLink;} + const Link<bool,void>& GetOle2Link() const {return maOle2Link;} + + // insert section (the ODF kind of section, not the nodesarray kind) + SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &, + std::pair<SwTOXBase const*, sw::RedlineMode> const* pTOXBase, + SfxItemSet const*const pAttr, bool const bUpdate = true); + static sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange, + const SwNode** ppSttNd = nullptr ); + static SwSection* GetCurrSection( const SwPosition& rPos ); + SwSectionFormats& GetSections() { return *mpSectionFormatTable; } + const SwSectionFormats& GetSections() const { return *mpSectionFormatTable; } + SwSectionFormat *MakeSectionFormat(); + void DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes = false ); + void UpdateSection(size_t const nSect, SwSectionData &, + SfxItemSet const*const = nullptr, bool const bPreventLinkUpdate = false); + OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const; + + /* @@@MAINTAINABILITY-HORROR@@@ + The model should not have anything to do with a shell. + Unnecessary compile/link time dependency. + */ + + // Pointer to SfxDocShell from Doc. Can be 0!! + SwDocShell* GetDocShell() { return mpDocShell; } + const SwDocShell* GetDocShell() const { return mpDocShell; } + void SetDocShell( SwDocShell* pDSh ); + + /** in case during copying of embedded object a new shell is created, + it should be set here and cleaned later */ + void SetTmpDocShell( SfxObjectShellLock rLock ) { mxTmpDocShell = rLock; } + const SfxObjectShellLock& GetTmpDocShell() const { return mxTmpDocShell; } + + // For Autotexts? (text modules) They have only one SVPersist at their disposal. + SfxObjectShell* GetPersist() const; + + // Pointer to storage of SfxDocShells. Can be 0!!! + css::uno::Reference< css::embed::XStorage > GetDocStorage(); + + // Query / set flag indicating if document is loaded asynchronously at this moment. + bool IsInLoadAsynchron() const { return mbInLoadAsynchron; } + void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; } + + // For Drag&Move: (e.g. allow "moving" of RefMarks) + bool IsCopyIsMove() const { return mbCopyIsMove; } + void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; } + + SwDrawContact* GroupSelection( SdrView& ); + void UnGroupSelection( SdrView& ); + bool DeleteSelection( SwDrawView& ); + + // Invalidates OnlineSpell-WrongLists. + void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags ); + void InvalidateAutoCompleteFlag(); + + void SetCalcFieldValueHdl(Outliner* pOutliner); + + // Query if URL was visited. + // Query via Doc, if only a Bookmark has been given. + // In this case the document name has to be set in front. + bool IsVisitedURL( const OUString& rURL ); + + // Save current values for automatic registration of exceptions in Autocorrection. + void SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew ); + SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return mpACEWord.get(); } + void DeleteAutoCorrExceptWord(); + + const SwFormatINetFormat* FindINetAttr( const OUString& rName ) const; + + // Call into intransparent Basic; expect possible Return String. + void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); + + // Call into intransparent Basic / JavaScript. + sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent, + bool bChkPtr = false ); + + /** Adjust left margin via object bar (similar to adjustment of numerations). + One can either change the margin "by" adding or subtracting a given + offset or set it "to" this position (bModulus = true). */ + void MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus, + SwRootFrame const* pLayout = nullptr); + + // Query NumberFormatter. + SvNumberFormatter* GetNumberFormatter(bool bCreate = true) + { + if (bCreate) + EnsureNumberFormatter(); + return mpNumberFormatter; + } + + const SvNumberFormatter* GetNumberFormatter(bool bCreate = true) const + { + return const_cast<SwDoc*>(this)->GetNumberFormatter(bCreate); + } + + bool HasInvisibleContent() const; + // delete invisible content, like hidden sections and paragraphs + bool RemoveInvisibleContent(); + // restore the invisible content if it's available on the undo stack + bool RestoreInvisibleContent(); + + bool ConvertFieldsToText(SwRootFrame const& rLayout); + + // Create sub-documents according to given collection. + // If no collection is given, use chapter styles for 1st level. + bool GenerateGlobalDoc( const OUString& rPath, + const SwTextFormatColl* pSplitColl ); + bool GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel ); + bool GenerateHTMLDoc( const OUString& rPath, + const SwTextFormatColl* pSplitColl ); + bool GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel ); + + // Compare two documents. + long CompareDoc( const SwDoc& rDoc ); + + // Merge two documents. + long MergeDoc( const SwDoc& rDoc ); + + bool IsAutoFormatRedline() const { return mbIsAutoFormatRedline; } + void SetAutoFormatRedline( bool bFlag ) { mbIsAutoFormatRedline = bFlag; } + + // For AutoFormat: with Undo/Redlining. + void SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId, + const SfxItemSet* pSet ); + void SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& ); + + // Only for SW-textbloxks! Does not pay any attention to layout! + void ClearDoc(); // Deletes all content! + + // Query /set data for PagePreview. + const SwPagePreviewPrtData* GetPreviewPrtData() const { return m_pPgPViewPrtData.get(); } + + // If pointer == 0 destroy pointer in document. + // Else copy object. + // Pointer is not transferred to ownership by document! + void SetPreviewPrtData( const SwPagePreviewPrtData* pData ); + + /** update all modified OLE-Objects. The modification is called over the + StarOne - Interface */ + void SetOLEObjModified(); + + // Uno - Interfaces + std::shared_ptr<SwUnoCursor> CreateUnoCursor( const SwPosition& rPos, bool bTableCursor = false ); + + // FeShell - Interfaces + // !!! These assume always an existing layout !!! + bool ChgAnchor( const SdrMarkList& _rMrkList, + RndStdIds _eAnchorType, + const bool _bSameOnly, + const bool _bPosCorr ); + + void SetRowHeight( const SwCursor& rCursor, const SwFormatFrameSize &rNew ); + static std::unique_ptr<SwFormatFrameSize> GetRowHeight( const SwCursor& rCursor ); + void SetRowSplit( const SwCursor& rCursor, const SwFormatRowSplit &rNew ); + static std::unique_ptr<SwFormatRowSplit> GetRowSplit( const SwCursor& rCursor ); + + /// Adjustment of Rowheights. Determine via bTstOnly if more than one row is selected. + /// bOptimize: distribute current table height, instead of using the largest row. + /// Call again without bOptimize to ensure equal height in case some row's content didn't fit. + bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize ); + void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew ); + static bool GetRowBackground( const SwCursor& rCursor, std::unique_ptr<SvxBrushItem>& rToFill ); + void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ); + void SetTabLineStyle( const SwCursor& rCursor, + const Color* pColor, bool bSetLine, + const editeng::SvxBorderLine* pBorderLine ); + static void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ); + void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ); + /** + Retrieves a box attribute from the given cursor. + + @return Whether the property is set over the current box selection. + + @remarks A property is 'set' if it's set to the same value over all boxes in the current selection. + The property value is retrieved from the first box in the current selection. It is then compared to + the values of the same property over any other boxes in the selection; if any value is different from + that of the first box, the property is unset (and false is returned). + */ + static bool GetBoxAttr( const SwCursor& rCursor, std::unique_ptr<SfxPoolItem>& rToFill ); + void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign ); + static sal_uInt16 GetBoxAlign( const SwCursor& rCursor ); + /// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible). + /// bBalance evenly re-distributes the available space regardless of content or wrapping. + /// bNoShrink keeps table size the same by distributing excess space proportionately. + void AdjustCellWidth( const SwCursor& rCursor, const bool bBalance, const bool bNoShrink ); + + SwChainRet Chainable( const SwFrameFormat &rSource, const SwFrameFormat &rDest ); + SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest ); + void Unchain( SwFrameFormat &rFormat ); + + // For Copy/Move from FrameShell. + SdrObject* CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false, + bool bInsInPage = true ); + + // FeShell - Interface end + + // Interface for TextInputData - for text input of Chinese and Japanese. + SwExtTextInput* CreateExtTextInput( const SwPaM& rPam ); + void DeleteExtTextInput( SwExtTextInput* pDel ); + SwExtTextInput* GetExtTextInput( const SwNode& rNd, + sal_Int32 nContentPos = -1) const; + SwExtTextInput* GetExtTextInput() const; + + // Interface for access to AutoComplete-List. + static SwAutoCompleteWord& GetAutoCompleteWords() { return *s_pAutoCompleteWords; } + + bool ContainsMSVBasic() const { return mbContains_MSVBasic; } + void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; } + + // Interface for the list of Ruby - texts/attributes + static sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList ); + void SetRubyList( const SwPaM& rPam, const SwRubyList& rList ); + + void ReadLayoutCache( SvStream& rStream ); + void WriteLayoutCache( SvStream& rStream ); + SwLayoutCache* GetLayoutCache() const { return mpLayoutCache.get(); } + + /** Checks if any of the text node contains hidden characters. + Used for optimization. Changing the view option 'view hidden text' + has to trigger a reformatting only if some of the text is hidden. + */ + bool ContainsHiddenChars() const; + + IGrammarContact* getGrammarContact() const { return mpGrammarContact.get(); } + + /** Marks/Unmarks a list level of a certain list + + levels of a certain lists are marked now + + @param sListId list Id of the list whose level has to be marked/unmarked + @param nListLevel level to mark + @param bValue - true mark the level + - false unmark the level + */ + void MarkListLevel( const OUString& sListId, + const int nListLevel, + const bool bValue ); + + // Change a format undoable. + void ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet); + + void RenameFormat(SwFormat & rFormat, const OUString & sNewName, + bool bBroadcast = false); + + // Change a TOX undoable. + void ChangeTOX(SwTOXBase & rTOX, const SwTOXBase & rNew); + + /** + Returns a textual description of a PaM. + + @param rPaM the PaM to describe + + If rPaM only spans one paragraph the result is: + + '<text in the PaM>' + + <text in the PaM> is shortened to nUndoStringLength characters. + + If rPaM spans more than one paragraph the result is: + + paragraphs (STR_PARAGRAPHS) + + @return the textual description of rPaM + */ + static OUString GetPaMDescr(const SwPaM & rPaM); + + static bool IsFirstOfNumRuleAtPos(const SwPosition & rPos, SwRootFrame const& rLayout); + + // access methods for XForms model(s) + + // access container for XForms model; will be NULL if !isXForms() + const css::uno::Reference<css::container::XNameContainer>& + getXForms() const { return mxXForms;} + + css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const; + + // #i31958# is this an XForms document? + bool isXForms() const; + + // #i31958# initialize XForms models; turn this into an XForms document + void initXForms( bool bCreateDefaultModel ); + + // #i113606# for disposing XForms + void disposeXForms( ); + + //Update all the page masters + void SetDefaultPageMode(bool bSquaredPageMode); + bool IsSquaredPageMode() const; + + css::uno::Reference< css::script::vba::XVBAEventProcessor > const & GetVbaEventProcessor(); + void SetVBATemplateToProjectCache( css::uno::Reference< css::container::XNameContainer > const & xCache ) { m_xTemplateToProjectCache = xCache; }; + const css::uno::Reference< css::container::XNameContainer >& GetVBATemplateToProjectCache() const { return m_xTemplateToProjectCache; }; + ::sfx2::IXmlIdRegistry& GetXmlIdRegistry(); + ::sw::MetaFieldManager & GetMetaFieldManager(); + ::sw::UndoManager & GetUndoManager(); + ::sw::UndoManager const& GetUndoManager() const; + + SfxObjectShell* CreateCopy(bool bCallInitNew, bool bEmpty) const; + SwNodeIndex AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber, + bool bDeletePrevious, int physicalPageOffset, + const sal_uLong nDocNo); + + /** + * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default) + */ + void dumpAsXml(xmlTextWriterPtr = nullptr) const; + + std::set<Color> GetDocColors(); + std::vector< std::weak_ptr<SwUnoCursor> > mvUnoCursorTable; + + // Remove expired UnoCursor weak pointers the document keeps to notify about document death. + void cleanupUnoCursorTable() const + { + auto & rTable = const_cast<SwDoc*>(this)->mvUnoCursorTable; + // In most cases we'll remove most of the elements. + rTable.erase( std::remove_if(rTable.begin(), + rTable.end(), + [] (std::weak_ptr<SwUnoCursor> const & x) { return x.expired(); }), + rTable.end()); + } + + /** + * @param bSkipStart don't actually start the jobs, just check + * @returns true if new background checking jobs were started + */ + bool StartGrammarChecking( bool bSkipStart = false ); + + /// Use to notify if the dictionary can be found for a single content portion (has to be called for all portions) + void SetMissingDictionaries( bool bIsMissing ); + /// Returns true if no dictionary can be found for any content + bool IsDictionaryMissing() const { return meDictionaryMissing == MissingDictionary::True; } + +private: + // Copies master header to left / first one, if necessary - used by ChgPageDesc(). + void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst); + // Copies master footer to left / first one, if necessary - used by ChgPageDesc(). + void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst); + +}; + +// This method is called in Dtor of SwDoc and deletes cache of ContourObjects. +void ClrContourCache(); + +inline const SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) const +{ + return const_cast<SwDoc*>(this)->IsIdxInTable( rIdx ); +} + +inline void SwDoc::SetOLEPrtNotifyPending( bool bSet ) +{ + mbOLEPrtNotifyPending = bSet; + if( !bSet ) + mbAllOLENotify = false; +} + +bool sw_GetPostIts( IDocumentFieldsAccess const * pIDFA, SetGetExpFields * pSrtLst ); + +#endif //_DOC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx new file mode 100644 index 000000000..d07819c40 --- /dev/null +++ b/sw/inc/docary.hxx @@ -0,0 +1,304 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOCARY_HXX +#define INCLUDED_SW_INC_DOCARY_HXX + +#include <vector> +#include <type_traits> +#include <o3tl/sorted_vector.hxx> + +#include "fmtcol.hxx" +#include "frmfmt.hxx" +#include "section.hxx" +#include "tox.hxx" +#include "numrule.hxx" +#include "fldbas.hxx" + +class SwRangeRedline; +class SwExtraRedline; +class SwOLENode; +class SwTable; +class SwTableLine; +class SwTableBox; +struct SwPosition; +enum class RedlineType : sal_uInt16; + +/** provides some methods for generic operations on lists that contain SwFormat* subclasses. */ +class SwFormatsBase +{ +public: + virtual size_t GetFormatCount() const = 0; + virtual SwFormat* GetFormat(size_t idx) const = 0; + virtual ~SwFormatsBase() {}; + + SwFormatsBase() = default; + SwFormatsBase(SwFormatsBase const &) = default; + SwFormatsBase(SwFormatsBase &&) = default; + SwFormatsBase & operator =(SwFormatsBase const &) = default; + SwFormatsBase & operator =(SwFormatsBase &&) = default; +}; + +template<typename Value> +class SwVectorModifyBase +{ +public: + typedef typename std::vector<Value>::iterator iterator; + typedef typename std::vector<Value>::const_iterator const_iterator; + typedef typename std::vector<Value>::size_type size_type; + typedef typename std::vector<Value>::value_type value_type; + +protected: + enum class DestructorPolicy { + KeepElements, + FreeElements, + }; + +private: + typename std::vector<Value> mvVals; + const DestructorPolicy mPolicy; + +protected: + // default destructor deletes all contained elements + SwVectorModifyBase(DestructorPolicy policy = DestructorPolicy::FreeElements) + : mPolicy(policy) {} + +public: + bool empty() const { return mvVals.empty(); } + Value const& front() const { return mvVals.front(); } + size_t size() const { return mvVals.size(); } + iterator begin() { return mvVals.begin(); } + const_iterator begin() const { return mvVals.begin(); } + iterator end() { return mvVals.end(); } + const_iterator end() const { return mvVals.end(); } + void clear() { mvVals.clear(); } + iterator erase(iterator aIt) { return mvVals.erase(aIt); } + iterator erase(iterator aFirst, iterator aLast) { return mvVals.erase(aFirst, aLast); } + iterator insert(iterator aIt, Value const& rVal) { return mvVals.insert(aIt, rVal); } + template<typename TInputIterator> + void insert(iterator aIt, TInputIterator aFirst, TInputIterator aLast) + { + mvVals.insert(aIt, aFirst, aLast); + } + void push_back(Value const& rVal) { mvVals.push_back(rVal); } + void reserve(size_type nSize) { mvVals.reserve(nSize); } + Value const& at(size_type nPos) const { return mvVals.at(nPos); } + Value const& operator[](size_type nPos) const { return mvVals[nPos]; } + Value& operator[](size_type nPos) { return mvVals[nPos]; } + + // free any remaining child objects based on mPolicy + virtual ~SwVectorModifyBase() + { + if (mPolicy == DestructorPolicy::FreeElements) + for(const_iterator it = begin(); it != end(); ++it) + delete *it; + } + + //TODO: These functions are apparently brittle (but the copy functions are actually used by the + // code; the move functions will be implicitly-defined as deleted anyway) and should probably + // only be used with DestructorPolicy::KeepELements: + SwVectorModifyBase(SwVectorModifyBase const &) = default; + SwVectorModifyBase(SwVectorModifyBase &&) = default; + SwVectorModifyBase & operator =(SwVectorModifyBase const &) = default; + SwVectorModifyBase & operator =(SwVectorModifyBase &&) = default; + + void DeleteAndDestroy(int aStartIdx, int aEndIdx) + { + if (aEndIdx < aStartIdx) + return; + for (const_iterator it = begin() + aStartIdx; + it != begin() + aEndIdx; ++it) + delete *it; + erase( begin() + aStartIdx, begin() + aEndIdx); + } + + size_t GetPos(Value const& p) const + { + const_iterator const it = std::find(begin(), end(), p); + return it == end() ? SIZE_MAX : it - begin(); + } + + /// check that given format is still alive (i.e. contained here) + bool IsAlive(typename std::remove_pointer<Value>::type const*const p) const + { return std::find(begin(), end(), p) != end(); } + + static void dumpAsXml(xmlTextWriterPtr /*pWriter*/) {}; +}; + +template<typename Value> +class SwFormatsModifyBase : public SwVectorModifyBase<Value>, public SwFormatsBase +{ +protected: + SwFormatsModifyBase(typename SwVectorModifyBase<Value>::DestructorPolicy + policy = SwVectorModifyBase<Value>::DestructorPolicy::FreeElements) + : SwVectorModifyBase<Value>(policy) {} + +public: + virtual size_t GetFormatCount() const override + { return SwVectorModifyBase<Value>::size(); } + + virtual Value GetFormat(size_t idx) const override + { return SwVectorModifyBase<Value>::operator[](idx); } + + size_t GetPos(const SwFormat *p) const + { return SwVectorModifyBase<Value>::GetPos( static_cast<Value>( const_cast<SwFormat*>( p ) ) ); } + + /// check if given format is contained here + /// @precond pFormat must not have been deleted + bool ContainsFormat(SwFormat const*const pFormat) const { + Value p = dynamic_cast<Value>(const_cast<SwFormat*>(pFormat)); + return p != nullptr && SwVectorModifyBase<Value>::IsAlive(p); + } +}; + +class SwGrfFormatColls final : public SwFormatsModifyBase<SwGrfFormatColl*> +{ +public: + SwGrfFormatColls() : SwFormatsModifyBase( DestructorPolicy::KeepElements ) {} +}; + + +/// Unsorted, undeleting SwFrameFormat vector +class SwFrameFormatsV final : public SwFormatsModifyBase<SwFrameFormat*> +{ +public: + SwFrameFormatsV() : SwFormatsModifyBase( DestructorPolicy::KeepElements ) {} +}; + +class SwCharFormats final : public SwFormatsModifyBase<SwCharFormat*> +{ +public: + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +class SwTextFormatColls final : public SwFormatsModifyBase<SwTextFormatColl*> +{ +public: + SwTextFormatColls() : SwFormatsModifyBase( DestructorPolicy::KeepElements ) {} + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +/// Array of Undo-history. +class SwSectionFormats final : public SwFormatsModifyBase<SwSectionFormat*> +{ +public: + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +class SwFieldTypes : public std::vector<std::unique_ptr<SwFieldType>> { +public: + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +class SwTOXTypes : public std::vector<std::unique_ptr<SwTOXType>> {}; + +class SwNumRuleTable final : public SwVectorModifyBase<SwNumRule*> { +public: + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +struct CompareSwRedlineTable +{ + bool operator()(SwRangeRedline* const &lhs, SwRangeRedline* const &rhs) const; +}; + +// Notification type for notifying about redlines to LOK clients +enum class RedlineNotification { Add, Remove, Modify }; + +class SwRedlineTable +{ +public: + typedef o3tl::sorted_vector<SwRangeRedline*, CompareSwRedlineTable, + o3tl::find_partialorder_ptrequals> vector_type; + typedef vector_type::size_type size_type; + static constexpr size_type npos = SAL_MAX_INT32; +private: + vector_type maVector; +public: + ~SwRedlineTable(); + bool Contains(const SwRangeRedline* p) const { return maVector.find(const_cast<SwRangeRedline*>(p)) != maVector.end(); } + size_type GetPos(const SwRangeRedline* p) const; + + bool Insert(SwRangeRedline*& p); + bool Insert(SwRangeRedline*& p, size_type& rInsPos); + bool InsertWithValidRanges(SwRangeRedline*& p, size_type* pInsPos = nullptr); + + void Remove( size_type nPos ); + void Remove( const SwRangeRedline* p ); + void DeleteAndDestroy(size_type nPos); + void DeleteAndDestroyAll(); + + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + size_type FindNextOfSeqNo( size_type nSttPos ) const; + size_type FindPrevOfSeqNo( size_type nSttPos ) const; + /** Search next or previous Redline with the same Seq. No. + Search can be restricted via Lookahead. + Using 0 makes search the whole array. */ + size_type FindNextSeqNo( sal_uInt16 nSeqNo, size_type nSttPos ) const; + size_type FindPrevSeqNo( sal_uInt16 nSeqNo, size_type nSttPos ) const; + + /** + Find the redline at the given position. + + @param tableIndex position in SwRedlineTable to start searching at, will be updated with the index of the returned + redline (or the next redline after the given position if not found) + @param next true: redline starts at position and ends after, false: redline starts before position and ends at or after + */ + const SwRangeRedline* FindAtPosition( const SwPosition& startPosition, size_type& tableIndex, bool next = true ) const; + + bool empty() const { return maVector.empty(); } + size_type size() const { return maVector.size(); } + SwRangeRedline* operator[]( size_type idx ) const { return maVector[idx]; } + vector_type::const_iterator begin() const { return maVector.begin(); } + vector_type::const_iterator end() const { return maVector.end(); } + void Resort() { maVector.Resort(); } + + // Notifies all LOK clients when redlines are added/modified/removed + static void LOKRedlineNotification(RedlineNotification eType, SwRangeRedline* pRedline); +}; + +/// Table that holds 'extra' redlines, such as 'table row insert/delete', 'paragraph moves' etc... +class SwExtraRedlineTable +{ +private: + std::vector<SwExtraRedline*> m_aExtraRedlines; + +public: + ~SwExtraRedlineTable(); + + void Insert( SwExtraRedline* p ); + + void DeleteAndDestroy( sal_uInt16 nPos); + void DeleteAndDestroyAll(); + + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + sal_uInt16 GetSize() const { return m_aExtraRedlines.size(); } + SwExtraRedline* GetRedline( sal_uInt16 uIndex ) const { return m_aExtraRedlines.operator[]( uIndex ); } + + SW_DLLPUBLIC bool DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTable, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); + bool DeleteTableRowRedline ( SwDoc* pDoc, const SwTableLine& rTableLine, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); + bool DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& rTableBox, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); +}; + +typedef std::vector<SwOLENode*> SwOLENodes; + +#endif // INCLUDED_SW_INC_DOCARY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/docfac.hxx b/sw/inc/docfac.hxx new file mode 100644 index 000000000..01bf092f2 --- /dev/null +++ b/sw/inc/docfac.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOCFAC_HXX +#define INCLUDED_SW_INC_DOCFAC_HXX + +#include <rtl/ref.hxx> +#include "swdllapi.h" +#include "doc.hxx" + +class SW_DLLPUBLIC SwDocFac +{ +protected: + rtl::Reference<SwDoc> mxDoc; + +public: + SwDocFac( SwDoc *pDoc = nullptr ); + ~SwDocFac() COVERITY_NOEXCEPT_FALSE; + + /// Document is created after calling Read(...). + SwDoc* GetDoc(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/docfunc.hxx b/sw/inc/docfunc.hxx new file mode 100644 index 000000000..cd645ea57 --- /dev/null +++ b/sw/inc/docfunc.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOCFUNC_HXX +#define INCLUDED_SW_INC_DOCFUNC_HXX + +class SwDoc; + +// namespace <docfunc> for functions and procedures working on a Writer document. +namespace docfunc +{ + /** method to check, if given Writer document contains at least one drawing object + + @param p_rDoc + input parameter - reference to the Writer document, which is investigated. + */ + bool ExistsDrawObjs( SwDoc& p_rDoc ); + + /** method to check, if given Writer document contains only drawing objects, + which are completely on its page. + + @param p_rDoc + input parameter - reference to the Writer document, which is investigated. + */ + bool AllDrawObjsOnPage( SwDoc& p_rDoc ); + + /** method to check, if the outline style has to written as a normal list style + + #i69627# + The outline style has to written as a normal list style, if a parent + paragraph style of one of the paragraph styles, which are assigned to + the list levels of the outline style, has a list style set or inherits + a list style from its parent paragraphs style. + This information is needed for the OpenDocument file format export. + + @param rDoc + input parameter - reference to the text document, which is investigated. + + @return boolean + indicating, if the outline style has to written as a normal list style + */ + bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc& rDoc ); +} + +#endif //_DOCFUNC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx new file mode 100644 index 000000000..225305aec --- /dev/null +++ b/sw/inc/docsh.hxx @@ -0,0 +1,351 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOCSH_HXX +#define INCLUDED_SW_INC_DOCSH_HXX + +#include <memory> +#include <vector> +#include <rtl/ref.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <sfx2/docfac.hxx> +#include <sfx2/objsh.hxx> +#include "swdllapi.h" +#include "shellid.hxx" + +#include <svl/lstner.hxx> +#include <sfx2/StyleManager.hxx> +#include <o3tl/deleter.hxx> + +class SwDoc; +class SfxDocumentInfoDialog; +class SfxInPlaceClient; +class FontList; +class SwEditShell; +class SwView; +class SwWrtShell; +class SwFEShell; +class Reader; +class SwReader; +typedef std::unique_ptr<SwReader, o3tl::default_delete<SwReader>> SwReaderPtr; +class SwCursorShell; +class SwSrcView; +class SwPaM; +class SwgReaderOption; +class IDocumentDeviceAccess; +class IDocumentChartDataProviderAccess; +class SwDocShell; +class SwDrawModel; +class SwViewShell; +namespace svt +{ +class EmbeddedObjectRef; +} +namespace com::sun::star::frame { class XController; } +namespace ooo::vba { class XSinkCaller; } +namespace ooo::vba::word { class XDocument; } + +// initialize DrawModel (in form of a SwDrawModel) and DocShell (in form of a SwDocShell) +// as needed, one or both parameters may be zero +void InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawModel); + +class SW_DLLPUBLIC SwDocShell + : public SfxObjectShell + , public SfxListener +{ + rtl::Reference< SwDoc > m_xDoc; ///< Document. + rtl::Reference< SfxStyleSheetBasePool > m_xBasePool; ///< Passing through for formats. + std::unique_ptr<FontList> m_pFontList; ///< Current Fontlist. + bool m_IsInUpdateFontList; ///< prevent nested calls of UpdateFontList + + std::unique_ptr<sfx2::StyleManager> m_pStyleManager; + + /** For "historical reasons" nothing can be done without the WrtShell. + Back-pointer on View (again "for historical reasons"). + Back-pointer is valid until in Activate a new one is set + or until it is deleted in the View's Dtor. */ + + SwView* m_pView; + SwWrtShell* m_pWrtShell; + + std::unique_ptr<comphelper::EmbeddedObjectContainer> m_pOLEChildList; + sal_Int16 m_nUpdateDocMode; ///< contains the css::document::UpdateDocMode + bool m_IsATemplate; ///< prevent nested calls of UpdateFontList + + bool m_IsRemovedInvisibleContent; + ///< whether SID_MAIL_PREPAREEXPORT removed content that + ///< SID_MAIL_EXPORT_FINISHED needs to restore + + css::uno::Reference< ooo::vba::XSinkCaller > mxAutomationDocumentEventsCaller; + css::uno::Reference< ooo::vba::word::XDocument> mxAutomationDocumentObject; + + /// Methods for access to doc. + SAL_DLLPRIVATE void AddLink(); + SAL_DLLPRIVATE void RemoveLink(); + + /// Catch hint for DocInfo. + SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + /// FileIO + SAL_DLLPRIVATE virtual bool InitNew( const css::uno::Reference< css::embed::XStorage >& xStorage ) override; + SAL_DLLPRIVATE virtual bool Load( SfxMedium& rMedium ) override; + SAL_DLLPRIVATE virtual bool LoadFrom( SfxMedium& rMedium ) override; + SAL_DLLPRIVATE virtual bool ConvertFrom( SfxMedium &rMedium ) override; + SAL_DLLPRIVATE virtual bool ConvertTo( SfxMedium &rMedium ) override; + SAL_DLLPRIVATE virtual bool SaveAs( SfxMedium& rMedium ) override; + SAL_DLLPRIVATE virtual bool SaveCompleted( const css::uno::Reference< css::embed::XStorage >& xStorage ) override; + + SAL_DLLPRIVATE virtual bool PrepareClose( bool bUI = true ) override; + + SAL_DLLPRIVATE virtual bool InsertGeneratedStream(SfxMedium& rMedium, + css::uno::Reference<css::text::XTextRange> const& xInsertPosition) + override; + + /// Make DocInfo known to the Doc. + SAL_DLLPRIVATE virtual std::shared_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, + const SfxItemSet &rSet) override; + /// OLE-stuff + SAL_DLLPRIVATE virtual void Draw( OutputDevice*, const JobSetup&, sal_uInt16 nAspect) override; + + /// Methods for StyleSheets + + /// @param nSlot + /// Only used for nFamily == SfxStyleFamily::Page. Identifies optional Slot by which the edit is triggered. + /// Used to activate certain dialog pane + SAL_DLLPRIVATE void Edit( + const OUString &rName, + const OUString& rParent, + const SfxStyleFamily nFamily, + SfxStyleSearchBits nMask, + const bool bNew, + const OString& sPageId, + SwWrtShell* pActShell, + SfxRequest* pRequest = nullptr, + sal_uInt16 nSlot = 0); + + SAL_DLLPRIVATE void Delete(const OUString &rName, SfxStyleFamily nFamily); + SAL_DLLPRIVATE void Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden); + SAL_DLLPRIVATE SfxStyleFamily ApplyStyles(const OUString &rName, + const SfxStyleFamily nFamily, + SwWrtShell* pShell, + sal_uInt16 nMode); + SAL_DLLPRIVATE SfxStyleFamily DoWaterCan( const OUString &rName, SfxStyleFamily nFamily); + SAL_DLLPRIVATE void UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell); + SAL_DLLPRIVATE void MakeByExample(const OUString &rName, + SfxStyleFamily nFamily, SfxStyleSearchBits nMask, SwWrtShell* pShell); + + SAL_DLLPRIVATE void SubInitNew(); ///< for InitNew and HtmlSourceMode. + + SAL_DLLPRIVATE void RemoveOLEObjects(); + SAL_DLLPRIVATE void CalcLayoutForOLEObjects(); + + SAL_DLLPRIVATE void Init_Impl(); + + using SfxObjectShell::GetVisArea; + +protected: + /// override to update text fields + virtual void DoFlushDocInfo() override; + +public: + /// but we implement this ourselves. + SFX_DECL_INTERFACE(SW_DOCSHELL) + SFX_DECL_OBJECTFACTORY() + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + static OUString GetEventName( sal_Int32 nId ); + + /// Doc is required for SO data exchange! + SwDocShell( SfxObjectCreateMode eMode = SfxObjectCreateMode::EMBEDDED ); + SwDocShell( SfxModelFlags i_nSfxCreationFlags ); + SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode ); + virtual ~SwDocShell() override; + + /// OLE 2.0-notification. + DECL_LINK( Ole2ModifiedHdl, bool, void ); + + /// OLE-stuff. + virtual void SetVisArea( const tools::Rectangle &rRect ) override; + virtual tools::Rectangle GetVisArea( sal_uInt16 nAspect ) const override; + virtual Printer *GetDocumentPrinter() override; + virtual OutputDevice* GetDocumentRefDev() override; + virtual void OnDocumentPrinterChanged( Printer * pNewPrinter ) override; + + virtual void SetModified( bool = true ) override; + + /// Dispatcher + void Execute(SfxRequest &); + void ExecStyleSheet(SfxRequest&); + + void GetState(SfxItemSet &); + void StateStyleSheet(SfxItemSet&, SwWrtShell* pSh = nullptr ); + + /// returns Doc. But be careful! + SwDoc* GetDoc() { return m_xDoc.get(); } + const SwDoc* GetDoc() const { return m_xDoc.get(); } + IDocumentDeviceAccess& getIDocumentDeviceAccess(); + IDocumentChartDataProviderAccess& getIDocumentChartDataProviderAccess(); + + void UpdateFontList(); + void UpdateChildWindows(); + + /// global IO. + virtual bool Save() override; + + /// For Style PI. + virtual SfxStyleSheetBasePool* GetStyleSheetPool() override; + virtual sfx2::StyleManager* GetStyleManager() override; + + /// Set View for actions via Shell. + void SetView(SwView* pVw); + const SwView *GetView() const { return m_pView; } + SwView *GetView() { return m_pView; } + + /// Access to the SwWrtShell belonging to SwView. + SwWrtShell *GetWrtShell() { return m_pWrtShell; } + const SwWrtShell *GetWrtShell() const { return m_pWrtShell; } + // Same as GetWrtShell, but return pointer to SwEditShell base of + // (potentially incomplete) SwWrtShell: + SwEditShell * GetEditShell(); + + /// For Core - it knows the DocShell but not the WrtShell! + SwFEShell *GetFEShell(); + const SwFEShell *GetFEShell() const + { return const_cast<SwDocShell*>(this)->GetFEShell(); } + + /// For inserting document. + Reader* StartConvertFrom(SfxMedium& rMedium, SwReaderPtr& rpRdr, + SwCursorShell const * pCursorSh = nullptr, SwPaM* pPaM = nullptr); + +#if defined(_WIN32) + virtual bool DdeGetData( const OUString& rItem, const OUString& rMimeType, + css::uno::Any & rValue ) override; + virtual bool DdeSetData( const OUString& rItem, const OUString& rMimeType, + const css::uno::Any & rValue ) override; +#endif + virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem ) override; + virtual void ReconnectDdeLink(SfxObjectShell& rServer) override; + + virtual void FillClass( SvGlobalName * pClassName, + SotClipboardFormatId * pClipFormat, + OUString * pLongUserName, + sal_Int32 nFileFormat, + bool bTemplate = false ) const override; + + virtual std::set<Color> GetDocColors() override; + sfx::AccessibilityIssueCollection runAccessibilityCheck() override; + + virtual void LoadStyles( SfxObjectShell& rSource ) override; + + void LoadStyles_( SfxObjectShell& rSource, bool bPreserveCurrentDocument ); + + /// Show page style format dialog + /// @param nSlot + /// Identifies slot by which the dialog is triggered. Used to activate certain dialog pane + void FormatPage( + const OUString& rPage, + const OString& rPageId, + SwWrtShell& rActShell, + SfxRequest* pRequest = nullptr); + + // #i59688# + /** linked graphics are now loaded on demand. + Thus, loading of linked graphics no longer needed and necessary for + the load of document being finished. */ + + void LoadingFinished(); + + /// Cancel transfer (called from SFX). + virtual void CancelTransfers() override; + + /// Re-read Doc from Html-source. + void ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcView ); + + sal_Int16 GetUpdateDocMode() const { return m_nUpdateDocMode; } + + void ToggleLayoutMode(SwView* pView); + + ErrCode LoadStylesFromFile(const OUString& rURL, SwgReaderOption& rOpt, bool bUnoCall); + void InvalidateModel(); + void ReactivateModel(); + + virtual css::uno::Sequence< OUString > GetEventNames() override; + + /// #i20883# Digital Signatures and Encryption + virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates ) override; + + /** #i42634# Overwrites SfxObjectShell::UpdateLinks + This new function is necessary to trigger update of links in docs + read by the binary filter: */ + virtual void UpdateLinks() override; + + css::uno::Reference< css::frame::XController > + GetController(); + + SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef ); + SAL_DLLPRIVATE bool IsTemplate() const { return m_IsATemplate; } + SAL_DLLPRIVATE void SetIsTemplate( bool bValue ) { m_IsATemplate = bValue; } + + virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const override; + + /** passwword protection for Writer (derived from SfxObjectShell) + see also: FN_REDLINE_ON, FN_REDLINE_ON */ + virtual bool IsChangeRecording() const override; + virtual bool HasChangeRecordProtection() const override; + virtual void SetChangeRecording( bool bActivate ) override; + virtual void SetProtectionPassword( const OUString &rPassword ) override; + virtual bool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash ) override; + + void RegisterAutomationDocumentEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller); + void CallAutomationDocumentEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments); + void RegisterAutomationDocumentObject(css::uno::Reference< ooo::vba::word::XDocument > const& xDocument); + + class SAL_DLLPRIVATE LockAllViewsGuard + { + std::vector<SwViewShell*> m_aViewWasUnLocked; + + public: + explicit LockAllViewsGuard(SwViewShell* pViewShell); + ~LockAllViewsGuard(); + }; + // Lock all unlocked views, and returns a guard object which unlocks those views when destructed + std::unique_ptr<LockAllViewsGuard> LockAllViews(); +}; + +/** Find the right DocShell and create a new one: + The return value specifies what should happen to the Shell + 0 - Error, could not find the DocShell + 1 - DocShell is an existing Document + 2 - DocShell was created anew, thus it needs to be closed again + (will be assigned to xLockRef additionally) +*/ +int SwFindDocShell( SfxObjectShellRef& xDocSh, + SfxObjectShellLock& xLockRef, + const OUString& rFileName, + const OUString& rPasswd, + const OUString& rFilter, + sal_Int16 nVersion, + SwDocShell* pDestSh ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/docstat.hxx b/sw/inc/docstat.hxx new file mode 100644 index 000000000..fd53d80bf --- /dev/null +++ b/sw/inc/docstat.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOCSTAT_HXX +#define INCLUDED_SW_INC_DOCSTAT_HXX + +#include <tools/solar.h> +#include "swdllapi.h" + +struct SW_DLLPUBLIC SwDocStat +{ + sal_uInt16 nTable; + sal_uInt16 nGrf; + sal_uInt16 nOLE; + sal_uLong nPage; + /// paragraphs for document statistic: non-empty and non-hidden ones + sal_uLong nPara; + /// all paragraphs, including empty/hidden ones + sal_uLong nAllPara; + sal_uLong nWord; + sal_uLong nAsianWord; + sal_uLong nChar; + sal_uLong nCharExcludingSpaces; + bool bModified; + + SwDocStat(); + void Reset(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx new file mode 100644 index 000000000..229ed37e0 --- /dev/null +++ b/sw/inc/docstyle.hxx @@ -0,0 +1,237 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOCSTYLE_HXX +#define INCLUDED_SW_INC_DOCSTYLE_HXX + +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> + +#include <svl/style.hxx> +#include <svl/itemset.hxx> +#include "swdllapi.h" + +#include <unordered_map> +#include <memory> +#include <vector> + +class SwDoc; +class SwDocStyleSheetPool; +class SwPageDesc; +class SwCharFormat; +class SwTextFormatColl; +class SwFrameFormat; +class SwNumRule; +class SwTableAutoFormat; +class SwBoxAutoFormat; +enum class SwGetPoolIdFromName : sal_uInt16; + +// Temporary StyleSheet. +class SW_DLLPUBLIC SwDocStyleSheet final : public SfxStyleSheetBase +{ + friend class SwDocStyleSheetPool; + friend class SwStyleSheetIterator; + + SwCharFormat* pCharFormat; + SwTextFormatColl* pColl; + SwFrameFormat* pFrameFormat; + const SwPageDesc* pDesc; + const SwNumRule* pNumRule; + SwTableAutoFormat* pTableFormat; + const SwBoxAutoFormat* pBoxFormat; + SwDoc& rDoc; + SfxItemSet aCoreSet; + + bool bPhysical; + + /// Make empty shell a real StyleSheet (Core). + SAL_DLLPRIVATE void Create(); + + /// Fill StyleSheet with data. + enum FillStyleType { + FillOnlyName, + FillAllInfo, + FillPhysical, + FillPreview, + }; + + SAL_DLLPRIVATE bool FillStyleSheet(FillStyleType eFType, + std::unique_ptr<SfxItemSet> * o_ppFlatSet = nullptr); + + virtual ~SwDocStyleSheet() override; + +public: + SwDocStyleSheet( SwDoc& rDoc, + SwDocStyleSheetPool& rPool); + + SwDocStyleSheet( const SwDocStyleSheet& ); + + void Reset(); + + void SetFamily(SfxStyleFamily eFam) { nFamily = eFam; } + + bool IsPhysical() const { return bPhysical; } + void SetPhysical(bool bPhys); + + virtual void SetHidden( bool bHidden ) override; + virtual bool IsHidden( ) const override; + void SetGrabBagItem(const css::uno::Any& rVal); + void GetGrabBagItem(css::uno::Any& rVal) const; + + /** add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value false, + which indicates that the indent attributes at a paragraph style should + be reset in case that a list style is applied to the paragraph style and + no indent attributes are applied. */ + void SetItemSet( const SfxItemSet& rSet, + const bool bResetIndentAttrsAtParagraphStyle = false ); + + virtual SfxItemSet& GetItemSet() override; + virtual std::unique_ptr<SfxItemSet> GetItemSetForPreview() override; + /** new method for paragraph styles to merge indent attributes of applied list + style into the given item set, if the list style indent attributes are applicable. */ + void MergeIndentAttrsOfListStyle( SfxItemSet& rSet ); + virtual const OUString& GetParent() const override; + virtual const OUString& GetFollow() const override; + + virtual sal_uLong GetHelpId( OUString& rFile ) override; + virtual void SetHelpId( const OUString& r, sal_uLong nId ) override; + + /** Preset the members without physical access. + Used by StyleSheetPool. */ + void PresetName(const OUString& rName) { aName = rName; } + void PresetNameAndFamily(const OUString& rName); + void PresetParent(const OUString& rName){ aParent = rName; } + void PresetFollow(const OUString& rName){ aFollow = rName; } + + virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) override; + virtual bool SetParent( const OUString& rStr) override; + virtual bool SetFollow( const OUString& rStr) override; + + virtual bool HasFollowSupport() const override; + virtual bool HasParentSupport() const override; + virtual bool HasClearParentSupport() const override; + virtual OUString GetDescription(MapUnit eUnit) override; + + virtual OUString GetUsedBy() override; + + SwCharFormat* GetCharFormat(); + SwTextFormatColl* GetCollection(); + SwFrameFormat* GetFrameFormat(); + const SwPageDesc* GetPageDesc(); + const SwNumRule* GetNumRule(); + void SetNumRule(const SwNumRule& rRule); + SwTableAutoFormat* GetTableFormat(); + + virtual bool IsUsed() const override; +}; + +// Iterator for Pool. +class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener +{ + // Local helper class. + class SwPoolFormatList + { + std::vector<OUString> maImpl; + typedef std::unordered_map<OUString, sal_uInt32> UniqueHash; + UniqueHash maUnique; + void rehash(); + public: + SwPoolFormatList() {} + void Append( char cChar, const OUString& rStr ); + void clear() { maImpl.clear(); maUnique.clear(); } + size_t size() { return maImpl.size(); } + bool empty() { return maImpl.empty(); } + sal_uInt32 FindName(SfxStyleFamily eFam, const OUString &rName); + void RemoveName(SfxStyleFamily eFam, const OUString &rName); + const OUString &operator[](sal_uInt32 nIdx) { return maImpl[ nIdx ]; } + }; + + rtl::Reference< SwDocStyleSheet > mxIterSheet; + rtl::Reference< SwDocStyleSheet > mxStyleSheet; + SwPoolFormatList aLst; + sal_uInt32 nLastPos; + bool bFirstCalled; + + void AppendStyleList(const std::vector<OUString>& rLst, + bool bUsed, + bool bTestHidden, + bool bOnlyHidden, + SwGetPoolIdFromName nSection, + char cType); + +public: + SwStyleSheetIterator(SwDocStyleSheetPool& rBase, + SfxStyleFamily eFam, SfxStyleSearchBits n); + virtual ~SwStyleSheetIterator() override; + + virtual sal_uInt16 Count() override; + virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx) override; + virtual SfxStyleSheetBase* First() override; + virtual SfxStyleSheetBase* Next() override; + virtual SfxStyleSheetBase* Find(const OUString& rStr) override; + + virtual void Notify( SfxBroadcaster&, const SfxHint& ) override; + + void InvalidateIterator(); +}; + +class SwDocStyleSheetPool : public SfxStyleSheetBasePool +{ + rtl::Reference< SwDocStyleSheet > mxStyleSheet; + SwDoc& rDoc; + bool bOrganizer : 1; ///< Organizer + + virtual SfxStyleSheetBase* Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits nMask) override; + virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& ) override; + + using SfxStyleSheetBasePool::Find; + +public: + SwDocStyleSheetPool( SwDoc&, bool bOrganizer ); + + virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily, + SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; + + virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, + SfxStyleSearchBits n=SfxStyleSearchBits::All ) override; + + virtual bool SetParent( SfxStyleFamily eFam, const OUString &rStyle, + const OUString &rParent ) override; + + virtual void Remove( SfxStyleSheetBase* pStyle) override; + + bool IsOrganizerMode() const { return bOrganizer; } + + virtual std::unique_ptr<SfxStyleSheetIterator> CreateIterator( SfxStyleFamily, SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; + + SwDoc& GetDoc() const { return rDoc; } + + void dispose(); + + void InvalidateIterator(); + +protected: + virtual ~SwDocStyleSheetPool() override; + +private: + SwDocStyleSheetPool( const SwDocStyleSheetPool& ) = delete; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx new file mode 100644 index 000000000..5c8187daf --- /dev/null +++ b/sw/inc/docufld.hxx @@ -0,0 +1,750 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DOCUFLD_HXX +#define INCLUDED_SW_INC_DOCUFLD_HXX + +#include <tools/solar.h> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <rtl/ref.hxx> +#include <svl/macitem.hxx> + +#include "fldbas.hxx" + +class SetGetExpFields; +class SwTextField; +class SwFrame; +class OutlinerParaObject; +class SwTextAPIObject; +class SwCharFormat; + +enum SwAuthorFormat +{ + AF_BEGIN, + AF_NAME = AF_BEGIN, + AF_SHORTCUT, + AF_FIXED = 0x8000 +}; + +// Subtype of document statistics. +enum SwDocStatSubType +{ + DS_BEGIN, + DS_PAGE = DS_BEGIN, + DS_PARA, + DS_WORD, + DS_CHAR, + DS_TBL, + DS_GRF, + DS_OLE, +}; + +typedef sal_uInt16 SwDocInfoSubType; +namespace nsSwDocInfoSubType +{ + /** NB: these must denote consecutive integers! + NB2: these are extended by 4 DI_INFO values for backward compatibility + in filter/html/htmlfld.cxx, so make sure that DI_SUBTYPE_END + really is the end, and is at least 4 less than DI_SUB_*! */ + const SwDocInfoSubType DI_SUBTYPE_BEGIN = 0; + const SwDocInfoSubType DI_TITLE = DI_SUBTYPE_BEGIN; + const SwDocInfoSubType DI_SUBJECT = 1; + const SwDocInfoSubType DI_KEYS = 2; + const SwDocInfoSubType DI_COMMENT = 3; + const SwDocInfoSubType DI_CREATE = 4; + const SwDocInfoSubType DI_CHANGE = 5; + const SwDocInfoSubType DI_PRINT = 6; + const SwDocInfoSubType DI_DOCNO = 7; + const SwDocInfoSubType DI_EDIT = 8; + const SwDocInfoSubType DI_CUSTOM = 9; + const SwDocInfoSubType DI_SUBTYPE_END = 10; + + const SwDocInfoSubType DI_SUB_AUTHOR = 0x0100; + const SwDocInfoSubType DI_SUB_TIME = 0x0200; + const SwDocInfoSubType DI_SUB_DATE = 0x0300; + const SwDocInfoSubType DI_SUB_FIXED = 0x1000; + const SwDocInfoSubType DI_SUB_MASK = 0xff00; +} + +enum SwPageNumSubType +{ + PG_RANDOM, + PG_NEXT, + PG_PREV +}; + +// NOTE: Possibly the first 15 values in the below enum are required +// to exactly match the published constants in css::text::UserDataPart +// (see offapi/com/sun/star/text/UserDataPart.idl). + +enum SwExtUserSubType +{ + EU_COMPANY, + EU_FIRSTNAME, + EU_NAME, + EU_SHORTCUT, + EU_STREET, + EU_COUNTRY, + EU_ZIP, + EU_CITY, + EU_TITLE, + EU_POSITION, + EU_PHONE_PRIVATE, + EU_PHONE_COMPANY, + EU_FAX, + EU_EMAIL, + EU_STATE, + EU_FATHERSNAME, + EU_APARTMENT +}; + +enum SwJumpEditFormat +{ + JE_FMT_TEXT, + JE_FMT_TABLE, + JE_FMT_FRAME, + JE_FMT_GRAPHIC, + JE_FMT_OLE +}; + +class SAL_DLLPUBLIC_RTTI SwPageNumberFieldType final : public SwFieldType +{ + SvxNumType m_nNumberingType; + bool m_bVirtual; + +public: + SwPageNumberFieldType(); + + OUString Expand( SvxNumType nFormat, short nOff, sal_uInt16 const nPageNumber, + sal_uInt16 const nMaxPage, const OUString&, LanguageType = LANGUAGE_NONE ) const; + void ChangeExpansion( SwDoc* pDoc, + bool bVirtPageNum, const SvxNumType* pNumFormat ); + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +// Page numbering. +class SW_DLLPUBLIC SwPageNumberField final : public SwField +{ + OUString m_sUserStr; + sal_uInt16 m_nSubType; + short m_nOffset; + // fdo#58074 store page number in SwField, not SwFieldType + sal_uInt16 m_nPageNumber; + sal_uInt16 m_nMaxPage; + +public: + SwPageNumberField(SwPageNumberFieldType*, sal_uInt16 nSub, + sal_uInt32 nFormat, short nOff = 0, + sal_uInt16 const nPageNumber = 0, + sal_uInt16 const nMaxPage = 0); + + void ChangeExpansion(sal_uInt16 const nPageNumber, + sal_uInt16 const nMaxPage); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + + virtual sal_uInt16 GetSubType() const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + + const OUString& GetUserString() const { return m_sUserStr; } + void SetUserString( const OUString& rS ) { m_sUserStr = rS; } +}; + +class SwAuthorFieldType final : public SwFieldType +{ +public: + SwAuthorFieldType(); + + static OUString Expand(sal_uLong); + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SwAuthorField final : public SwField +{ + OUString m_aContent; + +public: + SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + void SetExpansion(const OUString& rStr) { m_aContent = rStr; } + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +class SAL_DLLPUBLIC_RTTI SwFileNameFieldType final : public SwFieldType +{ + SwDoc *m_pDoc; +public: + SwFileNameFieldType(SwDoc*); + + OUString Expand(sal_uLong) const; + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SW_DLLPUBLIC SwFileNameField final : public SwField +{ + OUString m_aContent; + +public: + SwFileNameField(SwFileNameFieldType*, sal_uInt32 nFormat); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + void SetExpansion(const OUString& rStr) { m_aContent = rStr; } + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +class SAL_DLLPUBLIC_RTTI SwTemplNameFieldType final : public SwFieldType +{ + SwDoc *m_pDoc; +public: + SwTemplNameFieldType(SwDoc*); + + OUString Expand(sal_uLong) const; + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SW_DLLPUBLIC SwTemplNameField final : public SwField +{ +public: + SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFormat); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Document statistics +class SAL_DLLPUBLIC_RTTI SwDocStatFieldType final : public SwFieldType +{ + SwDoc* m_pDoc; + SvxNumType m_nNumberingType; + +public: + SwDocStatFieldType(SwDoc*); + OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const; + virtual std::unique_ptr<SwFieldType> Copy() const override; + + void SetNumFormat( SvxNumType eFormat ) { m_nNumberingType = eFormat; } +}; + +class SW_DLLPUBLIC SwDocStatField final : public SwField +{ + sal_uInt16 m_nSubType; + +public: + SwDocStatField( SwDocStatFieldType*, + sal_uInt16 nSubType, sal_uInt32 nFormat); + + void ChangeExpansion( const SwFrame* pFrame ); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nSub) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +class SAL_DLLPUBLIC_RTTI SwHiddenTextFieldType final : public SwFieldType +{ + bool m_bHidden; +public: + SwHiddenTextFieldType(bool bSetHidden = true); + + virtual std::unique_ptr<SwFieldType> Copy() const override; + + void SetHiddenFlag( bool bSetHidden ); + bool GetHiddenFlag() const { return m_bHidden; } +}; + +class SW_DLLPUBLIC SwHiddenTextField final : public SwField +{ + OUString m_aTRUEText; ///< Text if condition true. + OUString m_aFALSEText; ///< If condition false. + OUString m_aContent; ///< Evaluated DB-text. + + OUString m_aCond; ///< Condition. + SwFieldTypesEnum m_nSubType; + + bool m_bCanToggle : 1; ///< Can field be toggled alone? + bool m_bIsHidden : 1; ///< Is it not visible? + bool m_bValid : 1; ///< Is DB-field evaluated? + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwHiddenTextField( SwHiddenTextFieldType*, + bool bConditional, + const OUString& rCond, + const OUString& rText, + bool bHidden, + SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText); + + SwHiddenTextField( SwHiddenTextFieldType*, + const OUString& rCond, + const OUString& rTrue, + const OUString& rFalse, + SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText); + + virtual OUString GetFieldName() const override; + + void Evaluate(SwDoc*); + + void SetValue(bool bHidden) { m_bIsHidden = bHidden; } + static OUString GetColumnName(const OUString& rName); + static OUString GetDBName(const OUString& rName, SwDoc *pDoc); + + /// Condition + virtual void SetPar1(const OUString& rStr) override; + virtual OUString GetPar1() const override; + + /// True/False - String + virtual void SetPar2(const OUString& rStr) override; + virtual OUString GetPar2() const override; + + virtual sal_uInt16 GetSubType() const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + + static void ParseIfFieldDefinition(const OUString& aFieldDefinition, + OUString& rCondition, + OUString& rTrue, + OUString& rFalse); +}; + +// Field that expands to an empty line (without height). +class SwHiddenParaFieldType final : public SwFieldType +{ +public: + SwHiddenParaFieldType(); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SwHiddenParaField final : public SwField +{ + OUString m_aCond; + bool m_bIsHidden; +public: + /// Direct input, delete old value. + SwHiddenParaField(SwHiddenParaFieldType*, const OUString& rCond); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + void SetHidden(bool bHidden) { m_bIsHidden = bHidden; } + bool IsHidden() const { return m_bIsHidden; } + + /// Query, set condition. + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +class SAL_DLLPUBLIC_RTTI SwMacroFieldType final : public SwFieldType +{ + SwDoc* m_pDoc; + +public: + SwMacroFieldType(SwDoc*); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SW_DLLPUBLIC SwMacroField final : public SwField +{ + OUString m_aMacro; + OUString m_aText; + bool m_bIsScriptURL; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + /// Direct input, delete old value. + SwMacroField( SwMacroFieldType*, const OUString& rLibAndName, + const OUString& rText); + + const OUString& GetMacro() const { return m_aMacro; } + OUString GetLibName() const; + OUString GetMacroName() const; + SvxMacro GetSvxMacro() const; + + virtual OUString GetFieldName() const override; + + /// Library and FileName + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + + /// Macrotext + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + + static void CreateMacroString( OUString& rMacro, + const OUString& rMacroName, + const OUString& rLibraryName ); + + static bool isScriptURL( const OUString& str ); +}; + +class SAL_DLLPUBLIC_RTTI SwPostItFieldType final : public SwFieldType +{ +private: + SwDoc* mpDoc; +public: + SwPostItFieldType(SwDoc* pDoc); + + virtual std::unique_ptr<SwFieldType> Copy() const override; + + SwDoc* GetDoc() const + { + return mpDoc; + }; +}; + +class SW_DLLPUBLIC SwPostItField final : public SwField +{ + OUString m_sText; + OUString m_sAuthor; + OUString m_sInitials; ///< Initials of the author. + OUString m_sName; ///< Name of the comment. + DateTime m_aDateTime; + bool m_bResolved; + std::unique_ptr<OutlinerParaObject> mpText; + rtl::Reference<SwTextAPIObject> m_xTextObject; + sal_uInt32 m_nPostItId; + +public: + static sal_uInt32 m_nLastPostItId; + + SwPostItField( SwPostItFieldType*, + const OUString& rAuthor, + const OUString& rText, + const OUString& rInitials, + const OUString& rName, + const DateTime& rDate, + const bool bResolved = false, + const sal_uInt32 nPostItId = 0); + + SwPostItField(const SwPostItField&) = delete; + SwPostItField* operator=(const SwPostItField&) = delete; + + virtual ~SwPostItField() override; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + const DateTime& GetDateTime() const { return m_aDateTime; } + Date GetDate() const { return Date(m_aDateTime.GetDate()); } + tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); } + sal_uInt32 GetPostItId() const { return m_nPostItId; } + + /// Author + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + + /// Text + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + const OUString& GetText() const { return m_sText; } + const OUString& GetInitials() const { return m_sInitials;} + void SetName(const OUString& rStr); + const OUString& GetName() const { return m_sName;} + + const OutlinerParaObject* GetTextObject() const { return mpText.get();} + void SetTextObject( std::unique_ptr<OutlinerParaObject> pText ); + + void SetResolved(bool bNewState); + void ToggleResolved(); + bool GetResolved() const; + + sal_Int32 GetNumberOfParagraphs() const; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + virtual OUString GetDescription() const override; + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +class SAL_DLLPUBLIC_RTTI SwDocInfoFieldType final : public SwValueFieldType +{ +public: + SwDocInfoFieldType(SwDoc* pDc); + + OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString& rName) const; + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SW_DLLPUBLIC SwDocInfoField final : public SwValueField +{ + sal_uInt16 m_nSubType; + OUString m_aContent; + OUString m_aName; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat=0); + SwDocInfoField(SwDocInfoFieldType*, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFormat=0); + + virtual void SetSubType(sal_uInt16) override; + virtual sal_uInt16 GetSubType() const override; + virtual void SetLanguage(LanguageType nLng) override; + virtual OUString GetFieldName() const override; + const OUString& GetName() const { return m_aName; } + void SetName( const OUString& rName ) { m_aName = rName; } + void SetExpansion(const OUString& rStr) { m_aContent = rStr; } + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Extended User settings. +class SwExtUserFieldType final : public SwFieldType +{ +public: + SwExtUserFieldType(); + + static OUString Expand(sal_uInt16 nSubType); + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SwExtUserField final : public SwField +{ + OUString m_aContent; + sal_uInt16 m_nType; + +public: + SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nSub) override; + + void SetExpansion(const OUString& rStr) { m_aContent = rStr; } + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Relative page numbers - field. +class SwRefPageSetFieldType final : public SwFieldType +{ +public: + SwRefPageSetFieldType(); + + virtual std::unique_ptr<SwFieldType> Copy() const override; + +private: + /// Overlay, because there is nothing to update! + virtual void Modify( const SfxPoolItem*, const SfxPoolItem * ) override; +}; + +// Relative page numbering. +class SAL_DLLPUBLIC_RTTI SwRefPageSetField final : public SwField +{ + short m_nOffset; + bool m_bOn; + +public: + SwRefPageSetField( SwRefPageSetFieldType*, short nOff, bool bOn ); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + + bool IsOn() const { return m_bOn; } + + short GetOffset() const { return m_nOffset; } + void SetOffset( short nOff ) { m_nOffset = nOff; } + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Relative page numbers - query field. +class SwRefPageGetFieldType final : public SwFieldType +{ + SwDoc* m_pDoc; + sal_Int16 m_nNumberingType; + + void UpdateField(SwTextField const * pTextField, + SetGetExpFields const & rSetList, SwRootFrame const* pLayout); + + /// overwritten to update all RefPageGet fields + virtual void Modify( const SfxPoolItem*, const SfxPoolItem * ) override; +public: + SwRefPageGetFieldType( SwDoc* pDoc ); + virtual std::unique_ptr<SwFieldType> Copy() const override; + bool MakeSetList(SetGetExpFields& rTmpLst, SwRootFrame const* pLayout); + SwDoc* GetDoc() const { return m_pDoc; } +}; + +// Query relative page numbering. +class SwRefPageGetField final : public SwField +{ + OUString m_sText; + OUString m_sTextRLHidden; ///< hidden redlines + +public: + SwRefPageGetField( SwRefPageGetFieldType*, sal_uInt32 nFormat ); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + void SetText(const OUString& rText, SwRootFrame const* pLayout); + + void ChangeExpansion(const SwFrame& rFrame, const SwTextField* pField); + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Field to jump to and edit. +class SwJumpEditFieldType final : public SwFieldType +{ + SwDoc* m_pDoc; + sw::WriterMultiListener m_aDep; + +public: + SwJumpEditFieldType( SwDoc* pDoc ); + virtual std::unique_ptr<SwFieldType> Copy() const override; + + SwCharFormat* GetCharFormat(); +}; + +class SwJumpEditField final : public SwField +{ + OUString m_sText; + OUString m_sHelp; +public: + SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat, + const OUString& sText, const OUString& sHelp ); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + /// Placeholder-Text + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + + /// Hint-Text + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + + SwCharFormat* GetCharFormat() const + { return static_cast<SwJumpEditFieldType*>(GetTyp())->GetCharFormat(); } + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +class SwScriptFieldType final : public SwFieldType +{ + SwDoc* m_pDoc; +public: + SwScriptFieldType( SwDoc* pDoc ); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SW_DLLPUBLIC SwScriptField final : public SwField +{ + OUString m_sType; ///< Type of Code (Java/VBScript/...) + OUString m_sCode; /**< Code as text. + Code as JavaCode ? */ + + bool m_bCodeURL; ///< Code contains URL of a script. + +public: + SwScriptField( SwScriptFieldType*, const OUString& rType, + const OUString& rCode, bool bURL ); + + virtual OUString GetDescription() const override; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + /// Type + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + /// Text + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + + bool IsCodeURL() const { return m_bCodeURL; } + void SetCodeURL( bool bURL ) { m_bCodeURL = bURL; } + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Combined Character Fieldtype +class SAL_DLLPUBLIC_RTTI SwCombinedCharFieldType final : public SwFieldType +{ +public: + SwCombinedCharFieldType(); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +// ScriptField +#define MAX_COMBINED_CHARACTERS 6 + +class SW_DLLPUBLIC SwCombinedCharField final : public SwField +{ + OUString m_sCharacters; ///< combine these characters + +public: + SwCombinedCharField( SwCombinedCharFieldType*, const OUString& rChars ); + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + /// Characters + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +#endif // INCLUDED_SW_INC_DOCUFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/dpage.hxx b/sw/inc/dpage.hxx new file mode 100644 index 000000000..a599a462d --- /dev/null +++ b/sw/inc/dpage.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DPAGE_HXX +#define INCLUDED_SW_INC_DPAGE_HXX + +#include <memory> +#include <svx/fmpage.hxx> +#include <svx/svdobj.hxx> + +class SdrPageGridFrameList; +class SwDrawModel; +class SwDoc; + +class SwDPage final : public FmFormPage, public SdrObjUserCall +{ + SwDPage &operator=(const SwDPage&) = delete; + SwDPage(const SwDPage&) = delete; + + std::unique_ptr<SdrPageGridFrameList> pGridLst; + SwDoc* pDoc; + +public: + explicit SwDPage(SwDrawModel& rNewModel, bool bMasterPage); + virtual ~SwDPage() override; + + virtual SwDPage* CloneSdrPage(SdrModel& rTargetModel) const override; + + // #i3694# + // This GetOffset() method is not needed anymore, it even leads to errors. + // virtual Point GetOffset() const; + virtual SdrObject* ReplaceObject( SdrObject* pNewObj, size_t nObjNum ) override; + + virtual const SdrPageGridFrameList* GetGridFrameList(const SdrPageView* pPV, + const tools::Rectangle *pRect) const override; + + bool RequestHelp( vcl::Window* pWindow, SdrView const * pView, const HelpEvent& rEvt ); + + virtual css::uno::Reference< css::uno::XInterface > createUnoPage() override; + +private: + void lateInit(const SwDPage& rSrcPage); +}; + +#endif // INCLUDED_SW_INC_DPAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx new file mode 100644 index 000000000..de45437ef --- /dev/null +++ b/sw/inc/drawdoc.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_DRAWDOC_HXX +#define INCLUDED_SW_INC_DRAWDOC_HXX + +#include <svx/fmmodel.hxx> + +class SwDoc; + +class SwDrawModel final : public FmFormModel +{ +private: + SwDoc* m_pDoc; + +public: + SwDrawModel( SwDoc* pDoc ); + virtual ~SwDrawModel() override; + + const SwDoc& GetDoc() const { return *m_pDoc; } + SwDoc& GetDoc() { return *m_pDoc; } + /// Put needed items for XPropertyList entries from the DrawModel. + void PutAreaListItems(SfxItemSet& rSet) const; + + virtual SdrPage* AllocPage(bool bMasterPage) override; + + virtual css::uno::Reference<css::embed::XStorage> GetDocumentStorage() const override; + +private: + /// override of <SdrModel::createUnoModel()> is needed to provide corresponding uno model. + virtual css::uno::Reference< css::uno::XInterface > createUnoModel() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/edglbldc.hxx b/sw/inc/edglbldc.hxx new file mode 100644 index 000000000..6cac147f5 --- /dev/null +++ b/sw/inc/edglbldc.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_EDGLBLDC_HXX +#define INCLUDED_SW_INC_EDGLBLDC_HXX + +#include <o3tl/sorted_vector.hxx> +#include <tools/solar.h> + +class SwSection; +class SwTOXBase; +class SwTOXBaseSection; + +enum GlobalDocContentType { + GLBLDOC_UNKNOWN, + GLBLDOC_TOXBASE, + GLBLDOC_SECTION +}; + +class SwGlblDocContent +{ + GlobalDocContentType eType; + sal_uLong nDocPos; + union { + const SwTOXBase* pTOX; + const SwSection* pSect; + } PTR; + +public: + SwGlblDocContent( sal_uLong nPos ); + SwGlblDocContent( const SwTOXBaseSection* pTOX ); + SwGlblDocContent( const SwSection* pSect ); + + /// Query contents. + GlobalDocContentType GetType() const { return eType; } + const SwSection* GetSection() const + { return GLBLDOC_SECTION == eType ? PTR.pSect : nullptr; } + const SwTOXBase* GetTOX() const + { return GLBLDOC_TOXBASE == eType ? PTR.pTOX : nullptr; } + sal_uLong GetDocPos() const { return nDocPos; } + + /// For sorting. + bool operator==( const SwGlblDocContent& rCmp ) const + { return GetDocPos() == rCmp.GetDocPos(); } + bool operator<( const SwGlblDocContent& rCmp ) const + { return GetDocPos() < rCmp.GetDocPos(); } +}; + +class SwGlblDocContents : public o3tl::sorted_vector<std::unique_ptr<SwGlblDocContent>, o3tl::less_uniqueptr_to<SwGlblDocContent> > {}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx new file mode 100644 index 000000000..b9bc4a480 --- /dev/null +++ b/sw/inc/edimp.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_EDIMP_HXX +#define INCLUDED_SW_INC_EDIMP_HXX + +#include <tools/solar.h> +#include <o3tl/sorted_vector.hxx> + +class SwPaM; +class SwNodeIndex; + +struct SwPamRange +{ + sal_uLong nStart, nEnd; + + SwPamRange( sal_uLong nS, sal_uLong nE ) : nStart( nS ), nEnd( nE ) {} + + bool operator==( const SwPamRange& rRg ) const + { return nStart == rRg.nStart; } + bool operator<( const SwPamRange& rRg ) const + { return nStart < rRg.nStart; } +}; + +class SwPamRanges +{ +public: + SwPamRanges( const SwPaM& rRing ); + + void Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 ); + SwPaM& SetPam( size_t nArrPos, SwPaM& rPam ); + + size_t Count() const + { return maVector.size(); } +private: + o3tl::sorted_vector<SwPamRange> maVector; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx new file mode 100644 index 000000000..66226bc40 --- /dev/null +++ b/sw/inc/editsh.hxx @@ -0,0 +1,1035 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_EDITSH_HXX +#define INCLUDED_SW_INC_EDITSH_HXX + +#include "crsrsh.hxx" + +#include "charfmt.hxx" +#include "fldupde.hxx" +#include "frmfmt.hxx" +#include "swdllapi.h" +#include "swundo.hxx" +#include "tblenum.hxx" +#include "tox.hxx" + +#include <memory> +#include <vector> +#include <set> + +namespace tools { class PolyPolygon; } +class SwDoc; +class CommandExtTextInputData; + +class SvNumberFormatter; +class SfxPoolItem; +class SfxItemSet; +class SfxWatermarkItem; +class SvxAutoCorrect; + +class SwDDEFieldType; +class SwDBManager; + +struct SwDocStat; +class SwAutoCompleteWord; + +class SwFormatRefMark; + +class SwNumRule; + +class SwTextFormatColl; +class SwGrfNode; + +class Graphic; +class GraphicObject; +class GraphicAttr; +class SwFormatINetFormat; +class SwTable; +class SwTextBlocks; +class SwFormatFootnote; +class SwSection; +class SwSectionData; +class SwSectionFormat; +class SwTableAutoFormat; +class SwPageDesc; +class SwTextINetFormat; +class SwSeqFieldList; +class SwGlblDocContent; +class SwGlblDocContents; +class SwRangeRedline; +class SwRedlineData; +class SwFootnoteInfo; +class SwEndNoteInfo; +class SwLineNumberInfo; +class SwAuthEntry; +class SwRewriter; +class SwView; +struct SwConversionArgs; +struct SvxSwAutoFormatFlags; +struct SwInsertTableOptions; +struct SwDBData; +enum class SvtScriptType; +enum class SfxClassificationPolicyType; +enum class RedlineFlags; +enum class TransliterationFlags; +enum class GraphicType; + +namespace com::sun::star::uno { template < class > class Sequence; } +namespace com::sun::star::linguistic2 { class XSpellAlternatives; } +namespace com::sun::star::linguistic2 { struct ProofreadingResult; } + +namespace svx{ + struct SpellPortion; + typedef std::vector<SpellPortion> SpellPortions; + class ClassificationResult; +} + +namespace sfx2{ + class LinkManager; +} + +namespace sw { + class UndoRedoContext; +} + +enum class ParaBreakType { + ToBlank = 0, + ToOnlyCR = 2 +}; + + /// For querying the INet-attributes for Navigator. +struct SwGetINetAttr +{ + OUString sText; + const SwTextINetFormat& rINetAttr; + + SwGetINetAttr( const OUString& rText, const SwTextINetFormat& rAttr ) + : sText( rText ), rINetAttr( rAttr ) + {} +}; +typedef std::vector<SwGetINetAttr> SwGetINetAttrs; + +// Types of forms of content. +#define CNT_TXT 0x0001 +#define CNT_GRF 0x0002 +#define CNT_OLE 0x0010 + +// Test USHORT for a defined form of content. +#define CNT_HasText(USH) ((USH)&CNT_TXT) +#define CNT_HasGrf(USH) ((USH)&CNT_GRF) +#define CNT_HasOLE(USH) ((USH)&CNT_OLE) + +class SW_DLLPUBLIC SwEditShell : public SwCursorShell +{ + static SvxSwAutoFormatFlags* s_pAutoFormatFlags; + + /// For the private methods DelRange and those of AutoCorrect. + friend class SwAutoFormat; + friend void InitCore(); + friend void FinitCore(); + /// For the PamCorrAbs/-Rel methods. + friend class SwUndo; + + /** Returns pointer to a SwGrfNode + that will be used by GetGraphic() and GetGraphicSize(). */ + SAL_DLLPRIVATE SwGrfNode *GetGrfNode_() const ; + + SAL_DLLPRIVATE void DeleteSel( SwPaM& rPam, bool* pUndo = nullptr ); + + SAL_DLLPRIVATE void SetSectionAttr_( SwSectionFormat& rSectFormat, const SfxItemSet& rSet ); + + using SwViewShell::UpdateFields; + using SwModify::GetInfo; + +public: + /// Edit (all selected ranges). + void Insert( sal_Unicode, bool bOnlyCurrCursor = false ); + void Insert2( const OUString &, const bool bForceExpandHints = false ); + void Overwrite( const OUString & ); + + /** Replace a selected range in a TextNode by given string. + Meant for Search & Replace. + bRegExpRplc - replace tabs (\\t) and insert found string (not \&). + E.g.: Fnd: "zzz", Repl: "xx\t\\t..&..\&" + --> "xx\t<Tab>..zzz..&" */ + bool Replace( const OUString& rNewStr, bool bRegExpRplc ); + + /** Delete content of all ranges. + If whole nodes are selected, these nodes get deleted. */ + bool Delete(); + + /// Remove a complete paragraph. + bool DelFullPara(); + + /// Change text to Upper/Lower/Hiragana/Katakana/... + void TransliterateText( TransliterationFlags nType ); + + /// Count words in current selection. + void CountWords( SwDocStat& rStat ) const; + + /// Replace fields by text - mailmerge support. + bool ConvertFieldsToText(); + + /// Set all numbering start points to a fixed value - mailmerge support. + void SetNumberingRestart(); + + /// Embeds all local links (ranges/graphics). + sal_uInt16 GetLinkUpdMode() const; + void SetLinkUpdMode( sal_uInt16 nMode ); + + /// Copy content of all ranges at current position of cursor to given Shell. + bool Copy( SwEditShell* pDestShell ); + + /** For copying via ClipBoard: + If table is copied into table, move all cursors away from it. + Copy and Paste must be in FEShell because of FlyFrames! + Copy all selections to the document. */ + bool CopySelToDoc( SwDoc* pInsDoc ); + + void SplitNode( bool bAutoFormat = false, bool bCheckTableStart = true ); + bool AppendTextNode(); + void AutoFormatBySplitNode(); + + /** If cursor is in an INetAttribute it will be deleted completely + including the descriptive text (needed at drag & drop). */ + void DelINetAttrWithText(); + + /** If Cursor is at the end of a character style in which the DontExpand-flag + is not yet set, the latter will be set (==> return TRUE). */ + bool DontExpandFormat(); + + /** Apply / remove attributes. + @return attributes in required AttributeSet. + When not unambiguous the set has a DONT_CARE !! + 2nd optional parameter <bMergeIndentValuesOfNumRule>. + If <bMergeIndentValuesOfNumRule> == true, the indent attributes of + the corresponding list level of an applied list style is merged into + the requested item set as a LR-SPACE item, if corresponding node has not + its own indent attributes and the position-and-space mode of the list + level is SvxNumberFormat::LABEL_ALIGNMENT. */ + bool GetPaMAttr( SwPaM* pPaM, SfxItemSet& , + const bool bMergeIndentValuesOfNumRule = false ) const; + bool GetCurAttr( SfxItemSet& , + const bool bMergeIndentValuesOfNumRule = false ) const; + void SetAttrItem( const SfxPoolItem&, SetAttrMode nFlags = SetAttrMode::DEFAULT, + const bool bParagraphSetting = false ); + void SetAttrSet( const SfxItemSet&, SetAttrMode nFlags = SetAttrMode::DEFAULT, + SwPaM* pCursor = nullptr, const bool bParagraphSetting = false ); + + /** Get RES_CHRATR_* items of one type in the current selection. + * @param nWhich WhichId of the collected items. + * If parts of the selection have different scripttypes, the items with corresponding WhichIds are also collected. + * @return a vector of pairs. The pair contains a SfxPoolItem and a SwPaM, in which the item is valid and can be changed. */ + std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM>>> GetItemWithPaM( sal_uInt16 nWhich ); + + /** + * Get the paragraph format attribute(s) of the current selection. + * + * @see GetPaMParAttr() + * + * @param rSet + * output parameter - the SfxItemSet where the automatic paragraph format attribute(s) will be store. + * The attributes aren't invalidated or cleared if the function reach the getMaxLookup limit. + */ + void GetCurParAttr( SfxItemSet& rSet ) const; + /** + * Get the paragraph format attribute(s) of the selection(s) described by a SwPaM. + * + * @param pPaM + * input parameter - the selection where to look for the paragraph format. + * + * @param rSet + * output parameter - the SfxItemSet where the automatic paragraph format attribute(s) will be store. + * The attributes aren't invalidated or cleared if the function reaches the getMaxLookup limit. + * + * @return true if the function inspects all the nodes point by the pPaM parameter, + * false if the function reaches the limit of getMaxLookup number of nodes inspected. + */ + bool GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const; + + /// Set attribute as new default attribute in document. + void SetDefault( const SfxPoolItem& ); + + /// Query default attribute of document. + const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const; + template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const + { + return static_cast<const T&>(GetDefault(sal_uInt16(nWhich))); + } + + void ResetAttr( const std::set<sal_uInt16> &attrs = std::set<sal_uInt16>(), SwPaM* pCursor = nullptr ); + void GCAttr(); + + /// @return the scripttype of the selection. + SvtScriptType GetScriptType() const; + + /// @return the language at current cursor position. + LanguageType GetCurLang() const; + + /// TABLE + size_t GetTableFrameFormatCount( bool bUsed = false ) const; + SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed = false ) const; + OUString GetUniqueTableName() const; + + /// CHAR + sal_uInt16 GetCharFormatCount() const; + SwCharFormat& GetCharFormat(sal_uInt16 nFormat) const; + SwCharFormat* GetCurCharFormat() const; + void FillByEx(SwCharFormat*); + SwCharFormat* MakeCharFormat( const OUString& rName ); + SwCharFormat* FindCharFormatByName( const OUString& rName ) const; + + /* FormatCollections (new) - Explaining the general naming pattern: + * GetXXXCount() returns the count of xxx in the document. + * GetXXX(i) returns i-th xxx (ERR_RAISE if beyond range!). + * DelXXX(i) deletes i-th xxx (ERR_RAISE if beyond range!). + * GetCurXXX() returns xxx that is valid at cursor or in ranges. + * returns 0, if not unanimous. + * SetXXX() sets xxx at cursor or in ranges. + * MakeXXX() makes a xxx, derived from pDerivedFrom. + */ + + // TXT + SwTextFormatColl& GetDfltTextFormatColl() const; + sal_uInt16 GetTextFormatCollCount() const; + SwTextFormatColl& GetTextFormatColl( sal_uInt16 nTextFormatColl) const; + /** + * Get the named paragraph format of the current selection. + * + * @see GetPaMTextFormatColl() + * + * @return the named paragraph format of the first node that contains one. + * Nodes are sort by order of appearance in the selections ; + * selections are sort by their order of creation + * (last created selection first, oldest selection at last). + */ + SwTextFormatColl* GetCurTextFormatColl() const; + /** + * Get the named paragraph format of the selection(s) described by a SwPaM. + * + * @param pPaM + * input parameter - the selection where to look for the paragraph format. + * + * @return the named paragraph format of the first node that contains one. + */ + SwTextFormatColl* GetPaMTextFormatColl( SwPaM* pPaM ) const; + + // #i62675# + /// Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTextFormatColl(..)> + void SetTextFormatColl(SwTextFormatColl*, const bool bResetListAttrs = false); + SwTextFormatColl *MakeTextFormatColl(const OUString &rFormatCollName, + SwTextFormatColl *pDerivedFrom = nullptr); + void FillByEx(SwTextFormatColl*); + SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const; + + /// @return "Auto-Collection" with given Id. If it does not exist create it. + SwTextFormatColl* GetTextCollFromPool( sal_uInt16 nId ); + + /// @return required automatic format base class. + SwFormat* GetFormatFromPool( sal_uInt16 nId ); + + /// @return required automatic page style. + SwPageDesc* GetPageDescFromPool( sal_uInt16 nId ); + + /// Query if the paragraph-/character-/frame-/page-style is used. + bool IsUsed( const SwModify& ) const; + + /// @return required automatic format. + SwFrameFormat* GetFrameFormatFromPool( sal_uInt16 nId ) + { return static_cast<SwFrameFormat*>(SwEditShell::GetFormatFromPool( nId )); } + SwCharFormat* GetCharFormatFromPool( sal_uInt16 nId ) + { return static_cast<SwCharFormat*>(SwEditShell::GetFormatFromPool( nId )); } + + void SetClassification(const OUString& rName, SfxClassificationPolicyType eType); + void ApplyAdvancedClassification(std::vector<svx::ClassificationResult> const & rResult); + std::vector<svx::ClassificationResult> CollectAdvancedClassification(); + + SfxWatermarkItem GetWatermark() const; + void SetWatermark(const SfxWatermarkItem& rText); + + /// Sign the paragraph at the cursor. + void SignParagraph(); + + /// Validate the paragraph signatures, if any, of the current text node. + void ValidateParagraphSignatures(SwTextNode* pNode, bool updateDontRemove); + + /// Validate the current paragraph signatures, if any, at the cursor start. + void ValidateCurrentParagraphSignatures(bool updateDontRemove); + + /// Validate all paragraph signatures. + void ValidateAllParagraphSignatures(bool updateDontRemove); + + /// Restore the metadata fields, if missing, from the RDF metadata + /// and validate the signatures and update the signature metadata fields. + /// Needed since deleting the metadata field doesn't remove the RDF + /// and editing docs using software that don't support paragraph signing. + void RestoreMetadataFieldsAndValidateParagraphSignatures(); + + /// Ensure that the classification of the doc is never lower than + /// the paragraph with the highest classification. + void ClassifyDocPerHighestParagraphClass(); + + /// Apply the classification to the paragraph at cursor. + void ApplyParagraphClassification(std::vector<svx::ClassificationResult> aResult); + std::vector<svx::ClassificationResult> CollectParagraphClassification(); + + /// Returns true iff the cursor is within a paragraph metadata field. + /// Currently there are two variants: signature and classification. + bool IsCursorInParagraphMetadataField() const; + + /// Removes the paragraph metadata field at the current cursor, if any. + /// Returns true iff a paragraph metadata field was removed. + /// Currently there are two variants: signature and classification. + bool RemoveParagraphMetadataFieldAtCursor(); + + void Insert2(SwField const &, const bool bForceExpandHints); + + void UpdateOneField(SwField &); ///< One single field. + + size_t GetFieldTypeCount(SwFieldIds nResId = SwFieldIds::Unknown) const; + SwFieldType* GetFieldType(size_t nField, SwFieldIds nResId = SwFieldIds::Unknown) const; + SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName) const; + + void RemoveFieldType(size_t nField); + void RemoveFieldType(SwFieldIds nResId, const OUString& rName); + + void FieldToText( SwFieldType const * pType ); + + void ChangeAuthorityData(const SwAuthEntry* pNewData); + + /// Database information. + SwDBData const & GetDBData() const; + const SwDBData& GetDBDesc() const; + void ChgDBData(const SwDBData& SwDBData); + void ChangeDBFields( const std::vector<OUString>& rOldNames, + const OUString& rNewName ); + void GetAllUsedDB( std::vector<OUString>& rDBNameList, + std::vector<OUString> const * pAllDBNames ); + + bool IsAnyDatabaseFieldInDoc()const; + + /// Check whether DB fields point to an available data source and returns it. + bool IsFieldDataSourceAvailable(OUString& rUsedDataSource) const; + void UpdateExpFields(bool bCloseDB = false);///< only every expression fields update + void LockExpFields(); + void UnlockExpFields(); + bool IsExpFieldsLocked() const; + + SwFieldUpdateFlags GetFieldUpdateFlags() const; + void SetFieldUpdateFlags( SwFieldUpdateFlags eFlags ); + + /// For evaluation of DB fields (new DB-manager). + SwDBManager* GetDBManager() const; + + SwFieldType* InsertFieldType(const SwFieldType &); + + /// Changes in document? + bool IsModified() const; + void SetModified(); + void ResetModified(); + void SetUndoNoResetModified(); + + /// Document - Statistics + void UpdateDocStat(); + const SwDocStat &GetUpdatedDocStat(); + + void Insert(const SwTOXMark& rMark); + + void DeleteTOXMark(SwTOXMark const * pMark); + + /// Get all marks at current SPoint. + void GetCurTOXMarks(SwTOXMarks& rMarks) const ; + + /// Insert content table. Renew if required. + void InsertTableOf(const SwTOXBase& rTOX, + const SfxItemSet* pSet = nullptr); + void UpdateTableOf(const SwTOXBase& rTOX, + const SfxItemSet* pSet = nullptr); + const SwTOXBase* GetCurTOX() const; + const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate = false ); + void SetDefaultTOXBase(const SwTOXBase& rBase); + + static bool IsTOXBaseReadonly(const SwTOXBase& rTOXBase); + void SetTOXBaseReadonly(const SwTOXBase& rTOXBase, bool bReadonly); + + sal_uInt16 GetTOXCount() const; + const SwTOXBase* GetTOX( sal_uInt16 nPos ) const; + bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ); + + /// After reading file update all content tables. + void SetUpdateTOX( bool bFlag ); + bool IsUpdateTOX() const; + + /// Manage types of content tables. + sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const; + const SwTOXType* GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const; + void InsertTOXType(const SwTOXType& rTyp); + + /// AutoMark file + OUString const & GetTOIAutoMarkURL() const; + void SetTOIAutoMarkURL(const OUString& rSet); + void ApplyAutoMark(); + + /// Key for managing index. + void GetTOIKeys( SwTOIKeyType eTyp, std::vector<OUString>& rArr ) const; + + void SetOutlineNumRule(const SwNumRule&); + const SwNumRule* GetOutlineNumRule() const; + + bool OutlineUpDown( short nOffset = 1 ); + + bool MoveOutlinePara( SwOutlineNodes::difference_type nOffset ); + + bool IsProtectedOutlinePara() const; + + const SwNumRule* GetNumRuleAtCurrCursorPos() const; + + /** Returns the numbering rule found at the paragraphs of the current selection, + if all paragraphs of the current selection have the same or none numbering rule applied. */ + const SwNumRule* GetNumRuleAtCurrentSelection() const; + + /** Optional parameter <bResetIndentAttrs> (default value false). + If <bResetIndentAttrs> equals true, the indent attributes "before text" + and "first line indent" are additionally reset at the current selection, + if the list style makes use of the new list level attributes. + Parameters <bCreateNewList> and <sContinuedListId> + <bCreateNewList> indicates, if a new list is created by applying the given list style. + If <bCreateNewList> equals false, <sContinuedListId> may contain the + list Id of a list, which has to be continued by applying the given list style */ + void SetCurNumRule( const SwNumRule&, + const bool bCreateNewList /*= false*/, + const OUString& sContinuedListId = OUString(), + const bool bResetIndentAttrs = false ); + + /// Paragraphs without enumeration but with indents. + void NoNum(); + + /// Delete, split enumeration list. + void DelNumRules(); + + void NumUpDown( bool bDown = true ); + + bool MoveParagraph( long nOffset = 1); + bool MoveNumParas( bool bUpperLower, bool bUpperLeft ); + + /// Switch on/off of numbering via Delete/Backspace. + bool NumOrNoNum(bool bDelete = false, bool bChkStart = true); + + // #i23726# + // #i90078# + /// Remove unused default parameter <nLevel> and <bRelative>. + // Adjust method name and parameter name + void ChangeIndentOfAllListLevels( sal_Int32 nDiff ); + // Adjust method name + void SetIndent(short nIndent, const SwPosition & rPos); + bool IsFirstOfNumRuleAtCursorPos() const; + + bool IsNoNum( bool bChkStart = true ) const; + + /** @return Num-Level of the node in which point of cursor is. + @return values can be: NO_NUMBERING, + 0..MAXLEVEL-1, NO_NUMLEVEL .. NO_NUMLEVEL|MAXLEVEL-1 */ + sal_uInt8 GetNumLevel() const; + + /// Detect highest and lowest level to check moving of outline levels. + void GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower ); + + /// Get Outline level of current paragraph. + int GetCurrentParaOutlineLevel( ) const; + + // i29560 + bool HasNumber() const; + bool HasBullet() const; + + bool SelectionHasNumber() const; + bool SelectionHasBullet() const; + + OUString GetUniqueNumRuleName() const; + void ChgNumRuleFormats( const SwNumRule& rRule ); + + /// Set (and query if) a numbering with StartFlag starts at current PointPos. + void SetNumRuleStart( bool bFlag, SwPaM* pCursor ); + bool IsNumRuleStart( SwPaM* pPaM = nullptr ) const; + void SetNodeNumStart( sal_uInt16 nStt ); + + sal_uInt16 GetNodeNumStart( SwPaM* pPaM ) const; + + void ReplaceNumRule( const OUString& rOldRule, const OUString& rNewRule ); + + /** Searches for a text node with a numbering rule. + in case a list style is found, <sListId> holds the list id, to which the + text node belongs, which applies the found list style. */ + const SwNumRule * SearchNumRule(const bool bNum, + OUString& sListId ); + + /** Undo. + Maintain UndoHistory in Document. + Reset UndoHistory at Save, SaveAs, Create ??? */ + void DoUndo( bool bOn = true ); + bool DoesUndo() const; + void DoGroupUndo( bool bUn ); + bool DoesGroupUndo() const; + void DelAllUndoObj(); + + /// Undo: set up Undo parenthesis, return nUndoId of this parenthesis. + SwUndoId StartUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr ); + + /// Closes parenthesis of nUndoId, not used by UI. + SwUndoId EndUndo( SwUndoId eUndoId = SwUndoId::EMPTY, const SwRewriter * pRewriter = nullptr ); + + bool GetLastUndoInfo(OUString *const o_pStr, + SwUndoId *const o_pId, + const SwView* pView = nullptr) const; + bool GetFirstRedoInfo(OUString *const o_pStr, + SwUndoId *const o_pId, + const SwView* pView = nullptr) const; + SwUndoId GetRepeatInfo(OUString *const o_pStr) const; + + /// is it forbidden to modify cursors via API calls? + bool CursorsLocked() const; + /// set selections to those contained in the UndoRedoContext + /// should only be called by sw::UndoManager! + void HandleUndoRedoContext(::sw::UndoRedoContext & rContext); + + void Undo(sal_uInt16 const nCount = 1); + void Redo(sal_uInt16 const nCount = 1); + void Repeat(sal_uInt16 const nCount); + + /// For all views of this document. + void StartAllAction(); + void EndAllAction(); + + /// To enable set up of StartActions and EndActions. + virtual void CalcLayout() override; + + /// Determine form of content. Return Type at CurrentCursor->SPoint. + sal_uInt16 GetCntType() const; + + /// Are there frames, footnotes, etc. + bool HasOtherCnt() const; + + /// Apply ViewOptions with Start-/EndAction. + virtual void ApplyViewOptions( const SwViewOption &rOpt ) override; + + /** Query text within selection. */ + void GetSelectedText( OUString &rBuf, + ParaBreakType nHndlParaBreak = ParaBreakType::ToBlank ); + + /** @return graphic, if CurrentCursor->Point() points to a SwGrfNode + (and mark is not set or points to the same graphic). */ + + const Graphic* GetGraphic( bool bWait = true ) const; + const GraphicObject* GetGraphicObj() const; + const GraphicAttr* GetGraphicAttr( GraphicAttr& rGA ) const; + + bool IsLinkedGrfSwapOut() const; + GraphicType GetGraphicType() const; + + const tools::PolyPolygon *GetGraphicPolygon() const; + void SetGraphicPolygon( const tools::PolyPolygon *pPoly ); + + /** If there's an automatic, not manipulated polygon at the selected + notxtnode, it has to be deleted, e.g. cause the object has changed. */ + void ClearAutomaticContour(); + + /// @return the size of a graphic in Twips if cursor is in a graphic. + bool GetGrfSize(Size&) const; + + /** @return name and filter of a graphic if the cursor is in a graphic, + else give a rap on the knuckles! + If a string-ptr != 0 return the respective name. */ + void GetGrfNms( OUString* pGrfName, OUString* pFltName, + const SwFlyFrameFormat* = nullptr ) const; + + /// Re-read if graphic is not ok. Current graphic is replaced by the new one. + void ReRead( const OUString& rGrfName, const OUString& rFltName, + const Graphic* pGraphic = nullptr ); + + /// Unique identification of object (for ImageMapDlg). + void *GetIMapInventor() const; + + // #i73788# + /// Remove default parameter, because method always called this default value. + Graphic GetIMapGraphic() const; ///< @return a graphic for all Flys! + const SwFlyFrameFormat* FindFlyByName( const OUString& rName ) const; + + /** @return a ClientObject, if CurrentCursor->Point() points to a SwOLENode + (and mark is neither set not pointint to same ClientObject) + else give rap on the knuckles. */ + svt::EmbeddedObjectRef& GetOLEObject() const; + + /// Is there an OLEObject with this name (SwFormat)? + bool HasOLEObj( const OUString &rName ) const; + + /// @return pointer to the data of the chart in which Cursr is. + void SetChartName( const OUString &rName ); + + /// Update content of all charts for table with given name. + void UpdateCharts( const OUString &rName ); + + OUString GetCurWord() const; + + /** Glossary from glossary document in current document. + Styles only if not already existent. */ + void InsertGlossary( SwTextBlocks& rGlossary, const OUString& ); + + /** Make current selection glossary and insert into glossary document + including styles. */ + sal_uInt16 MakeGlossary( SwTextBlocks& rToFill, const OUString& rName, + const OUString& rShortName, bool bSaveRelFile, + const OUString* pOnlyText ); + + /// Save complete content of doc as glossary. + sal_uInt16 SaveGlossaryDoc( SwTextBlocks& rGlossary, const OUString& rName, + const OUString& rShortName, + bool bSaveRelFile, + bool bOnlyText ); + + // Linguistics... + /// Save selections. + void HyphStart( SwDocPositions eStart, SwDocPositions eEnd ); + + /// restore selections. + void HyphEnd(); + css::uno::Reference< css::uno::XInterface> + HyphContinue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ); + + void HyphIgnore(); + + /// For Inserting SoftHyphen. Position is offset within the syllabificated word. + static void InsertSoftHyph( const sal_Int32 nHyphPos ); + + const SwTable& InsertTable( const SwInsertTableOptions& rInsTableOpts, ///< All + sal_uInt16 nRows, sal_uInt16 nCols, + const SwTableAutoFormat* pTAFormat = nullptr ); + + void InsertDDETable( const SwInsertTableOptions& rInsTableOpts, ///< HeadlineNoBorder + SwDDEFieldType* pDDEType, + sal_uInt16 nRows, sal_uInt16 nCols ); + + void UpdateTable(); + void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName ); + + SwFrameFormat *GetTableFormat(); + bool TextToTable( const SwInsertTableOptions& rInsTableOpts, ///< All + sal_Unicode cCh, + const SwTableAutoFormat* pTAFormat = nullptr ); + bool TableToText( sal_Unicode cCh ); + bool IsTextToTableAvailable() const; + + bool GetTableBoxFormulaAttrs( SfxItemSet& rSet ) const; + void SetTableBoxFormulaAttrs( const SfxItemSet& rSet ); + + bool IsTableBoxTextFormat() const; + OUString GetTableBoxText() const; + + TableChgMode GetTableChgMode() const; + void SetTableChgMode( TableChgMode eMode ); + + /// Split table at cursor position. + void SplitTable( SplitTable_HeadlineOption eMode ); + + /** Merge tables. + + Can Merge checks if Prev or Next are possible. + If pointer pChkNxtPrv is passed possible direction is given. */ + bool CanMergeTable( bool bWithPrev = true, bool* pChkNxtPrv = nullptr ) const; + bool MergeTable( bool bWithPrev ); + + /// Set up InsertDB as table Undo. + void AppendUndoForInsertFromDB( bool bIsTable ); + + /// Functions used for spell checking and text conversion. + + /// Save selections. + void SpellStart( SwDocPositions eStart, SwDocPositions eEnd, + SwDocPositions eCurr, SwConversionArgs *pConvArgs = nullptr ); + + /// Restore selections. + void SpellEnd( SwConversionArgs const *pConvArgs = nullptr, bool bRestoreSelection = true ); + css::uno::Any SpellContinue( + sal_uInt16* pPageCnt, sal_uInt16* pPageSt, + SwConversionArgs const *pConvArgs ); + + /** Spells on a sentence basis - the SpellPortions are needed + @return false if no error could be found. */ + bool SpellSentence(svx::SpellPortions& rToFill, bool bIsGrammarCheck ); + + /// Make SpellIter start with the current sentence when called next time. + static void PutSpellingToSentenceStart(); + + /// Moves the continuation position to the end of the currently checked sentence. + static void MoveContinuationPosToEndOfCheckedSentence(); + + /// Applies a changed sentence. + void ApplyChangedSentence(const svx::SpellPortions& rNewPortions, bool bRecheck); + + /// Check SwSpellIter data to see if the last sentence got grammar checked. + static bool HasLastSentenceGotGrammarChecked(); + + /// Is text conversion active somewhere else? + static bool HasConvIter(); + + /// Is hyphenation active somewhere else? + static bool HasHyphIter(); + + void HandleCorrectionError(const OUString& aText, SwPosition aPos, sal_Int32 nBegin, + sal_Int32 nLen, const Point* pPt, + SwRect& rSelectRect); + css::uno::Reference< css::linguistic2::XSpellAlternatives > + GetCorrection( const Point* pPt, SwRect& rSelectRect ); + + bool GetGrammarCorrection( css::linguistic2::ProofreadingResult /*out*/ &rResult, + sal_Int32 /*out*/ &rErrorPosInText, + sal_Int32 /*out*/ &rErrorIndexInResult, + css::uno::Sequence< OUString > /*out*/ &rSuggestions, + const Point* pPt, SwRect& rSelectRect ); + + static void IgnoreGrammarErrorAt( SwPaM& rErrorPosition ); + void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnd ); + + /// @return reference set in document according to given name. + const SwFormatRefMark* GetRefMark( const OUString& rName ) const; + + /** @return names of all references set in document. + If ArrayPointer == 0 then return only whether a RefMark is set in document. */ + sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const; + + /// Call AutoCorrect + void AutoCorrect( SvxAutoCorrect& rACorr, bool bInsertMode, + sal_Unicode cChar ); + OUString GetPrevAutoCorrWord(SvxAutoCorrect& rACorr); + + // We consider no more than 9 characters before the cursor, and they must not start in the + // middle of a word (leading spaces are OK) + std::vector<OUString> GetChunkForAutoText(); + + /// Set our styles according to the respective rules. + void AutoFormat( const SvxSwAutoFormatFlags* pAFlags ); + + static SvxSwAutoFormatFlags* GetAutoFormatFlags(); + static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *); + + /// Calculates selection. + OUString Calculate(); + + bool InsertURL( const SwFormatINetFormat& rFormat, const OUString& rStr, + bool bKeepSelection = false ); + void GetINetAttrs( SwGetINetAttrs& rArr ); + + OUString GetDropText( const sal_Int32 nChars ) const; + void ReplaceDropText( const OUString &rStr, SwPaM* pPaM = nullptr ); + + /** May an outline be moved or copied? + Check whether it's in text body, not in table, and not read-only (move). */ + bool IsOutlineMovable( SwOutlineNodes::size_type nIdx ) const; + bool IsOutlineCopyable( SwOutlineNodes::size_type nIdx ) const; + + sal_uInt16 GetLineCount(); + + /// Query and set footnote-text/number. Set... to current SSelection! + bool GetCurFootnote( SwFormatFootnote* pToFillFootnote = nullptr ); + bool SetCurFootnote( const SwFormatFootnote& rFillFootnote ); + bool HasFootnotes( bool bEndNotes = false ) const; + + size_t GetSeqFootnoteList( SwSeqFieldList& rList, bool bEndNotes = false ); + /// @return list of all footnotes and their first portions of text. + + SwSection const* InsertSection( + SwSectionData & rNewData, SfxItemSet const*const = nullptr ); + bool IsInsRegionAvailable() const; + const SwSection* GetCurrSection() const; + + /** @return current range like Cet CurrSection(). But this function iterates + also over frames and catches the range even if the cursor is positioned in + a footnote the reference of which is in a columned range. + If bOutOfTab is set, the range comprising the table is searched + and not an inner one. */ + SwSection* GetAnySection( bool bOutOfTab = false, const Point* pPt = nullptr ); + + size_t GetSectionFormatCount() const; + size_t GetSectionFormatPos(const SwSectionFormat&) const; + const SwSectionFormat& GetSectionFormat(size_t nFormat) const; + void DelSectionFormat( size_t nFormat); + void UpdateSection( size_t const nSect, SwSectionData &, + SfxItemSet const*const = nullptr); + bool IsAnySectionInDoc() const; + + OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const; + + /// Set attributes. + void SetSectionAttr(const SfxItemSet& rSet, SwSectionFormat* pSectFormat = nullptr); + + /** Search inside the cursor selection for full selected sections. + if any part of section in the selection @return 0. + if more than one in the selection return the count. */ + sal_uInt16 GetFullSelectedSectionCount() const; + + /** Special insert: Insert a new text node just before or after a section or + table, if the cursor is positioned at the start/end of said + section/table. The purpose of the method is to allow users to inert text + at certain 'impossible' position, e.g. before a table at the document + start or between to sections. */ + void DoSpecialInsert(); + bool CanSpecialInsert() const; + + /// Optimizing UI. + void SetNewDoc(); + + sfx2::LinkManager& GetLinkManager(); + inline const sfx2::LinkManager& GetLinkManager() const; + + /** Adjust left margin via object bar (similar to adjustment of numerations). + One can either change the margin "by" adding or subtracting a given + offset or set it "to" this position @param (bModulus = true). */ + bool IsMoveLeftMargin( bool bRight, bool bModulus = true ) const; + void MoveLeftMargin( bool bRight, bool bModulus = true ); + + /// Query NumberFormatter from document. + SvNumberFormatter* GetNumberFormatter(); + const SvNumberFormatter* GetNumberFormatter() const + { return const_cast<SwEditShell*>(this)->GetNumberFormatter(); } + + /// Interfaces for GlobalDocument. + bool IsGlobalDoc() const; + void SetGlblDocSaveLinks( bool bFlag ); + bool IsGlblDocSaveLinks() const; + void GetGlobalDocContent( SwGlblDocContents& rArr ) const; + void InsertGlobalDocContent( const SwGlblDocContent& rPos, + SwSectionData & rNew ); + bool InsertGlobalDocContent( const SwGlblDocContent& rPos, + const SwTOXBase& rTOX ); + bool InsertGlobalDocContent( const SwGlblDocContent& rPos ); + void DeleteGlobalDocContent( const SwGlblDocContents& rArr, + size_t nPos ); + bool MoveGlobalDocContent( const SwGlblDocContents& rArr , + size_t nFromPos, size_t nToPos, + size_t nNewPos ); + void GotoGlobalDocContent( const SwGlblDocContent& rPos ); + + /// For Redlining. + RedlineFlags GetRedlineFlags() const; + void SetRedlineFlags( RedlineFlags eMode ); + bool IsRedlineOn() const; + SwRedlineTable::size_type GetRedlineCount() const; + const SwRangeRedline& GetRedline( SwRedlineTable::size_type nPos ) const; + bool AcceptRedline( SwRedlineTable::size_type nPos ); + bool RejectRedline( SwRedlineTable::size_type nPos ); + bool AcceptRedlinesInSelection(); + bool RejectRedlinesInSelection(); + + /** Search Redline for this Data and @return position in array. + If not found, return SwRedlineTable::npos. */ + SwRedlineTable::size_type FindRedlineOfData( const SwRedlineData& ) const; + + /// Set comment to Redline at position. + bool SetRedlineComment( const OUString& rS ); + const SwRangeRedline* GetCurrRedline() const; + + /// Redline attributes have been changed. Updated views. + void UpdateRedlineAttr(); + + /// Compare two documents. + long CompareDoc( const SwDoc& rDoc ); + + /// Merge two documents. + long MergeDoc( const SwDoc& rDoc ); + + /// Footnote attributes global to document. + const SwFootnoteInfo& GetFootnoteInfo() const; + void SetFootnoteInfo(const SwFootnoteInfo& rInfo); + const SwEndNoteInfo& GetEndNoteInfo() const; + void SetEndNoteInfo(const SwEndNoteInfo& rInfo); + + const SwLineNumberInfo &GetLineNumberInfo() const; + void SetLineNumberInfo( const SwLineNumberInfo& rInfo); + + /// Labels: Synchronize ranges. + void SetLabelDoc( bool bFlag ); + bool IsLabelDoc() const; + + /// Interface for TextInputData - (for input of Japanese/Chinese chars.) + void CreateExtTextInput(LanguageType eInputLanguage); + OUString DeleteExtTextInput( bool bInsText = true); + void SetExtTextInputData( const CommandExtTextInputData& ); + + /// Returns true iff paragraph signature validation is enabled. + bool IsParagraphSignatureValidationEnabled() const { return m_bDoParagraphSignatureValidation; } + /// Enable/Disable paragraph signature validation and return the previous value. + bool SetParagraphSignatureValidation(const bool bEnable) + { + const bool bOldFlag = m_bDoParagraphSignatureValidation; + m_bDoParagraphSignatureValidation = bEnable; + return bOldFlag; + } + + /// Interface for access to AutoComplete-list. + static SwAutoCompleteWord& GetAutoCompleteWords(); + + /** @return a scaling factor of selected text. Used for the rotated + character attribute dialog. */ + sal_uInt16 GetScalingOfSelectedText() const; + + bool IsNbspRunNext() const { return m_bNbspRunNext; } + + /// Ctor/Dtor. + SwEditShell( SwDoc&, vcl::Window*, const SwViewOption *pOpt ); + + /// Copy-Constructor in disguise. + SwEditShell( SwEditShell&, vcl::Window* ); + virtual ~SwEditShell() override; + +private: + SwEditShell(const SwEditShell &) = delete; + const SwEditShell &operator=(const SwEditShell &) = delete; + + /* TODO: this flag may have to be invalidated / reset to false at various + * places if it was true and the edit cursor position changes. It's somehow + * overkill though because it can only be true if a NO-BREAK SPACE was + * inserted by the last DoAutoCorrect() call (in French language), any + * subsequent call will reset it anyway and just if the cursor is + * positioned behind "x :" and the next character inserted is not a space + * the existing nb-space will be removed. Bear this in mind if that problem + * arises. */ + bool m_bNbspRunNext; ///< NO-BREAK SPACE state flag passed to and maintained by SvxAutoCorrect::DoAutoCorrect() + bool m_bDoParagraphSignatureValidation; ///< Prevent nested calls of ValidateParagraphSignatures. +}; + +inline const sfx2::LinkManager& SwEditShell::GetLinkManager() const +{ return const_cast<SwEditShell*>(this)->GetLinkManager(); } + + /// Class for automated call of Start- and EndAction(). +class SwActContext { + SwEditShell & m_rShell; +public: + SwActContext(SwEditShell *pShell); + ~SwActContext() COVERITY_NOEXCEPT_FALSE; +}; + + /// Class for automated call of Start- and EndCursorMove(). +class SwMvContext { + SwEditShell & m_rShell; +public: + SwMvContext(SwEditShell *pShell); + ~SwMvContext() COVERITY_NOEXCEPT_FALSE; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/error.hrc b/sw/inc/error.hrc new file mode 100644 index 000000000..b2d55025c --- /dev/null +++ b/sw/inc/error.hrc @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_ERROR_HRC +#define INCLUDED_SW_INC_ERROR_HRC + +#include <svtools/ehdl.hxx> +#include <vcl/errcode.hxx> + +#include "swerror.h" + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +#define ERR_CODE( class, err ) ErrCode(ErrCodeArea::Sw, class, err.GetCode()) +#define WARN_CODE( class, err ) ErrCode(ErrCodeArea::Sw, class, err.GetCode()) + +const ErrMsgCode RID_SW_ERRHDL[] = +{ + // Import-Errors + { NC_("RID_SW_ERRHDL", "File format error found.") , ERR_SWG_FILE_FORMAT_ERROR }, + { NC_("RID_SW_ERRHDL", "Error reading file.") , ERR_SWG_READ_ERROR }, + { NC_("RID_SW_ERRHDL", "This is not a valid WinWord6 file.") , ERR_WW6_NO_WW6_FILE_ERR }, + { NC_("RID_SW_ERRHDL", "File format error found at $(ARG1)(row,col).") , ERR_FORMAT_ROWCOL }, + { NC_("RID_SW_ERRHDL", "This is not a valid WinWord97 file."), ERR_WW8_NO_WW8_FILE_ERR }, + { NC_("RID_SW_ERRHDL", "Format error discovered in the file in sub-document $(ARG1) at $(ARG2)(row,col)."), ERR_FORMAT_FILE_ROWCOL }, + // Export-Errors + { NC_("RID_SW_ERRHDL", "Error writing file.") , ERR_SWG_WRITE_ERROR }, + { NC_("RID_SW_ERRHDL", "Wrong AutoText document version.") , ERR_SWG_OLD_GLOSSARY }, + { NC_("RID_SW_ERRHDL", "Error in writing sub-document $(ARG1)."), ERR_WRITE_ERROR_FILE }, + // Import-/Export-Errors + { NC_("RID_SW_ERRHDL", "Internal error in %PRODUCTNAME Writer file format.") , ERR_CODE ( ErrCodeClass::Read , ERR_SWG_INTERNAL_ERROR ) }, + { NC_("RID_SW_ERRHDL", "Internal error in %PRODUCTNAME Writer file format.") , ERR_CODE ( ErrCodeClass::Write , ERR_SWG_INTERNAL_ERROR ) }, + { NC_("RID_SW_ERRHDL", "$(ARG1) has changed.") , ERR_TXTBLOCK_NEWFILE_ERROR }, + { NC_("RID_SW_ERRHDL", "$(ARG1) does not exist.") , ERR_AUTOPATH_ERROR }, + { NC_("RID_SW_ERRHDL", "Cells cannot be further split.") , ERR_TBLSPLIT_ERROR }, + { NC_("RID_SW_ERRHDL", "Additional columns cannot be inserted.") , ERR_TBLINSCOL_ERROR }, + { NC_("RID_SW_ERRHDL", "The structure of a linked table cannot be modified.") , ERR_TBLDDECHG_ERROR }, + + { NC_("RID_SW_ERRHDL", "Not all attributes could be read.") , WARN_CODE ( ErrCodeClass::Read , WARN_SWG_FEATURES_LOST ) }, + { NC_("RID_SW_ERRHDL", "Not all attributes could be recorded.") , WARN_CODE ( ErrCodeClass::Write , WARN_SWG_FEATURES_LOST ) }, + { NC_("RID_SW_ERRHDL", "Document could not be completely saved.") , WARN_SWG_POOR_LOAD }, + { NC_("RID_SW_ERRHDL", "This HTML document contains Basic macros.\nThey were not saved with the current export settings."), WARN_SWG_HTML_NO_MACROS }, + { NC_("RID_SW_ERRHDL", "Error in writing sub-document $(ARG1)."), WARN_WRITE_ERROR_FILE }, + { NC_("RID_SW_ERRHDL", "Format error discovered in the file in sub-document $(ARG1) at $(ARG2)(row,col)."), WARN_FORMAT_FILE_ROWCOL }, + { nullptr, ERRCODE_NONE } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx new file mode 100644 index 000000000..95673e62b --- /dev/null +++ b/sw/inc/expfld.hxx @@ -0,0 +1,410 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_EXPFLD_HXX +#define INCLUDED_SW_INC_EXPFLD_HXX + +#include "swdllapi.h" +#include "fldbas.hxx" +#include "cellfml.hxx" +#include <set> +#include <memory> +#include <vector> +#include <tools/solar.h> +#include <o3tl/sorted_vector.hxx> + +class SfxPoolItem; +class SwTextNode; +class SwFrame; +class SwRootFrame; +struct SwPosition; +class SwTextField; +class SwDoc; +class SwFormatField; +class SetGetExpFields; +class SwEditShell; + +/// Forward declaration: get "BodyTextNode" for exp.fld in Fly's headers/footers/footnotes. +const SwTextNode* GetBodyTextNode( const SwDoc& pDoc, SwPosition& rPos, + const SwFrame& rFrame ); + +OUString ReplacePoint(const OUString& sTmpName, bool bWithCommandType = false); + +struct SeqFieldLstElem +{ + OUString sDlgEntry; + sal_uInt16 nSeqNo; + + SeqFieldLstElem( const OUString& rStr, sal_uInt16 nNo ) + : sDlgEntry( rStr ), nSeqNo( nNo ) + {} +}; + +class SW_DLLPUBLIC SwSeqFieldList +{ + std::vector<SeqFieldLstElem> maData; +public: + bool InsertSort(SeqFieldLstElem aNew); + bool SeekEntry(const SeqFieldLstElem& rNew, size_t* pPos) const; + + size_t Count() { return maData.size(); } + SeqFieldLstElem& operator[](size_t nIndex) { return maData[nIndex]; } + const SeqFieldLstElem& operator[](size_t nIndex) const { return maData[nIndex]; } + void Clear() { maData.clear(); } +}; + +class SAL_DLLPUBLIC_RTTI SwGetExpFieldType final : public SwValueFieldType +{ +public: + SwGetExpFieldType(SwDoc* pDoc); + virtual std::unique_ptr<SwFieldType> Copy() const override; + + /** Overlay, because get-field cannot be changed and therefore + does not need to be updated. Update at changing of set-values! */ +private: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) override; +}; + +class SW_DLLPUBLIC SwGetExpField final : public SwFormulaField +{ + double m_fValueRLHidden; ///< SwValueField; hidden redlines + OUString m_sExpand; + OUString m_sExpandRLHidden; ///< hidden redlines + bool m_bIsInBodyText; + sal_uInt16 m_nSubType; + + bool m_bLateInitialization; // #i82544# + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + using SwFormulaField::GetValue; // hide it, don't use + virtual void SetValue(const double& rVal) override; // hide it + +public: + SwGetExpField( SwGetExpFieldType*, const OUString& rFormel, + sal_uInt16 nSubType, sal_uLong nFormat); + + double GetValue(SwRootFrame const* pLayout) const; + void SetValue(const double& rVal, SwRootFrame const* pLayout); + + virtual void SetLanguage(LanguageType nLng) override; + + void ChgExpStr(const OUString& rExpand, SwRootFrame const* pLayout); + + /// Called by formatting. + inline bool IsInBodyText() const; + + /// Set by UpdateExpFields where node position is known. + inline void ChgBodyTextFlag( bool bIsInBody ); + + /** For fields in header/footer/footnotes/flys: + Only called by formatting!! */ + void ChangeExpansion( const SwFrame&, const SwTextField& ); + + virtual OUString GetFieldName() const override; + + /// Change formula. + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nType) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; + + static sal_Int32 GetReferenceTextPos( const SwFormatField& rFormat, SwDoc& rDoc, sal_Int32 nHint = 0); + // #i82544# + void SetLateInitialization() { m_bLateInitialization = true;} +}; + + /// Called by formatting. +inline bool SwGetExpField::IsInBodyText() const + { return m_bIsInBodyText; } + + /// Set by UpdateExpFields where node position is known. +inline void SwGetExpField::ChgBodyTextFlag( bool bIsInBody ) + { m_bIsInBodyText = bIsInBody; } + +class SwSetExpField; + +class SW_DLLPUBLIC SwSetExpFieldType final : public SwValueFieldType +{ + OUString m_sName; + OUString m_sDelim; + sal_uInt16 m_nType; + sal_uInt8 m_nLevel; + bool m_bDeleted; + + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) override; + +public: + SwSetExpFieldType( SwDoc* pDoc, const OUString& rName, + sal_uInt16 nType = nsSwGetSetExpType::GSE_EXPR ); + virtual std::unique_ptr<SwFieldType> Copy() const override; + virtual OUString GetName() const override; + + inline void SetType(sal_uInt16 nTyp); + inline sal_uInt16 GetType() const; + + void SetSeqFormat(sal_uLong nFormat); + sal_uLong GetSeqFormat() const; + + bool IsDeleted() const { return m_bDeleted; } + void SetDeleted( bool b ) { m_bDeleted = b; } + + /// Overlay, because set-field takes care for its being updated by itself. + inline const OUString& GetSetRefName() const; + + void SetSeqRefNo( SwSetExpField& rField ); + + size_t GetSeqFieldList(SwSeqFieldList& rList, SwRootFrame const* pLayout); + + /// Number sequence fields chapterwise if required. + const OUString& GetDelimiter() const { return m_sDelim; } + void SetDelimiter( const OUString& s ) { m_sDelim = s; } + sal_uInt8 GetOutlineLvl() const { return m_nLevel; } + void SetOutlineLvl( sal_uInt8 n ) { m_nLevel = n; } + void SetChapter(SwSetExpField& rField, const SwNode& rNd, SwRootFrame const* pLayout); + + virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +inline void SwSetExpFieldType::SetType( sal_uInt16 nTyp ) +{ + m_nType = nTyp; + EnableFormat( !(m_nType & (nsSwGetSetExpType::GSE_SEQ|nsSwGetSetExpType::GSE_STRING))); +} + +inline sal_uInt16 SwSetExpFieldType::GetType() const + { return m_nType; } + +inline const OUString& SwSetExpFieldType::GetSetRefName() const + { return m_sName; } + +class SW_DLLPUBLIC SwSetExpField : public SwFormulaField +{ + double m_fValueRLHidden; ///< SwValueField; hidden redlines + OUString msExpand; + OUString msExpandRLHidden; ///< hidden redlines + OUString maPText; + bool mbInput; + sal_uInt16 mnSeqNo; + sal_uInt16 mnSubType; + SwFormatField * mpFormatField; /// pool item to which the SwSetExpField belongs + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + using SwFormulaField::GetValue; // hide it, don't use + virtual void SetValue(const double& rVal) override; // hide it + +public: + SwSetExpField(SwSetExpFieldType*, const OUString& rFormel, sal_uLong nFormat = 0); + + void SetFormatField(SwFormatField & rFormatField); + SwFormatField* GetFormatField() { return mpFormatField;} + + double GetValue(SwRootFrame const* pLayout) const; + void SetValue(const double& rVal, SwRootFrame const* pLayout); + + const OUString& GetExpStr(SwRootFrame const* pLayout) const; + + void ChgExpStr(const OUString& rExpand, SwRootFrame const* pLayout); + + inline void SetPromptText(const OUString& rStr); + inline const OUString& GetPromptText() const; + + inline void SetInputFlag(bool bInp); + inline bool GetInputFlag() const; + + virtual OUString GetFieldName() const override; + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nType) override; + + inline bool IsSequenceField() const; + + /// Logical number, sequence fields. + void SetSeqNumber( sal_uInt16 n ) { mnSeqNo = n; } + sal_uInt16 GetSeqNumber() const { return mnSeqNo; } + + /// Query name only. + virtual OUString GetPar1() const override; + + /// Query formula. + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +inline void SwSetExpField::SetPromptText(const OUString& rStr) + { maPText = rStr; } + +inline const OUString& SwSetExpField::GetPromptText() const + { return maPText; } + +inline void SwSetExpField::SetInputFlag(bool bInp) + { mbInput = bInp; } + +inline bool SwSetExpField::GetInputFlag() const + { return mbInput; } + +inline bool SwSetExpField::IsSequenceField() const + { return 0 != (nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(GetTyp())->GetType()); } + +class SAL_DLLPUBLIC_RTTI SwInputFieldType final : public SwFieldType +{ + SwDoc* mpDoc; +public: + SwInputFieldType( SwDoc* pDoc ); + + virtual std::unique_ptr<SwFieldType> Copy() const override; + + SwDoc* GetDoc() const { return mpDoc; } +}; + +class SW_DLLPUBLIC SwInputField final : public SwField +{ + mutable OUString maContent; + OUString maPText; + OUString maHelp; + OUString maToolTip; + sal_uInt16 mnSubType; + bool mbIsFormField; + + SwFormatField* mpFormatField; // attribute to which the <SwInputField> belongs to + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + // Accessing Input Field's content + const OUString& getContent() const { return maContent;} + +public: + /// Direct input via dialog; delete old value. + SwInputField( + SwInputFieldType* pFieldType, + const OUString& rContent, + const OUString& rPrompt, + sal_uInt16 nSubType, + sal_uLong nFormat = 0, + bool bIsFormField = true ); + virtual ~SwInputField() override; + + void SetFormatField( SwFormatField& rFormatField ); + SwFormatField* GetFormatField() { return mpFormatField;} + + // Providing new Input Field's content: + // Fill Input Field's content depending on <nSupType>. + void applyFieldContent( const OUString& rNewFieldContent ); + + bool isFormField() const; + + virtual OUString GetFieldName() const override; + + /// Content + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + + /// aPromptText + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + + const OUString& GetHelp() const; + void SetHelp(const OUString & rStr); + + const OUString& GetToolTip() const; + void SetToolTip(const OUString & rStr); + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nSub) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +// Sorted list of input fields and DropDown fields +class SwInputFieldList +{ +public: + SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst = false ); + ~SwInputFieldList(); + + size_t Count() const; + SwField* GetField(size_t nId); + + void GotoFieldPos(size_t nId); + void PushCursor(); + void PopCursor(); + + /** Put all that are new into SortList for updating. @return true if not empty. + (For Glossary: only update its input-fields). + Compare TmpLst with current fields. */ + bool BuildSortLst(); + +private: + SwEditShell* mpSh; + std::unique_ptr<SetGetExpFields> mpSrtLst; + o3tl::sorted_vector<const SwTextField*> maTmpLst; +}; + + /// Implementation in tblcalc.cxx. +class SwTableFieldType final : public SwValueFieldType +{ +public: + SwTableFieldType(SwDoc* pDocPtr); + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SwTableField final : public SwValueField, public SwTableFormula +{ + OUString m_sExpand; + sal_uInt16 m_nSubType; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + + /// Search TextNode containing the field. + virtual const SwNode* GetNodeOfFormula() const override; + + OUString GetCommand(); + +public: + SwTableField( SwTableFieldType*, const OUString& rFormel, + sal_uInt16 nSubType, sal_uLong nFormat); + + virtual void SetValue( const double& rVal ) override; + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nType) override; + + void ChgExpStr(const OUString& rStr) { m_sExpand = rStr; } + + void CalcField( SwTableCalcPara& rCalcPara ); + + virtual OUString GetFieldName() const override; + + /// The formula. + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override; +}; + +#endif // INCLUDED_SW_INC_EXPFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/extinput.hxx b/sw/inc/extinput.hxx new file mode 100644 index 000000000..c2fe02adb --- /dev/null +++ b/sw/inc/extinput.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_EXTINPUT_HXX +#define INCLUDED_SW_INC_EXTINPUT_HXX + +#include "pam.hxx" +#include <i18nlangtag/lang.h> +#include <vcl/commandevent.hxx> +#include <vector> + +class SwExtTextInput final : public SwPaM +{ + std::vector<ExtTextInputAttr> m_aAttrs; + OUString m_sOverwriteText; + bool m_bInsText : 1; + bool m_bIsOverwriteCursor : 1; + LanguageType m_eInputLanguage; +public: + SwExtTextInput( const SwPaM& rPam, Ring* pRing ); + virtual ~SwExtTextInput() override; + + void SetInputData( const CommandExtTextInputData& rData ); + const std::vector<ExtTextInputAttr>& GetAttrs() const { return m_aAttrs; } + void SetInsText( bool bFlag ) { m_bInsText = bFlag; } + bool IsOverwriteCursor() const { return m_bIsOverwriteCursor; } + void SetOverwriteCursor( bool bFlag ); + void SetLanguage(LanguageType eSet) { m_eInputLanguage = eSet;} + + SwExtTextInput* GetNext() { return static_cast<SwExtTextInput *>(GetNextInRing()); } + const SwExtTextInput* GetNext() const { return static_cast<SwExtTextInput const *>(GetNextInRing()); } + SwExtTextInput* GetPrev() { return static_cast<SwExtTextInput *>(GetPrevInRing()); } + const SwExtTextInput* GetPrev() const { return static_cast<SwExtTextInput const *>(GetPrevInRing()); } +}; + +#endif // INCLUDED_SW_INC_EXTINPUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx new file mode 100644 index 000000000..acca28559 --- /dev/null +++ b/sw/inc/fchrfmt.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FCHRFMT_HXX +#define INCLUDED_SW_INC_FCHRFMT_HXX + +#include <svl/poolitem.hxx> +#include "calbck.hxx" +#include "format.hxx" +#include "charfmt.hxx" + +class SwTextCharFormat; +class IntlWrapper; + +class SW_DLLPUBLIC SwFormatCharFormat final : public SfxPoolItem, public SwClient +{ + friend class SwTextCharFormat; + SwTextCharFormat* m_pTextAttribute; ///< My text attribute. + +public: + /// single argument ctors shall be explicit. + explicit SwFormatCharFormat( SwCharFormat *pFormat ); + virtual ~SwFormatCharFormat() override; + + /// @@@ public copy ctor, but no copy assignment? + SwFormatCharFormat( const SwFormatCharFormat& rAttr ); + +private: + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; + + /// @@@ public copy ctor, but no copy assignment? + SwFormatCharFormat & operator= (const SwFormatCharFormat &) = delete; +public: + + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatCharFormat* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetInfo( SfxPoolItem& rInfo ) const override; + + void SetCharFormat( SwFormat* pFormat ) + { + assert(!pFormat->IsDefault()); // expose cases that lead to use-after-free + pFormat->Add(this); + } + SwCharFormat* GetCharFormat() const { return const_cast<SwCharFormat*>(static_cast<const SwCharFormat*>(GetRegisteredIn())); } +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx new file mode 100644 index 000000000..741462379 --- /dev/null +++ b/sw/inc/fesh.hxx @@ -0,0 +1,823 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FESH_HXX +#define INCLUDED_SW_INC_FESH_HXX + +#include <com/sun/star/text/RelOrientation.hpp> + +#include <svx/svdobj.hxx> +#include "swdllapi.h" +#include "editsh.hxx" +#include "flyenum.hxx" + +#include <svx/svdtypes.hxx> +#include <sot/formats.hxx> +#include <rtl/ustring.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <comphelper/interfacecontainer2.hxx> + +#include <vector> +#include <memory> + +namespace editeng { class SvxBorderLine; } + +class SwFlyFrame; +class SwTabCols; +class SvxBrushItem; +class SvxFrameDirectionItem; +class SwTableAutoFormat; +class SwFrame; +class SwFormatFrameSize; +class SwFormatRowSplit; +class Outliner; +class SwFrameFormat; +struct SwSortOptions; +class SdrMarkList; +enum class RndStdIds; + +namespace svx +{ + class ISdrObjectFilter; +} +namespace com::sun::star::embed { class XEmbeddedObject; } + +// return values for GetFrameType() and GetSelFrameType(). +//! values can be combined via logical or +enum class FrameTypeFlags { + NONE = 0, + PAGE = 1, + HEADER = 2, + FOOTER = 4, + BODY = 8, + COLUMN = 16, + TABLE = 32, + FLY_FREE = 64, + FLY_ATCNT = 128, + FLY_INCNT = 256, + FOOTNOTE = 512, + FTNPAGE = 1024, + FLY_ANY = 2048, + DRAWOBJ = 4096, + COLSECT = 8192, + COLSECTOUTTAB = 16384 +}; +namespace o3tl +{ + template<> struct typed_flags<FrameTypeFlags> : is_typed_flags<FrameTypeFlags, 0x7fff> {}; +} + +//! values can be combined via logical or +enum class GotoObjFlags +{ + NONE = 0, + DrawControl = 1, + DrawSimple = 2, + DrawAny = DrawControl | DrawSimple, + FlyFrame = 4, + FlyGrf = 8, + FlyOLE = 16, + FlyAny = FlyOLE | FlyGrf | FlyFrame, + Any = FlyAny | DrawAny, +}; +namespace o3tl +{ + template<> struct typed_flags<GotoObjFlags> : is_typed_flags<GotoObjFlags, 31> {}; +} + +//! values can be combined via logical or +enum class FlyProtectFlags +{ + NONE = 0, + Content = 1, + Size = 2, + Pos = 4, + Parent = 8, ///< Check only parents. + Fixed = 16, /**< Only protection that cannot be withdrawn + e.g. by OLE-server; also relevant for dialog. */ +}; +namespace o3tl +{ + template<> struct typed_flags<FlyProtectFlags> : is_typed_flags<FlyProtectFlags, 31> {}; +} + +// For figuring out contents by position (D&D) +enum ObjCntType +{ + OBJCNT_NONE, + OBJCNT_FLY, + OBJCNT_GRF, + OBJCNT_OLE, + OBJCNT_SIMPLE, + OBJCNT_CONTROL, + OBJCNT_URLBUTTON, + + OBJCNT_GROUPOBJ, + OBJCNT_DONTCARE ///< Not determinable - different objects are selected. +}; + +//For GetAnyCurRect +enum class CurRectType +{ + Page, ///< Rect of current page. + PageCalc, ///< ... page will be formatted if required. + PagePrt, ///< Rect of current PrtArea of page. + Frame, ///< Rect of current frame. + FlyEmbedded, ///< Rect of current FlyFrame. + FlyEmbeddedPrt, ///< Rect of PrtArea of FlyFrame + Section, ///< Rect of current section. + SectionOutsideTable, ///< Rect of current section but outside of table. + SectionPrt, ///< Rect of current PrtArea of section. + HeaderFooter, ///< Rect of current header/footer + PagesArea ///< Rect covering the pages area +}; + +struct SwGetCurColNumPara +{ + const SwFrameFormat* pFrameFormat; + const SwRect* pPrtRect; + SwGetCurColNumPara() : pFrameFormat( nullptr ), pPrtRect( nullptr ) {} +}; + +enum class SwPasteSdr +{ + NONE = 0, + Insert = 1, + Replace = 2, + SetAttr = 3 +}; + +#define SW_ADD_SELECT 1 +#define SW_ENTER_GROUP 2 +#define SW_LEAVE_FRAME 4 +/// Allow SwFEShell::SelectObj() to select the TextBox of a shape. +#define SW_ALLOW_TEXTBOX 8 + +enum class SwMove +{ + UP = 0, + DOWN = 1, + LEFT = 2, + RIGHT = 3 +}; + +// return values for WhichMouseTabCol +enum class SwTab +{ + COL_NONE = 0, + COL_HORI = 1, + COL_VERT = 2, + ROW_HORI = 3, + ROW_VERT = 4, + SEL_HORI = 5, + SEL_HORI_RTL = 6, + ROWSEL_HORI = 7, + ROWSEL_HORI_RTL = 8, + COLSEL_HORI = 9, + SEL_VERT = 10, + ROWSEL_VERT = 11, + COLSEL_VERT = 12 +}; + +class SdrDropMarkerOverlay; +struct SwColCache; + +class SW_DLLPUBLIC SwFEShell : public SwEditShell +{ +private: + mutable std::unique_ptr<SwColCache> m_pColumnCache; + mutable std::unique_ptr<SwColCache> m_pRowCache; + std::unique_ptr<SdrDropMarkerOverlay> m_pChainTo; + std::unique_ptr<SdrDropMarkerOverlay> m_pChainFrom; + bool m_bCheckForOLEInCaption; + comphelper::OInterfaceContainerHelper2 m_aPasteListeners; + /// insert table rows or columns instead of overwriting the existing table cells + SwTable::SearchType m_eTableInsertMode; + /// table copied to the clipboard by the last private copy + bool m_bTableCopied; + + SAL_DLLPRIVATE SwFlyFrame *FindFlyFrame( const css::uno::Reference < css::embed::XEmbeddedObject >& ) const; + + /// Terminate actions for all shells and call ChangeLink. + SAL_DLLPRIVATE void EndAllActionAndCall(); + + SAL_DLLPRIVATE void ScrollTo( const Point &rPt ); + + SAL_DLLPRIVATE void ChangeOpaque( SdrLayerID nLayerId ); + + /** Used for mouse operations on a table: + @return a cell frame that is 'close' to rPt. */ + SAL_DLLPRIVATE const SwFrame *GetBox( const Point &rPt, bool* pbRow = nullptr, bool* pbCol = nullptr ) const; + + // 0 == not in any column. + SAL_DLLPRIVATE static sal_uInt16 GetCurColNum_( const SwFrame *pFrame, + SwGetCurColNumPara* pPara ); + + SAL_DLLPRIVATE void GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const; + SAL_DLLPRIVATE void GetTabRows_(SwTabCols &rToFill, const SwFrame *pBox) const; + + SAL_DLLPRIVATE bool ImpEndCreate(); + + /// Methods for copying of draw objects. + SAL_DLLPRIVATE bool CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt, + const Point& rInsPt, bool bIsMove, + bool bSelectInsert ); + + /// Get list of marked SdrObjects; + /// helper method for GetSelFrameType, IsSelContainsControl. + SAL_DLLPRIVATE const SdrMarkList* GetMarkList_() const; + + SAL_DLLPRIVATE bool CheckHeadline( bool bRepeat ) const; + + using SwEditShell::Copy; + +public: + + using SwEditShell::Insert; + + SwFEShell( SwDoc& rDoc, vcl::Window *pWin, const SwViewOption *pOpt ); + SwFEShell( SwEditShell& rShell, vcl::Window *pWin ); + virtual ~SwFEShell() override; + + /// Copy and Paste methods for internal clipboard. + void Copy( SwDoc* pClpDoc, const OUString* pNewClpText = nullptr ); + bool Paste( SwDoc* pClpDoc, bool bNestedTable = false ); + + /// Paste some pages into another doc - used in mailmerge. + void PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt16 nEndPage); + + /// Copy-Method for Drag&Drop + bool Copy( SwFEShell*, const Point& rSttPt, const Point& rInsPt, + bool bIsMove = false, bool bSelectInsert = true ); + + void SelectFlyFrame( SwFlyFrame& rFrame ); + + /// Is selected frame within another frame? + const SwFrameFormat* IsFlyInFly(); + + /** If an object has been given, exactly this object is selected + (instead of searching over position). */ + bool SelectObj( const Point& rSelPt, sal_uInt8 nFlag = 0, SdrObject *pObj = nullptr ); + void DelSelectedObj(); + + /** Move selection upwards or downwards (Z-Order). + TRUE = to top or bottom. + FALSE = run past one other. */ + void SelectionToTop ( bool bTop = true ); + void SelectionToBottom( bool bBottom = true ); + + SdrLayerID GetLayerId() const; ///< 1 Heaven, 0 Hell, SDRLAYER_NOTFOUND Ambiguous. + void SelectionToHeaven(); ///< Above document. + void SelectionToHell(); ///< Below document. + + /** The following two methods return enum SdrHdlKind. + Declared as int in order to spare including SVDRAW.HXX. */ + bool IsObjSelectable( const Point& rPt ); + /// Same as IsObjSelectable(), but return the object as well. + SdrObject* GetObjAt(const Point& rPt); + bool IsInsideSelectedObj( const Point& rPt ); ///< returns enum values + /** Test if there is a draw object at that position and if it should be selected. + The 'should' is aimed at Writer text fly frames which may be in front of + the draw object. */ + bool ShouldObjectBeSelected(const Point& rPt); + + bool MoveAnchor( SwMove nDir ); + + /** @return if Upper of frame at current position is section frame + Currently only used by the rules. To be replaced by something more + sophisticated one day. */ + bool IsDirectlyInSection() const; + + /** For return values see above FrameType. + pPt: Cursr or DocPos respectively; bStopAtFly: Stop at flys or continue over anchor. + Although (0,TRUE) is kind of a standard, the parameters are not defaulted here + in order to force more conscious use especially of bStopAtFly. */ + FrameTypeFlags GetFrameType( const Point *pPt, bool bStopAtFly ) const; + FrameTypeFlags GetSelFrameType() const; //Selection (Drawing) + + /** check whether selected frame contains a control; + * companion method to GetSelFrameType, used for preventing + * drag&drop of controls into header */ + bool IsSelContainsControl() const; + + static ObjCntType GetObjCntType( const SdrObject& rObj ); + ObjCntType GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const; + ObjCntType GetObjCntTypeOfSelection() const; + + /// For adjustment of PosAttr when anchor changes. + SwRect GetObjRect() const; + + /// For moving flys with keyboard. + SwRect GetFlyRect() const; + /** i#17567 - adjustments to allow negative vertical positions for fly frames anchored + to paragraph or to character. + i#18732 - adjustments for new option 'FollowTextFlow' + i#22341 - adjustments for new vertical alignment at top of line */ + void CalcBoundRect( SwRect& _orRect, + const RndStdIds _nAnchorId, + const sal_Int16 _eHoriRelOrient = css::text::RelOrientation::FRAME, + const sal_Int16 _eVertRelOrient = css::text::RelOrientation::FRAME, + const SwPosition* _pToCharContentPos = nullptr, + const bool _bFollowTextFlow = false, + bool _bMirror = false, + Point* _opRef = nullptr, + Size* _opPercent = nullptr, + const SwFormatFrameSize* pFormatFrameSize = nullptr ) const; + + /// Set size of draw objects. + void SetObjRect( const SwRect& rRect ); + + void BeginDrag( const Point *pPt, bool bProp ); + void Drag ( const Point *pPt, bool bProp ); + void EndDrag (); + void BreakDrag(); + + /// Methods for status line. + Point GetAnchorObjDiff() const; + Point GetObjAbsPos() const; + Size GetObjSize() const; + + /// SS for envelopes: get all page-bound objects and set them to new page. + void GetPageObjs( std::vector<SwFrameFormat*>& rFillArr ); + void SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr ); + + /// Show current selection (frame / draw object as required). + virtual void MakeSelVisible() override; + + /** @return FrameFormat of object that may be under Point. + Object does not become selected! */ + const SwFrameFormat* GetFormatFromObj( const Point& rPt, SwRect** pRectToFill = nullptr ) const; + + /// @return a format too, if the point is over the text of any fly. + const SwFrameFormat* GetFormatFromAnyObj( const Point& rPt ) const; + + /** Which Protection is set at selected object? */ + FlyProtectFlags IsSelObjProtected( FlyProtectFlags eType ) const; + + /** Deliver graphic in rName besides graphic name. If graphic is + linked give name with path. rbLink is TRUE if graphic is linked. */ + const Graphic *GetGrfAtPos( const Point &rDocPos, + OUString &rName, bool &rbLink ) const; + + OUString GetObjTitle() const; + void SetObjTitle( const OUString& rTitle ); + OUString GetObjDescription() const; + void SetObjDescription( const OUString& rDescription ); + + bool IsFrameSelected() const; + bool GetFlyFrameAttr( SfxItemSet &rSet ) const; + bool SetFlyFrameAttr( SfxItemSet &rSet ); + static SfxItemSet makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor); + void ResetFlyFrameAttr( const SfxItemSet* pSet ); + const SwFrameFormat *NewFlyFrame( const SfxItemSet &rSet, bool bAnchValid = false, + SwFrameFormat *pParent = nullptr ); + void SetFlyPos( const Point &rAbsPos); + Point FindAnchorPos( const Point &rAbsPos, bool bMoveIt = false ); + + /** Determines whether a frame or its environment is vertically formatted and right-to-left. + also determines, if frame or its environment is in Mongolian layout (vertical left-to-right) + - add output parameter <bVertL2R> */ + bool IsFrameVertical(const bool bEnvironment, bool& bRightToLeft, bool& bVertL2R) const; + + SwFrameFormat* GetSelectedFrameFormat() const; ///< If frame then frame style, else 0. + void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point const * pDocPos = nullptr ); ///< If frame then set frame style. + + // Get selected fly + SwFlyFrame* GetSelectedFlyFrame() const; + + // Get current fly in which the cursor is positioned + SwFlyFrame* GetCurrFlyFrame(const bool bCalcFrame = true) const; + + // Get selected fly, but if none Get current fly in which the cursor is positioned + SwFlyFrame* GetSelectedOrCurrFlyFrame() const; + + /// Find/delete fly containing the cursor. + SwFrameFormat* WizardGetFly(); + + /// Independent selecting of flys. + bool GotoNextFly( GotoObjFlags eType = GotoObjFlags::FlyAny ) + { return GotoObj( true, eType ); } + bool GotoPrevFly( GotoObjFlags eType = GotoObjFlags::FlyAny) + { return GotoObj( false, eType); } + + /// Iterate over flys - for Basic-collections. + size_t GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes = false ) const; + const SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes = false) const; + + std::vector<SwFrameFormat const*> GetFlyFrameFormats( + FlyCntType eType, bool bIgnoreTextBoxes); + + /// If a fly is selected, it draws cursor into the first ContentFrame. + const SwFrameFormat* SelFlyGrabCursor(); + + /// Get FlyFrameFormat; for UI macro linkage at Flys + const SwFrameFormat* GetFlyFrameFormat() const; + SwFrameFormat* GetFlyFrameFormat(); + + /** OLE. Server requires new size. Desired values are adjusted as frame attributes. + If the values are not allowed, the formatting clips and determines scaling. + See CalcAndSetScale(). + The @return value is the applied size. */ + Size RequestObjectResize( const SwRect &rRect, const css::uno::Reference < css::embed::XEmbeddedObject >& ); + + /// The layout has been changed, so the active object has to be moved after that + virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset ); + + /** Client for OleObject has to be up-to-date regarding scaling. + Implemented in WrtShell. + If a pointer is passed on a size, this is the object's current core-size. + Else the size is provided via GetCurFlyRect(). */ + virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj, + const SwRect *pFlyPrtRect = nullptr, + const SwRect *pFlyFrameRect = nullptr, + const bool bNoTextFramePrtAreaChanged = false ) = 0; + + /** Connect objects with ActivateWhenVisible at Paint. + Called by notxtfrm::Paint, implemented in wrtsh. */ + virtual void ConnectObj( svt::EmbeddedObjectRef&, + const SwRect &rPrt, + const SwRect &rFrame ) = 0; + + /// Check resize of OLE-Object. + bool IsCheckForOLEInCaption() const { return m_bCheckForOLEInCaption; } + void SetCheckForOLEInCaption( bool bFlag ) { m_bCheckForOLEInCaption = bFlag; } + + /// Set name at selected FlyFrame. + void SetFlyName( const OUString& rName ); + OUString GetFlyName() const; + + /// get reference to OLE object (if there is one) for selected FlyFrame + css::uno::Reference < css::embed::XEmbeddedObject > GetOleRef() const; + + /// Created unique name for frame. + OUString GetUniqueGrfName() const; + OUString GetUniqueOLEName() const; + OUString GetUniqueFrameName() const; + OUString GetUniqueShapeName() const; + + /// Jump to named Fly (graphic/OLE). + bool GotoFly( const OUString& rName, FlyCntType eType, + bool bSelFrame ); + + /// Position is a graphic with URL? + const SwFrameFormat* IsURLGrfAtPos( const Point& rPt, OUString* pURL = nullptr, + OUString *pTargetFrameName = nullptr, + OUString *pURLDescription = nullptr ) const; + + /** For Chain always connect Fly specified by format with that hit by point. + rRect contains rect of Fly (for its highlight). */ + SwChainRet Chainable( SwRect &rRect, const SwFrameFormat &rSource, const Point &rPt ) const; + SwChainRet Chain( SwFrameFormat &rSource, const Point &rPt ); + void Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest ); + void Unchain( SwFrameFormat &rFormat ); + void HideChainMarker(); + void SetChainMarker(); + + Size GetGraphicDefaultSize() const; + + /// Temporary work around for bug. + void CheckUnboundObjects(); + + /// Attention: Ambiguities if multiple selections. + bool GetObjAttr( SfxItemSet &rSet ) const; + void SetObjAttr( const SfxItemSet &rSet ); + + const SdrObject* GetBestObject( bool bNext, GotoObjFlags eType, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = nullptr ); + bool GotoObj( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny); + + /// Set DragMode (e.g. Rotate), but do nothing when frame is selected. + void SetDragMode( SdrDragMode eSdrDragMode ); + + // Get the current drag mode + SdrDragMode GetDragMode() const; + + // Start cropping the selected image + void StartCropImage(); + + // RotGrfFlyFrame: check if RotationMode is possible + bool IsRotationOfSwGrfNodePossible() const; + + size_t IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups. + bool IsObjSelected( const SdrObject& rObj ) const; + bool IsObjSameLevelWithMarked(const SdrObject* pObj) const; + const SdrMarkList* GetMarkList() const{ return GetMarkList_(); }; + + void EndTextEdit(); ///< Deletes object if required. + + /** Anchor type of selected object, RndStdIds::UNKNOWN if ambiguous or in case of frame selection. + Else RndStdIds::FLY_AT_PAGE or RndStdIds::FLY_AT_PARA. */ + RndStdIds GetAnchorId() const; + + /** Process of creating draw objects. At the beginning object type is passed. + At the end a Cmd can be passed. Here, SDRCREATE_RESTRAINTEND for end + or SdrCreateCmd::NextPoint for a polygon may be relevant. + After RESTRAINTEND the object is created and selected. + BreakCreate interrupts the process. In this case no object is selected. */ + bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const Point &rPos ); + bool BeginCreate( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, SdrInventor eObjInventor, const Point &); + void MoveCreate ( const Point &rPos ); + bool EndCreate ( SdrCreateCmd eSdrCreateCmd ); + void BreakCreate(); + bool IsDrawCreate() const; + void CreateDefaultShape( sal_uInt16 /*SdrObjKind ?*/ eSdrObjectKind, const tools::Rectangle& rRect, sal_uInt16 nSlotId); + + /// Functions for Rubberbox, ti select Draw-Objects + bool BeginMark( const Point &rPos ); + void MoveMark ( const Point &rPos ); + bool EndMark (); + + /// Create and destroy group, don't when frame is selected. + bool IsGroupSelected(); ///< Can be a mixed selection! + void GroupSelection(); ///< Afterwards the group is selected. + void UnGroupSelection(); /**< The individual objects are selected, but + it is possible that there are groups included. */ + + bool IsGroupAllowed() const; + bool IsUnGroupAllowed() const; + + void MirrorSelection( bool bHorizontal ); ///< Vertical if FALSE. + + /** frmatr.hxx. Here no enum because of dependencies. + bool value only for internal use! Anchor is newly set according + to current document position. Anchor is not re-set. */ + void ChgAnchor( RndStdIds eAnchorId, bool bSameOnly = false, + bool bPosCorr = true ); + + bool SetDrawingAttr( SfxItemSet &rSet ); + + /** Get selected DrawObj as graphics (MetaFile/Bitmap). + Return value indicates if it was converted. */ + bool GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf ) const; + + void Paste( SvStream& rStm, SwPasteSdr nAction, const Point* pPt ); + bool Paste( const Graphic &rGrf, const OUString& rURL ); + + comphelper::OInterfaceContainerHelper2& GetPasteListeners(); + + bool IsAlignPossible() const; + void SetCalcFieldValueHdl(Outliner* pOutliner); + + void Insert(const OUString& rGrfName, + const OUString& rFltName, + const Graphic* pGraphic, + const SfxItemSet* pFlyAttrSet ); + + /// Insertion of a drawing object which have to be already inserted in the DrawModel. + void InsertDrawObj( SdrObject& rDrawObj, + const Point& rInsertPosition ); + + void ReplaceSdrObj( const OUString& rGrfName, const Graphic* pGrf ); + + // --> #i972# + /** for starmath formulas anchored 'as char' it aligns it baseline to baseline + changing the previous vertical orientation */ + void AlignFormulaToBaseline( const css::uno::Reference < css::embed::XEmbeddedObject >& xObj ); + + /// aligns all formulas with anchor 'as char' to baseline + void AlignAllFormulasToBaseline(); + + /// Provide information about content situated closes to given Point. + Point GetContentPos( const Point& rPoint, bool bNext ) const; + + /// Convert document position into position relative to the current page. + Point GetRelativePagePosition(const Point& rDocPos); + + /// Hide or show layout-selection and pass call to CursorSh. + void ShellLoseFocus(); + void ShellGetFocus(); + + /// PageDescriptor-interface + void ChgCurPageDesc( const SwPageDesc& ); + size_t GetCurPageDesc( const bool bCalcFrame = true ) const; + size_t GetMousePageDesc( const Point &rPt ) const; + size_t GetPageDescCnt() const; + SwPageDesc* FindPageDescByName( const OUString& rName, + bool bGetFromPool = false, + size_t* pPos = nullptr ); + + const SwPageDesc& GetPageDesc( size_t i ) const; + void ChgPageDesc( size_t i, const SwPageDesc& ); + /** if inside all selection only one PageDesc, @return this. + Otherwise @return 0 pointer */ + const SwPageDesc* GetSelectedPageDescs() const; + + const SwRect& GetAnyCurRect( CurRectType eType, + const Point* pPt = nullptr, + const css::uno::Reference < css::embed::XEmbeddedObject >& = + css::uno::Reference < css::embed::XEmbeddedObject >() ) const; + + /// Page number of the page containing Point, O if no page. + sal_uInt16 GetPageNumber( const Point &rPoint ) const; + bool GetPageNumber( long nYPos, bool bAtCursorPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, OUString &rDisplay ) const; + + SwFlyFrameFormat* InsertObject( const svt::EmbeddedObjectRef&, + SfxItemSet* pFlyAttrSet ); + bool FinishOLEObj(); ///< Shutdown server. + + void GetTableAttr( SfxItemSet & ) const; + void SetTableAttr( const SfxItemSet & ); + + bool HasWholeTabSelection() const; + + /// Is content of a table cell or at least a table cell completely selected? + bool HasBoxSelection() const; + + void InsertRow( sal_uInt16 nCnt, bool bBehind ); + void InsertCol( sal_uInt16 nCnt, bool bBehind ); // 0 == at the end. + bool DeleteCol(); + void DeleteTable(); + bool DeleteRow(bool bCompleteTable = false); + + SwTable::SearchType GetTableInsertMode() const { return m_eTableInsertMode; } + void SetTableInsertMode( SwTable::SearchType eFlag ) { m_eTableInsertMode = eFlag; } + + bool GetTableCopied() { return m_bTableCopied; } + void SetTableCopied( bool bCopied ) { m_bTableCopied = bCopied; } + + bool DeleteTableSel(); ///< Current selection, may be whole table. + + TableMergeErr MergeTab(); /**< Merge selected parts of table */ + + /// Split cell vertically or horizontally. + void SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight ); + bool Sort(const SwSortOptions&); // sorting + + void SetRowHeight( const SwFormatFrameSize &rSz ); + + /// Pointer must be destroyed by caller != 0. + std::unique_ptr<SwFormatFrameSize> GetRowHeight() const; + + void SetRowSplit( const SwFormatRowSplit &rSz ); + std::unique_ptr<SwFormatRowSplit> GetRowSplit() const; + + void SetBoxAlign( sal_uInt16 nOrient ); + sal_uInt16 GetBoxAlign() const; ///< USHRT_MAX if ambiguous. + + bool BalanceRowHeight( bool bTstOnly, const bool bOptimize = false ); + + void SetTabBorders( const SfxItemSet& rSet ); + void GetTabBorders( SfxItemSet& rSet) const; + void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = nullptr); + + void SetTabBackground( const SvxBrushItem &rNew ); + void GetTabBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const; + + void SetBoxBackground( const SvxBrushItem &rNew ); + bool GetBoxBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous. + + void SetBoxDirection( const SvxFrameDirectionItem& rNew ); + bool GetBoxDirection( std::unique_ptr<SvxFrameDirectionItem>& rToFill ) const; ///< FALSE ambiguous. + + void SetRowBackground( const SvxBrushItem &rNew ); + bool GetRowBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous. + + SwTab WhichMouseTabCol( const Point &rPt ) const; + void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins. + void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly ); + void GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const; + void SetMouseTabCols( const SwTabCols &rNew, bool bCurRowOnly, + const Point &rPt ); + + /// pEnd will be used during MouseMove + bool SelTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag ); + + void GetTabRows( SwTabCols &rToFill ) const; + void SetTabRows( const SwTabCols &rNew, bool bCurColOnly ); + void GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const; + void SetMouseTabRows( const SwTabCols &rNew, bool bCurColOnly, const Point &rPt ); + + void ProtectCells(); /**< If a table selection exists it is destroyed in case + cursor is not allowed in readonly. */ + void UnProtectCells(); ///< Refers to table selection. + void UnProtectTables(); ///< Unprotect all tables in selection. + bool HasTableAnyProtection( const OUString* pTableName, + bool* pFullTableProtection ); + bool CanUnProtectCells() const; + + sal_uInt16 GetRowsToRepeat() const; + void SetRowsToRepeat( sal_uInt16 nNumOfRows ); + sal_uInt16 GetVirtPageNum() const; + + /** @return the number of table rows currently selected + if the selection start at the top of the table. */ + sal_uInt16 GetRowSelectionFromTop() const; + + bool IsInRepeatedHeadline() const { return CheckHeadline( true ); } + bool IsInHeadline() const { return CheckHeadline( false ); } + + void AdjustCellWidth( const bool bBalance, const bool bNoShrink ); + + /// Not allowed if only empty cells are selected. + bool IsAdjustCellWidthAllowed( bool bBalance = false ) const; + + /// Set table style of the current table. + bool SetTableStyle(const OUString& rStyleName); + bool SetTableStyle(const SwTableAutoFormat& rNew); + + /// Update the direct formatting according to the current table style. + /// @param pTableNode Table node to update. When nullptr, current cursor position is used. + /// @param bResetDirect Reset direct formatting that might be applied to the cells. + /// @param pStyleName new style to apply + bool UpdateTableStyleFormatting(SwTableNode *pTableNode = nullptr, bool bResetDirect = false, OUString const* pStyleName = nullptr); + + bool GetTableAutoFormat( SwTableAutoFormat& rGet ); + + void SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16 nDiff ); + + void GetAutoSum( OUString& rFormula ) const; + + /** Phy: real page count. + Virt: consider offset that may have been set by user. */ + sal_uInt16 GetPhyPageNum() const; + + void SetNewPageOffset( sal_uInt16 nOffset ); + void SetPageOffset( sal_uInt16 nOffset ); ///< Changes last page offset. + sal_uInt16 GetPageOffset() const; ///< @return last page offset. + + void InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator, + const OUString& rNumberSeparator, + const bool bBefore, const sal_uInt16 nId, + const OUString& rCharacterStyle, + const bool bCpyBrd ); + + /// The ruler needs some information too. + sal_uInt16 GetCurColNum( SwGetCurColNumPara* pPara = nullptr ) const; //0 == not in any column. + sal_uInt16 GetCurMouseColNum( const Point &rPt ) const; + size_t GetCurTabColNum() const; //0 == not in any table. + size_t GetCurMouseTabColNum( const Point &rPt ) const; + sal_uInt16 GetCurOutColNum() const; ///< Current outer column. + + bool IsColRightToLeft() const; + bool IsTableRightToLeft() const; + bool IsMouseTableRightToLeft( const Point &rPt ) const; + bool IsTableVertical() const; + + bool IsLastCellInRow() const; + + /// Width of current range for column-dialog. + long GetSectionWidth( SwFormat const & rFormat ) const; + + void GetConnectableFrameFormats + (SwFrameFormat & rFormat, const OUString & rReference, bool bSuccessors, + std::vector< OUString > & aPrevPageVec, + std::vector< OUString > & aThisPageVec, + std::vector< OUString > & aNextPageVec, + std::vector< OUString > & aRestVec); + + /** SwFEShell::GetShapeBackgrd + + method determines background color of the page the selected drawing + object is on and returns this color. + If no color is found, because no drawing object is selected or ..., + color COL_BLACK (default color on constructing object of class Color) + is returned. + + @returns an object of class Color + */ + Color GetShapeBackgrd() const; + + /** Is default horizontal text direction for selected drawing object right-to-left + + Because drawing objects only painted for each page only, the default + horizontal text direction of a drawing object is given by the corresponding + page property. + + @returns boolean, indicating, if the horizontal text direction of the + page, the selected drawing object is on, is right-to-left. + */ + bool IsShapeDefaultHoriTextDirR2L() const; + + void ParkCursorInTab(); + + SwTextNode * GetNumRuleNodeAtPos(const Point &rPot); + bool IsNumLabel( const Point &rPt, int nMaxOffset = -1 ); + + static bool IsVerticalModeAtNdAndPos( const SwTextNode& _rTextNode, + const Point& _rDocPos ); + + void ToggleHeaderFooterEdit( ); + static void SetLineEnds(SfxItemSet& rAttr, SdrObject const & rObj, sal_uInt16 nSlotId); + + SAL_DLLPRIVATE void ClearColumnRowCache(SwTabFrame const*); +}; + +void ClearFEShellTabCols(SwDoc & rDoc, SwTabFrame const*const pFrame); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/finalthreadmanager.hxx b/sw/inc/finalthreadmanager.hxx new file mode 100644 index 000000000..be73781e7 --- /dev/null +++ b/sw/inc/finalthreadmanager.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_SOURCE_CORE_INC_FINALTHREADMANAGER_HXX +#define INCLUDED_SW_SOURCE_CORE_INC_FINALTHREADMANAGER_HXX + +#include <sal/config.h> +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XJobManager.hpp> +#include <com/sun/star/frame/XTerminateListener2.hpp> +#include <o3tl/deleter.hxx> +#include <osl/mutex.hxx> +#include <list> +#include <memory> + +namespace com::sun::star::uno { class XComponentContext; } + +class CancelJobsThread; +class TerminateOfficeThread; +class SwPauseThreadStarting; + +class FinalThreadManager final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo, + css::util::XJobManager, + css::frame::XTerminateListener2 > +{ +public: + explicit FinalThreadManager(css::uno::Reference< css::uno::XComponentContext > const & context); + + // css::lang::XServiceInfo: + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString & ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // css::util::XJobManager: + virtual void SAL_CALL registerJob(const css::uno::Reference< css::util::XCancellable > & Job) override; + virtual void SAL_CALL releaseJob(const css::uno::Reference< css::util::XCancellable > & Job) override; + virtual void SAL_CALL cancelAllJobs() override; + + // css::frame::XTerminateListener2 + virtual void SAL_CALL cancelTermination( const css::lang::EventObject& Event ) override; + + // css::frame::XTerminateListener (inherited via css::frame::XTerminateListener2) + virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override; + virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override; + + // ::com::sun:star::lang::XEventListener (inherited via css::frame::XTerminateListener) + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + +private: + FinalThreadManager(FinalThreadManager const &) = delete; + void operator =(FinalThreadManager const &) = delete; + + virtual ~FinalThreadManager() override; + + void registerAsListenerAtDesktop(); + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + + osl::Mutex maMutex; + + std::list< css::uno::Reference< css::util::XCancellable > > maThreads; + std::unique_ptr<CancelJobsThread> mpCancelJobsThread; + TerminateOfficeThread* mpTerminateOfficeThread; + std::unique_ptr<SwPauseThreadStarting, o3tl::default_delete<SwPauseThreadStarting>> mpPauseThreadStarting; + + bool mbRegisteredAtDesktop; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx new file mode 100644 index 000000000..4f275e792 --- /dev/null +++ b/sw/inc/fldbas.hxx @@ -0,0 +1,491 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FLDBAS_HXX +#define INCLUDED_SW_INC_FLDBAS_HXX + +#include <i18nlangtag/lang.h> +#include "swdllapi.h" +#include "calbck.hxx" +#include "ndindex.hxx" + +#include <cppuhelper/weakref.hxx> +#include <editeng/svxenum.hxx> +#include <vector> +#include <climits> + +class SwDoc; +class SwField; +class SwFormatField; +class SwRootFrame; +class SvNumberFormatter; +class IDocumentRedlineAccess; +class SwGetRefField; +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::uno { class Any; } + +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +enum class SwFieldIds : sal_uInt16 { +/// For old documents the Field-Which IDs must be preserved !!! + Database, + User, + Filename, + DatabaseName, + Date, + Time, + PageNumber, + Author, + Chapter, + DocStat, + GetExp, // 10 + SetExp, + GetRef, + HiddenText, + Postit, + FixDate, + FixTime, + Reg, + VarReg, + SetRef, + Input, // 20 + Macro, + Dde, + Table, + HiddenPara, + DocInfo, + TemplateName, + DbNextSet, + DbNumSet, + DbSetNumber, + ExtUser, // 30 + RefPageSet, + RefPageGet, + Internet, + JumpEdit, + Script, + DateTime, + TableOfAuthorities, + CombinedChars, + Dropdown, + ParagraphSignature, // 40 + LAST = ParagraphSignature, + + Unknown = USHRT_MAX, // used as default value in some method calls +}; + +/// List of FieldTypes at UI. +enum class SwFieldTypesEnum : sal_uInt16 { + Begin, + Date = Begin, // 0 + Time, + Filename, + DatabaseName, + Chapter, + PageNumber, + DocumentStatistics, + Author, + Set, + Get, + Formel, // 10 + HiddenText, + SetRef, + GetRef, + DDE, + Macro, + Input, + HiddenParagraph, + DocumentInfo, + Database, + User, // 20 + Postit, + TemplateName, + Sequence, + DatabaseNextSet, + DatabaseNumberSet, + DatabaseSetNumber, + ConditionalText, + NextPage, + PreviousPage, + ExtendedUser, // 30 + FixedDate, + FixedTime, + SetInput, + UserInput, + SetRefPage, + GetRefPage, + Internet, + JumpEdit, + Script, + Authority, // 40 + CombinedChars, + Dropdown, + Custom, // Unused - necessary for alignment with aSwFields in fldmgr.cxx + ParagraphSignature, + LAST, + Unknown = USHRT_MAX // used by SwFieldMgr::GetCurTypeId +}; +enum SwAttrFieldType { + ATTR_NONE, + ATTR_DATEFLD, + ATTR_TIMEFLD, + ATTR_PAGENUMBERFLD, + ATTR_PAGECOOUNTFLD, + ATTR_BOOKMARKFLD, + ATTR_SETREFATTRFLD +}; +enum SwFileNameFormat { + FF_BEGIN, + FF_NAME = FF_BEGIN, + FF_PATHNAME, + FF_PATH, + FF_NAME_NOEXT, + FF_UI_NAME, + FF_UI_RANGE, + FF_END, + FF_FIXED = 0x8000 +}; + +enum SwVarFormat { + VVF_CMD = 0x0010, ///< Show command. + VVF_INVISIBLE = 0x0040, ///< Invisible. + VVF_XXP = 0x0400, ///< 1234% + VVF_XX_XXP = 0x0800, ///< 1.234,56% + VVF_CLEAR = 0x000f, + +// From here new formats: + VVF_SYS = 0x2000, ///< Format for numbers from system. + VVF_X = 0x2100, ///< 1234 + VVF_X_X = 0x2200, ///< 1234.5 + VVF_X_XX = 0x2300, ///< 1245.56 + VVF_XX_X = 0x2400, ///< 1.234.5 + VVF_XX_XX = 0x2500, ///< 1.234.56 + VVF_XX_XXX = 0x2600, ///< 1.234.567 + VVF_SYS_CUR = 0x2700, ///< Format for currency from system. + VVF_CUR_X = 0x2800, ///< EUR 1234 + VVF_CUR_XX_XX = 0x2900, ///< EUR 1234.56 EUR 1234.00 + VVF_CUR_XX_X0 = 0x2a00, ///< EUR 1234.56 EUR 1234.-- + VVF_X_CUR = 0x2b00, ///< 1234 EUR + VVF_XX_XX_CUR = 0x2c00, ///< 1234.56 EUR 1234.00 EUR + VVF_XX_X0_CUR = 0x2d00, ///< 1234.56 EUR 1234.-- EUR +/// Compatibility: + VF_CMD = VVF_CMD, + VF_INVISIBLE = VVF_INVISIBLE, + VF_XXP = VVF_XXP, + VF_XX_XXP = VVF_XX_XXP, + VF_VISIBLE = VVF_SYS, + VF_XX = VVF_X, + VF_XX_XX = VVF_XX_XX, + VF_XX_XX_CUR = VVF_SYS_CUR, + VF_CLEAR = VVF_CLEAR + +}; + +typedef sal_uInt16 SwGetSetExpType; +namespace nsSwGetSetExpType +{ +const SwGetSetExpType GSE_STRING = 0x0001; ///< String +const SwGetSetExpType GSE_EXPR = 0x0002; ///< Expression +const SwGetSetExpType GSE_SEQ = 0x0008; ///< Sequence +const SwGetSetExpType GSE_FORMULA = 0x0010; ///< Formula +} + +typedef sal_uInt16 SwExtendedSubType; +namespace nsSwExtendedSubType +{ +const SwExtendedSubType SUB_CMD = 0x0100; ///< Show command. +const SwExtendedSubType SUB_INVISIBLE = 0x0200; ///< Invisible. +const SwExtendedSubType SUB_OWN_FMT = 0x0400; ///< SwDBField: Don't accept formatting from database. +} + +enum SwInputFieldSubType { + INP_TXT = 0x01, + INP_USR = 0x02, + INP_VAR = 0x03 +}; + +enum SwUserType { + UF_STRING = 0x01, + UF_EXPR = 0x02 +}; + +enum SwDateTimeSubType { + FIXEDFLD = 1, + DATEFLD = 2, + TIMEFLD = 4 +}; + +/// General tools. +OUString FormatNumber(sal_uInt32 nNum, SvxNumType nFormat, LanguageType nLang = LANGUAGE_NONE); + +/** Instances of SwFields and those derived from it occur 0 to n times. + For each class there is one instance of the associated type class. + Base class of all field types is SwFieldType. */ + +class SW_DLLPUBLIC SwFieldType : public SwModify, public sw::BroadcasterMixin +{ + css::uno::WeakReference<css::beans::XPropertySet> m_wXFieldMaster; + + SwFieldIds m_nWhich; + + friend void FinitUI(); ///< In order to delete pointer! + static std::vector<OUString>* s_pFieldNames; + + static void GetFieldName_(); ///< Sets up FieldNames; fldmgr.cxx! + +protected: + /// Single argument ctors shall be explicit. + explicit SwFieldType( SwFieldIds nWhichId ); + +public: + + SAL_DLLPRIVATE css::uno::WeakReference<css::beans::XPropertySet> const& GetXObject() const { + return m_wXFieldMaster; + } + SAL_DLLPRIVATE void SetXObject(css::uno::Reference<css::beans::XPropertySet> const& xFieldMaster) { + m_wXFieldMaster = xFieldMaster; + } + + static OUString GetTypeStr( SwFieldTypesEnum nTypeId ); + + /// Only in derived classes. + virtual OUString GetName() const; + virtual std::unique_ptr<SwFieldType> Copy() const = 0; + virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const; + virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ); + + SwFieldIds Which() const { return m_nWhich; } + + inline void UpdateFields() const; + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; + SwFormatField* FindFormatForField(const SwField*) const; + SwFormatField* FindFormatForPostItId(sal_uInt32 nPostItId) const; + void CollectPostIts(std::vector<SwFormatField*>& rvFormatFields, IDocumentRedlineAccess const& rIDRA, bool HideRedlines); + bool HasHiddenInformationNotes(); + void GatherNodeIndex(std::vector<sal_uLong>& rvNodeIndex); + void GatherRefFields(std::vector<SwGetRefField*>& rvRFields, const sal_uInt16 nTyp); + void GatherFields(std::vector<SwFormatField*>& rvFormatFields, bool bCollectOnlyInDocNodes=true) const; +}; + +inline void SwFieldType::UpdateFields() const +{ + const_cast<SwFieldType*>(this)->ModifyNotification( nullptr, nullptr ); +} + +/** Base class of all fields. + Type of field is queried via Which. + Expanded content of field is queried via ExpandField(). */ +class SW_DLLPUBLIC SwField +{ +private: + mutable OUString m_Cache; ///< Cached expansion (for clipboard). + bool m_bUseFieldValueCache; /// control the usage of the cached field value + LanguageType m_nLang; ///< Always change via SetLanguage! + bool m_bIsAutomaticLanguage; + sal_uInt32 m_nFormat; /// this can be either SvxNumType or SwChapterFormat depending on the subtype + SwFieldType* m_pType; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const = 0; + virtual std::unique_ptr<SwField> Copy() const = 0; + +protected: + void SetFormat(sal_uInt32 const nSet) { + m_nFormat = nSet; + } + + SwField( SwFieldType* pTyp, + sal_uInt32 nFormat = 0, + LanguageType nLang = LANGUAGE_SYSTEM, + bool m_bUseFieldValueCache = true ); + +public: + virtual ~SwField(); + + SwField(SwField const &) = default; + SwField(SwField &&) = default; + SwField & operator =(SwField const &) = default; + SwField & operator =(SwField &&) = default; + + inline SwFieldType* GetTyp() const; + + /// Set new type (used for copying among documents). + virtual SwFieldType* ChgTyp( SwFieldType* ); + + /** expand the field. + @param bCached return cached field value. + @remark most callers should use the cached field value. + this is because various fields need special handing + (ChangeExpansion()) to return correct values, and only + SwTextFormatter::NewFieldPortion() sets things up properly. + @param pLayout the layout to use for expansion; there are a few + fields that expand differently via layout mode. + @return the generated text (suitable for display) + */ + OUString ExpandField(bool bCached, SwRootFrame const* pLayout) const; + + /// @return name or content. + virtual OUString GetFieldName() const; + + std::unique_ptr<SwField> CopyField() const; + + /// ResId + SwFieldIds Which() const +#ifdef DBG_UTIL + ; // implemented in fldbas.cxx +#else + { + return m_pType->Which(); + } +#endif + + // TYP_ID + SwFieldTypesEnum GetTypeId() const; + virtual sal_uInt16 GetSubType() const; + virtual void SetSubType(sal_uInt16); + + /// Language at field position. + inline LanguageType GetLanguage() const; + virtual void SetLanguage(LanguageType nLng); + + /// Query parameters for dialog and for BASIC. + inline sal_uInt32 GetFormat() const; + virtual OUString GetPar1() const; + virtual OUString GetPar2() const; + + virtual OUString GetFormula() const; + + void ChangeFormat(sal_uInt32 n); + virtual void SetPar1(const OUString& rStr); + virtual void SetPar2(const OUString& rStr); + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ); + + /// Does the field possess an action on its ClickHandler? (e.g. INetFields, ...). + bool HasClickHdl() const; + bool IsFixed() const; + + bool IsAutomaticLanguage() const { + return m_bIsAutomaticLanguage; + } + void SetAutomaticLanguage(bool const bSet) { + m_bIsAutomaticLanguage = bSet; + } + + virtual OUString GetDescription() const; + /// Is this field clickable? + bool IsClickable() const; + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +inline SwFieldType* SwField::GetTyp() const +{ + return m_pType; +} + +inline sal_uInt32 SwField::GetFormat() const +{ + return m_nFormat; +} + +inline LanguageType SwField::GetLanguage() const +{ + return m_nLang; +} + +/// Fields containing values that have to be formatted via number formatter. +class SwValueFieldType : public SwFieldType +{ +private: + SwDoc* m_pDoc; + bool m_bUseFormat; ///< Use number formatter. + +protected: + SwValueFieldType( SwDoc* pDocPtr, SwFieldIds nWhichId ); + SwValueFieldType( const SwValueFieldType& rTyp ); + +public: + SwDoc* GetDoc() const { + return m_pDoc; + } + void SetDoc(SwDoc* pNewDoc) { + m_pDoc = pNewDoc; + } + + bool UseFormat() const { + return m_bUseFormat; + } + void EnableFormat(bool bFormat = true) { + m_bUseFormat = bFormat; + } + + OUString ExpandValue(const double& rVal, sal_uInt32 nFormat, LanguageType nLng) const; + OUString DoubleToString(const double &rVal, LanguageType eLng) const; + OUString DoubleToString(const double &rVal, sal_uInt32 nFormat) const; +}; + +class SW_DLLPUBLIC SwValueField : public SwField +{ +private: + double m_fValue; + +protected: + SwValueField( SwValueFieldType* pFieldType, sal_uInt32 nFormat, LanguageType nLang = LANGUAGE_SYSTEM, const double fVal = 0.0 ); + SwValueField( const SwValueField& rField ); + +public: + virtual ~SwValueField() override; + + virtual SwFieldType* ChgTyp( SwFieldType* ) override; + virtual void SetLanguage(LanguageType nLng) override; + + SwDoc* GetDoc() const { + return static_cast<const SwValueFieldType*>(GetTyp())->GetDoc(); + } + + virtual double GetValue() const; + virtual void SetValue( const double& rVal ); + + OUString ExpandValue(const double& rVal, sal_uInt32 nFormat, LanguageType nLng) const { + return static_cast<SwValueFieldType*>(GetTyp())->ExpandValue(rVal, nFormat, nLng); + } + + static sal_uInt32 GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFormat); + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +class SW_DLLPUBLIC SwFormulaField : public SwValueField +{ +private: + OUString m_sFormula; + +protected: + SwFormulaField( SwValueFieldType* pFieldType, sal_uInt32 nFormat, const double fVal ); + SwFormulaField( const SwFormulaField& rField ); + +public: + virtual OUString GetFormula() const override; + void SetFormula(const OUString& rStr); + + void SetExpandedFormula(const OUString& rStr); + OUString GetExpandedFormula() const; +}; + +#endif // INCLUDED_SW_INC_FLDBAS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx new file mode 100644 index 000000000..66f13c98b --- /dev/null +++ b/sw/inc/flddat.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_FLDDAT_HXX +#define INCLUDED_SW_INC_FLDDAT_HXX + +#include <tools/solar.h> + +#include "fldbas.hxx" + +class DateTime; +class Date; +namespace tools { class Time; } + +enum SwDateSubFormat +{ + DATE_FIX, + DATE_VAR +}; + +class SAL_DLLPUBLIC_RTTI SwDateTimeFieldType final : public SwValueFieldType +{ +public: + SwDateTimeFieldType(SwDoc* pDoc); + + virtual std::unique_ptr<SwFieldType> Copy() const override; +}; + +class SW_DLLPUBLIC SwDateTimeField final : public SwValueField +{ + sal_uInt16 m_nSubType; + long m_nOffset; // Offset in minutes. + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD, + sal_uLong nFormat = 0, LanguageType nLng = LANGUAGE_SYSTEM); + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nSub) override; + + virtual double GetValue() const override; + + virtual void SetPar2(const OUString& rStr) override; + virtual OUString GetPar2() const override; + + void SetOffset(long nMinutes) { m_nOffset = nMinutes; } + long GetOffset() const { return m_nOffset; } + + Date GetDate() const; + tools::Time GetTime() const; + void SetDateTime(const DateTime& rDT); + static double GetDateTime(SwDoc* pDoc, const DateTime& rDT); + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override; +}; + +#endif // INCLUDED_SW_INC_FLDDAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/flddinf.hrc b/sw/inc/flddinf.hrc new file mode 100644 index 000000000..c9b1f3f6a --- /dev/null +++ b/sw/inc/flddinf.hrc @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_FLDDINF_HRC +#define INCLUDED_SW_INC_FLDDINF_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* FLD_SELECT[] = +{ + NC_("flddocinfopage|liststore1", "Author"), + NC_("flddocinfopage|liststore1", "Time"), + NC_("flddocinfopage|liststore1", "Date"), + NC_("flddocinfopage|liststore1", "Date Time Author"), +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/flddropdown.hxx b/sw/inc/flddropdown.hxx new file mode 100644 index 000000000..20ed29ac6 --- /dev/null +++ b/sw/inc/flddropdown.hxx @@ -0,0 +1,265 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FLDDROPDOWN_HXX +#define INCLUDED_SW_INC_FLDDROPDOWN_HXX + +#include <com/sun/star/uno/Sequence.h> +#include "swdllapi.h" +#include "fldbas.hxx" + +#include <vector> + +/** + Field type for dropdown boxes. +*/ +class SAL_DLLPUBLIC_RTTI SwDropDownFieldType final : public SwFieldType +{ +public: + /** + Constructor + */ + SwDropDownFieldType(); + + /** + Destructor + */ + virtual ~SwDropDownFieldType() override; + + /** + Create a copy of this field type. + + @return a copy of this type + */ + virtual std::unique_ptr<SwFieldType> Copy () const override; +}; + +/** + Dropdown field. + + The dropdown field contains a list of strings. At most one of them + can be selected. +*/ +class SW_DLLPUBLIC SwDropDownField final : public SwField +{ + /** + the possible values (aka items) of the dropdown box + */ + std::vector<OUString> aValues; + + /** + the selected item + */ + OUString aSelectedItem; + + /** + the name of the field + */ + OUString aName; + + /** + help text + */ + OUString aHelp; + + /** + tool tip string + */ + OUString aToolTip; + + /** + Expands the field. + + The expanded value of the field is the value of the selected + item. If no item is selected, an empty string is returned. + + @return the expanded value of the field + */ + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + + /** + Creates a copy of this field. + + @return the copy of this field + */ + virtual std::unique_ptr<SwField> Copy() const override; + +public: + /** + Constructor + + @param pTyp field type for this field + */ + SwDropDownField(SwFieldType * pTyp); + + /** + Copy constructor + + @param rSrc dropdown field to copy + */ + SwDropDownField(const SwDropDownField & rSrc); + + /** + Destructor + */ + virtual ~SwDropDownField() override; + + /** + Returns the selected value. + + @see Expand + + @return the selected value + */ + virtual OUString GetPar1() const override; + + /** + Returns the name of the field. + + @return the name of the field + */ + virtual OUString GetPar2() const override; + + /** + Sets the selected value. + + If rStr is an item of the field that item will be + selected. Otherwise no item will be selected, i.e. the + resulting selection will be empty. + */ + virtual void SetPar1(const OUString & rStr) override; + + /** + Sets the name of the field. + + @param rStr the new name of the field + */ + virtual void SetPar2(const OUString & rStr) override; + + /** + Sets the items of the dropdown box. + + After setting the items the selection will be empty. + + @param rItems the new items + */ + void SetItems(const std::vector<OUString> & rItems); + + /** + Sets the items of the dropdown box. + + After setting the items the selection will be empty. + + @param rItems the new items + */ + void SetItems(const css::uno::Sequence<OUString> & rItems); + + /** + Returns the items of the dropdown box. + + @return the items of the dropdown box + */ + css::uno::Sequence<OUString> GetItemSequence() const; + + /** + Returns the selected item. + + @return the selected item + */ + const OUString& GetSelectedItem() const { return aSelectedItem;} + + /** + Returns the name of the field. + + @return the name of the field + */ + const OUString& GetName() const { return aName;} + + /** + Returns the help text of the field. + + @return the help text of the field + */ + const OUString& GetHelp() const { return aHelp;} + + /** + Returns the tool tip of the field. + + @return the tool tip of the field + */ + const OUString& GetToolTip() const { return aToolTip;} + + /** + Sets the selected item. + + If rItem is found in this dropdown field it is selected. If + rItem is not found the selection will be empty. + + @param rItem the item to be set + */ + void SetSelectedItem(const OUString & rItem); + + /** + Sets the name of the field. + + @param rName the new name of the field + */ + void SetName(const OUString & rName); + + /** + Sets the help text of the field. + + @param rHelp the help text + */ + void SetHelp(const OUString & rHelp); + + /** + Sets the tool tip of the field. + + @param rToolTip the tool tip + */ + void SetToolTip(const OUString & rToolTip); + + /** + API: Gets a property value from the dropdown field. + + @param rVal return value + @param nMId + - FIELD_PROP_PAR1 Get selected item (String) + - FIELD_PROP_STRINGS Get all items (Sequence) + - FIELD_PROP_PAR3 Get the help text of the field. + - FIELD_PROP_PAR4 Get the tool tip of the field. + */ + virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const override; + + /** + API: Sets a property value on the dropdown field. + + @param rVal value to set + @param nMId + - FIELD_PROP_PAR1 Set selected item (String) + - FIELD_PROP_STRINGS Set all items (Sequence) + - FIELD_PROP_PAR3 Set the help text of the field. + - FIELD_PROP_PAR4 Set the tool tip of the field. + */ + virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fldref.hrc b/sw/inc/fldref.hrc new file mode 100644 index 000000000..9dca24fa8 --- /dev/null +++ b/sw/inc/fldref.hrc @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_FLDREF_HRC +#define INCLUDED_SW_INC_FLDREF_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* FLD_REF_PAGE_TYPES[] = +{ + NC_("fldrefpage|liststore1", "Bookmarks"), + NC_("fldrefpage|liststore1", "Footnotes"), + NC_("fldrefpage|liststore1", "Endnotes"), + NC_("fldrefpage|liststore1", "Headings"), + NC_("fldrefpage|liststore1", "Numbered Paragraphs"), +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fldupde.hxx b/sw/inc/fldupde.hxx new file mode 100644 index 000000000..6995b403d --- /dev/null +++ b/sw/inc/fldupde.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FLDUPDE_HXX +#define INCLUDED_SW_INC_FLDUPDE_HXX + +enum SwFieldUpdateFlags +{ + AUTOUPD_OFF, + AUTOUPD_FIELD_ONLY, + AUTOUPD_FIELD_AND_CHARTS, + AUTOUPD_GLOBALSETTING +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/flyenum.hxx b/sw/inc/flyenum.hxx new file mode 100644 index 000000000..469bb13ea --- /dev/null +++ b/sw/inc/flyenum.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_FLYENUM_HXX +#define INCLUDED_SW_INC_FLYENUM_HXX + +enum FlyCntType +{ + FLYCNTTYPE_ALL = 0, + FLYCNTTYPE_FRM, + FLYCNTTYPE_GRF, + FLYCNTTYPE_OLE + +}; + +// Return values for chainable and chain. +enum class SwChainRet +{ + OK = 0, + NOT_EMPTY = 1, ///< Only empty frames may be connected. + IS_IN_CHAIN = 2, ///< Destination already in chain. + WRONG_AREA = 3, /**< Destination in section where it shouldn't be + (header, footer). */ + NOT_FOUND = 4, ///< Destination and/or source not found. + SOURCE_CHAINED = 5, ///< Source already has a follow. + SELF = 6 ///< Self-chaining is not allowed. +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/flypos.hxx b/sw/inc/flypos.hxx new file mode 100644 index 000000000..933a9a30e --- /dev/null +++ b/sw/inc/flypos.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FLYPOS_HXX +#define INCLUDED_SW_INC_FLYPOS_HXX + +#include "swdllapi.h" +#include <memory> +#include <set> + +class SwFrameFormat; +class SwNodeIndex; + +/// For querying current flys in document. +class SAL_DLLPUBLIC_RTTI SwPosFlyFrame final +{ + const SwFrameFormat* m_pFrameFormat; ///< FlyFrameFormat + SwNodeIndex* m_pNodeIndex; ///< Index for node is sufficient. + sal_uInt32 m_nOrdNum; +public: + SwPosFlyFrame( const SwNodeIndex& , const SwFrameFormat*, sal_uInt16 nArrPos ); + virtual ~SwPosFlyFrame(); ///< Virtual for Writer (DLL !!) + + const SwFrameFormat& GetFormat() const { return *m_pFrameFormat; } + const SwNodeIndex& GetNdIndex() const { return *m_pNodeIndex; } + sal_uInt32 GetOrdNum() const { return m_nOrdNum; } +}; + +// define needed classes to safely handle an array of allocated SwPosFlyFrame(s). +// SwPosFlyFrames can be handled by value (as return value), only refcounts to +// contained SwPosFlyFrame* will be copied. When releasing the last SwPosFlyFramePtr +// instance the allocated instance will be freed. The array is sorted by +// GetNdIndex by using a std::set container. +typedef std::shared_ptr< SwPosFlyFrame > SwPosFlyFramePtr; +struct SwPosFlyFrameCmp { bool operator()(const SwPosFlyFramePtr& rA, const SwPosFlyFramePtr& rB) const; }; +typedef std::set< SwPosFlyFramePtr, SwPosFlyFrameCmp > SwPosFlyFrames; + +#endif // INCLUDED_SW_INC_FLYPOS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtanchr.hxx b/sw/inc/fmtanchr.hxx new file mode 100644 index 000000000..d04b2afcd --- /dev/null +++ b/sw/inc/fmtanchr.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTANCHR_HXX +#define INCLUDED_SW_INC_FMTANCHR_HXX + +#include "swdllapi.h" +#include "hintids.hxx" +#include "format.hxx" +#include <svl/poolitem.hxx> +#include <svx/swframetypes.hxx> + +#include <memory> + +struct SwPosition; +class IntlWrapper; + +/// FlyAnchors +class SW_DLLPUBLIC SwFormatAnchor: public SfxPoolItem +{ + std::unique_ptr<SwPosition> m_pContentAnchor; /**< 0 for page-bound frames. + Index for paragraph-bound frames. + Position for character-bound frames. */ + RndStdIds m_eAnchorId; + sal_uInt16 m_nPageNumber; ///< Page number for page-bound frames. + + /// #i28701# - getting anchor positions ordered + sal_uInt32 m_nOrder; + static sal_uInt32 m_nOrderCounter; + +public: + SwFormatAnchor( RndStdIds eRnd = RndStdIds::FLY_AT_PAGE, sal_uInt16 nPageNum = 0 ); + SwFormatAnchor( const SwFormatAnchor &rCpy ); + virtual ~SwFormatAnchor() override; + + SwFormatAnchor &operator=( const SwFormatAnchor& ); + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatAnchor* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + RndStdIds GetAnchorId() const { return m_eAnchorId; } + sal_uInt16 GetPageNum() const { return m_nPageNumber; } + const SwPosition *GetContentAnchor() const { return m_pContentAnchor.get(); } + // #i28701# + sal_uInt32 GetOrder() const { return m_nOrder;} + + void SetType( RndStdIds nRndId ) { m_eAnchorId = nRndId; } + void SetPageNum( sal_uInt16 nNew ) { m_nPageNumber = nNew; } + void SetAnchor( const SwPosition *pPos ); + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatAnchor &SwAttrSet::GetAnchor(bool bInP) const + { return Get(RES_ANCHOR, bInP); } + + inline const SwFormatAnchor &SwFormat::GetAnchor(bool bInP) const + { return m_aSet.GetAnchor(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtautofmt.hxx b/sw/inc/fmtautofmt.hxx new file mode 100644 index 000000000..5773bffd5 --- /dev/null +++ b/sw/inc/fmtautofmt.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTAUTOFMT_HXX +#define INCLUDED_SW_INC_FMTAUTOFMT_HXX + +#include "hintids.hxx" +#include <svl/poolitem.hxx> +#include <memory> + +class SAL_DLLPUBLIC_RTTI SwFormatAutoFormat final : public SfxPoolItem +{ + std::shared_ptr<SfxItemSet> mpHandle; + +public: + SwFormatAutoFormat( sal_uInt16 nWhich = RES_TXTATR_AUTOFMT ); + +public: + + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatAutoFormat* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + void SetStyleHandle( const std::shared_ptr<SfxItemSet>& pHandle ) { mpHandle = pHandle; } + const std::shared_ptr<SfxItemSet>& GetStyleHandle() const { return mpHandle; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtclbl.hxx b/sw/inc/fmtclbl.hxx new file mode 100644 index 000000000..9520f438e --- /dev/null +++ b/sw/inc/fmtclbl.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTCLBL_HXX +#define INCLUDED_SW_INC_FMTCLBL_HXX + +#include <svl/eitem.hxx> +#include "hintids.hxx" +#include "format.hxx" +#include "swdllapi.h" + +/// If text in multi-column sections should be evenly distributed. +class SW_DLLPUBLIC SwFormatNoBalancedColumns : public SfxBoolItem +{ +public: + SwFormatNoBalancedColumns( bool bFlag = false ) + : SfxBoolItem( RES_COLUMNBALANCE, bFlag ) {} + + /// "pure virtual methods" of SfxPoolItem + virtual SwFormatNoBalancedColumns* Clone( SfxItemPool *pPool = nullptr ) const override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatNoBalancedColumns &SwAttrSet::GetBalancedColumns(bool bInP) const + { return Get( RES_COLUMNBALANCE, bInP ); } + +inline const SwFormatNoBalancedColumns &SwFormat::GetBalancedColumns(bool bInP) const + { return m_aSet.GetBalancedColumns( bInP ); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx new file mode 100644 index 000000000..1828e5f11 --- /dev/null +++ b/sw/inc/fmtclds.hxx @@ -0,0 +1,173 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTCLDS_HXX +#define INCLUDED_SW_INC_FMTCLDS_HXX + +#include <editeng/borderline.hxx> +#include <tools/color.hxx> +#include <tools/solar.h> +#include <svl/poolitem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "format.hxx" + +#include <vector> + +/// ColumnDescriptor +class SwColumn +{ + sal_uInt16 m_nWish; /**< Desired width, borders included. + It is inversely proportional to the ratio of + desired width environment / current width column. */ + sal_uInt16 m_nLeft; ///< Left border. + sal_uInt16 m_nRight; ///< Right border. + +public: + SwColumn(); + + bool operator==( const SwColumn & ) const; + + void SetWishWidth( sal_uInt16 nNew ) { m_nWish = nNew; } + void SetLeft ( sal_uInt16 nNew ) { m_nLeft = nNew; } + void SetRight( sal_uInt16 nNew ) { m_nRight = nNew; } + + sal_uInt16 GetWishWidth() const { return m_nWish; } + sal_uInt16 GetLeft () const { return m_nLeft; } + sal_uInt16 GetRight() const { return m_nRight; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +typedef std::vector<SwColumn> SwColumns; + +enum SwColLineAdj +{ + COLADJ_NONE, + COLADJ_TOP, + COLADJ_CENTER, + COLADJ_BOTTOM +}; + +class SW_DLLPUBLIC SwFormatCol : public SfxPoolItem +{ + SvxBorderLineStyle m_eLineStyle; ///< style of the separator line + sal_uLong m_nLineWidth; ///< Width of the separator line. + Color m_aLineColor; ///< Color of the separator line. + + sal_uInt16 m_nLineHeight; /**< Percentile height of lines. + (Based on height of columns including UL). */ + + SwColLineAdj m_eAdj; ///< Line will be adjusted top, centered or bottom. + + SwColumns m_aColumns; ///< Information concerning the columns. + sal_uInt16 m_nWidth; ///< Total desired width of all columns. + sal_Int16 m_aWidthAdjustValue; + + bool m_bOrtho; /**< Only if this flag is set, the setting of GutterWidth will + be accompanied by a "visual rearrangement". + The flag must be reset if widths of columns or borders are changed. + When it is set (again) the visual arrangement is recalculated. + The flag is initially set. */ + + SAL_DLLPRIVATE void Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ); + +public: + SwFormatCol(); + SwFormatCol( const SwFormatCol& ); + virtual ~SwFormatCol() override; + //#i120133# + sal_Int16 GetAdjustValue() const { return m_aWidthAdjustValue; } + void SetAdjustValue( sal_Int16 n ) { m_aWidthAdjustValue = n; } + + SwFormatCol& operator=( const SwFormatCol& ); + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatCol* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + const SwColumns &GetColumns() const { return m_aColumns; } + SwColumns &GetColumns() { return m_aColumns; } + sal_uInt16 GetNumCols() const { return m_aColumns.size(); } + + SvxBorderLineStyle GetLineStyle() const { return m_eLineStyle;} + sal_uLong GetLineWidth() const { return m_nLineWidth;} + const Color& GetLineColor() const { return m_aLineColor;} + + SwColLineAdj GetLineAdj() const { return m_eAdj; } + bool IsOrtho() const { return m_bOrtho; } + sal_uInt16 GetWishWidth() const { return m_nWidth; } + sal_uInt8 GetLineHeight()const { return m_nLineHeight; } + + /** @return USHRT_MAX if ambiguous. + @return smallest width if bMin is true. */ + sal_uInt16 GetGutterWidth( bool bMin = false ) const; + + void SetLineStyle(SvxBorderLineStyle eStyle) { m_eLineStyle = eStyle;} + void SetLineWidth(sal_uLong nLWidth) { m_nLineWidth = nLWidth;} + void SetLineColor(const Color& rCol ) { m_aLineColor = rCol;} + void SetLineHeight( sal_uInt8 nNew ) { m_nLineHeight = nNew; } + void SetLineAdj( SwColLineAdj eNew ){ m_eAdj = eNew; } + void SetWishWidth( sal_uInt16 nNew ) { m_nWidth = nNew; } + + /** This function allows to (repeatedly) initialize the columns. + The Ortho flag is set automatically. */ + void Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct ); + + /** Adjusts borders for columns in aColumns. + If flag m_bOrtho is set, columns are visually re-arranged. + If the flag is not set, columns widths are not changed and + borders are adjusted. */ + void SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct ); + + /** This too re-arranges columns automatically if flag is set. + Only in this case the second parameter is needed and evaluated. */ + void SetOrtho( bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct ); + + /// For the reader + void SetOrtho_( bool bNew ) { m_bOrtho = bNew; } + + /** Calculates current width of column nCol. + The ratio of desired width of this column to return value is + proportional to ratio of total desired value to nAct. */ + sal_uInt16 CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const; + + /** As above except that it @return the width of PrtArea - + that corresponds to what constitutes the column for the user. */ + sal_uInt16 CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatCol &SwAttrSet::GetCol(bool bInP) const + { return Get( RES_COL,bInP); } + +inline const SwFormatCol &SwFormat::GetCol(bool bInP) const + { return m_aSet.GetCol(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtcnct.hxx b/sw/inc/fmtcnct.hxx new file mode 100644 index 000000000..e34299748 --- /dev/null +++ b/sw/inc/fmtcnct.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTCNCT_HXX +#define INCLUDED_SW_INC_FMTCNCT_HXX + +#include "hintids.hxx" +#include <svl/poolitem.hxx> +#include "format.hxx" +#include "calbck.hxx" +#include "frmfmt.hxx" + +class IntlWrapper; + +/// Connection (text flow) between two FlyFrames. +class SW_DLLPUBLIC SwFormatChain: public SfxPoolItem +{ + SwClient m_aPrev, ///< Previous SwFlyFrameFormat (if existent). + m_aNext; ///< Next SwFlyFrameFormat (if existent). + +public: + SwFormatChain() : SfxPoolItem( RES_CHAIN ) {} + SwFormatChain( const SwFormatChain &rCpy ); + + inline SwFormatChain &operator=( const SwFormatChain& ); + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatChain* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + + SwFlyFrameFormat* GetPrev() const { return const_cast<SwFlyFrameFormat*>(static_cast<const SwFlyFrameFormat*>(m_aPrev.GetRegisteredIn())); } + SwFlyFrameFormat* GetNext() const { return const_cast<SwFlyFrameFormat*>(static_cast<const SwFlyFrameFormat*>(m_aNext.GetRegisteredIn())); } + + void SetPrev( SwFlyFrameFormat *pFormat ); + void SetNext( SwFlyFrameFormat *pFormat ); +}; + +SwFormatChain &SwFormatChain::operator=( const SwFormatChain &rCpy ) +{ + SetPrev( rCpy.GetPrev() ); + SetNext( rCpy.GetNext() ); + return *this; +} + +inline const SwFormatChain &SwAttrSet::GetChain(bool bInP) const + { return Get( RES_CHAIN,bInP); } + +inline const SwFormatChain &SwFormat::GetChain(bool bInP) const + { return m_aSet.GetChain(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtcntnt.hxx b/sw/inc/fmtcntnt.hxx new file mode 100644 index 000000000..afb8ce66f --- /dev/null +++ b/sw/inc/fmtcntnt.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTCNTNT_HXX +#define INCLUDED_SW_INC_FMTCNTNT_HXX + +#include <memory> +#include <svl/poolitem.hxx> +#include "hintids.hxx" +#include "format.hxx" + +class SwNodeIndex; +class SwStartNode; + +/// Content, content of frame (header, footer, fly). +class SAL_DLLPUBLIC_RTTI SwFormatContent: public SfxPoolItem +{ + std::unique_ptr<SwNodeIndex> m_pStartNode; + + SwFormatContent &operator=( const SwFormatContent & ) = delete; + +public: + SwFormatContent( const SwStartNode* pStartNode = nullptr ); + SwFormatContent( const SwFormatContent &rCpy ); + virtual ~SwFormatContent() override; + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatContent* Clone( SfxItemPool* pPool = nullptr ) const override; + + const SwNodeIndex *GetContentIdx() const { return m_pStartNode.get(); } + void SetNewContentIdx( const SwNodeIndex *pIdx ); + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatContent &SwAttrSet::GetContent(bool bInP) const + { return Get( RES_CNTNT,bInP); } + +inline const SwFormatContent &SwFormat::GetContent(bool bInP) const + { return m_aSet.GetContent(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx new file mode 100644 index 000000000..cc612d48c --- /dev/null +++ b/sw/inc/fmtcol.hxx @@ -0,0 +1,234 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTCOL_HXX +#define INCLUDED_SW_INC_FMTCOL_HXX + +#include "swdllapi.h" +#include "format.hxx" +#include "hintids.hxx" +#include <rtl/ustring.hxx> +#include <tools/solar.h> + +#include <vector> +#include <memory> + +class SwAttrPool; +namespace sw{ class DocumentStylePoolManager; } + +class SAL_DLLPUBLIC_RTTI SwFormatColl : public SwFormat +{ +protected: + SwFormatColl( SwAttrPool& rPool, const char* pFormatName, + const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom, + sal_uInt16 nFormatWhich ) + : SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich ) + { SetAuto(false); } + + SwFormatColl( SwAttrPool& rPool, const OUString &rFormatName, + const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom, + sal_uInt16 nFormatWhich ) + : SwFormat( rPool, rFormatName, pWhichRanges, pDerFrom, nFormatWhich ) + { SetAuto(false); } + +private: + SwFormatColl(const SwFormatColl & ) = delete; + const SwFormatColl &operator=(const SwFormatColl &) = delete; +}; + +/// Represents the style of a paragraph. +class SW_DLLPUBLIC SwTextFormatColl: public SwFormatColl +{ + friend class SwDoc; + friend class ::sw::DocumentStylePoolManager; + + SwTextFormatColl(const SwTextFormatColl & rRef) = delete; + + bool mbStayAssignedToListLevelOfOutlineStyle; + + bool mbAssignedToOutlineStyle; + + SwTextFormatColl *mpNextTextFormatColl; + +protected: + + SwTextFormatColl( SwAttrPool& rPool, const char* pFormatCollName, + SwTextFormatColl* pDerFrom = nullptr, + sal_uInt16 nFormatWh = RES_TXTFMTCOLL ) + : SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh) + , mbStayAssignedToListLevelOfOutlineStyle(false) + , mbAssignedToOutlineStyle(false) + { + mpNextTextFormatColl = this; + } + + SwTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName, + SwTextFormatColl* pDerFrom, + sal_uInt16 nFormatWh = RES_TXTFMTCOLL ) + : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh) + , mbStayAssignedToListLevelOfOutlineStyle(false) + , mbAssignedToOutlineStyle(false) + { + mpNextTextFormatColl = this; + } + + /// To get UL- / LR- / FontHeight-changes. + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; + +public: + + + inline void SetNextTextFormatColl(SwTextFormatColl& rNext); + SwTextFormatColl& GetNextTextFormatColl() const { return *mpNextTextFormatColl; } + + bool IsAtDocNodeSet() const; + + void SetAttrOutlineLevel( int ); + int GetAttrOutlineLevel() const; + + // Return the list level of the Outline Style - the List Style for the + // outline numbering - + // to which the Paragraph Style is assigned. + int GetAssignedOutlineStyleLevel() const; + + bool IsAssignedToListLevelOfOutlineStyle() const + { + return mbAssignedToOutlineStyle; + } + + // If a Paragraph Style is assigned to list level N of the Outline Style, + // then its outline level - AttrOutlineLevel - is set to N+1 + void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel); + void DeleteAssignmentToListLevelOfOutlineStyle(); + + /** Override to recognize changes on the <SwNumRuleItem> and register/unregister + the paragragh style at the corresponding <SwNumRule> instance. */ + virtual bool SetFormatAttr( const SfxPoolItem& rAttr ) override; + virtual bool SetFormatAttr( const SfxItemSet& rSet ) override; + virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) override; + + /// Override <ResetAllFormatAttr()> to stay assigned to list level of outline style. + virtual sal_uInt16 ResetAllFormatAttr() override; + + bool StayAssignedToListLevelOfOutlineStyle() const + { + return mbStayAssignedToListLevelOfOutlineStyle; + } + + bool AreListLevelIndentsApplicable() const; + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +class SwGrfFormatColl final : public SwFormatColl +{ + friend class SwDoc; + + SwGrfFormatColl( SwAttrPool& rPool, const char* pFormatCollName, + SwGrfFormatColl* pDerFrom = nullptr ) + : SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange, + pDerFrom, RES_GRFFMTCOLL ) + {} + + SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName, + SwGrfFormatColl* pDerFrom ) + : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange, + pDerFrom, RES_GRFFMTCOLL ) + {} +}; + +// FEATURE::CONDCOLL +/// Conditional styles. +enum class Master_CollCondition +{ + NONE, + PARA_IN_LIST, + PARA_IN_OUTLINE, + PARA_IN_FRAME, + PARA_IN_TABLEHEAD, + PARA_IN_TABLEBODY, + PARA_IN_SECTION, + PARA_IN_FOOTNOTE, + PARA_IN_FOOTER, + PARA_IN_HEADER, + PARA_IN_ENDNOTE +}; + +class SW_DLLPUBLIC SwCollCondition final : public SwClient +{ + Master_CollCondition m_nCondition; + sal_uLong m_nSubCondition; + +public: + + SwCollCondition( SwTextFormatColl* pColl, Master_CollCondition nMasterCond, + sal_uLong nSubCond ); + virtual ~SwCollCondition() override; + + /// @@@ public copy ctor, but no copy assignment? + SwCollCondition( const SwCollCondition& rCpy ); +private: + /// @@@ public copy ctor, but no copy assignment? + SwCollCondition & operator= (const SwCollCondition &) = delete; +public: + + bool operator==( const SwCollCondition& rCmp ) const; + + Master_CollCondition GetCondition() const { return m_nCondition; } + sal_uLong GetSubCondition() const { return m_nSubCondition; } + + void SetCondition( Master_CollCondition nCond, sal_uLong nSubCond ); + SwTextFormatColl* GetTextFormatColl() const { return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn())); } + void RegisterToFormat( SwFormat& ); +}; + +using SwFormatCollConditions = std::vector<std::unique_ptr<SwCollCondition>>; + +class SW_DLLPUBLIC SwConditionTextFormatColl final : public SwTextFormatColl +{ + friend class SwDoc; + friend class ::sw::DocumentStylePoolManager; + + SwFormatCollConditions m_CondColls; + + SwConditionTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName, + SwTextFormatColl* pDerFrom ) + : SwTextFormatColl( rPool, rFormatCollName, pDerFrom, RES_CONDTXTFMTCOLL ) + {} + +public: + + virtual ~SwConditionTextFormatColl() override; + + const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const; + const SwFormatCollConditions& GetCondColls() const { return m_CondColls; } + void InsertCondition( const SwCollCondition& rCond ); + void RemoveCondition( const SwCollCondition& rCond ); + + void SetConditions( const SwFormatCollConditions& ); +}; + +// FEATURE::CONDCOLL +/// Inline implementations. +inline void SwTextFormatColl::SetNextTextFormatColl( SwTextFormatColl& rNext ) +{ + mpNextTextFormatColl = &rNext; +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtcolfunc.hxx b/sw/inc/fmtcolfunc.hxx new file mode 100644 index 000000000..2f4e70e07 --- /dev/null +++ b/sw/inc/fmtcolfunc.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTCOLFUNC_HXX +#define INCLUDED_SW_INC_FMTCOLFUNC_HXX + +#include "numrule.hxx" +#include "fmtcol.hxx" + +class SwFormat; +class SwNumRuleItem; + +// namespace <TextFormatCollFunc> for functions and procedures working on +// paragraph styles (instances of <SwTextFormatColl> +namespace TextFormatCollFunc +{ + /** Checks, if assignment of paragraph style to list level of outline style + has to be deleted, and deletes the assignment, if needed. + + #i71574# + The assignment of a paragraph style to a list level of the outline style + has to be deleted, if the numbering rule, which is set at the paragraph + style isn't the outline style. + */ + void CheckTextFormatCollForDeletionOfAssignmentToOutlineStyle( + SwFormat* pFormat, + const SwNumRuleItem* pNewNumRuleItem = nullptr ); + + /** determines the list style, which directly set at the given paragraph style + + @param rTextFormatColl + input parameter - paragraph style for which the list style should be retrieved + + @return pointer to <SwNumRule> instance, if the given paragraph style + has directly set a list style, 0 otherwise + */ + SwNumRule* GetNumRule( SwTextFormatColl& rTextFormatColl ); + + /** adds the given paragraph style at the directly set list style + + Note: If the given paragraph style has no directly set list style, nothing happens + + @param rTextFormatColl + input parameter - paragraph style which is added to its directly set list style + */ + void AddToNumRule( SwTextFormatColl& rTextFormatColl ); + + /** removes the given paragraph style from the directly set list style + + Note: If the given paragraph style has no directly set list style, nothing happens + + @param rTextFormatColl + input parameter - paragraph style which is removed from its directly set list style + */ + void RemoveFromNumRule( SwTextFormatColl& rTextFormatColl ); +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmteiro.hxx b/sw/inc/fmteiro.hxx new file mode 100644 index 000000000..f3e2d5d6d --- /dev/null +++ b/sw/inc/fmteiro.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTEIRO_HXX +#define INCLUDED_SW_INC_FMTEIRO_HXX + +#include <svl/eitem.hxx> +#include "hintids.hxx" +#include "format.hxx" +#include "swdllapi.h" + +class IntlWrapper; + +class SW_DLLPUBLIC SwFormatEditInReadonly : public SfxBoolItem +{ +public: + SwFormatEditInReadonly( sal_uInt16 nId = RES_EDIT_IN_READONLY, + bool bPrt = false ) : SfxBoolItem( nId, bPrt ) {} + + /// "pure virtual method" of SfxPoolItem + virtual SwFormatEditInReadonly* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatEditInReadonly &SwAttrSet::GetEditInReadonly(bool bInP) const + { return Get( RES_EDIT_IN_READONLY,bInP); } + +inline const SwFormatEditInReadonly &SwFormat::GetEditInReadonly(bool bInP) const + { return m_aSet.GetEditInReadonly(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtflcnt.hxx b/sw/inc/fmtflcnt.hxx new file mode 100644 index 000000000..882e1b328 --- /dev/null +++ b/sw/inc/fmtflcnt.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTFLCNT_HXX +#define INCLUDED_SW_INC_FMTFLCNT_HXX + +#include <svl/poolitem.hxx> + +class SwFrameFormat; +class SwTextFlyCnt; + +/** + * Format of a fly content. + * + * A pool item that is attached to the placeholder character of an as-character frame. (TextFrame, etc.) + */ +class SAL_DLLPUBLIC_RTTI SwFormatFlyCnt final : public SfxPoolItem +{ + friend class SwTextFlyCnt; + SwTextFlyCnt* m_pTextAttr; + SwFrameFormat* m_pFormat; ///< My Fly/DrawFrame-format. + SwFormatFlyCnt& operator=(const SwFormatFlyCnt& rFlyCnt) = delete; + +public: + SwFormatFlyCnt( SwFrameFormat *pFrameFormat ); + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatFlyCnt* Clone( SfxItemPool* pPool = nullptr ) const override; + + SwFrameFormat *GetFrameFormat() const { return m_pFormat; } + /// For Undo: delete the FlyFrameFormat "logically"; it is kept in Undo-object. + void SetFlyFormat( SwFrameFormat* pNew = nullptr ) { m_pFormat = pNew; } + + const SwTextFlyCnt *GetTextFlyCnt() const { return m_pTextAttr; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx new file mode 100644 index 000000000..f65f7d437 --- /dev/null +++ b/sw/inc/fmtfld.hxx @@ -0,0 +1,183 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_FMTFLD_HXX +#define INCLUDED_SW_INC_FMTFLD_HXX + +#include <cppuhelper/weakref.hxx> +#include <svl/poolitem.hxx> +#include <svl/SfxBroadcaster.hxx> + +#include "swdllapi.h" +#include "calbck.hxx" +#include "ndindex.hxx" +#include "reffld.hxx" + +class SwField; +class SwTextField; +class SwView; +class SwFieldType; +class SwFormatField; +class IDocumentRedlineAccess; +namespace com::sun::star::text { class XTextField; } + +namespace sw { + struct FindFormatForFieldHint final : SfxHint { + const SwField* m_pField; + SwFormatField*& m_rpFormat; + FindFormatForFieldHint(const SwField* pField, SwFormatField*& rpFormat) : m_pField(pField), m_rpFormat(rpFormat) {}; + }; + struct FindFormatForPostItIdHint final : SfxHint { + const sal_uInt32 m_nPostItId; + SwFormatField*& m_rpFormat; + FindFormatForPostItIdHint(const sal_uInt32 nPostItId, SwFormatField*& rpFormat) : m_nPostItId(nPostItId), m_rpFormat(rpFormat) {}; + }; + struct CollectPostItsHint final : SfxHint { + std::vector<SwFormatField*>& m_rvFormatFields; + IDocumentRedlineAccess const& m_rIDRA; + const bool m_bHideRedlines; + CollectPostItsHint(std::vector<SwFormatField*>& rvFormatFields, IDocumentRedlineAccess const& rIDRA, bool bHideRedlines) : m_rvFormatFields(rvFormatFields), m_rIDRA(rIDRA), m_bHideRedlines(bHideRedlines) {}; + }; + struct HasHiddenInformationNotesHint final : SfxHint { + bool& m_rbHasHiddenInformationNotes; + HasHiddenInformationNotesHint(bool& rbHasHiddenInformationNotes) : m_rbHasHiddenInformationNotes(rbHasHiddenInformationNotes) {}; + }; + struct GatherNodeIndexHint final : SfxHint { + std::vector<sal_uLong>& m_rvNodeIndex; + GatherNodeIndexHint(std::vector<sal_uLong>& rvNodeIndex) : m_rvNodeIndex(rvNodeIndex) {}; + }; + struct GatherRefFieldsHint final : SfxHint { + std::vector<SwGetRefField*>& m_rvRFields; + const sal_uInt16 m_nType; + GatherRefFieldsHint(std::vector<SwGetRefField*>& rvRFields, const sal_uInt16 nType) : m_rvRFields(rvRFields), m_nType(nType) {}; + }; + struct GatherFieldsHint final : SfxHint { + const bool m_bCollectOnlyInDocNodes; + std::vector<SwFormatField*>& m_rvFields; + GatherFieldsHint(std::vector<SwFormatField*>& rvFields, bool bCollectOnlyInDocNodes = true) : m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {}; + }; +} + + +// ATT_FLD +class SW_DLLPUBLIC SwFormatField final + : public SfxPoolItem + , public sw::BroadcastingModify + , public SfxBroadcaster +{ + friend void InitCore(); + SwFormatField( sal_uInt16 nWhich ); // for default-Attribute + + css::uno::WeakReference<css::text::XTextField> m_wXTextField; + + std::unique_ptr<SwField> mpField; + SwTextField* mpTextField; // the TextAttribute + + virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) override; + +public: + + /// Single argument constructors shall be explicit. + explicit SwFormatField( const SwField &rField ); + + SwFormatField( const SwFormatField& rAttr ); + + virtual ~SwFormatField() override; + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatField* Clone( SfxItemPool* pPool = nullptr ) const override; + + virtual bool GetInfo( SfxPoolItem& rInfo ) const override; + + void InvalidateField(); + + const SwField* GetField() const + { + return mpField.get(); + } + SwField* GetField() + { + return mpField.get(); + } + + /** + Sets current field. + + @param pField new field + + @attention The current field will be destroyed before setting the new field. + */ + void SetField( std::unique_ptr<SwField> pField ); + + const SwTextField* GetTextField() const + { + return mpTextField; + } + SwTextField* GetTextField() + { + return mpTextField; + } + void SetTextField( SwTextField& rTextField ); + void ClearTextField(); + + void RegisterToFieldType( SwFieldType& ); + bool IsFieldInDoc() const; + bool IsProtect() const; + + SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextField> const& GetXTextField() const + { return m_wXTextField; } + SAL_DLLPRIVATE void SetXTextField(css::uno::Reference<css::text::XTextField> const& xTextField) + { m_wXTextField = xTextField; } + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + + void UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* pNew); +}; + +enum class SwFormatFieldHintWhich +{ + INSERTED = 1, + REMOVED = 2, + FOCUS = 3, + CHANGED = 4, + LANGUAGE = 5, + RESOLVED = 6 +}; + +class SW_DLLPUBLIC SwFormatFieldHint final : public SfxHint +{ + const SwFormatField* m_pField; + SwFormatFieldHintWhich m_nWhich; + const SwView* m_pView; + +public: + SwFormatFieldHint( const SwFormatField* pField, SwFormatFieldHintWhich nWhich, const SwView* pView = nullptr) + : m_pField(pField) + , m_nWhich(nWhich) + , m_pView(pView) + {} + + const SwFormatField* GetField() const { return m_pField; } + SwFormatFieldHintWhich Which() const { return m_nWhich; } + const SwView* GetView() const { return m_pView; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx new file mode 100644 index 000000000..01e6da304 --- /dev/null +++ b/sw/inc/fmtfollowtextflow.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTFOLLOWTEXTFLOW_HXX +#define INCLUDED_SW_INC_FMTFOLLOWTEXTFLOW_HXX + +#include <svl/eitem.hxx> +#include "hintids.hxx" +#include "format.hxx" +#include "swdllapi.h" + +class IntlWrapper; + +class SW_DLLPUBLIC SwFormatFollowTextFlow : public SfxBoolItem +{ +public: + + SwFormatFollowTextFlow( bool bFlag = false ) + : SfxBoolItem( RES_FOLLOW_TEXT_FLOW, bFlag ) + {} + + /// "pure virtual methods" of SfxPoolItem + virtual SwFormatFollowTextFlow* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatFollowTextFlow &SwAttrSet::GetFollowTextFlow(bool bInP) const + { return Get( RES_FOLLOW_TEXT_FLOW, bInP ); } + +inline const SwFormatFollowTextFlow &SwFormat::GetFollowTextFlow(bool bInP) const + { return m_aSet.GetFollowTextFlow( bInP ); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtfordr.hxx b/sw/inc/fmtfordr.hxx new file mode 100644 index 000000000..d9f922a12 --- /dev/null +++ b/sw/inc/fmtfordr.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTFORDR_HXX +#define INCLUDED_SW_INC_FMTFORDR_HXX + +#include <svl/eitem.hxx> +#include "hintids.hxx" +#include "format.hxx" + +enum SwFillOrder +{ + SW_FILL_ORDER_BEGIN, + ATT_TOP_DOWN = SW_FILL_ORDER_BEGIN, + ATT_BOTTOM_UP, + ATT_LEFT_TO_RIGHT, + ATT_RIGHT_TO_LEFT, + SW_FILL_ORDER_END +}; + +class SwFormatFillOrder: public SfxEnumItem<SwFillOrder> +{ +public: + SwFormatFillOrder( SwFillOrder = ATT_TOP_DOWN ); + + /// "Pure virtual methods" of SfxPoolItem. + virtual SwFormatFillOrder* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual sal_uInt16 GetValueCount() const override; +}; + +inline const SwFormatFillOrder &SwAttrSet::GetFillOrder(bool bInP) const + { return Get( RES_FILL_ORDER,bInP); } + +inline const SwFormatFillOrder &SwFormat::GetFillOrder(bool bInP) const + { return m_aSet.GetFillOrder(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtfsize.hxx b/sw/inc/fmtfsize.hxx new file mode 100644 index 000000000..2eb3dbf13 --- /dev/null +++ b/sw/inc/fmtfsize.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTFSIZE_HXX +#define INCLUDED_SW_INC_FMTFSIZE_HXX + +#include <sal/config.h> + +#include <editeng/sizeitem.hxx> +#include <svl/poolitem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "swtypes.hxx" +#include "format.hxx" + +class IntlWrapper; + +//Frame size. + +enum class SwFrameSize +{ + Variable, ///< Frame is variable in Var-direction. + Fixed, ///< Frame cannot be moved in Var-direction. + Minimum /**< Value in Var-direction gives minimum + (can be exceeded but not be less). */ +}; + +class SW_DLLPUBLIC SwFormatFrameSize: public SvxSizeItem +{ + SwFrameSize m_eFrameHeightType; + SwFrameSize m_eFrameWidthType; + sal_uInt8 m_nWidthPercent; + sal_Int16 m_eWidthPercentRelation; + sal_uInt8 m_nHeightPercent; + sal_Int16 m_eHeightPercentRelation; + + // For tables: width can be given in percent. + + // For frames: height and/or width may be given in percent. + // If only one of these percentage values is given, the value 0xFF + // used instead of the missing percentage value indicates this side + // being proportional to the given one. + // The calculation in this case is based upon the values in Size. + // Percentages are always related to the environment in which + // the object is placed (PrtArea) and to the screen width + // minus borders in BrowseView if the environment is the page. + + void ScaleMetrics(long lMult, long lDiv) override; + bool HasMetrics() const override; + +public: + SwFormatFrameSize( SwFrameSize eSize = SwFrameSize::Variable, + SwTwips nWidth = 0, SwTwips nHeight = 0 ); + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatFrameSize* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + SwFrameSize GetHeightSizeType() const { return m_eFrameHeightType; } + void SetHeightSizeType( SwFrameSize eSize ) { m_eFrameHeightType = eSize; } + + SwFrameSize GetWidthSizeType() const { return m_eFrameWidthType; } + void SetWidthSizeType( SwFrameSize eSize ) { m_eFrameWidthType = eSize; } + + enum PercentFlags { SYNCED = 0xff }; + //0xff is reserved to indicate height is synced to width + sal_uInt8 GetHeightPercent() const{ return m_nHeightPercent; } + sal_Int16 GetHeightPercentRelation() const { return m_eHeightPercentRelation; } + //0xff is reserved to indicate width is synced to height + sal_uInt8 GetWidthPercent() const { return m_nWidthPercent; } + sal_Int16 GetWidthPercentRelation() const { return m_eWidthPercentRelation; } + void SetHeightPercent( sal_uInt8 n ) { m_nHeightPercent = n; } + void SetHeightPercentRelation ( sal_Int16 n ) { m_eHeightPercentRelation = n; } + void SetWidthPercent ( sal_uInt8 n ) { m_nWidthPercent = n; } + void SetWidthPercentRelation ( sal_Int16 n ) { m_eWidthPercentRelation = n; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatFrameSize &SwAttrSet::GetFrameSize(bool bInP) const + { return Get( RES_FRM_SIZE,bInP); } + +inline const SwFormatFrameSize &SwFormat::GetFrameSize(bool bInP) const + { return m_aSet.GetFrameSize(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx new file mode 100644 index 000000000..150b3bd7e --- /dev/null +++ b/sw/inc/fmtftn.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTFTN_HXX +#define INCLUDED_SW_INC_FMTFTN_HXX + +#include <rtl/ustring.hxx> +#include <cppuhelper/weakref.hxx> +#include <svl/poolitem.hxx> + +#include "swdllapi.h" +#include "calbck.hxx" + +namespace com::sun::star::text { + class XFootnote; + class XTextRange; +} + +class SwDoc; +class SwTextFootnote; +class SwRootFrame; + +// ATT_FTN + +class SW_DLLPUBLIC SwFormatFootnote final + : public SfxPoolItem + , public SwModify + , public sw::BroadcasterMixin +{ + friend class SwTextFootnote; + SwTextFootnote* m_pTextAttr; ///< My TextAttribute. + OUString m_aNumber; ///< User-defined 'Number'. + sal_uInt16 m_nNumber; ///< automatic sequence number + sal_uInt16 m_nNumberRLHidden; ///< automatic sequence number (hidden redlines) + bool m_bEndNote; ///< Is it an End note? + + css::uno::WeakReference<css::text::XFootnote> m_wXFootnote; + + SwFormatFootnote& operator=(const SwFormatFootnote& rFootnote) = delete; + SwFormatFootnote( const SwFormatFootnote& ) = delete; + +public: + SwFormatFootnote( bool bEndNote = false ); + virtual ~SwFormatFootnote() override; + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatFootnote* Clone( SfxItemPool* pPool = nullptr ) const override; + + // SwClient + virtual void Modify(SfxPoolItem const* pOld, SfxPoolItem const* pNew) + override; + + void InvalidateFootnote(); + + const OUString& GetNumStr() const { return m_aNumber; } + sal_uInt16 GetNumber() const { return m_nNumber; } + sal_uInt16 GetNumberRLHidden() const { return m_nNumberRLHidden; } + bool IsEndNote() const { return m_bEndNote;} + + void SetNumStr( const OUString& rStr ) { m_aNumber = rStr; } + void SetEndNote( bool b ); + + void SetNumber( const SwFormatFootnote& rFootnote ) + { + m_nNumber = rFootnote.m_nNumber; + m_nNumberRLHidden = rFootnote.m_nNumberRLHidden; + m_aNumber = rFootnote.m_aNumber; + } + + const SwTextFootnote *GetTextFootnote() const { return m_pTextAttr; } + SwTextFootnote *GetTextFootnote() { return m_pTextAttr; } + + OUString GetFootnoteText(SwRootFrame const& rLayout) const; + + /// Returns string to be displayed of footnote / endnote. + OUString GetViewNumStr(const SwDoc& rDoc, SwRootFrame const* pLayout, + bool bInclStrings = false) const; + + css::uno::Reference<css::text::XTextRange> getAnchor(SwDoc& rDoc) const; + + css::uno::WeakReference<css::text::XFootnote> const& GetXFootnote() const + { return m_wXFootnote; } + void SetXFootnote(css::uno::Reference<css::text::XFootnote> const& xNote) + { m_wXFootnote = xNote; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx new file mode 100644 index 000000000..c3783178b --- /dev/null +++ b/sw/inc/fmtftntx.hxx @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTFTNTX_HXX +#define INCLUDED_SW_INC_FMTFTNTX_HXX + +#include <svl/eitem.hxx> +#include <editeng/numitem.hxx> +#include "hintids.hxx" +#include "format.hxx" +#include "swdllapi.h" + +enum SwFootnoteEndPosEnum +{ + FTNEND_ATPGORDOCEND, ///< at page or document end + FTNEND_ATTXTEND, ///< at end of the current text end + FTNEND_ATTXTEND_OWNNUMSEQ, ///< -""- and with own number sequence + FTNEND_ATTXTEND_OWNNUMANDFMT, ///< -""- and with own numberformat + FTNEND_ATTXTEND_END +}; + +class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd : public SfxEnumItem<SwFootnoteEndPosEnum> +{ + OUString m_sPrefix; + OUString m_sSuffix; + SvxNumberType m_aFormat; + sal_uInt16 m_nOffset; + +protected: + SwFormatFootnoteEndAtTextEnd( sal_uInt16 nWhichL, SwFootnoteEndPosEnum ePos ) + : SfxEnumItem( nWhichL, ePos ), m_nOffset( 0 ) + {} + +public: + virtual sal_uInt16 GetValueCount() const override; + + virtual bool operator==( const SfxPoolItem& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); } + + SwFormatFootnoteEndAtTextEnd & operator=( const SwFormatFootnoteEndAtTextEnd & rAttr ); + SwFormatFootnoteEndAtTextEnd(SwFormatFootnoteEndAtTextEnd const &) = default; + // SfxPoolItem copy function dichotomy + + SvxNumType GetNumType() const { return m_aFormat.GetNumberingType(); } + void SetNumType( SvxNumType eType ) { m_aFormat.SetNumberingType(eType); } + + const SvxNumberType& GetSwNumType() const { return m_aFormat; } + + sal_uInt16 GetOffset() const { return m_nOffset; } + void SetOffset( sal_uInt16 nOff ) { m_nOffset = nOff; } + + const OUString& GetPrefix() const { return m_sPrefix; } + void SetPrefix(const OUString& rSet) { m_sPrefix = rSet; } + + const OUString& GetSuffix() const { return m_sSuffix; } + void SetSuffix(const OUString& rSet) { m_sSuffix = rSet; } +}; + +class SW_DLLPUBLIC SwFormatFootnoteAtTextEnd : public SwFormatFootnoteEndAtTextEnd +{ +public: + SwFormatFootnoteAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND ) + : SwFormatFootnoteEndAtTextEnd( RES_FTN_AT_TXTEND, ePos ) + {} + + virtual SwFormatFootnoteAtTextEnd* Clone( SfxItemPool *pPool = nullptr ) const override; +}; + +class SW_DLLPUBLIC SwFormatEndAtTextEnd : public SwFormatFootnoteEndAtTextEnd +{ +public: + SwFormatEndAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND ) + : SwFormatFootnoteEndAtTextEnd( RES_END_AT_TXTEND, ePos ) + { + SetNumType( SVX_NUM_ROMAN_LOWER ); + } + + virtual SwFormatEndAtTextEnd* Clone( SfxItemPool *pPool = nullptr ) const override; +}; + +inline const SwFormatFootnoteAtTextEnd &SwAttrSet::GetFootnoteAtTextEnd(bool bInP) const + { return Get( RES_FTN_AT_TXTEND, bInP); } +inline const SwFormatEndAtTextEnd &SwAttrSet::GetEndAtTextEnd(bool bInP) const + { return Get( RES_END_AT_TXTEND, bInP); } + +inline const SwFormatFootnoteAtTextEnd &SwFormat::GetFootnoteAtTextEnd(bool bInP) const + { return m_aSet.GetFootnoteAtTextEnd(bInP); } +inline const SwFormatEndAtTextEnd &SwFormat::GetEndAtTextEnd(bool bInP) const + { return m_aSet.GetEndAtTextEnd(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmthdft.hxx b/sw/inc/fmthdft.hxx new file mode 100644 index 000000000..1a9e634dc --- /dev/null +++ b/sw/inc/fmthdft.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTHDFT_HXX +#define INCLUDED_SW_INC_FMTHDFT_HXX + +#include "hintids.hxx" +#include "format.hxx" +#include <svl/poolitem.hxx> +#include "calbck.hxx" +#include "frmfmt.hxx" + +class IntlWrapper; + + /** Header, for PageFormats + Client of FrameFormat describing the header. */ + +class SW_DLLPUBLIC SwFormatHeader: public SfxPoolItem, public SwClient +{ + bool m_bActive; ///< Only for controlling (creation of content). + +public: + SwFormatHeader( bool bOn = false ); + SwFormatHeader( SwFrameFormat *pHeaderFormat ); + SwFormatHeader( const SwFormatHeader &rCpy ); + virtual ~SwFormatHeader() override; + SwFormatHeader& operator=( const SwFormatHeader &rCpy ); + + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatHeader* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + const SwFrameFormat *GetHeaderFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); } + SwFrameFormat *GetHeaderFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } + + void RegisterToFormat( SwFormat& rFormat ); + bool IsActive() const { return m_bActive; } +}; + + /**Footer, for pageformats + Client of FrameFormat describing the footer */ + +class SW_DLLPUBLIC SwFormatFooter: public SfxPoolItem, public SwClient +{ + bool m_bActive; // Only for controlling (creation of content). + +public: + SwFormatFooter( bool bOn = false ); + SwFormatFooter( SwFrameFormat *pFooterFormat ); + SwFormatFooter( const SwFormatFooter &rCpy ); + virtual ~SwFormatFooter() override; + SwFormatFooter& operator=( const SwFormatFooter &rCpy ); + + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatFooter* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + const SwFrameFormat *GetFooterFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); } + SwFrameFormat *GetFooterFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } + + void RegisterToFormat( SwFormat& rFormat ); + bool IsActive() const { return m_bActive; } +}; + +inline const SwFormatHeader &SwAttrSet::GetHeader(bool bInP) const + { return Get( RES_HEADER,bInP); } +inline const SwFormatFooter &SwAttrSet::GetFooter(bool bInP) const + { return Get( RES_FOOTER,bInP); } + +inline const SwFormatHeader &SwFormat::GetHeader(bool bInP) const + { return m_aSet.GetHeader(bInP); } +inline const SwFormatFooter &SwFormat::GetFooter(bool bInP) const + { return m_aSet.GetFooter(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtinfmt.hxx b/sw/inc/fmtinfmt.hxx new file mode 100644 index 000000000..1abc322bb --- /dev/null +++ b/sw/inc/fmtinfmt.hxx @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTINFMT_HXX +#define INCLUDED_SW_INC_FMTINFMT_HXX + +#include <svl/poolitem.hxx> +#include "swdllapi.h" +#include <memory> +#include "calbck.hxx" + +class SvxMacro; +class SvxMacroTableDtor; +class SwTextINetFormat; +class IntlWrapper; +enum class SvMacroItemId : sal_uInt16; + +// ATT_INETFMT + +class SW_DLLPUBLIC SwFormatINetFormat final + : public SfxPoolItem + , public sw::BroadcasterMixin +{ + friend class SwTextINetFormat; + + OUString msURL; ///< URL. + OUString msTargetFrame; ///< Target frame for URL. + OUString msINetFormatName; + OUString msVisitedFormatName; + OUString msHyperlinkName; ///< Name of the link. + std::unique_ptr<SvxMacroTableDtor> mpMacroTable; + SwTextINetFormat* mpTextAttr; ///< My TextAttribute. + sal_uInt16 mnINetFormatId; + sal_uInt16 mnVisitedFormatId; +public: + SwFormatINetFormat( const OUString& rURL, const OUString& rTarget ); + SwFormatINetFormat( const SwFormatINetFormat& rAttr ); + SwFormatINetFormat(); ///< For TypeInfo. + virtual ~SwFormatINetFormat() override; + + static SfxPoolItem* CreateDefault(); + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatINetFormat* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + const SwTextINetFormat* GetTextINetFormat() const + { + return mpTextAttr; + } + + const OUString& GetValue() const + { + return msURL; + } + + const OUString& GetName() const + { + return msHyperlinkName; + } + void SetName( const OUString& rNm ) + { + msHyperlinkName = rNm; + } + + const OUString& GetTargetFrame() const + { + return msTargetFrame; + } + + void SetINetFormatAndId( + const OUString& rNm, + const sal_uInt16 nId ) + { + msINetFormatName = rNm; + mnINetFormatId = nId; + } + + const OUString& GetINetFormat() const + { + return msINetFormatName; + } + + sal_uInt16 GetINetFormatId() const + { + return mnINetFormatId; + } + + void SetVisitedFormatAndId( + const OUString& rNm, + const sal_uInt16 nId ) + { + msVisitedFormatName = rNm; + mnVisitedFormatId = nId; + } + + const OUString& GetVisitedFormat() const + { + return msVisitedFormatName; + } + + sal_uInt16 GetVisitedFormatId() const + { + return mnVisitedFormatId; + } + + /// Set a new MacroTable or clear the current one. + void SetMacroTable( const SvxMacroTableDtor* pTable ); + const SvxMacroTableDtor* GetMacroTable() const + { + return mpMacroTable.get(); + } + + /// Macro getter and setter. + void SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro ); + const SvxMacro* GetMacro( SvMacroItemId nEvent ) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtline.hxx b/sw/inc/fmtline.hxx new file mode 100644 index 000000000..82a444829 --- /dev/null +++ b/sw/inc/fmtline.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTLINE_HXX +#define INCLUDED_SW_INC_FMTLINE_HXX + +#include <svl/poolitem.hxx> +#include <tools/solar.h> +#include "hintids.hxx" +#include "swdllapi.h" +#include "swatrset.hxx" + +class IntlWrapper; + +class SW_DLLPUBLIC SwFormatLineNumber: public SfxPoolItem +{ + sal_uLong m_nStartValue :24; ///< Starting value for the paragraph. 0 == no starting value. + bool m_bCountLines :1; ///< Also count lines of paragraph. + +public: + SwFormatLineNumber(); + virtual ~SwFormatLineNumber() override; + + SwFormatLineNumber(SwFormatLineNumber const &) = default; + SwFormatLineNumber(SwFormatLineNumber &&) = default; + SwFormatLineNumber & operator =(SwFormatLineNumber const &) = delete; // due to SfxPoolItem + SwFormatLineNumber & operator =(SwFormatLineNumber &&) = delete; // due to SfxPoolItem + + static SfxPoolItem* CreateDefault(); + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatLineNumber* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + sal_uLong GetStartValue() const { return m_nStartValue; } + bool IsCount() const { return m_bCountLines; } + + void SetStartValue( sal_uLong nNew ) { m_nStartValue = nNew; } + void SetCountLines( bool b ) { m_bCountLines = b; } +}; + +inline const SwFormatLineNumber &SwAttrSet::GetLineNumber(bool bInP) const + { return Get( RES_LINENUMBER,bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtlsplt.hxx b/sw/inc/fmtlsplt.hxx new file mode 100644 index 000000000..4d473f29b --- /dev/null +++ b/sw/inc/fmtlsplt.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTLSPLT_HXX +#define INCLUDED_SW_INC_FMTLSPLT_HXX + +#include <svl/eitem.hxx> +#include "hintids.hxx" +#include "format.hxx" +#include "swdllapi.h" + +class IntlWrapper; + +class SW_DLLPUBLIC SwFormatLayoutSplit : public SfxBoolItem +{ +public: + SwFormatLayoutSplit( bool bSplit = true ) : SfxBoolItem( RES_LAYOUT_SPLIT, bSplit ) {} + + /// "pure virtual methods" of SfxPoolItem + virtual SwFormatLayoutSplit* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +inline const SwFormatLayoutSplit &SwAttrSet::GetLayoutSplit(bool bInP) const + { return Get( RES_LAYOUT_SPLIT,bInP); } + +inline const SwFormatLayoutSplit &SwFormat::GetLayoutSplit(bool bInP) const + { return m_aSet.GetLayoutSplit(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx new file mode 100644 index 000000000..3bb8f928f --- /dev/null +++ b/sw/inc/fmtmeta.hxx @@ -0,0 +1,226 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_FMTMETA_HXX +#define INCLUDED_SW_INC_FMTMETA_HXX + +#include "calbck.hxx" + +#include <cppuhelper/weakref.hxx> + +#include <svl/poolitem.hxx> +#include <sfx2/Metadatable.hxx> + +#include <memory> +#include <vector> + +namespace com::sun::star { + namespace document { + class XDocumentProperties; + } + namespace text { + class XTextField; + } +} + +/** + * The classes that make up a meta entity are: + * <dl> + * <dt>SwTextMeta</dt><dd>the text hint</dd> + * <dt>SwFormatMeta</dt><dd>the pool item</dd> + * <dt>sw::Meta</dt><dd>the metadatable entity itself</dd> + * <dt>SwXMeta</dt><dd>the UNO wrapper object</dd> + * </dl> + * + * The text hint contains the pool item (as usual) and has a pointer to the + * text node at which it is attached. + * The pool item has a shared pointer to the metadatable entity, and a reverse + * pointer to the text attribute at which it is attached. + * The pool item is non-poolable; it may only be attached to one text + * attribute. + * Of all the pool items that refer to a metadatable entity, only one may be + * in the document content at any time. Others may be in the undo array, or in + * undo objects. + * The metadatable entity has a reverse pointer to the pool item that is + * currently in the document. It also registers as a client at the text node + * at which it is attached via this pool item and its text attribute. + * The UNO wrapper object registers as a client at the metadatable entity. + * + * Copying the metadatable entity proceeds in the following way: + * <ol> + * <li>The pool item is cloned (because it is non-poolable); the clone + * points to the same metadatable entity, but the metadatable entity's + * reverse pointer is unchanged.</li> + * <li>The DoCopy() method is called at the new pool item: + * it will clone the metadatable entity (using RegisterAsCopyOf). + * This is necessary, because first, a metadatable entity may + * only be inserted once into a document, and second, the copy may be + * inserted into a different document than the source document!</li> + * <li>A new text hint is created, taking over the new pool item.</li> + * <li>The text hint is inserted into the hints array of some text node.</li> + * </ol> + */ + +class SwTextMeta; +class SwXMeta; +class SwXMetaField; +class SwTextNode; +class SwDoc; +namespace sw { + class Meta; + class MetaFieldManager; +} + +class SwFormatMeta + : public SfxPoolItem +{ +private: + friend class SwTextMeta; ///< needs SetTextAttr, DoCopy + friend class ::sw::Meta; ///< needs m_pTextAttr + + std::shared_ptr< ::sw::Meta > m_pMeta; + SwTextMeta * m_pTextAttr; + + SwTextMeta * GetTextAttr() { return m_pTextAttr; } + void SetTextAttr(SwTextMeta * const i_pTextAttr); + + /// this method <em>must</em> be called when the hint is actually copied + void DoCopy(::sw::MetaFieldManager & i_rTargetDocManager, + SwTextNode & i_rTargetTextNode); + + explicit SwFormatMeta( const sal_uInt16 i_nWhich ); + +public: + /// takes ownership + explicit SwFormatMeta( std::shared_ptr< ::sw::Meta > const & i_pMeta, + const sal_uInt16 i_nWhich ); + virtual ~SwFormatMeta() override; + + /// SfxPoolItem + virtual bool operator==( const SfxPoolItem & ) const override; + virtual SwFormatMeta* Clone( SfxItemPool *pPool = nullptr ) const override; + + /// notify clients registered at m_pMeta that this meta is being (re-)moved + void NotifyChangeTextNode(SwTextNode *const pTextNode); + static SwFormatMeta * CreatePoolDefault( const sal_uInt16 i_nWhich ); + ::sw::Meta * GetMeta() { return m_pMeta.get(); } +}; + +namespace sw { + +class Meta + : public ::sfx2::Metadatable + , public SwModify + , public sw::BroadcasterMixin +{ + friend class ::SwFormatMeta; ///< SetFormatMeta, NotifyChangeTextNode + friend class ::SwXMeta; ///< GetTextNode, GetTextAttr, Get/SetXMeta + + css::uno::WeakReference< + css::rdf::XMetadatable> m_wXMeta; + + SwFormatMeta * m_pFormat; + SwTextNode * m_pTextNode; + +protected: + + SwTextMeta * GetTextAttr() const; + SwTextNode * GetTextNode() const { return m_pTextNode;} ///< @return 0 if not in document (undo) + + SwFormatMeta * GetFormatMeta() const { return m_pFormat; } + void SetFormatMeta( SwFormatMeta * const i_pFormat ) { m_pFormat = i_pFormat; }; + + void NotifyChangeTextNode(SwTextNode *const pTextNode); + + css::uno::WeakReference<css::rdf::XMetadatable> const& GetXMeta() const + { return m_wXMeta; } + void SetXMeta(css::uno::Reference<css::rdf::XMetadatable> const& xMeta) + { m_wXMeta = xMeta; } + + /// SwClient + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) override; + +public: + explicit Meta(SwFormatMeta * const i_pFormat); + virtual ~Meta() override; + + /// sfx2::Metadatable + virtual ::sfx2::IXmlIdRegistry& GetRegistry() override; + virtual bool IsInClipboard() const override; + virtual bool IsInUndo() const override; + virtual bool IsInContent() const override; + virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override; +}; + +class MetaField final + : public Meta +{ +private: + friend class ::SwFormatMeta; + friend class ::SwXMetaField; + friend class ::sw::MetaFieldManager; + + sal_uInt32 m_nNumberFormat; + bool m_bIsFixedLanguage; + + sal_uInt32 GetNumberFormat(OUString const & rContent) const; + void SetNumberFormat(sal_uInt32 nNumberFormat); + bool IsFixedLanguage() const { return m_bIsFixedLanguage; } + void SetIsFixedLanguage(bool b) { m_bIsFixedLanguage = b; } + + explicit MetaField(SwFormatMeta * const i_pFormat, + const sal_uInt32 nNumberFormat, + const bool bIsFixedLanguage ); + +public: + /// get prefix/suffix from the RDF repository. @throws RuntimeException + void GetPrefixAndSuffix( + OUString *const o_pPrefix, OUString *const o_pSuffix); +}; + + /// knows all meta-fields in the document. +class SW_DLLPUBLIC MetaFieldManager +{ +private: + typedef std::vector< std::weak_ptr<MetaField> > MetaFieldList_t; + MetaFieldList_t m_MetaFields; + /// Document properties of a clipboard document, empty for non-clipboard documents. + css::uno::Reference<css::document::XDocumentProperties> m_xDocumentProperties; + + MetaFieldManager(MetaFieldManager const&) = delete; + MetaFieldManager& operator=(MetaFieldManager const&) = delete; + +public: + MetaFieldManager(); + std::shared_ptr<MetaField> makeMetaField( + SwFormatMeta * const i_pFormat = nullptr, + const sal_uInt32 nNumberFormat = SAL_MAX_UINT32, + const bool bIsFixedLanguage = false ); + /// get all meta fields + std::vector< css::uno::Reference<css::text::XTextField> > getMetaFields(); + /// Copy document properties from rSource to m_xDocumentProperties. + void copyDocumentProperties(const SwDoc& rSource); + const css::uno::Reference<css::document::XDocumentProperties>& getDocumentProperties() const; +}; + +} // namespace sw + +#endif // INCLUDED_SW_INC_FMTMETA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx new file mode 100644 index 000000000..59afdb46f --- /dev/null +++ b/sw/inc/fmtornt.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTORNT_HXX +#define INCLUDED_SW_INC_FMTORNT_HXX + +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> +#include "swdllapi.h" +#include "hintids.hxx" +#include "swtypes.hxx" +#include "format.hxx" +#include <svl/poolitem.hxx> + +class IntlWrapper; + +class SW_DLLPUBLIC SwFormatVertOrient: public SfxPoolItem +{ + SwTwips m_nYPos; ///< Contains *always* the current RelPos. + sal_Int16 m_eOrient; + sal_Int16 m_eRelation; +public: + SwFormatVertOrient( SwTwips nY = 0, sal_Int16 eVert = css::text::VertOrientation::NONE, + sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA ); + SwFormatVertOrient(SwFormatVertOrient const &) = default; // SfxPoolItem copy function dichotomy + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatVertOrient* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + sal_Int16 GetVertOrient() const { return m_eOrient; } + sal_Int16 GetRelationOrient() const { return m_eRelation; } + void SetVertOrient( sal_Int16 eNew ) { m_eOrient = eNew; } + void SetRelationOrient( sal_Int16 eNew ) { m_eRelation = eNew; } + + SwTwips GetPos() const { return m_nYPos; } + void SetPos( SwTwips nNew ) { m_nYPos = nNew; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +class SW_DLLPUBLIC SwFormatHoriOrient: public SfxPoolItem +{ + SwTwips m_nXPos; ///< Contains *always* the current RelPos. + sal_Int16 m_eOrient; + sal_Int16 m_eRelation; + bool m_bPosToggle : 1; ///< Flip position on even pages. +public: + SwFormatHoriOrient( SwTwips nX = 0, sal_Int16 eHori = css::text::HoriOrientation::NONE, + sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA, bool bPos = false ); + SwFormatHoriOrient(SwFormatHoriOrient const &) = default; // SfxPoolItem copy function dichotomy + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatHoriOrient* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + sal_Int16 GetHoriOrient() const { return m_eOrient; } + sal_Int16 GetRelationOrient() const { return m_eRelation; } + void SetHoriOrient( sal_Int16 eNew ) { m_eOrient = eNew; } + void SetRelationOrient( sal_Int16 eNew ) { m_eRelation = eNew; } + + SwTwips GetPos() const { return m_nXPos; } + void SetPos( SwTwips nNew ) { m_nXPos = nNew; } + + bool IsPosToggle() const { return m_bPosToggle; } + void SetPosToggle( bool bNew ) { m_bPosToggle = bNew; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatVertOrient &SwAttrSet::GetVertOrient(bool bInP) const + { return Get( RES_VERT_ORIENT,bInP); } +inline const SwFormatHoriOrient &SwAttrSet::GetHoriOrient(bool bInP) const + { return Get( RES_HORI_ORIENT,bInP); } + +inline const SwFormatVertOrient &SwFormat::GetVertOrient(bool bInP) const + { return m_aSet.GetVertOrient(bInP); } +inline const SwFormatHoriOrient &SwFormat::GetHoriOrient(bool bInP) const + { return m_aSet.GetHoriOrient(bInP); } + +namespace sw { + + bool GetAtPageRelOrientation(sal_Int16 & rOrientation, bool const isIgnorePrintArea); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx new file mode 100644 index 000000000..887ddbcf4 --- /dev/null +++ b/sw/inc/fmtpdsc.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTPDSC_HXX +#define INCLUDED_SW_INC_FMTPDSC_HXX + +#include <svl/poolitem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "format.hxx" +#include "calbck.hxx" +#include <optional> +#include "pagedesc.hxx" + +class IntlWrapper; + +/** Pagedescriptor + Client of SwPageDesc that is "described" by the attribute. */ + +class SW_DLLPUBLIC SwFormatPageDesc : public SfxPoolItem, public SwClient +{ + ::std::optional<sal_uInt16> m_oNumOffset; ///< Offset page number. + SwModify* m_pDefinedIn; /**< Points to the object in which the + attribute was set (ContentNode/Format). */ +protected: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) override; + virtual void SwClientNotify( const SwModify&, const SfxHint& rHint ) override; + +public: + SwFormatPageDesc( const SwPageDesc *pDesc = nullptr ); + SwFormatPageDesc( const SwFormatPageDesc &rCpy ); + SwFormatPageDesc &operator=( const SwFormatPageDesc &rCpy ); + virtual ~SwFormatPageDesc() override; + + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatPageDesc* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + SwPageDesc *GetPageDesc() { return static_cast<SwPageDesc*>(GetRegisteredIn()); } + const SwPageDesc *GetPageDesc() const { return static_cast<const SwPageDesc*>(GetRegisteredIn()); } + + const ::std::optional<sal_uInt16>& GetNumOffset() const { return m_oNumOffset; } + void SetNumOffset( const ::std::optional<sal_uInt16>& oNum ) { m_oNumOffset = oNum; } + + /// Query / set where attribute is anchored. + const SwModify* GetDefinedIn() const { return m_pDefinedIn; } + void ChgDefinedIn( const SwModify* pNew ) { m_pDefinedIn = const_cast<SwModify*>(pNew); } + void RegisterToPageDesc( SwPageDesc& ); + bool KnowsPageDesc() const; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatPageDesc &SwAttrSet::GetPageDesc(bool bInP) const + { return Get( RES_PAGEDESC,bInP); } + +inline const SwFormatPageDesc &SwFormat::GetPageDesc(bool bInP) const + { return m_aSet.GetPageDesc(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx new file mode 100644 index 000000000..971bd8879 --- /dev/null +++ b/sw/inc/fmtrfmrk.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTRFMRK_HXX +#define INCLUDED_SW_INC_FMTRFMRK_HXX + +#include <rtl/ustring.hxx> +#include <cppuhelper/weakref.hxx> +#include <svl/poolitem.hxx> + +#include "calbck.hxx" + +namespace com::sun::star { + namespace text { class XTextContent; } +} + +class SwTextRefMark; + +// ATT_REFMARK + +class SAL_DLLPUBLIC_RTTI SwFormatRefMark final + : public SfxPoolItem + , public SwModify + , public sw::BroadcasterMixin +{ + friend class SwTextRefMark; + SwTextRefMark* m_pTextAttr; + + SwFormatRefMark& operator=(const SwFormatRefMark& rRefMark) = delete; + OUString m_aRefName; + + css::uno::WeakReference<css::text::XTextContent> m_wXReferenceMark; + +public: + SwFormatRefMark( const OUString& rText ); + SwFormatRefMark( const SwFormatRefMark& rRefMark ); + virtual ~SwFormatRefMark( ) override; + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatRefMark* Clone( SfxItemPool* pPool = nullptr ) const override; + + // SwClient + virtual void Modify(SfxPoolItem const* pOld, SfxPoolItem const* pNew) + override; + + void InvalidateRefMark(); + + const SwTextRefMark *GetTextRefMark() const { return m_pTextAttr; } + + OUString &GetRefName() { return m_aRefName; } + const OUString &GetRefName() const { return m_aRefName; } + + css::uno::WeakReference<css::text::XTextContent> const& GetXRefMark() const + { return m_wXReferenceMark; } + void SetXRefMark(css::uno::Reference<css::text::XTextContent> const& xMark) + { m_wXReferenceMark = xMark; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtrowsplt.hxx b/sw/inc/fmtrowsplt.hxx new file mode 100644 index 000000000..f216aba87 --- /dev/null +++ b/sw/inc/fmtrowsplt.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTROWSPLT_HXX +#define INCLUDED_SW_INC_FMTROWSPLT_HXX + +#include <svl/eitem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "format.hxx" + +class IntlWrapper; + +class SW_DLLPUBLIC SwFormatRowSplit : public SfxBoolItem +{ +public: + SwFormatRowSplit( bool bSplit = true ) : SfxBoolItem( RES_ROW_SPLIT, bSplit ) {} + + // "pure virtual methods" of SfxPoolItem + virtual SwFormatRowSplit* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +inline const SwFormatRowSplit &SwAttrSet::GetRowSplit(bool bInP) const + { return Get( RES_ROW_SPLIT,bInP); } + +inline const SwFormatRowSplit &SwFormat::GetRowSplit(bool bInP) const + { return m_aSet.GetRowSplit(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx new file mode 100644 index 000000000..7ac18fef4 --- /dev/null +++ b/sw/inc/fmtruby.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTRUBY_HXX +#define INCLUDED_SW_INC_FMTRUBY_HXX + +#include "swdllapi.h" +#include <svl/poolitem.hxx> +#include <com/sun/star/text/RubyAdjust.hpp> + +class SwTextRuby; + +class SW_DLLPUBLIC SwFormatRuby final : public SfxPoolItem +{ + friend class SwTextRuby; + + OUString m_sRubyText; ///< The ruby text. + OUString m_sCharFormatName; ///< Name of the charformat. + SwTextRuby* m_pTextAttr; ///< The TextAttribute. + sal_uInt16 m_nCharFormatId; ///< PoolId of the charformat. + sal_uInt16 m_nPosition; ///< Position of the Ruby-character. + css::text::RubyAdjust m_eAdjustment; ///< Specific adjustment of the Ruby-ch. + +public: + SwFormatRuby( const OUString& rRubyText ); + SwFormatRuby( const SwFormatRuby& rAttr ); + virtual ~SwFormatRuby() override; + + SwFormatRuby& operator=( const SwFormatRuby& rAttr ); + + // "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatRuby* Clone( SfxItemPool* pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + const SwTextRuby* GetTextRuby() const { return m_pTextAttr; } + + const OUString& GetText() const { return m_sRubyText; } + void SetText( const OUString& rText ) { m_sRubyText = rText; } + + const OUString& GetCharFormatName() const { return m_sCharFormatName; } + void SetCharFormatName( const OUString& rNm ) { m_sCharFormatName = rNm; } + + sal_uInt16 GetCharFormatId() const { return m_nCharFormatId; } + void SetCharFormatId( sal_uInt16 nNew ) { m_nCharFormatId = nNew; } + + sal_uInt16 GetPosition() const { return m_nPosition; } + void SetPosition( sal_uInt16 nNew ) { m_nPosition = nNew; } + + css::text::RubyAdjust GetAdjustment() const { return m_eAdjustment; } + void SetAdjustment( css::text::RubyAdjust nNew ) { m_eAdjustment = nNew; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtsrnd.hxx b/sw/inc/fmtsrnd.hxx new file mode 100644 index 000000000..e672d84f0 --- /dev/null +++ b/sw/inc/fmtsrnd.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTSRND_HXX +#define INCLUDED_SW_INC_FMTSRND_HXX + +#include "swdllapi.h" +#include <com/sun/star/text/WrapTextMode.hpp> +#include "hintids.hxx" +#include "format.hxx" +#include <svl/eitem.hxx> + +class IntlWrapper; + +// SwFormatSurround: How document content under the frame shall behave. +class SW_DLLPUBLIC SwFormatSurround: public SfxEnumItem<css::text::WrapTextMode> +{ + bool m_bAnchorOnly :1; + bool m_bContour :1; + bool m_bOutside :1; +public: + SwFormatSurround( css::text::WrapTextMode eNew = css::text::WrapTextMode_PARALLEL ); + + // "Pure virtual Methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatSurround* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual sal_uInt16 GetValueCount() const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + css::text::WrapTextMode GetSurround() const { return GetValue(); } + bool IsAnchorOnly() const { return m_bAnchorOnly; } + bool IsContour() const { return m_bContour; } + bool IsOutside() const { return m_bOutside; } + void SetSurround ( css::text::WrapTextMode eNew ) { SetValue( eNew ); } + void SetAnchorOnly( bool bNew ) { m_bAnchorOnly = bNew; } + void SetContour( bool bNew ) { m_bContour = bNew; } + void SetOutside( bool bNew ) { m_bOutside = bNew; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatSurround &SwAttrSet::GetSurround(bool bInP) const + { return Get( RES_SURROUND,bInP); } + +inline const SwFormatSurround &SwFormat::GetSurround(bool bInP) const + { return m_aSet.GetSurround(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmturl.hxx b/sw/inc/fmturl.hxx new file mode 100644 index 000000000..0f14b6dd3 --- /dev/null +++ b/sw/inc/fmturl.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTURL_HXX +#define INCLUDED_SW_INC_FMTURL_HXX + +#include <memory> +#include <svl/poolitem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "format.hxx" + +class ImageMap; +class IntlWrapper; + +// URL, ServerMap and ClientMap + +class SW_DLLPUBLIC SwFormatURL: public SfxPoolItem +{ + OUString m_sTargetFrameName; ///< Target frame for URL. + OUString m_sURL; ///< Simple URL. + OUString m_sName; ///< Name of the anchor. + std::unique_ptr<ImageMap> + m_pMap; ///< ClientSide images. + + bool m_bIsServerMap; ///< A ServerSideImageMap with the URL. + +public: + SwFormatURL(); + + SwFormatURL( const SwFormatURL& ); + + virtual ~SwFormatURL() override; + + /// "Pure virtual methods" of SfxPoolItem. + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatURL* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + void SetTargetFrameName( const OUString& rStr ) { m_sTargetFrameName = rStr; } + void SetURL(const OUString &rURL, bool bServerMap); + void SetMap( const ImageMap *pM ); ///< Pointer will be copied. + + const OUString& GetTargetFrameName()const { return m_sTargetFrameName; } + const OUString& GetURL() const { return m_sURL; } + bool IsServerMap() const { return m_bIsServerMap; } + const ImageMap *GetMap() const { return m_pMap.get(); } + ImageMap *GetMap() { return m_pMap.get(); } + + const OUString& GetName() const { return m_sName; } + void SetName( const OUString& rNm ) { m_sName = rNm; } +}; + +inline const SwFormatURL &SwAttrSet::GetURL(bool bInP) const + { return Get( RES_URL,bInP); } + +inline const SwFormatURL &SwFormat::GetURL(bool bInP) const + { return m_aSet.GetURL(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx b/sw/inc/fmtwrapinfluenceonobjpos.hxx new file mode 100644 index 000000000..84d3961a3 --- /dev/null +++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FMTWRAPINFLUENCEONOBJPOS_HXX +#define INCLUDED_SW_INC_FMTWRAPINFLUENCEONOBJPOS_HXX + +#include "hintids.hxx" +#include "format.hxx" +#include "swtypes.hxx" +#include <svl/poolitem.hxx> +#include <com/sun/star/text/WrapInfluenceOnPosition.hpp> + +class SW_DLLPUBLIC SwFormatWrapInfluenceOnObjPos: public SfxPoolItem +{ +private: + sal_Int16 mnWrapInfluenceOnPosition; + /// Allow objects to overlap, permitted by default. + bool mbAllowOverlap = true; + /// Vertical offset added during positioning to avoid an overlap. + SwTwips mnOverlapVertOffset = 0; + +public: + + // #i35017# - constant name has changed + SwFormatWrapInfluenceOnObjPos( + sal_Int16 _nWrapInfluenceOnPosition = css::text::WrapInfluenceOnPosition::ONCE_CONCURRENT ); + virtual ~SwFormatWrapInfluenceOnObjPos() override; + + SwFormatWrapInfluenceOnObjPos(SwFormatWrapInfluenceOnObjPos const &) = default; + SwFormatWrapInfluenceOnObjPos(SwFormatWrapInfluenceOnObjPos &&) = default; + SwFormatWrapInfluenceOnObjPos & operator =(SwFormatWrapInfluenceOnObjPos const &) = delete; // due to SfxPoolItem + SwFormatWrapInfluenceOnObjPos & operator =(SwFormatWrapInfluenceOnObjPos &&) = delete; // due to SfxPoolItem + + /// pure virtual methods of class <SfxPoolItem> + virtual bool operator==( const SfxPoolItem& _rAttr ) const override; + virtual SwFormatWrapInfluenceOnObjPos* Clone( SfxItemPool* pPool = nullptr ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + /// direct accessors to data + void SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition ); + // #i35017# - add parameter <_bIterativeAsOnceConcurrent> + /// to control, if value <ITERATIVE> has to be treated as <ONCE_CONCURRENT> + sal_Int16 GetWrapInfluenceOnObjPos( + const bool _bIterativeAsOnceConcurrent = false ) const; + + void SetAllowOverlap(bool bAllowOverlap); + bool GetAllowOverlap() const; + void SetOverlapVertOffset(SwTwips nOverlapVertOffset); + SwTwips GetOverlapVertOffset() const; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline const SwFormatWrapInfluenceOnObjPos& SwAttrSet::GetWrapInfluenceOnObjPos(bool bInP) const + { return Get( RES_WRAP_INFLUENCE_ON_OBJPOS,bInP); } + + inline const SwFormatWrapInfluenceOnObjPos& SwFormat::GetWrapInfluenceOnObjPos(bool bInP) const + { return m_aSet.GetWrapInfluenceOnObjPos(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx new file mode 100644 index 000000000..de607a382 --- /dev/null +++ b/sw/inc/format.hxx @@ -0,0 +1,257 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FORMAT_HXX +#define INCLUDED_SW_INC_FORMAT_HXX + +#include "swdllapi.h" +#include "swatrset.hxx" +#include "calbck.hxx" +#include <memory> + +class IDocumentSettingAccess; +class IDocumentDrawModelAccess; +class IDocumentLayoutAccess; +class IDocumentTimerAccess; +class IDocumentFieldsAccess; +class IDocumentChartDataProviderAccess; +class SwDoc; +class SfxGrabBagItem; +class SwTextGridItem; + +namespace drawinglayer::attribute { + class SdrAllFillAttributesHelper; + typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +} + +/// Base class for various Writer styles. +class SW_DLLPUBLIC SwFormat : public sw::BroadcastingModify +{ + friend class SwFrameFormat; + + OUString m_aFormatName; + SwAttrSet m_aSet; + + sal_uInt16 m_nWhichId; + sal_uInt16 m_nPoolFormatId; /**< Id for "automatically" created formats. + (is not hard attribution!!!) */ + sal_uInt16 m_nPoolHelpId; ///< HelpId for this Pool-style. + sal_uInt8 m_nPoolHlpFileId; ///< FilePos to Doc to these style helps. + bool m_bAutoFormat : 1; /**< FALSE: it is a template. + default is true! */ + bool m_bFormatInDTOR : 1; /**< TRUE: Format becomes deleted. In order to be able + to recognize this in FormatChg-message!! */ + bool m_bAutoUpdateFormat : 1;/**< TRUE: Set attributes of a whole paragraph + at format (UI-side!). */ + bool m_bHidden : 1; + std::shared_ptr<SfxGrabBagItem> m_pGrabBagItem; ///< Style InteropGrabBag. + +protected: + SwFormat( SwAttrPool& rPool, const char* pFormatNm, + const sal_uInt16* pWhichRanges, SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich ); + SwFormat( SwAttrPool& rPool, const OUString &rFormatNm, const sal_uInt16* pWhichRanges, + SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich ); + SwFormat( const SwFormat& rFormat ); + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue ) override; + +public: + + virtual ~SwFormat() override; + SwFormat &operator=(const SwFormat&); + + /// for Querying of Writer-functions. + sal_uInt16 Which() const { return m_nWhichId; } + + /// Copy attributes even among documents. + void CopyAttrs( const SwFormat& ); + + /// Delete all attributes that are not in rFormat. + void DelDiffs( const SfxItemSet& rSet ); + void DelDiffs( const SwFormat& rFormat ) { DelDiffs( rFormat.GetAttrSet() ); } + + /// 0 is Default. + bool SetDerivedFrom(SwFormat *pDerivedFrom = nullptr); + + /// If bInParents is FALSE, search only in this format for attribute. + const SfxPoolItem& GetFormatAttr( sal_uInt16 nWhich, + bool bInParents = true ) const; + template<class T> const T& GetFormatAttr( TypedWhichId<T> nWhich, bool bInParents = true ) const + { + return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents)); + } + SfxItemState GetItemState( sal_uInt16 nWhich, bool bSrchInParent = true, + const SfxPoolItem **ppItem = nullptr ) const; + SfxItemState GetBackgroundState(std::unique_ptr<SvxBrushItem>& rItem) const; + virtual bool SetFormatAttr( const SfxPoolItem& rAttr ); + virtual bool SetFormatAttr( const SfxItemSet& rSet ); + virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ); + + /** Takes all hints from Delta-Array, + @return count of deleted hints. */ + virtual sal_uInt16 ResetAllFormatAttr(); + + SwFormat* DerivedFrom() const { return const_cast<SwFormat*>(static_cast<const SwFormat*>(GetRegisteredIn())); } + bool IsDefault() const { return DerivedFrom() == nullptr; } + + const OUString& GetName() const { return m_aFormatName; } + bool HasName(const OUString &rName) const { return m_aFormatName == rName; } + virtual void SetName( const OUString& rNewName, bool bBroadcast=false ); + + /// For querying the attribute array. + const SwAttrSet& GetAttrSet() const { return m_aSet; } + + /** The document is set in SwAttrPool now, therefore you always can access it. */ + const SwDoc *GetDoc() const { return m_aSet.GetDoc(); } + SwDoc *GetDoc() { return m_aSet.GetDoc(); } + + /// Provides access to the document settings interface. + const IDocumentSettingAccess& getIDocumentSettingAccess() const; + + /// Provides access to the document draw model interface. + const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const; + IDocumentDrawModelAccess& getIDocumentDrawModelAccess(); + + /// Provides access to the document layout interface. + const IDocumentLayoutAccess& getIDocumentLayoutAccess() const; + IDocumentLayoutAccess& getIDocumentLayoutAccess(); + + /// Provides access to the document idle timer interface. + IDocumentTimerAccess& getIDocumentTimerAccess(); + + /// Provides access to the document idle timer interface. + IDocumentFieldsAccess& getIDocumentFieldsAccess(); + + /// Gives access to the chart data-provider. + IDocumentChartDataProviderAccess& getIDocumentChartDataProviderAccess(); + + /// Get and set Pool style IDs. + sal_uInt16 GetPoolFormatId() const { return m_nPoolFormatId; } + void SetPoolFormatId( sal_uInt16 nId ) { m_nPoolFormatId = nId; } + + /// Get and set Help-IDs for document templates. + sal_uInt16 GetPoolHelpId() const { return m_nPoolHelpId; } + void SetPoolHelpId( sal_uInt16 nId ) { m_nPoolHelpId = nId; } + sal_uInt8 GetPoolHlpFileId() const { return m_nPoolHlpFileId; } + void SetPoolHlpFileId( sal_uInt8 nId ) { m_nPoolHlpFileId = nId; } + + /// Get attribute-description. Returns passed string. + void GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const + { m_aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, rText ); } + + /// Query / set AutoFormat-flag. + bool IsAuto() const { return m_bAutoFormat; } + void SetAuto( bool bNew ) { m_bAutoFormat = bNew; } + + bool IsHidden() const { return m_bHidden; } + void SetHidden( bool bValue ) { m_bHidden = bValue; } + + void GetGrabBagItem(css::uno::Any& rVal) const; + void SetGrabBagItem(const css::uno::Any& rVal); + + /// Query / set bAutoUpdateFormat-flag. + bool IsAutoUpdateFormat() const { return m_bAutoUpdateFormat; } + void SetAutoUpdateFormat( bool bNew = true ) { m_bAutoUpdateFormat = bNew; } + + bool IsFormatInDTOR() const { return m_bFormatInDTOR; } + + /** GetMethods: Bool indicates whether to search only in Set (FALSE) + or also in Parents. + If nothing is found the defaulted attribute is returned. */ + + /// Character-attributes - implemented in charatr.hxx + inline const SvxUnderlineItem &GetUnderline( bool = true ) const; + inline const SvxFontHeightItem &GetSize( bool = true ) const; + inline const SvxFontItem &GetFont( bool = true ) const; + inline const SvxColorItem &GetColor( bool = true ) const; + inline const SvxFontItem &GetCJKFont( bool = true ) const; + inline const SvxFontItem &GetCTLFont( bool = true ) const; + + /// Frame-attributes - implemented in frmatr.hxx. + inline const SwFormatFillOrder &GetFillOrder( bool = true ) const; + inline const SwFormatFrameSize &GetFrameSize( bool = true ) const; + inline const SwFormatHeader &GetHeader( bool = true ) const; + inline const SwFormatFooter &GetFooter( bool = true ) const; + inline const SwFormatSurround &GetSurround( bool = true ) const; + inline const SwFormatHoriOrient &GetHoriOrient( bool = true ) const; + inline const SwFormatAnchor &GetAnchor( bool = true ) const; + inline const SwFormatCol &GetCol( bool = true ) const; + inline const SvxPaperBinItem &GetPaperBin( bool = true ) const; + inline const SvxLRSpaceItem &GetLRSpace( bool = true ) const; + inline const SvxULSpaceItem &GetULSpace( bool = true ) const; + inline const SwFormatContent &GetContent( bool = true ) const; + inline const SvxPrintItem &GetPrint( bool = true ) const; + inline const SvxOpaqueItem &GetOpaque( bool = true ) const; + inline const SvxProtectItem &GetProtect( bool = true ) const; + inline const SwFormatVertOrient &GetVertOrient( bool = true ) const; + inline const SvxBoxItem &GetBox( bool = true ) const; + inline const SvxFormatKeepItem &GetKeep( bool = true ) const; + + // Create SvxBrushItem for Background fill (partially for backwards compatibility) + std::unique_ptr<SvxBrushItem> makeBackgroundBrushItem( bool = true ) const; + + inline const SvxShadowItem &GetShadow( bool = true ) const; + inline const SwFormatPageDesc &GetPageDesc( bool = true ) const; + inline const SvxFormatBreakItem &GetBreak( bool = true ) const; + inline const SvxMacroItem &GetMacro( bool = true ) const; + inline const SwFormatURL &GetURL( bool = true ) const; + inline const SwFormatEditInReadonly &GetEditInReadonly( bool = true ) const; + inline const SwFormatLayoutSplit &GetLayoutSplit( bool = true ) const; + inline const SwFormatRowSplit &GetRowSplit( bool = true ) const; + inline const SwFormatChain &GetChain( bool = true ) const; + inline const SwFormatFootnoteAtTextEnd &GetFootnoteAtTextEnd( bool = true ) const; + inline const SwFormatEndAtTextEnd &GetEndAtTextEnd( bool = true ) const; + inline const SwFormatNoBalancedColumns &GetBalancedColumns( bool = true ) const; + inline const SvxFrameDirectionItem &GetFrameDir( bool = true ) const; + inline const SwTextGridItem &GetTextGrid( bool = true ) const; + inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( bool = true ) const; + // #i18732# + inline const SwFormatFollowTextFlow &GetFollowTextFlow(bool = true) const; + // #i28701# + inline const SwFormatWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(bool = true) const; + inline const SdrTextVertAdjustItem& GetTextVertAdjust(bool = true) const; + + /// Paragraph-attributes - implemented in paratr.hxx. + inline const SvxLineSpacingItem &GetLineSpacing( bool = true ) const; + inline const SwNumRuleItem &GetNumRule( bool = true ) const; + inline const SvxTabStopItem &GetTabStops( bool = true ) const; + inline const SwFormatDrop &GetDrop( bool = true ) const; + + /// TableBox attributes - implemented in cellatr.hxx. + inline const SwTableBoxNumFormat &GetTableBoxNumFormat( bool = true ) const; + inline const SwTableBoxFormula &GetTableBoxFormula( bool = true ) const; + inline const SwTableBoxValue &GetTableBoxValue( bool = true ) const; + + /** SwFormat::IsBackgroundTransparent + + Virtual method to determine, if background of format is transparent. + Default implementation returns false. Thus, subclasses have to override + method, if the specific subclass can have a transparent background. + + @return false, default implementation + */ + virtual bool IsBackgroundTransparent() const; + + // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; + virtual bool supportsFullDrawingLayerFillAttributeSet() const; +}; + +#endif // INCLUDED_SW_INC_FORMAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/frameformats.hxx b/sw/inc/frameformats.hxx new file mode 100644 index 000000000..92b34d49e --- /dev/null +++ b/sw/inc/frameformats.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#pragma once + +#include "docary.hxx" +#include <boost/multi_index_container.hpp> +#include <boost/multi_index/composite_key.hpp> +#include <boost/multi_index/identity.hpp> +#include <boost/multi_index/mem_fun.hpp> +#include <boost/multi_index/ordered_index.hpp> +#include <boost/multi_index/random_access_index.hpp> + +// Like o3tl::find_partialorder_ptrequals +// We don't allow duplicated object entries! +struct type_name_key + : boost::multi_index::composite_key< + SwFrameFormat*, boost::multi_index::const_mem_fun<SwFormat, sal_uInt16, &SwFormat::Which>, + boost::multi_index::const_mem_fun<SwFormat, const OUString&, &SwFormat::GetName>, + boost::multi_index::identity<SwFrameFormat*> // the actual object pointer + > +{ +}; + +typedef boost::multi_index_container< + SwFrameFormat*, + boost::multi_index::indexed_by<boost::multi_index::random_access<>, + boost::multi_index::ordered_unique<type_name_key>>> + SwFrameFormatsBase; + +/// Specific frame formats (frames, DrawObjects). +class SW_DLLPUBLIC SwFrameFormats : public SwFormatsBase +{ + // function updating ByName index via modify + friend void SwFrameFormat::SetName(const OUString&, bool); + + typedef SwFrameFormatsBase::nth_index<0>::type ByPos; + typedef SwFrameFormatsBase::nth_index<1>::type ByTypeAndName; + typedef ByPos::iterator iterator; + + SwFrameFormatsBase m_Array; + ByPos& m_PosIndex; + ByTypeAndName& m_TypeAndNameIndex; + +public: + typedef ByPos::const_iterator const_iterator; + typedef ByTypeAndName::const_iterator const_range_iterator; + typedef SwFrameFormatsBase::size_type size_type; + typedef SwFrameFormatsBase::value_type value_type; + + SwFrameFormats(); + // frees all SwFrameFormat! + virtual ~SwFrameFormats() override; + + bool empty() const { return m_Array.empty(); } + size_t size() const { return m_Array.size(); } + + // Only fails, if you try to insert the same object twice + std::pair<const_iterator, bool> push_back(const value_type& x); + + // This will try to remove the exact object! + bool erase(const value_type& x); + void erase(size_type index); + void erase(const_iterator const& position); + + // Get the iterator of the exact object (includes pointer!), + // e.g for position with std::distance. + // There is also ContainsFormat, if you don't need the position. + const_iterator find(const value_type& x) const; + + // As this array is non-unique related to type and name, + // we always get ranges for the "key" values. + std::pair<const_range_iterator, const_range_iterator> rangeFind(sal_uInt16 type, + const OUString& name) const; + // Convenience function, which just uses type and name! + // To look for the exact object use find. + std::pair<const_range_iterator, const_range_iterator> rangeFind(const value_type& x) const; + // So we can actually check for end() + const_range_iterator rangeEnd() const { return m_TypeAndNameIndex.end(); } + const_iterator rangeProject(const_range_iterator const& position) + { + return m_Array.project<0>(position); + } + + const value_type& operator[](size_t index_) const { return m_PosIndex.operator[](index_); } + const value_type& front() const { return m_PosIndex.front(); } + const value_type& back() const { return m_PosIndex.back(); } + const_iterator begin() const { return m_PosIndex.begin(); } + const_iterator end() const { return m_PosIndex.end(); } + + void dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) const; + + virtual size_t GetFormatCount() const override { return m_Array.size(); } + virtual SwFormat* GetFormat(size_t idx) const override { return operator[](idx); } + + /// fast check if given format is contained here + /// @precond pFormat must not have been deleted + bool ContainsFormat(SwFrameFormat const& rFormat) const; + /// not so fast check that given format is still alive (i.e. contained here) + bool IsAlive(SwFrameFormat const*) const; + + void DeleteAndDestroyAll(bool keepDefault = false); + + bool newDefault(const value_type& x); + void newDefault(const_iterator const& position); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx new file mode 100644 index 000000000..51dda4f4a --- /dev/null +++ b/sw/inc/frmatr.hxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FRMATR_HXX +#define INCLUDED_SW_INC_FRMATR_HXX + +#include "hintids.hxx" +#include "format.hxx" +#include <editeng/pbinitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/prntitem.hxx> +#include <editeng/opaqitem.hxx> +#include <editeng/protitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/formatbreakitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <svl/macitem.hxx> +#include <svx/sdtaitm.hxx> + +// Inlines + +// Implementation of FrameAttribute methods of SwAttrSet. +inline const SvxPaperBinItem &SwAttrSet::GetPaperBin(bool bInP) const + { return Get( RES_PAPER_BIN,bInP); } +inline const SvxLRSpaceItem &SwAttrSet::GetLRSpace(bool bInP) const + { return Get( RES_LR_SPACE,bInP); } +inline const SvxULSpaceItem &SwAttrSet::GetULSpace(bool bInP) const + { return Get( RES_UL_SPACE,bInP); } +inline const SvxPrintItem &SwAttrSet::GetPrint(bool bInP) const + { return Get( RES_PRINT,bInP); } +inline const SvxOpaqueItem &SwAttrSet::GetOpaque(bool bInP) const + { return Get( RES_OPAQUE,bInP); } +inline const SvxProtectItem &SwAttrSet::GetProtect(bool bInP) const + { return Get( RES_PROTECT,bInP); } +inline const SvxBoxItem &SwAttrSet::GetBox(bool bInP) const + { return Get( RES_BOX,bInP); } +inline const SvxFormatKeepItem &SwAttrSet::GetKeep(bool bInP) const + { return Get( RES_KEEP,bInP); } +inline const SvxBrushItem &SwAttrSet::GetBackground(bool bInP) const + { return Get( RES_BACKGROUND,bInP); } +inline const SvxShadowItem &SwAttrSet::GetShadow(bool bInP) const + { return Get( RES_SHADOW,bInP); } +inline const SvxFormatBreakItem &SwAttrSet::GetBreak(bool bInP) const + { return Get( RES_BREAK,bInP); } +inline const SvxMacroItem &SwAttrSet::GetMacro(bool bInP) const + { return Get( RES_FRMMACRO,bInP); } +inline const SvxFrameDirectionItem &SwAttrSet::GetFrameDir(bool bInP) const + { return Get( RES_FRAMEDIR,bInP); } +inline const SdrTextVertAdjustItem &SwAttrSet::GetTextVertAdjust(bool bInP) const + { return Get( RES_TEXT_VERT_ADJUST,bInP); } + +// Implementation of FrameAttribute methods of SwFormat. +inline const SvxPaperBinItem &SwFormat::GetPaperBin(bool bInP) const + { return m_aSet.GetPaperBin(bInP); } +inline const SvxLRSpaceItem &SwFormat::GetLRSpace(bool bInP) const + { return m_aSet.GetLRSpace(bInP); } +inline const SvxULSpaceItem &SwFormat::GetULSpace(bool bInP) const + { return m_aSet.GetULSpace(bInP); } +inline const SvxPrintItem &SwFormat::GetPrint(bool bInP) const + { return m_aSet.GetPrint(bInP); } +inline const SvxOpaqueItem &SwFormat::GetOpaque(bool bInP) const + { return m_aSet.GetOpaque(bInP); } +inline const SvxProtectItem &SwFormat::GetProtect(bool bInP) const + { return m_aSet.GetProtect(bInP); } +inline const SvxBoxItem &SwFormat::GetBox(bool bInP) const + { return m_aSet.GetBox(bInP); } +inline const SvxFormatKeepItem &SwFormat::GetKeep(bool bInP) const + { return m_aSet.GetKeep(bInP); } +inline const SvxShadowItem &SwFormat::GetShadow(bool bInP) const + { return m_aSet.GetShadow(bInP); } +inline const SvxFormatBreakItem &SwFormat::GetBreak(bool bInP) const + { return m_aSet.GetBreak(bInP); } +inline const SvxMacroItem &SwFormat::GetMacro(bool bInP) const + { return m_aSet.GetMacro(bInP); } +inline const SvxFrameDirectionItem &SwFormat::GetFrameDir(bool bInP) const + { return m_aSet.GetFrameDir(bInP); } +inline const SdrTextVertAdjustItem &SwFormat::GetTextVertAdjust(bool bInP) const + { return m_aSet.GetTextVertAdjust(bInP); } + +#endif // INCLUDED_SW_INC_FRMATR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx new file mode 100644 index 000000000..d739925f8 --- /dev/null +++ b/sw/inc/frmfmt.hxx @@ -0,0 +1,413 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FRMFMT_HXX +#define INCLUDED_SW_INC_FRMFMT_HXX + +#include <memory> +#include <com/sun/star/text/PositionLayoutDir.hpp> +#include <cppuhelper/weakref.hxx> +#include <tools/gen.hxx> +#include "format.hxx" +#include "hintids.hxx" +#include "swdllapi.h" +#include <list> + +class SwFlyFrame; +class SwFlyDrawContact; +class SwAnchoredObject; +class Graphic; +class ImageMap; +class IMapObject; +class SwRect; +class SdrObject; +class SwRootFrame; + +namespace sw +{ + class DocumentLayoutManager; + // This is cheating: we are not really decoupling much with this hint. + // SwDrawFrameFormat should probably bookkeep its SdrObject (and + // SwDrawFrameFormat too) as members + struct SW_DLLPUBLIC FindSdrObjectHint final : SfxHint + { + SdrObject*& m_rpObject; + FindSdrObjectHint(SdrObject*& rpObject) : m_rpObject(rpObject) {}; + virtual ~FindSdrObjectHint() override; + }; +} +class SwFrameFormats; + +/// Style of a layout element. +class SW_DLLPUBLIC SwFrameFormat + : public SwFormat +{ + friend class SwDoc; + friend class SwPageDesc; ///< Is allowed to call protected CTor. + friend class ::sw::DocumentLayoutManager; ///< Is allowed to call protected CTor. + friend class SwFrameFormats; ///< Is allowed to update the list backref. + friend class SwTextBoxHelper; + friend class SwUndoFlyBase; ///< calls SetOtherTextBoxFormat + + css::uno::WeakReference<css::uno::XInterface> m_wXObject; + + // DrawingLayer FillAttributes in a preprocessed form for primitive usage + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes; + + // The assigned SwFrmFmt list. + SwFrameFormats *m_ffList; + + SwFrameFormat *m_pOtherTextBoxFormat; + + struct change_name + { + change_name(const OUString &rName) : mName(rName) {} + void operator()(SwFormat *pFormat) { pFormat->m_aFormatName = mName; } + const OUString &mName; + }; + +protected: + SwFrameFormat( + SwAttrPool& rPool, + const char* pFormatNm, + SwFrameFormat *pDrvdFrame, + sal_uInt16 nFormatWhich = RES_FRMFMT, + const sal_uInt16* pWhichRange = nullptr); + + SwFrameFormat( + SwAttrPool& rPool, + const OUString &rFormatNm, + SwFrameFormat *pDrvdFrame, + sal_uInt16 nFormatWhich = RES_FRMFMT, + const sal_uInt16* pWhichRange = nullptr); + + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue ) override; + + SwFrameFormat* GetOtherTextBoxFormat() const { return m_pOtherTextBoxFormat; } + void SetOtherTextBoxFormat( SwFrameFormat *pFormat ); + +public: + virtual ~SwFrameFormat() override; + + SwFrameFormat(SwFrameFormat const &) = default; + SwFrameFormat(SwFrameFormat &&) = default; + SwFrameFormat & operator =(SwFrameFormat const &) = default; + SwFrameFormat & operator =(SwFrameFormat &&) = default; + + /// Destroys all Frames in aDepend (Frames are identified via dynamic_cast). + virtual void DelFrames(); + + /// Creates the views. + virtual void MakeFrames(); + + virtual Graphic MakeGraphic( ImageMap* pMap = nullptr ); + + /** @return the IMapObject defined at format (Fly) + in the ImageMap at position Point. + rPoint - test on DocPosition. + pFly - optional FlyFrame, in case it is already known. */ + IMapObject* GetIMapObject( const Point& rPoint, + const SwFlyFrame *pFly = nullptr ) const; + + /** @return the real size of the frame - or an empty rectangle + if no layout exists. + If pPoint is given, look for the frame closest to it. */ + SwRect FindLayoutRect( const bool bPrtArea = false, + const Point* pPoint = nullptr ) const; + + /** @return the SdrObject, that is connected to the ContactObject. + Only DrawFrameFormats are connected to the "real SdrObject". FlyFrameFormats + are connected to a Master and all FlyFrames has the "real SdrObject". + "Real SdrObject" has position and a Z-order. */ + SdrObject* FindSdrObject() + { + SdrObject* pObject(nullptr); + CallSwClientNotify(sw::FindSdrObjectHint(pObject)); + return pObject; + } + const SdrObject *FindSdrObject() const + { return const_cast<SwFrameFormat*>(this)->FindSdrObject(); } + + SdrObject *FindRealSdrObject(); + const SdrObject *FindRealSdrObject() const + { return const_cast<SwFrameFormat*>(this)->FindRealSdrObject(); } + + bool IsLowerOf( const SwFrameFormat& rFormat ) const; + + enum tLayoutDir + { + HORI_L2R, + HORI_R2L, + VERT_R2L + }; + + virtual SwFrameFormat::tLayoutDir GetLayoutDir() const; + virtual void SetLayoutDir( const SwFrameFormat::tLayoutDir _eLayoutDir ); + + virtual sal_Int16 GetPositionLayoutDir() const; + virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ); + + virtual OUString GetDescription() const; + + SAL_DLLPRIVATE css::uno::WeakReference<css::uno::XInterface> const& GetXObject() const + { return m_wXObject; } + SAL_DLLPRIVATE void SetXObject(css::uno::Reference<css::uno::XInterface> const& xObject) + { m_wXObject = xObject; } + + void RegisterToFormat( SwFormat& rFormat ); + + // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override; + virtual bool supportsFullDrawingLayerFillAttributeSet() const override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + virtual void SetName( const OUString& rNewName, bool bBroadcast=false ) override; +}; + +// The FlyFrame-Format + +class SW_DLLPUBLIC SwFlyFrameFormat final : public SwFrameFormat +{ + friend class SwDoc; + OUString msTitle; + OUString msDesc; + + /** Both not existent. + it stores the previous position of Prt rectangle from RequestObjectResize + so it can be used to move frames of non-resizable objects to align them correctly + when they get borders (this is done in SwWrtShell::CalcAndGetScale) */ + Point m_aLastFlyFramePrtRectPos; + std::unique_ptr<SwFlyDrawContact> m_pContact; + + SwFlyFrameFormat( const SwFlyFrameFormat &rCpy ) = delete; + SwFlyFrameFormat &operator=( const SwFlyFrameFormat &rCpy ) = delete; + + SwFlyFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, SwFrameFormat *pDrvdFrame ); + +public: + virtual ~SwFlyFrameFormat() override; + + /// Creates the views. + virtual void MakeFrames() override; + + SwFlyFrame* GetFrame( const Point* pDocPos = nullptr ) const; + + SwAnchoredObject* GetAnchoredObj() const; + + virtual Graphic MakeGraphic( ImageMap* pMap = nullptr ) override; + + virtual bool GetInfo( SfxPoolItem& rInfo ) const override; + + OUString GetObjTitle() const; + void SetObjTitle( const OUString& rTitle, bool bBroadcast = false ); + OUString GetObjDescription() const; + void SetObjDescription( const OUString& rDescription, bool bBroadcast = false ); + + /** SwFlyFrameFormat::IsBackgroundTransparent + + Override virtual method and its default implementation, + because format of fly frame provides transparent backgrounds. + Method determines, if background of fly frame is transparent. + + @return true, if background color is transparent, but not "no fill" + or an existing background graphic is transparent. + */ + virtual bool IsBackgroundTransparent() const override; + + /** SwFlyFrameFormat::IsBackgroundBrushInherited + + Method to determine, if the brush for drawing the + background is "inherited" from its parent/grandparent. + This is the case, if no background graphic is set and the background + color is "no fill"/"auto fill" + + @return true, if background brush is "inherited" from parent/grandparent + */ + bool IsBackgroundBrushInherited() const; + + const Point & GetLastFlyFramePrtRectPos() const { return m_aLastFlyFramePrtRectPos; } + void SetLastFlyFramePrtRectPos( const Point &rPoint ) { m_aLastFlyFramePrtRectPos = rPoint; } + + SwFlyDrawContact* GetOrCreateContact(); +}; + +//The DrawFrame-Format + + +class SwDrawFrameFormat; +class SwDrawContact; +class SdrTextObj; + +namespace sw +{ + enum class DrawFrameFormatHintId { + DYING, + PREPPASTING, + PREP_INSERT_FLY, + PREP_DELETE_FLY, + PAGE_OUT_OF_BOUNDS, + MAKE_FRAMES, + DELETE_FRAMES, + POST_RESTORE_FLY_ANCHOR, + }; + struct DrawFrameFormatHint final: SfxHint + { + DrawFrameFormatHintId m_eId; + DrawFrameFormatHint(DrawFrameFormatHintId eId) : m_eId(eId) {}; + virtual ~DrawFrameFormatHint() override; + }; + struct CheckDrawFrameFormatLayerHint final: SfxHint + { + bool* m_bCheckControlLayer; + CheckDrawFrameFormatLayerHint(bool* bCheckControlLayer) : m_bCheckControlLayer(bCheckControlLayer) {}; + virtual ~CheckDrawFrameFormatLayerHint() override; + }; + struct ContactChangedHint final: SfxHint + { + SdrObject** m_ppObject; + ContactChangedHint(SdrObject** ppObject) : m_ppObject(ppObject) {}; + virtual ~ContactChangedHint() override; + }; + struct DrawFormatLayoutCopyHint final : SfxHint + { + SwDrawFrameFormat& m_rDestFormat; + SwDoc& m_rDestDoc; + DrawFormatLayoutCopyHint(SwDrawFrameFormat& rDestFormat, SwDoc& rDestDoc) : m_rDestFormat(rDestFormat), m_rDestDoc(rDestDoc) {}; + virtual ~DrawFormatLayoutCopyHint() override; + }; + enum class WW8AnchorConv + { + NO_CONV, + CONV2PG, + CONV2COL_OR_PARA, + CONV2CHAR, + CONV2LINE, + RELTOTABLECELL + }; + struct WW8AnchorConvResult final + { + WW8AnchorConv m_eHoriConv; + WW8AnchorConv m_eVertConv; + bool m_bConverted; + Point m_aPos; + WW8AnchorConvResult(WW8AnchorConv eHoriConv, WW8AnchorConv eVertConv) : m_eHoriConv(eHoriConv), m_eVertConv(eVertConv), m_bConverted(false) {}; + }; + struct SW_DLLPUBLIC WW8AnchorConvHint final : SfxHint + { + WW8AnchorConvResult& m_rResult; + WW8AnchorConvHint(WW8AnchorConvResult& rResult) : m_rResult(rResult) {}; + virtual ~WW8AnchorConvHint() override; + }; + struct RestoreFlyAnchorHint final : SfxHint + { + const Point m_aPos; + RestoreFlyAnchorHint(Point aPos) : m_aPos(aPos) {}; + virtual ~RestoreFlyAnchorHint() override; + }; + struct CreatePortionHint final : SfxHint + { + SwDrawContact** m_ppContact; + CreatePortionHint(SwDrawContact** ppContact) : m_ppContact(ppContact) {}; + virtual ~CreatePortionHint() override; + }; + struct CollectTextObjectsHint final : SfxHint + { + std::list<SdrTextObj*>& m_rTextObjects; + CollectTextObjectsHint(std::list<SdrTextObj*>& rTextObjects) : m_rTextObjects(rTextObjects) {}; + virtual ~CollectTextObjectsHint() override; + }; + struct GetZOrderHint final : SfxHint + { + sal_uInt32& m_rnZOrder; + GetZOrderHint(sal_uInt32& rnZOrder) : m_rnZOrder(rnZOrder) {}; + virtual ~GetZOrderHint() override; + }; + struct GetObjectConnectedHint final : SfxHint + { + bool& m_risConnected; + const SwRootFrame* m_pRoot; + GetObjectConnectedHint(bool& risConnected, const SwRootFrame* pRoot) : m_risConnected(risConnected), m_pRoot(pRoot) {}; + virtual ~GetObjectConnectedHint() override; + }; +} + +class SW_DLLPUBLIC SwDrawFrameFormat: public SwFrameFormat +{ + friend class SwDoc; + + mutable const SdrObject * m_pSdrObjectCached; + mutable OUString m_sSdrObjectCachedComment; + + SwDrawFrameFormat( const SwDrawFrameFormat &rCpy ) = delete; + SwDrawFrameFormat &operator=( const SwDrawFrameFormat &rCpy ) = delete; + + SwFrameFormat::tLayoutDir meLayoutDir; + + sal_Int16 mnPositionLayoutDir; + + bool mbPosAttrSet; + +protected: + SwDrawFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm, + SwFrameFormat *pDrvdFrame ) + : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_DRAWFRMFMT ), + m_pSdrObjectCached(nullptr), + meLayoutDir( SwFrameFormat::HORI_L2R ), + + mnPositionLayoutDir( css::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), + + mbPosAttrSet( false ) + {} + +public: + virtual ~SwDrawFrameFormat() override; + + /** DrawObjects are removed from the arrays at the layout. + The DrawObjects are marked as deleted. */ + virtual void DelFrames() override; + + /** Register DrawObjects in the arrays at layout. + Reset delete marks. */ + virtual void MakeFrames() override; + + virtual Graphic MakeGraphic( ImageMap* pMap = nullptr ) override; + + virtual SwFrameFormat::tLayoutDir GetLayoutDir() const override; + virtual void SetLayoutDir( const SwFrameFormat::tLayoutDir _eLayoutDir ) override; + + virtual sal_Int16 GetPositionLayoutDir() const override; + virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ) override; + + bool IsPosAttrSet() const { return mbPosAttrSet; } + void PosAttrSet() { mbPosAttrSet = true; } + + virtual OUString GetDescription() const override; +}; + +namespace sw { + +SW_DLLPUBLIC bool IsFlyFrameFormatInHeader(const SwFrameFormat& rFormat); + +void CheckAnchoredFlyConsistency(SwDoc const& rDoc); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx new file mode 100644 index 000000000..39acdf0a9 --- /dev/null +++ b/sw/inc/ftnidx.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FTNIDX_HXX +#define INCLUDED_SW_INC_FTNIDX_HXX + +#include <vector> +#include <sal/types.h> +#include <o3tl/sorted_vector.hxx> + +class IDocumentRedlineAccess; +class SwTextFootnote; +class SwNodeIndex; +class SwSectionNode; + +// Everywhere where NodeIndex is used, the header files missing here +// are already included. Therefore put here as defines only and +// not as inline methods (saves compile time). +#define SwTextFootnote_GetIndex( pFIdx ) (pFIdx->GetTextNode().GetIndex()) + +struct CompareSwFootnoteIdxs +{ + bool operator()(SwTextFootnote* const& lhs, SwTextFootnote* const& rhs) const; +}; + +class SwFootnoteIdxs : public o3tl::sorted_vector<SwTextFootnote*, CompareSwFootnoteIdxs> +{ +public: + SwFootnoteIdxs() {} + + void UpdateFootnote( const SwNodeIndex& rStt ); // Update all from pos. + void UpdateAllFootnote(); // Update all footnotes. + + SwTextFootnote* SeekEntry( const SwNodeIndex& rIdx, size_t* pPos = nullptr ) const; +}; + +class SwUpdFootnoteEndNtAtEnd +{ + std::vector<const SwSectionNode*> m_aFootnoteSections, m_aEndSections; + std::vector<std::pair<sal_uInt16, sal_uInt16>> m_aFootnoteNumbers, m_aEndNumbers; + +public: + SwUpdFootnoteEndNtAtEnd() : m_aFootnoteSections(), m_aEndSections() {} + + static const SwSectionNode* FindSectNdWithEndAttr( + const SwTextFootnote& rTextFootnote ); + + std::pair<sal_uInt16, sal_uInt16> GetNumber( + IDocumentRedlineAccess const&, const SwTextFootnote& rTextFootnote, + const SwSectionNode& rNd); + std::pair<sal_uInt16, sal_uInt16> ChkNumber( + IDocumentRedlineAccess const&, const SwTextFootnote& rTextFootnote); +}; + +namespace sw { + +bool IsFootnoteDeleted(IDocumentRedlineAccess const& rIDRA, + SwTextFootnote const& rTextFootnote); + +} + +#endif // INCLUDED_SW_INC_FTNIDX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx new file mode 100644 index 000000000..c9084aef3 --- /dev/null +++ b/sw/inc/ftninfo.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_FTNINFO_HXX +#define INCLUDED_SW_INC_FTNINFO_HXX + +#include <rtl/ustring.hxx> +#include "swdllapi.h" +#include "calbck.hxx" +#include <editeng/numitem.hxx> + +class SwTextFormatColl; +class SwPageDesc; +class SwCharFormat; +class SwDoc; + +class SW_DLLPUBLIC SwEndNoteInfo : public SwClient +{ + mutable sw::WriterMultiListener m_aDepends; + mutable SwTextFormatColl* m_pTextFormatColl; + mutable SwPageDesc* m_pPageDesc; + mutable SwCharFormat* m_pCharFormat; + mutable SwCharFormat* m_pAnchorFormat; + OUString m_sPrefix; + OUString m_sSuffix; +protected: + bool m_bEndNote; + virtual void SwClientNotify( const SwModify&, const SfxHint&) override; + +public: + SvxNumberType m_aFormat; + sal_uInt16 m_nFootnoteOffset; + + void ChgPageDesc(SwPageDesc* pDesc); + SwPageDesc* GetPageDesc(SwDoc& rDoc) const; + bool KnowsPageDesc() const; + bool DependsOn(const SwPageDesc*) const; + + void SetFootnoteTextColl(SwTextFormatColl& rColl); + SwTextFormatColl* GetFootnoteTextColl() const { return m_pTextFormatColl; } // can be 0. + + SwCharFormat* GetCharFormat(SwDoc &rDoc) const; + void SetCharFormat( SwCharFormat* ); + + SwCharFormat* GetAnchorCharFormat(SwDoc &rDoc) const; + void SetAnchorCharFormat(SwCharFormat*); + SwCharFormat* GetCurrentCharFormat(const bool bAnchor) const; + + SwEndNoteInfo & operator=(const SwEndNoteInfo&); + bool operator==( const SwEndNoteInfo &rInf ) const; + + SwEndNoteInfo(); + SwEndNoteInfo(const SwEndNoteInfo&); + + const OUString& GetPrefix() const { return m_sPrefix; } + const OUString& GetSuffix() const { return m_sSuffix; } + + void SetPrefix(const OUString& rSet) { m_sPrefix = rSet; } + void SetSuffix(const OUString& rSet) { m_sSuffix = rSet; } +}; + +enum SwFootnotePos +{ + // Momentarily only PAGE and CHAPTER. CHAPTER == document-endnotes. + FTNPOS_PAGE = 1, + FTNPOS_CHAPTER = 8 +}; + +enum SwFootnoteNum : unsigned +{ + FTNNUM_PAGE, FTNNUM_CHAPTER, FTNNUM_DOC +}; + +class SW_DLLPUBLIC SwFootnoteInfo final : public SwEndNoteInfo +{ + using SwEndNoteInfo::operator ==; + +public: + OUString m_aQuoVadis; + OUString m_aErgoSum; + SwFootnotePos m_ePos; + SwFootnoteNum m_eNum; + + SwFootnoteInfo& operator=(const SwFootnoteInfo&); + + bool operator==( const SwFootnoteInfo &rInf ) const; + + SwFootnoteInfo(); + SwFootnoteInfo(const SwFootnoteInfo&); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc new file mode 100644 index 000000000..473ec1f5f --- /dev/null +++ b/sw/inc/globals.hrc @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_GLOBALS_HRC +#define INCLUDED_SW_INC_GLOBALS_HRC + +#include "rcid.hrc" + +// ACC --------------------------------------------------------------- + +#define FN_CHAR_LEFT_SEL (RC_GLOBALS_BEGIN + 1) +#define FN_CHAR_RIGHT_SEL (RC_GLOBALS_BEGIN + 2) +#define FN_LINE_UP_SEL (RC_GLOBALS_BEGIN + 3) +#define FN_LINE_DOWN_SEL (RC_GLOBALS_BEGIN + 4) +#define FN_START_OF_LINE_SEL (RC_GLOBALS_BEGIN + 5) // StartOfLine +#define FN_END_OF_LINE_SEL (RC_GLOBALS_BEGIN + 6) // EndOfLine +#define FN_START_OF_DOCUMENT_SEL (RC_GLOBALS_BEGIN + 7) // StartOfDocument +#define FN_END_OF_DOCUMENT_SEL (RC_GLOBALS_BEGIN + 8) // EndOfDocument +#define FN_START_OF_NEXT_PAGE_SEL (RC_GLOBALS_BEGIN + 9) // StartOfNextPage ??? +#define FN_END_OF_NEXT_PAGE_SEL (RC_GLOBALS_BEGIN + 10) // ??? +#define FN_START_OF_PREV_PAGE_SEL (RC_GLOBALS_BEGIN + 11) // StartOfPrevPage ??? +#define FN_END_OF_PREV_PAGE_SEL (RC_GLOBALS_BEGIN + 12) // ??? +#define FN_START_OF_PAGE_SEL (RC_GLOBALS_BEGIN + 13) // StartOfPage +#define FN_END_OF_PAGE_SEL (RC_GLOBALS_BEGIN + 14) // EndOfPage +#define FN_START_OF_PARA_SEL (RC_GLOBALS_BEGIN + 19) // StartOfPara +#define FN_END_OF_PARA_SEL (RC_GLOBALS_BEGIN + 20) // EndOfPara +#define FN_NEXT_WORD_SEL (RC_GLOBALS_BEGIN + 21) // NextWord +#define FN_PREV_WORD_SEL (RC_GLOBALS_BEGIN + 22) // PrevWord +#define FN_NEXT_SENT_SEL (RC_GLOBALS_BEGIN + 23) // NextSentence +#define FN_PREV_SENT_SEL (RC_GLOBALS_BEGIN + 24) // PrevSentence + +#define FN_PAGEUP_SEL (RC_GLOBALS_BEGIN + 29) +#define FN_PAGEDOWN_SEL (RC_GLOBALS_BEGIN + 30) + +// Sw-pages +#define TP_OPTPRINT_PAGE (RC_GLOBALS_BEGIN + 26) + +//maximum: RC_GLOBALS_BEGIN + 120 + +#define SID_PREVIEWFLAG_TYPE (RC_GLOBALS_BEGIN + 114) +#define SID_FONTMODE_TYPE (RC_GLOBALS_BEGIN + 115) +#define SID_FAX_LIST (RC_GLOBALS_BEGIN + 116) +#define SID_WRT_SHELL (RC_GLOBALS_BEGIN + 117) + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/globdoc.hxx b/sw/inc/globdoc.hxx new file mode 100644 index 000000000..d83e0d101 --- /dev/null +++ b/sw/inc/globdoc.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_GLOBDOC_HXX +#define INCLUDED_SW_INC_GLOBDOC_HXX + +#include "docsh.hxx" + +class SwGlobalDocShell final : public SwDocShell +{ +public: + + SFX_DECL_OBJECTFACTORY(); + + SwGlobalDocShell(SfxObjectCreateMode eMode); + virtual ~SwGlobalDocShell() override; + + virtual void FillClass( SvGlobalName * pClassName, + SotClipboardFormatId * pClipFormat, + OUString * pLongUserName, + sal_Int32 nFileFormat, + bool bTemplate = false ) const override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/gotodlg.hxx b/sw/inc/gotodlg.hxx new file mode 100644 index 000000000..a7971bec2 --- /dev/null +++ b/sw/inc/gotodlg.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_GOTODLG_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_GOTODLG_HXX + +#include <sfx2/bindings.hxx> +#include <vcl/weld.hxx> + +class SwView; + +class SwGotoPageDlg final : public weld::GenericDialogController +{ +public: + SwGotoPageDlg(weld::Window *parent, SfxBindings* _pBindings); + + sal_uInt16 GetPageSelection() const + { + return mxMtrPageCtrl->get_text().toUInt32(); + } + +private: + SwView *m_pCreateView; + SfxBindings *m_rBindings; + sal_uInt16 mnMaxPageCnt; + + std::unique_ptr<weld::Entry> mxMtrPageCtrl; + std::unique_ptr<weld::Label> mxPageNumberLbl; + + SwView* GetCreateView() const; + sal_uInt16 GetPageInfo(); + + DECL_LINK( PageModifiedHdl, weld::Entry&, void ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx new file mode 100644 index 000000000..55d0f99dd --- /dev/null +++ b/sw/inc/grfatr.hxx @@ -0,0 +1,307 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_GRFATR_HXX +#define INCLUDED_SW_INC_GRFATR_HXX + +#include "hintids.hxx" +#include <tools/gen.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <vcl/GraphicObject.hxx> +#include <svx/grfcrop.hxx> +#include "swdllapi.h" +#include "swatrset.hxx" + +enum class MirrorGraph +{ + Dont, + Vertical, + Horizontal, + Both +}; + +class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem<MirrorGraph> +{ + bool m_bGrfToggle; // Flip graphics on even pages. + +public: + SwMirrorGrf( MirrorGraph eMiro = MirrorGraph::Dont ) + : SfxEnumItem( RES_GRFATR_MIRRORGRF, eMiro ), m_bGrfToggle( false ) + {} + + // pure virtual methods of SfxPoolItem + virtual SwMirrorGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + + // pure virtual methods of SfxEnumItem + virtual sal_uInt16 GetValueCount() const override; + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, + sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, + sal_uInt8 nMemberId ) override; + + bool IsGrfToggle() const { return m_bGrfToggle; } + void SetGrfToggle( bool bNew ) { m_bGrfToggle = bNew; } +}; + +class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop +{ +public: + SwCropGrf(); + SwCropGrf( sal_Int32 nLeft, sal_Int32 nRight, + sal_Int32 nTop, sal_Int32 nBottom ); + + // "pure virtual methods" of SfxPoolItem + virtual SwCropGrf* Clone( SfxItemPool *pPool = nullptr ) const override; +}; + +class SAL_DLLPUBLIC_RTTI SwRotationGrf : public SfxUInt16Item +{ +private: + Size m_aUnrotatedSize; + + // tdf#115529 check and evtl. correct value, it is in 10th + // degrees and *has* to be in the range [0 .. 3600[ + static sal_Int16 checkAndCorrectValue(sal_Int16 nValue); + +public: + SwRotationGrf() + : SfxUInt16Item( RES_GRFATR_ROTATION, 0 ) + {} + SwRotationGrf( sal_Int16 nVal, const Size& rSz ); + + // pure virtual methods from SfxInt16Item + virtual SwRotationGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, + sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, + sal_uInt8 nMemberId ) override; + + const Size& GetUnrotatedSize() const { return m_aUnrotatedSize; } +}; + +class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item +{ +public: + SwLuminanceGrf( sal_Int16 nVal = 0 ) + : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal ) + {} + + // pure virtual methods from SfxInt16Item + virtual SwLuminanceGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item +{ +public: + SwContrastGrf( sal_Int16 nVal = 0 ) + : SfxInt16Item( RES_GRFATR_CONTRAST, nVal ) + {} + + // pure virtual methods from SfxInt16Item + virtual SwContrastGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +class SwChannelGrf : public SfxInt16Item +{ +protected: + SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL ) + : SfxInt16Item( nWhichL, nVal ) + {} + +public: + // pure virtual methods from SfxInt16Item + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +class SwChannelRGrf : public SwChannelGrf +{ +public: + SwChannelRGrf( sal_Int16 nVal = 0 ) + : SwChannelGrf( nVal, RES_GRFATR_CHANNELR ) + {} + virtual SwChannelRGrf* Clone( SfxItemPool *pPool = nullptr ) const override; +}; +class SwChannelGGrf : public SwChannelGrf +{ +public: + SwChannelGGrf( sal_Int16 nVal = 0 ) + : SwChannelGrf( nVal, RES_GRFATR_CHANNELG ) + {} + virtual SwChannelGGrf* Clone( SfxItemPool *pPool = nullptr ) const override; +}; +class SwChannelBGrf : public SwChannelGrf +{ +public: + SwChannelBGrf( sal_Int16 nVal = 0 ) + : SwChannelGrf( nVal, RES_GRFATR_CHANNELB ) + {} + virtual SwChannelBGrf* Clone( SfxItemPool *pPool = nullptr ) const override; +}; + +class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem +{ + double m_nValue; +public: + SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), m_nValue( 1.0 ) + {} + + SwGammaGrf( const double& rVal ) + : SfxPoolItem( RES_GRFATR_GAMMA ), m_nValue( rVal ) + {} + + // pure virtual methods from SfxEnumItem + virtual SwGammaGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, + sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, + sal_uInt8 nMemberId ) override; + + const double& GetValue() const { return m_nValue; } +}; + +class SwInvertGrf: public SfxBoolItem +{ +public: + SwInvertGrf( bool bVal = false ) + : SfxBoolItem( RES_GRFATR_INVERT, bVal ) + {} + + // pure virtual methods from SfxInt16Item + virtual SwInvertGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +class SwTransparencyGrf : public SfxByteItem +{ +public: + SwTransparencyGrf( sal_Int8 nVal = 0 ) + : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal ) + {} + + // pure virtual methods from SfxInt16Item + virtual SwTransparencyGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, + sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, + sal_uInt8 nMemberId ) override; +}; + +// MSVC hack: +class SwDrawModeGrf_Base: public SfxEnumItem<GraphicDrawMode> { +protected: + SwDrawModeGrf_Base(GraphicDrawMode nMode): + SfxEnumItem(RES_GRFATR_DRAWMODE, nMode) {} +}; + +class SW_DLLPUBLIC SwDrawModeGrf : public SwDrawModeGrf_Base +{ +public: + SwDrawModeGrf( GraphicDrawMode nMode = GraphicDrawMode::Standard ) + : SwDrawModeGrf_Base( nMode ) + {} + + // pure virtual methods of SfxPoolItem + virtual SwDrawModeGrf* Clone( SfxItemPool *pPool = nullptr ) const override; + + // pure virtual methods of SfxEnumItem + virtual sal_uInt16 GetValueCount() const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, + sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, + sal_uInt8 nMemberId ) override; +}; + +// Implementation of graphics attributes methods of SwAttr +inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(bool bInP) const + { return Get( RES_GRFATR_MIRRORGRF,bInP); } +inline const SwCropGrf &SwAttrSet::GetCropGrf(bool bInP) const + { return Get( RES_GRFATR_CROPGRF,bInP); } +inline const SwRotationGrf &SwAttrSet::GetRotationGrf(bool bInP) const + { return Get( RES_GRFATR_ROTATION,bInP); } +inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(bool bInP) const + { return Get( RES_GRFATR_LUMINANCE,bInP); } +inline const SwContrastGrf &SwAttrSet::GetContrastGrf(bool bInP) const + { return Get( RES_GRFATR_CONTRAST,bInP); } +inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(bool bInP) const + { return Get( RES_GRFATR_CHANNELR,bInP); } +inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(bool bInP) const + { return Get( RES_GRFATR_CHANNELG,bInP); } +inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(bool bInP) const + { return Get( RES_GRFATR_CHANNELB,bInP); } +inline const SwGammaGrf &SwAttrSet::GetGammaGrf(bool bInP) const + { return Get( RES_GRFATR_GAMMA,bInP); } +inline const SwInvertGrf &SwAttrSet::GetInvertGrf(bool bInP) const + { return Get( RES_GRFATR_INVERT,bInP); } +inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(bool bInP) const + { return Get( RES_GRFATR_TRANSPARENCY,bInP); } +inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(bool bInP) const + { return Get( RES_GRFATR_DRAWMODE,bInP); } + +#endif // INCLUDED_SW_INC_GRFATR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/helpids.h b/sw/inc/helpids.h new file mode 100644 index 000000000..ad9c82557 --- /dev/null +++ b/sw/inc/helpids.h @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_HELPIDS_H +#define INCLUDED_SW_INC_HELPIDS_H + +#define HID_EDIT_WIN "SW_HID_EDIT_WIN" + +#define HID_NAVI_DRAG_HYP "SW_HID_NAVI_DRAG_HYP" +#define HID_NAVI_DRAG_LINK "SW_HID_NAVI_DRAG_LINK" +#define HID_NAVI_DRAG_COPY "SW_HID_NAVI_DRAG_COPY" +#define HID_NAVI_OUTLINES "SW_HID_NAVI_OUTLINES" + + +#define HID_PAGEPREVIEW "SW_HID_PAGEPREVIEW" +#define HID_SOURCE_EDITWIN "SW_HID_SOURCE_EDITWIN" + +// Dialog Help-IDs + +#define HID_NAVIGATOR_TREELIST "SW_HID_NAVIGATOR_TREELIST" +#define HID_NAVIGATOR_TOOLBOX "SW_HID_NAVIGATOR_TOOLBOX" +#define HID_NAVIGATOR_LISTBOX "SW_HID_NAVIGATOR_LISTBOX" +#define HID_NAVI_VS "SW_HID_NAVI_VS" +#define HID_NAVIGATOR_GLOBAL_TOOLBOX "SW_HID_NAVIGATOR_GLOBAL_TOOLBOX" +#define HID_NAVIGATOR_GLOB_TREELIST "SW_HID_NAVIGATOR_GLOB_TREELIST" +#define HID_GLBLTREE_UPDATE "SW_HID_GLBLTREE_UPDATE" +#define HID_GLBLTREE_INSERT "SW_HID_GLBLTREE_INSERT" +#define HID_GLBLTREE_EDIT "SW_HID_GLBLTREE_EDIT" +#define HID_GLBLTREE_DEL "SW_HID_GLBLTREE_DEL" +#define HID_GLBLTREE_INS_IDX "SW_HID_GLBLTREE_INS_IDX" +#define HID_GLBLTREE_INS_FILE "SW_HID_GLBLTREE_INS_FILE" +#define HID_GLBLTREE_INS_NEW_FILE "SW_HID_GLBLTREE_INS_NEW_FILE" +#define HID_GLBLTREE_INS_TEXT "SW_HID_GLBLTREE_INS_TEXT" +#define HID_GLBLTREE_UPD_SEL "SW_HID_GLBLTREE_UPD_SEL" +#define HID_GLBLTREE_UPD_IDX "SW_HID_GLBLTREE_UPD_IDX" +#define HID_GLBLTREE_UPD_LINK "SW_HID_GLBLTREE_UPD_LINK" +#define HID_GLBLTREEUPD_ALL "SW_HID_GLBLTREEUPD_ALL" + +#define HID_GLBLTREE_EDIT_LINK "SW_HID_GLBLTREE_EDIT_LINK" + + +// TabPage Help-IDs + +#define HID_REDLINE_CTRL "SW_HID_REDLINE_CTRL" + +#define HID_LINGU_AUTOCORR "SW_HID_LINGU_AUTOCORR" +#define HID_LINGU_REPLACE "SW_HID_LINGU_REPLACE" +#define HID_LINGU_IGNORE_SELECTION "SW_HID_LINGU_IGNORE_SELECTION" // grammar check context menu + +// More Help-IDs +#define HID_EDIT_FORMULA "SW_HID_EDIT_FORMULA" + +#define HID_AUTH_FIELD_IDENTIFIER "SW_HID_AUTH_FIELD_IDENTIFIER" +#define HID_AUTH_FIELD_AUTHORITY_TYPE "SW_HID_AUTH_FIELD_AUTHORITY_TYPE" +#define HID_AUTH_FIELD_ADDRESS "SW_HID_AUTH_FIELD_ADDRESS" +#define HID_AUTH_FIELD_ANNOTE "SW_HID_AUTH_FIELD_ANNOTE" +#define HID_AUTH_FIELD_AUTHOR "SW_HID_AUTH_FIELD_AUTHOR" +#define HID_AUTH_FIELD_BOOKTITLE "SW_HID_AUTH_FIELD_BOOKTITLE" +#define HID_AUTH_FIELD_CHAPTER "SW_HID_AUTH_FIELD_CHAPTER" +#define HID_AUTH_FIELD_EDITION "SW_HID_AUTH_FIELD_EDITION" +#define HID_AUTH_FIELD_EDITOR "SW_HID_AUTH_FIELD_EDITOR" +#define HID_AUTH_FIELD_HOWPUBLISHED "SW_HID_AUTH_FIELD_HOWPUBLISHED" +#define HID_AUTH_FIELD_INSTITUTION "SW_HID_AUTH_FIELD_INSTITUTION" +#define HID_AUTH_FIELD_JOURNAL "SW_HID_AUTH_FIELD_JOURNAL" +#define HID_AUTH_FIELD_MONTH "SW_HID_AUTH_FIELD_MONTH" +#define HID_AUTH_FIELD_NOTE "SW_HID_AUTH_FIELD_NOTE" +#define HID_AUTH_FIELD_NUMBER "SW_HID_AUTH_FIELD_NUMBER" +#define HID_AUTH_FIELD_ORGANIZATIONS "SW_HID_AUTH_FIELD_ORGANIZATIONS" +#define HID_AUTH_FIELD_PAGES "SW_HID_AUTH_FIELD_PAGES" +#define HID_AUTH_FIELD_PUBLISHER "SW_HID_AUTH_FIELD_PUBLISHER" +#define HID_AUTH_FIELD_SCHOOL "SW_HID_AUTH_FIELD_SCHOOL" +#define HID_AUTH_FIELD_SERIES "SW_HID_AUTH_FIELD_SERIES" +#define HID_AUTH_FIELD_TITLE "SW_HID_AUTH_FIELD_TITLE" +#define HID_AUTH_FIELD_REPORT_TYPE "SW_HID_AUTH_FIELD_REPORT_TYPE" +#define HID_AUTH_FIELD_VOLUME "SW_HID_AUTH_FIELD_VOLUME" +#define HID_AUTH_FIELD_YEAR "SW_HID_AUTH_FIELD_YEAR" +#define HID_AUTH_FIELD_URL "SW_HID_AUTH_FIELD_URL" +#define HID_AUTH_FIELD_CUSTOM1 "SW_HID_AUTH_FIELD_CUSTOM1" +#define HID_AUTH_FIELD_CUSTOM2 "SW_HID_AUTH_FIELD_CUSTOM2" +#define HID_AUTH_FIELD_CUSTOM3 "SW_HID_AUTH_FIELD_CUSTOM3" +#define HID_AUTH_FIELD_CUSTOM4 "SW_HID_AUTH_FIELD_CUSTOM4" +#define HID_AUTH_FIELD_CUSTOM5 "SW_HID_AUTH_FIELD_CUSTOM5" +#define HID_AUTH_FIELD_ISBN "SW_HID_AUTH_FIELD_ISBN" + +#define HID_BUSINESS_FMT_PAGE "SW_HID_BUSINESS_FMT_PAGE" +#define HID_BUSINESS_FMT_PAGE_CONT "SW_HID_BUSINESS_FMT_PAGE_CONT" +#define HID_BUSINESS_FMT_PAGE_SHEET "SW_HID_BUSINESS_FMT_PAGE_SHEET" +#define HID_BUSINESS_FMT_PAGE_BRAND "SW_HID_BUSINESS_FMT_PAGE_BRAND" +#define HID_BUSINESS_FMT_PAGE_TYPE "SW_HID_BUSINESS_FMT_PAGE_TYPE" +#define HID_SEND_MASTER_CTRL_PUSHBUTTON_OK "SW_HID_SEND_MASTER_CTRL_PUSHBUTTON_OK" +#define HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL "SW_HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL" +#define HID_SEND_MASTER_CTRL_LISTBOX_FILTER "SW_HID_SEND_MASTER_CTRL_LISTBOX_FILTER" +#define HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW "SW_HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW" +#define HID_SEND_MASTER_CTRL_EDIT_FILEURL "SW_HID_SEND_MASTER_CTRL_EDIT_FILEURL" +#define HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION "SW_HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION" +#define HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE "SW_HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE" + +#define HID_SEND_HTML_CTRL_PUSHBUTTON_OK "SW_HID_SEND_HTML_CTRL_PUSHBUTTON_OK" +#define HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL "SW_HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL" +#define HID_SEND_HTML_CTRL_LISTBOX_FILTER "SW_HID_SEND_HTML_CTRL_LISTBOX_FILTER" +#define HID_SEND_HTML_CTRL_CONTROL_FILEVIEW "SW_HID_SEND_HTML_CTRL_CONTROL_FILEVIEW" +#define HID_SEND_HTML_CTRL_EDIT_FILEURL "SW_HID_SEND_HTML_CTRL_EDIT_FILEURL" +#define HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION "SW_HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION" +#define HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE "SW_HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE" + +#define HID_PVIEW_ZOOM_LB "SW_HID_PVIEW_ZOOM_LB" + +#define HID_NID_TBL "SW_HID_NID_TBL" +#define HID_NID_FRM "SW_HID_NID_FRM" +#define HID_NID_GRF "SW_HID_NID_GRF" +#define HID_NID_OLE "SW_HID_NID_OLE" +#define HID_NID_PGE "SW_HID_NID_PGE" +#define HID_NID_OUTL "SW_HID_NID_OUTL" +#define HID_NID_MARK "SW_HID_NID_MARK" +#define HID_NID_DRW "SW_HID_NID_DRW" +#define HID_NID_CTRL "SW_HID_NID_CTRL" +#define HID_NID_PREV "SW_HID_NID_PREV" +#define HID_NID_REG "SW_HID_NID_REG" +#define HID_NID_BKM "SW_HID_NID_BKM" +#define HID_NID_SEL "SW_HID_NID_SEL" +#define HID_NID_FTN "SW_HID_NID_FTN" +#define HID_NID_POSTIT "SW_HID_NID_POSTIT" +#define HID_NID_SRCH_REP "SW_HID_NID_SRCH_REP" +#define HID_NID_INDEX_ENTRY "SW_HID_NID_INDEX_ENTRY" +#define HID_NID_TABLE_FORMULA "SW_HID_NID_TABLE_FORMULA" +#define HID_NID_TABLE_FORMULA_ERROR "SW_HID_NID_TABLE_FORMULA_ERROR" +#define HID_NID_NEXT "SW_HID_NID_NEXT" +#define HID_MM_NEXT_PAGE "SW_HID_MM_NEXT_PAGE" +#define HID_MM_PREV_PAGE "SW_HID_MM_PREV_PAGE" +#define HID_MM_ADDBLOCK_ELEMENTS "SW_HID_MM_ADDBLOCK_ELEMENTS" +#define HID_MM_ADDBLOCK_INSERT "SW_HID_MM_ADDBLOCK_INSERT" +#define HID_MM_ADDBLOCK_REMOVE "SW_HID_MM_ADDBLOCK_REMOVE" +#define HID_MM_ADDBLOCK_DRAG "SW_HID_MM_ADDBLOCK_DRAG" +#define HID_MM_ADDBLOCK_PREVIEW "SW_HID_MM_ADDBLOCK_PREVIEW" +#define HID_MM_ADDBLOCK_MOVEBUTTONS "SW_HID_MM_ADDBLOCK_MOVEBUTTONS" + +#define HID_TBX_FORMULA_CALC "SW_HID_TBX_FORMULA_CALC" +#define HID_TBX_FORMULA_CANCEL "SW_HID_TBX_FORMULA_CANCEL" +#define HID_TBX_FORMULA_APPLY "SW_HID_TBX_FORMULA_APPLY" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/hfspacingitem.hxx b/sw/inc/hfspacingitem.hxx new file mode 100644 index 000000000..4b061bd50 --- /dev/null +++ b/sw/inc/hfspacingitem.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_HFSPACINGITEM_HXX +#define INCLUDED_SW_INC_HFSPACINGITEM_HXX + +#include <svl/eitem.hxx> +#include "hintids.hxx" +#include "format.hxx" + +class IntlWrapper; + +class SW_DLLPUBLIC SwHeaderAndFooterEatSpacingItem : public SfxBoolItem +{ +public: + SwHeaderAndFooterEatSpacingItem( sal_uInt16 nId = RES_HEADER_FOOTER_EAT_SPACING, + bool bPrt = false ) : SfxBoolItem( nId, bPrt ) {} + + // "pure virtual methods" of SfxPoolItem + virtual SwHeaderAndFooterEatSpacingItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +inline const SwHeaderAndFooterEatSpacingItem &SwAttrSet::GetHeaderAndFooterEatSpacing(bool bInP) const + { return Get( RES_HEADER_FOOTER_EAT_SPACING,bInP); } + +inline const SwHeaderAndFooterEatSpacingItem &SwFormat::GetHeaderAndFooterEatSpacing(bool bInP) const + { return m_aSet.GetHeaderAndFooterEatSpacing(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx new file mode 100644 index 000000000..17874777c --- /dev/null +++ b/sw/inc/hhcwrp.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_HHCWRP_HXX +#define INCLUDED_SW_INC_HHCWRP_HXX + +#include <editeng/hangulhanja.hxx> +#include <editeng/svxenum.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/window.hxx> +#include "swdllapi.h" + +class SwView; +class SwWrtShell; +struct SwConversionArgs; +class SwPaM; + +class SW_DLLPUBLIC SwHHCWrapper : public editeng::HangulHanjaConversion +{ + SwView * m_pView; + VclPtr<vcl::Window> m_pWin; + SwWrtShell &m_rWrtShell; + + std::unique_ptr<SwConversionArgs> m_pConvArgs; /**< object for arguments (and results) needed + to find of next convertible text portion */ + + sal_Int32 m_nLastPos; /**< starting position of the last found text part + (needs to be sth that gets not moved like + SwPaM or SwPosition by replace operations!) */ + sal_Int32 m_nUnitOffset; + + sal_uInt16 m_nPageCount; ///< page count for progress bar + sal_uInt16 m_nPageStart; ///< first checked page + + bool m_bIsDrawObj; + bool m_bIsOtherContent; + bool m_bStartChk; + bool m_bIsSelection; ///< true if only the selected text should be converted + bool m_bStartDone; + bool m_bEndDone; + + /// from SvxSpellWrapper copied and modified + bool ConvNext_impl(); ///< former SpellNext + void FindConvText_impl(); ///< former FindSpellError + + void ConvStart_impl( SwConversionArgs *pConvArgs, SvxSpellArea eSpell ); ///< former SpellStart + void ConvEnd_impl( SwConversionArgs const *pConvArgs ); ///< former SpellEnd + bool ConvContinue_impl( SwConversionArgs *pConvArgs ); ///< former SpellContinue + + void SelectNewUnit_impl( const sal_Int32 nUnitStart, + const sal_Int32 nUnitEnd ); + void ChangeText( const OUString &rNewText, + const OUString& rOrigText, + const css::uno::Sequence< sal_Int32 > *pOffsets, + SwPaM *pCursor ); + void ChangeText_impl( const OUString &rNewText, bool bKeepAttributes ); + +protected: + virtual void GetNextPortion( OUString& rNextPortion, + LanguageType& rLangOfPortion, + bool bAllowImplicitChangesForNotConvertibleText ) override; + virtual void HandleNewUnit( const sal_Int32 nUnitStart, + const sal_Int32 nUnitEnd ) override; + virtual void ReplaceUnit( + const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd, + const OUString& rOrigText, + const OUString& rReplaceWith, + const css::uno::Sequence< sal_Int32 > &rOffsets, + ReplacementAction eAction, + LanguageType *pNewUnitLanguage ) override; + + virtual bool HasRubySupport() const override; + +public: + SwHHCWrapper( + SwView* pView, + const css::uno::Reference< css::uno::XComponentContext >& rxContext, + LanguageType nSourceLanguage, LanguageType nTargetLanguage, + const vcl::Font *pTargetFont, + sal_Int32 nConvOptions, bool bIsInteractive, + bool bStart, bool bOther, bool bSelection ); + + virtual ~SwHHCWrapper() override; + + void Convert(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx new file mode 100644 index 000000000..f8b05e9a0 --- /dev/null +++ b/sw/inc/hintids.hxx @@ -0,0 +1,582 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_HINTIDS_HXX +#define INCLUDED_SW_INC_HINTIDS_HXX + +#include <sal/types.h> +#include <svx/xdef.hxx> +#include "swdllapi.h" +#include <svl/typedwhich.hxx> +#include <vector> + +class SfxStringItem; +class SwFormatChg; +class SwUpdateAttr; +class SwAttrSetChg; +class SwDocPosUpdate; +class SwFormatMeta; +class SvXMLAttrContainerItem; +class SwMsgPoolItem; +class SwPtrMsgPoolItem; +class SfxBoolItem; +class SvxColorItem; +class SvxLRSpaceItem; +class SdrTextVertAdjustItem; +class SfxGrabBagItem; +class SfxInt16Item; +class SfxUInt16Item; +class SvxAdjustItem; +class SvxAutoKernItem; +class SvxBlinkItem; +class SvxBoxItem; +class SvxBrushItem; +class SvxCaseMapItem; +class SvxCharHiddenItem; +class SvxCharReliefItem; +class SvxCharRotateItem; +class SvxCharScaleWidthItem; +class SvxContourItem; +class SvxCrossedOutItem; +class SvxEmphasisMarkItem; +class SvxEscapementItem; +class SvxFontHeightItem; +class SvxFontItem; +class SvxForbiddenRuleItem; +class SvxFormatBreakItem; +class SvxFormatKeepItem; +class SvxFormatSplitItem; +class SvxFrameDirectionItem; +class SvxHangingPunctuationItem; +class SvxHyphenZoneItem; +class SvxKerningItem; +class SvxLanguageItem; +class SvxLineSpacingItem; +class SvxNoHyphenItem; +class SvxOpaqueItem; +class SvxOrphansItem; +class SvxOverlineItem; +class SvxPaperBinItem; +class SvxParaGridItem; +class SvxParaVertAlignItem; +class SvxPostureItem; +class SvxPrintItem; +class SvxProtectItem; +class SvxRsidItem; +class SvxScriptSpaceItem; +class SvxShadowedItem; +class SvxShadowItem; +class SvxTabStopItem; +class SvxTwoLinesItem; +class SvxULSpaceItem; +class SvxUnderlineItem; +class SvxWeightItem; +class SvxWidowsItem; +class SvxWordLineModeItem; +class SwChannelBGrf; +class SwChannelGGrf; +class SwChannelRGrf; +class SwContrastGrf; +class SwCropGrf; +class SwDrawModeGrf; +class SwFormatAnchor; +class SwFormatAutoFormat; +class SwFormatChain; +class SwFormatCharFormat; +class SwFormatCol; +class SwFormatDrop; +class SwFormatEditInReadonly; +class SwFormatEndAtTextEnd; +class SwFormatFlyCnt; +class SwFormatFollowTextFlow; +class SwFormatFootnoteAtTextEnd; +class SwFormatFrameSize; +class SwFormatHoriOrient; +class SwFormatINetFormat; +class SwFormatLayoutSplit; +class SwFormatLineNumber; +class SwFormatNoBalancedColumns; +class SwFormatPageDesc; +class SwFormatRowSplit; +class SwFormatSurround; +class SwFormatURL; +class SwFormatVertOrient; +class SwFormatWrapInfluenceOnObjPos; +class SwGammaGrf; +class SwHeaderAndFooterEatSpacingItem; +class SwInvertGrf; +class SwLuminanceGrf; +class SwMirrorGrf; +class SwNumRuleItem; +class SwParaConnectBorderItem; +class SwRegisterItem; +class SwRotationGrf; +class SwTableBoxNumFormat; +class SwTextGridItem; +class SwTransparencyGrf; +class SwFormatRuby; +class SwInsText; +class SwDelChr; +class SwDelText; +class SwRefMarkFieldUpdate; +class SwTableFormulaUpdate; +class SwAutoFormatGetDocNode; +class SwCondCollCondChg; +class SwVirtPageNumInfo; +class SwFindNearestNode; +class SwStringMsgPoolItem; +class SwFltAnchor; +class SwFltTOX; +class SwFltRedline; +class SwFltRDFMark; +class SwCharFormat; +class SwConditionTextFormatColl; +class SwDrawFrameFormat; +class SwFlyFrameFormat; +class SwFormatField; +class SwFormatFootnote; +class SwFormatRefMark; +class SwGrfFormatColl; +class SwTextFormatColl; +class SwTOXMark; +class CntUInt16Item; +class SwFormatFillOrder; +class SwFormatHeader; +class SwFormatFooter; +class SwFormatContent; +class SvxMacroItem; +class SwTableBoxFormula; +class SwTableBoxValue; +class SwFrameFormat; +class SfxVoidItem; + +// For SwTextHints without end index the following char is added: + +#define CH_TXTATR_BREAKWORD u'\x0001' +#define CH_TXTATR_INWORD u'\xFFF9' +#define CH_TXTATR_TAB u'\t' +#define CH_TXTATR_NEWLINE u'\n' +#define CH_TXT_ATR_INPUTFIELDSTART u'\x0004' +#define CH_TXT_ATR_INPUTFIELDEND u'\x0005' + +#define CH_TXT_ATR_FORMELEMENT u'\x0006' + +#define CH_TXT_ATR_FIELDSTART u'\x0007' +#define CH_TXT_ATR_FIELDSEP u'\x0003' +#define CH_TXT_ATR_FIELDEND u'\x0008' +#define CH_TXT_ATR_SUBST_FIELDSTART ("[") +#define CH_TXT_ATR_SUBST_FIELDEND ("]") + +/* + * Enums for the hints + */ + +constexpr sal_uInt16 HINT_BEGIN = 1; + +constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN); + +// Ranges for the IDs of the format-attributes. +// Which-values for character-format attributes. +constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN); +constexpr TypedWhichId<SvxCaseMapItem> RES_CHRATR_CASEMAP (RES_CHRATR_BEGIN); // 1 +constexpr TypedWhichId<SvxColorItem> RES_CHRATR_CHARSETCOLOR (2); +constexpr TypedWhichId<SvxColorItem> RES_CHRATR_COLOR (3); +constexpr TypedWhichId<SvxContourItem> RES_CHRATR_CONTOUR (4); +constexpr TypedWhichId<SvxCrossedOutItem> RES_CHRATR_CROSSEDOUT (5); +constexpr TypedWhichId<SvxEscapementItem> RES_CHRATR_ESCAPEMENT (6); +constexpr TypedWhichId<SvxFontItem> RES_CHRATR_FONT (7); +constexpr TypedWhichId<SvxFontHeightItem> RES_CHRATR_FONTSIZE (8); +constexpr TypedWhichId<SvxKerningItem> RES_CHRATR_KERNING (9); +constexpr TypedWhichId<SvxLanguageItem> RES_CHRATR_LANGUAGE (10); +constexpr TypedWhichId<SvxPostureItem> RES_CHRATR_POSTURE (11); +constexpr TypedWhichId<SfxVoidItem> RES_CHRATR_UNUSED1 (12); +constexpr TypedWhichId<SvxShadowedItem> RES_CHRATR_SHADOWED (13); +constexpr TypedWhichId<SvxUnderlineItem> RES_CHRATR_UNDERLINE (14); +constexpr TypedWhichId<SvxWeightItem> RES_CHRATR_WEIGHT (15); +constexpr TypedWhichId<SvxWordLineModeItem> RES_CHRATR_WORDLINEMODE (16); +constexpr TypedWhichId<SvxAutoKernItem> RES_CHRATR_AUTOKERN (17); +constexpr TypedWhichId<SvxBlinkItem> RES_CHRATR_BLINK (18); +constexpr TypedWhichId<SvxNoHyphenItem> RES_CHRATR_NOHYPHEN (19); +constexpr TypedWhichId<SfxVoidItem> RES_CHRATR_UNUSED2 (20); +constexpr TypedWhichId<SvxBrushItem> RES_CHRATR_BACKGROUND (21); +constexpr TypedWhichId<SvxFontItem> RES_CHRATR_CJK_FONT (22); +constexpr TypedWhichId<SvxFontHeightItem> RES_CHRATR_CJK_FONTSIZE (23); +constexpr TypedWhichId<SvxLanguageItem> RES_CHRATR_CJK_LANGUAGE (24); +constexpr TypedWhichId<SvxPostureItem> RES_CHRATR_CJK_POSTURE (25); +constexpr TypedWhichId<SvxWeightItem> RES_CHRATR_CJK_WEIGHT (26); +constexpr TypedWhichId<SvxFontItem> RES_CHRATR_CTL_FONT (27); +constexpr TypedWhichId<SvxFontHeightItem> RES_CHRATR_CTL_FONTSIZE (28); +constexpr TypedWhichId<SvxLanguageItem> RES_CHRATR_CTL_LANGUAGE (29); +constexpr TypedWhichId<SvxPostureItem> RES_CHRATR_CTL_POSTURE (30); +constexpr TypedWhichId<SvxWeightItem> RES_CHRATR_CTL_WEIGHT (31); +constexpr TypedWhichId<SvxCharRotateItem> RES_CHRATR_ROTATE (32); +constexpr TypedWhichId<SvxEmphasisMarkItem> RES_CHRATR_EMPHASIS_MARK (33); +constexpr TypedWhichId<SvxTwoLinesItem> RES_CHRATR_TWO_LINES (34); +constexpr TypedWhichId<SvxCharScaleWidthItem> RES_CHRATR_SCALEW (35); +constexpr TypedWhichId<SvxCharReliefItem> RES_CHRATR_RELIEF (36); +constexpr TypedWhichId<SvxCharHiddenItem> RES_CHRATR_HIDDEN (37); +constexpr TypedWhichId<SvxOverlineItem> RES_CHRATR_OVERLINE (38); +constexpr TypedWhichId<SvxRsidItem> RES_CHRATR_RSID (39); +constexpr TypedWhichId<SvxBoxItem> RES_CHRATR_BOX (40); +constexpr TypedWhichId<SvxShadowItem> RES_CHRATR_SHADOW (41); +constexpr TypedWhichId<SvxBrushItem> RES_CHRATR_HIGHLIGHT (42); +constexpr TypedWhichId<SfxGrabBagItem> RES_CHRATR_GRABBAG (43); +constexpr TypedWhichId<SfxInt16Item> RES_CHRATR_BIDIRTL (44); +constexpr TypedWhichId<SfxInt16Item> RES_CHRATR_IDCTHINT (45); +constexpr sal_uInt16 RES_CHRATR_END(46); + +// this Attribute used only in a TextNodes SwpAttr-Array +constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END); + +/** text attributes with start and end. + #i105453#: + Hints (SwTextAttr) with the same start and end position are sorted by + WhichId, i.e., the TXTATR constants defined here. + The text formatting (SwAttrIter) poses some requirements on TXTATR order: + - AUTOFMT must precede CHARFMT, so that auto style can overwrite char style. + - INETFMT must precede CHARFMT, so that link style can overwrite char style. + (this is actually surprising: CHARFMT hints are not split at INETFMT + hints on insertion, but on exporting to ODF. if CHARFMT would precede + INETFMT, then exporting and importing will effectively change precedence) + + Nesting hints (SwTextAttrNesting) also have requirements on TXTATR order, + to ensure proper nesting (because CJK_RUBY and INETFMT have no CH_TXTATR): + - INETFMT should precede CJK_RUBY (for UNO API it does not matter...) + - META and METAFIELD must precede CJK_RUBY and INETFMT + */ +constexpr sal_uInt16 RES_TXTATR_WITHEND_BEGIN(RES_TXTATR_BEGIN); +constexpr TypedWhichId<SwFormatRefMark> RES_TXTATR_REFMARK (RES_TXTATR_WITHEND_BEGIN); // 46 +constexpr TypedWhichId<SwTOXMark> RES_TXTATR_TOXMARK (47); +constexpr TypedWhichId<SwFormatMeta> RES_TXTATR_META (48); +constexpr TypedWhichId<SwFormatMeta> RES_TXTATR_METAFIELD (49); +constexpr TypedWhichId<SwFormatAutoFormat> RES_TXTATR_AUTOFMT (50); +constexpr TypedWhichId<SwFormatINetFormat> RES_TXTATR_INETFMT (51); +constexpr TypedWhichId<SwFormatCharFormat> RES_TXTATR_CHARFMT (52); +constexpr TypedWhichId<SwFormatRuby> RES_TXTATR_CJK_RUBY (53); +constexpr TypedWhichId<SvXMLAttrContainerItem> RES_TXTATR_UNKNOWN_CONTAINER (54); +constexpr TypedWhichId<SwFormatField> RES_TXTATR_INPUTFIELD (55); +constexpr sal_uInt16 RES_TXTATR_WITHEND_END(56); + +// all TextAttributes without an end +constexpr sal_uInt16 RES_TXTATR_NOEND_BEGIN(RES_TXTATR_WITHEND_END); +constexpr TypedWhichId<SwFormatField> RES_TXTATR_FIELD (RES_TXTATR_NOEND_BEGIN); // 56 +constexpr TypedWhichId<SwFormatFlyCnt> RES_TXTATR_FLYCNT (57); +constexpr TypedWhichId<SwFormatFootnote> RES_TXTATR_FTN (58); +constexpr TypedWhichId<SwFormatField> RES_TXTATR_ANNOTATION (59); +constexpr TypedWhichId<SfxBoolItem> RES_TXTATR_DUMMY3 (60); +constexpr TypedWhichId<SfxBoolItem> RES_TXTATR_DUMMY1 (61); +constexpr TypedWhichId<SfxBoolItem> RES_TXTATR_DUMMY2 (62); +constexpr sal_uInt16 RES_TXTATR_NOEND_END(63); +constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END); + +constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END); +constexpr TypedWhichId<SvxLineSpacingItem> RES_PARATR_LINESPACING (RES_PARATR_BEGIN); // 63 +constexpr TypedWhichId<SvxAdjustItem> RES_PARATR_ADJUST (64); +constexpr TypedWhichId<SvxFormatSplitItem> RES_PARATR_SPLIT (65); +constexpr TypedWhichId<SvxOrphansItem> RES_PARATR_ORPHANS (66); +constexpr TypedWhichId<SvxWidowsItem> RES_PARATR_WIDOWS (67); +constexpr TypedWhichId<SvxTabStopItem> RES_PARATR_TABSTOP (68); +constexpr TypedWhichId<SvxHyphenZoneItem> RES_PARATR_HYPHENZONE (69); +constexpr TypedWhichId<SwFormatDrop> RES_PARATR_DROP (70); +constexpr TypedWhichId<SwRegisterItem> RES_PARATR_REGISTER (71); +constexpr TypedWhichId<SwNumRuleItem> RES_PARATR_NUMRULE (72); +constexpr TypedWhichId<SvxScriptSpaceItem> RES_PARATR_SCRIPTSPACE (73); +constexpr TypedWhichId<SvxHangingPunctuationItem> RES_PARATR_HANGINGPUNCTUATION (74); +constexpr TypedWhichId<SvxForbiddenRuleItem> RES_PARATR_FORBIDDEN_RULES (75); +constexpr TypedWhichId<SvxParaVertAlignItem> RES_PARATR_VERTALIGN (76); +constexpr TypedWhichId<SvxParaGridItem> RES_PARATR_SNAPTOGRID (77); +constexpr TypedWhichId<SwParaConnectBorderItem> RES_PARATR_CONNECT_BORDER (78); +constexpr TypedWhichId<SfxUInt16Item> RES_PARATR_OUTLINELEVEL (79); +constexpr TypedWhichId<SvxRsidItem> RES_PARATR_RSID (80); +constexpr TypedWhichId<SfxGrabBagItem> RES_PARATR_GRABBAG (81); +constexpr sal_uInt16 RES_PARATR_END(82); + +// list attributes for paragraphs. +// intentionally these list attributes are not contained in paragraph styles +constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END); +constexpr TypedWhichId<SfxStringItem> RES_PARATR_LIST_ID (RES_PARATR_LIST_BEGIN); // 82 +constexpr TypedWhichId<SfxInt16Item> RES_PARATR_LIST_LEVEL (83); +constexpr TypedWhichId<SfxBoolItem> RES_PARATR_LIST_ISRESTART (84); +constexpr TypedWhichId<SfxInt16Item> RES_PARATR_LIST_RESTARTVALUE (85); +constexpr TypedWhichId<SfxBoolItem> RES_PARATR_LIST_ISCOUNTED (86); +constexpr TypedWhichId<SwFormatAutoFormat> RES_PARATR_LIST_AUTOFMT (87);//TypedWhichId<SfxSetItem>(87) +constexpr sal_uInt16 RES_PARATR_LIST_END(88); + +constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END); +constexpr TypedWhichId<SwFormatFillOrder> RES_FILL_ORDER (RES_FRMATR_BEGIN); +constexpr TypedWhichId<SwFormatFrameSize> RES_FRM_SIZE (89); +constexpr TypedWhichId<SvxPaperBinItem> RES_PAPER_BIN (90); +constexpr TypedWhichId<SvxLRSpaceItem> RES_LR_SPACE (91); +constexpr TypedWhichId<SvxULSpaceItem> RES_UL_SPACE (92); +constexpr TypedWhichId<SwFormatPageDesc> RES_PAGEDESC (93); +constexpr TypedWhichId<SvxFormatBreakItem> RES_BREAK (94); +constexpr TypedWhichId<SwFormatContent> RES_CNTNT (95); +constexpr TypedWhichId<SwFormatHeader> RES_HEADER (96); +constexpr TypedWhichId<SwFormatFooter> RES_FOOTER (97); +constexpr TypedWhichId<SvxPrintItem> RES_PRINT (98); +constexpr TypedWhichId<SvxOpaqueItem> RES_OPAQUE (99); +constexpr TypedWhichId<SvxProtectItem> RES_PROTECT (100); +constexpr TypedWhichId<SwFormatSurround> RES_SURROUND (101); +constexpr TypedWhichId<SwFormatVertOrient> RES_VERT_ORIENT (102); +constexpr TypedWhichId<SwFormatHoriOrient> RES_HORI_ORIENT (103); +constexpr TypedWhichId<SwFormatAnchor> RES_ANCHOR (104); +constexpr TypedWhichId<SvxBrushItem> RES_BACKGROUND (105); +constexpr TypedWhichId<SvxBoxItem> RES_BOX (106); +constexpr TypedWhichId<SvxShadowItem> RES_SHADOW (107); +constexpr TypedWhichId<SvxMacroItem> RES_FRMMACRO (108); +constexpr TypedWhichId<SwFormatCol> RES_COL (109); +constexpr TypedWhichId<SvxFormatKeepItem> RES_KEEP (110); +constexpr TypedWhichId<SwFormatURL> RES_URL (111); +constexpr TypedWhichId<SwFormatEditInReadonly> RES_EDIT_IN_READONLY (112); +constexpr TypedWhichId<SwFormatLayoutSplit> RES_LAYOUT_SPLIT (113); +constexpr TypedWhichId<SwFormatChain> RES_CHAIN (114); +constexpr TypedWhichId<SwTextGridItem> RES_TEXTGRID (115); +constexpr TypedWhichId<SwFormatLineNumber> RES_LINENUMBER (116); +constexpr TypedWhichId<SwFormatFootnoteAtTextEnd> RES_FTN_AT_TXTEND (117); +constexpr TypedWhichId<SwFormatEndAtTextEnd> RES_END_AT_TXTEND (118); +constexpr TypedWhichId<SwFormatNoBalancedColumns> RES_COLUMNBALANCE (119); +constexpr TypedWhichId<SvxFrameDirectionItem> RES_FRAMEDIR (120); +constexpr TypedWhichId<SwHeaderAndFooterEatSpacingItem> RES_HEADER_FOOTER_EAT_SPACING (121); +constexpr TypedWhichId<SwFormatRowSplit> RES_ROW_SPLIT (122); +constexpr TypedWhichId<SwFormatFollowTextFlow> RES_FOLLOW_TEXT_FLOW (123); +constexpr TypedWhichId<SfxBoolItem> RES_COLLAPSING_BORDERS (124); +constexpr TypedWhichId<SwFormatWrapInfluenceOnObjPos> RES_WRAP_INFLUENCE_ON_OBJPOS (125); +constexpr TypedWhichId<SwFormatAutoFormat> RES_AUTO_STYLE (126); +constexpr TypedWhichId<SfxStringItem> RES_FRMATR_STYLE_NAME (127); +constexpr TypedWhichId<SfxStringItem> RES_FRMATR_CONDITIONAL_STYLE_NAME (128); +constexpr TypedWhichId<SfxGrabBagItem> RES_FRMATR_GRABBAG (129); +constexpr TypedWhichId<SdrTextVertAdjustItem> RES_TEXT_VERT_ADJUST (130); +constexpr sal_uInt16 RES_FRMATR_END(131); + +constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END); +constexpr TypedWhichId<SwMirrorGrf> RES_GRFATR_MIRRORGRF (RES_GRFATR_BEGIN); // 131 +constexpr TypedWhichId<SwCropGrf> RES_GRFATR_CROPGRF (132); + +constexpr TypedWhichId<SwRotationGrf> RES_GRFATR_ROTATION (133); +constexpr TypedWhichId<SwLuminanceGrf> RES_GRFATR_LUMINANCE (134); +constexpr TypedWhichId<SwContrastGrf> RES_GRFATR_CONTRAST (135); +constexpr TypedWhichId<SwChannelRGrf> RES_GRFATR_CHANNELR (136); +constexpr TypedWhichId<SwChannelGGrf> RES_GRFATR_CHANNELG (137); +constexpr TypedWhichId<SwChannelBGrf> RES_GRFATR_CHANNELB (138); +constexpr TypedWhichId<SwGammaGrf> RES_GRFATR_GAMMA (139); +constexpr TypedWhichId<SwInvertGrf> RES_GRFATR_INVERT (140); +constexpr TypedWhichId<SwTransparencyGrf> RES_GRFATR_TRANSPARENCY (141); +constexpr TypedWhichId<SwDrawModeGrf> RES_GRFATR_DRAWMODE (142); + +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY1 (143); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY2 (144); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY3 (145); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY4 (146); +constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY5 (147); +constexpr sal_uInt16 RES_GRFATR_END(148); + +constexpr sal_uInt16 RES_BOXATR_BEGIN(RES_GRFATR_END); +constexpr TypedWhichId<SwTableBoxNumFormat> RES_BOXATR_FORMAT (RES_BOXATR_BEGIN); // 148 +constexpr TypedWhichId<SwTableBoxFormula> RES_BOXATR_FORMULA (149); +constexpr TypedWhichId<SwTableBoxValue> RES_BOXATR_VALUE (150); +constexpr sal_uInt16 RES_BOXATR_END(151); + +constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END); +constexpr TypedWhichId<SvXMLAttrContainerItem> RES_UNKNOWNATR_CONTAINER (RES_UNKNOWNATR_BEGIN);// 151 +constexpr sal_uInt16 RES_UNKNOWNATR_END(152); + +constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END); + +// Format IDs +constexpr sal_uInt16 RES_FMT_BEGIN(RES_UNKNOWNATR_END); +constexpr TypedWhichId<SwCharFormat> RES_CHRFMT (RES_FMT_BEGIN); // 152 +constexpr TypedWhichId<SwFrameFormat> RES_FRMFMT (153); +constexpr TypedWhichId<SwFlyFrameFormat> RES_FLYFRMFMT (154); +constexpr TypedWhichId<SwTextFormatColl> RES_TXTFMTCOLL (155); +constexpr TypedWhichId<SwGrfFormatColl> RES_GRFFMTCOLL (156); +constexpr TypedWhichId<SwDrawFrameFormat> RES_DRAWFRMFMT (157); +constexpr TypedWhichId<SwConditionTextFormatColl> RES_CONDTXTFMTCOLL (158); +constexpr sal_uInt16 RES_FMT_END(159); + +// ID's for Messages in the Formats +constexpr sal_uInt16 RES_MSG_BEGIN(RES_FMT_END); +constexpr TypedWhichId<SwPtrMsgPoolItem> RES_OBJECTDYING (RES_MSG_BEGIN); // 159 +constexpr TypedWhichId<SwFormatChg> RES_FMT_CHG (160); +constexpr TypedWhichId<SwAttrSetChg> RES_ATTRSET_CHG (161); +constexpr TypedWhichId<SwInsText> RES_INS_TXT (162); +constexpr TypedWhichId<SwDelChr> RES_DEL_CHR (163); +constexpr TypedWhichId<SwDelText> RES_DEL_TXT (164); +constexpr TypedWhichId<SwUpdateAttr> RES_UPDATE_ATTR (165); +constexpr TypedWhichId<SwRefMarkFieldUpdate> RES_REFMARKFLD_UPDATE (166); +constexpr TypedWhichId<SwDocPosUpdate> RES_DOCPOS_UPDATE (167); +constexpr TypedWhichId<SwTableFormulaUpdate> RES_TABLEFML_UPDATE (168); +constexpr TypedWhichId<SwMsgPoolItem> RES_UPDATEDDETBL (169); +constexpr TypedWhichId<SwMsgPoolItem> RES_TBLHEADLINECHG (170); +constexpr TypedWhichId<SwAutoFormatGetDocNode> RES_AUTOFMT_DOCNODE (171); +constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_HIDDEN (172); +constexpr TypedWhichId<SwMsgPoolItem> RES_SECTION_NOT_HIDDEN (173); +constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_ARRIVED (174); +constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_PIECE_ARRIVED (175); +constexpr TypedWhichId<SwMsgPoolItem> RES_HIDDENPARA_PRINT (176); +constexpr TypedWhichId<SwCondCollCondChg> RES_CONDCOLL_CONDCHG (177); +constexpr TypedWhichId<SwVirtPageNumInfo> RES_VIRTPAGENUM_INFO (178); +constexpr TypedWhichId<SwPtrMsgPoolItem> RES_REMOVE_UNO_OBJECT (179); +constexpr TypedWhichId<SwMsgPoolItem> RES_GRF_REREAD_AND_INCACHE (180); +// empty +constexpr TypedWhichId<SwFindNearestNode> RES_FINDNEARESTNODE (182); +constexpr TypedWhichId<SwPtrMsgPoolItem> RES_CONTENT_VISIBLE (183); +constexpr TypedWhichId<SwMsgPoolItem> RES_GRAPHIC_SWAPIN (184); +constexpr TypedWhichId<SwStringMsgPoolItem> RES_NAME_CHANGED (185); +constexpr TypedWhichId<SwStringMsgPoolItem> RES_TITLE_CHANGED (186); +constexpr TypedWhichId<SwStringMsgPoolItem> RES_DESCRIPTION_CHANGED (187); +constexpr TypedWhichId<SwMsgPoolItem> RES_LINKED_GRAPHIC_STREAM_ARRIVED (187); +constexpr sal_uInt16 RES_MSG_END(188); + +// An ID for the RTF-reader. The stylesheets are treated like attributes, +// i.e. there is a StyleSheet-attribute. To avoid collision with other +// Which()-values, the value is listed here. (The help system too defines +// new attributes!) +constexpr sal_uInt16 RES_FLTRATTR_BEGIN(RES_MSG_END); +constexpr TypedWhichId<SfxStringItem> RES_FLTR_BOOKMARK (RES_FLTRATTR_BEGIN); +constexpr TypedWhichId<SwFltAnchor> RES_FLTR_ANCHOR (189); +constexpr TypedWhichId<SfxStringItem> RES_FLTR_NUMRULE (190); +constexpr TypedWhichId<SwFltTOX> RES_FLTR_TOX (191); +constexpr TypedWhichId<SwFltRedline> RES_FLTR_REDLINE (192); +constexpr TypedWhichId<CntUInt16Item> RES_FLTR_ANNOTATIONMARK (193); +constexpr TypedWhichId<SwFltRDFMark> RES_FLTR_RDFMARK (194); +constexpr sal_uInt16 RES_FLTRATTR_END(195); + +constexpr sal_uInt16 RES_TBX_DUMMY(RES_FLTRATTR_END + 1); + +constexpr sal_uInt16 HINT_END(RES_TBX_DUMMY); + +// Error recognition!! +constexpr sal_uInt16 INVALID_HINT(HINT_END); +constexpr sal_uInt16 RES_WHICHHINT_END(HINT_END); + +inline bool isATR(const sal_uInt16 nWhich) +{ + return (RES_CHRATR_BEGIN <= nWhich) && (RES_UNKNOWNATR_END > nWhich); +} +inline bool isCHRATR(const sal_uInt16 nWhich) +{ + return (RES_CHRATR_BEGIN <= nWhich) && (RES_CHRATR_END > nWhich); +} +inline bool isTXTATR_WITHEND(const sal_uInt16 nWhich) +{ + return (RES_TXTATR_WITHEND_BEGIN <= nWhich) + && (RES_TXTATR_WITHEND_END > nWhich); +} +inline bool isTXTATR_NOEND(const sal_uInt16 nWhich) +{ + return (RES_TXTATR_NOEND_BEGIN <= nWhich) + && (RES_TXTATR_NOEND_END > nWhich); +} +inline bool isTXTATR(const sal_uInt16 nWhich) +{ + return (RES_TXTATR_BEGIN <= nWhich) && (RES_TXTATR_END > nWhich); +} +inline bool isPARATR(const sal_uInt16 nWhich) +{ + return (RES_PARATR_BEGIN <= nWhich) && (RES_PARATR_END > nWhich); +} +inline bool isPARATR_LIST(const sal_uInt16 nWhich) +{ + return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); +} +inline bool isFRMATR(const sal_uInt16 nWhich) +{ + return (RES_FRMATR_BEGIN <= nWhich) && (RES_FRMATR_END > nWhich); +} +inline bool isDrawingLayerAttribute(const sal_uInt16 nWhich) +{ + return (XATTR_START <= nWhich) && (XATTR_END > nWhich); +} +inline bool isGRFATR(const sal_uInt16 nWhich) +{ + return (RES_GRFATR_BEGIN <= nWhich) && (RES_GRFATR_END > nWhich); +} +inline bool isBOXATR(const sal_uInt16 nWhich) +{ + return (RES_BOXATR_BEGIN <= nWhich) && (RES_BOXATR_END > nWhich); +} +inline bool isUNKNOWNATR(const sal_uInt16 nWhich) +{ + return (RES_UNKNOWNATR_BEGIN <= nWhich) && (RES_UNKNOWNATR_END > nWhich); +} + +// Take the respective default attribute from the statistical default +// attributes table over the Which-value. +// If none exists, return a 0 pointer!!! +// This function is implemented in Init.cxx. It is declared here as external +// in order to allow the formats to access it. +// Inline in PRODUCT. +class SfxPoolItem; +struct SfxItemInfo; +typedef std::vector<SfxPoolItem*> SwDfltAttrTab; + +extern SwDfltAttrTab aAttrTab; +extern SfxItemInfo aSlotTab[]; + +/** Get the default attribute from corresponding default attribute table. + + @param[in] nWhich Position in table + @return Attribute if found, null pointer otherwise +*/ +SW_DLLPUBLIC const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich ); + +template<class T> inline const T* GetDfltAttr( TypedWhichId<T> nWhich ) +{ return static_cast<const T*>(GetDfltAttr(sal_uInt16(nWhich))); } + +SW_DLLPUBLIC sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript ); + +// return for the given TextAttribute without an end the correct character. +// This function returns +// CH_TXTATR_BREAKWORD for Textattribute which breaks a word (default) +// CH_TXTATR_INWORD for Textattribute which doesn't breaks a word +class SwTextAttr; +sal_Unicode GetCharOfTextAttr( const SwTextAttr& rAttr ); + +// all Sets defined in init.cxx + +// AttrSet-Range for the 3 Break-Attribute +extern sal_uInt16 const aBreakSetRange[]; +// AttrSet-Range for TextFormatColl +extern sal_uInt16 const aTextFormatCollSetRange[]; +// AttrSet-Range for GrfFormatColl +extern sal_uInt16 const aGrfFormatCollSetRange[]; +// AttrSet-Range for TextNode +SW_DLLPUBLIC extern sal_uInt16 const aTextNodeSetRange[]; +// AttrSet-Range for NoTextNode +extern sal_uInt16 const aNoTextNodeSetRange[]; +// AttrSet-Range for SwTable +extern sal_uInt16 const aTableSetRange[]; +// AttrSet-Range for SwTableLine +extern sal_uInt16 const aTableLineSetRange[]; +// AttrSet-Range for SwTableBox +extern sal_uInt16 const aTableBoxSetRange[]; +// AttrSet-Range for SwFrameFormat +SW_DLLPUBLIC extern sal_uInt16 const aFrameFormatSetRange[]; +// AttrSet-Range for SwCharFormat +extern sal_uInt16 const aCharFormatSetRange[]; +// AttrSet-Range for the autostyles +extern sal_uInt16 const aCharAutoFormatSetRange[]; +// AttrSet-Range for SwPageDescFormat +extern sal_uInt16 const aPgFrameFormatSetRange[]; + +// check if ID is InRange of AttrSet-Ids +bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx new file mode 100644 index 000000000..9a79579c1 --- /dev/null +++ b/sw/inc/hints.hxx @@ -0,0 +1,301 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_HINTS_HXX +#define INCLUDED_SW_INC_HINTS_HXX + +#include "swatrset.hxx" +#include "swtypes.hxx" +#include <vcl/vclptr.hxx> + +class SwFormat; +class OutputDevice; +class SwTable; +class SwNode; +class SwNodes; +class SwPageFrame; +class SwFrame; +class SwHistory; +class SwTextNode; + +// Base class for all Message-Hints: +// "Overhead" of SfxPoolItem is handled here +class SwMsgPoolItem : public SfxPoolItem +{ +public: + SwMsgPoolItem( sal_uInt16 nWhich ); + + // "Overhead" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwMsgPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; +}; + +// SwPtrMsgPoolItem (old SwObjectDying!) + +class SwPtrMsgPoolItem final : public SwMsgPoolItem +{ +public: + void * pObject; + + SwPtrMsgPoolItem( sal_uInt16 nId, void * pObj ) + : SwMsgPoolItem( nId ), pObject( pObj ) + {} +}; + +/* + * SwFormatChg is sent when a format has changed to another format. 2 Hints are always sent + * the old and the new format + */ +class SwFormatChg final : public SwMsgPoolItem +{ +public: + SwFormat *pChangedFormat; + SwFormatChg( SwFormat *pFormat ); +}; + +class SwInsText final : public SwMsgPoolItem +{ +public: + sal_Int32 nPos; + sal_Int32 nLen; + + SwInsText( sal_Int32 nP, sal_Int32 nL ); +}; + +class SwDelChr final : public SwMsgPoolItem +{ +public: + sal_Int32 nPos; + + SwDelChr( sal_Int32 nP ); +}; + +class SwDelText final : public SwMsgPoolItem +{ +public: + sal_Int32 nStart; + sal_Int32 nLen; + + SwDelText( sal_Int32 nS, sal_Int32 nL ); +}; + +namespace sw { + +/// text is moved into pDestNode +class MoveText final : public SfxHint +{ +public: + SwTextNode * pDestNode; + sal_Int32 nDestStart; + sal_Int32 nSourceStart; + sal_Int32 nLen; + + MoveText(SwTextNode *pD, sal_Int32 nD, sal_Int32 nS, sal_Int32 nL); +}; + +/// new delete redline is created +class RedlineDelText final : public SfxHint +{ +public: + sal_Int32 nStart; + sal_Int32 nLen; + + RedlineDelText(sal_Int32 nS, sal_Int32 nL); +}; + +/// delete redline is removed +class RedlineUnDelText final : public SfxHint +{ +public: + sal_Int32 nStart; + sal_Int32 nLen; + + RedlineUnDelText(sal_Int32 nS, sal_Int32 nL); +}; + +} + +class SwUpdateAttr final : public SwMsgPoolItem +{ +private: + sal_Int32 m_nStart; + sal_Int32 m_nEnd; + sal_uInt16 m_nWhichAttr; + std::vector<sal_uInt16> m_aWhichFmtAttrs; // attributes changed inside RES_TXTATR_AUTOFMT + +public: + SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW ); + SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW ); + + sal_Int32 getStart() const + { + return m_nStart; + } + + sal_Int32 getEnd() const + { + return m_nEnd; + } + + sal_uInt16 getWhichAttr() const + { + return m_nWhichAttr; + } + + const std::vector<sal_uInt16>& getFmtAttrs() const + { + return m_aWhichFmtAttrs; + } +}; + +/** SwRefMarkFieldUpdate is sent when the referencemarks should be updated. + To determine Page- / chapternumbers the current frame has to be asked. + For this we need the current outputdevice */ +class SwRefMarkFieldUpdate final : public SwMsgPoolItem +{ + VclPtr<OutputDevice> pOut; ///< pointer to the current output device +public: + /** Is sent if reference marks should be updated. + + To get the page/chapter number, the frame has to be asked. For that we need + the current OutputDevice. + */ + SwRefMarkFieldUpdate( OutputDevice* ); +}; + +/** SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position + have to be updated. At the moment this is only needed when updating pagenumber fields. */ +class SwDocPosUpdate final : public SwMsgPoolItem +{ +public: + const SwTwips nDocPos; + SwDocPosUpdate( const SwTwips nDocPos ); +}; + +/// SwTableFormulaUpdate is sent when the table has to be newly calculated or when a table itself is merged or split +enum TableFormulaUpdateFlags { TBL_CALC = 0, + TBL_BOXNAME, + TBL_BOXPTR, + TBL_RELBOXNAME, + TBL_MERGETBL, + TBL_SPLITTBL + }; +class SwTableFormulaUpdate final : public SwMsgPoolItem +{ +public: + const SwTable* m_pTable; ///< Pointer to the current table + union { + const SwTable* pDelTable; ///< Merge: Pointer to the table to be removed + const OUString* pNewTableNm; ///< Split: the name of the new table + } m_aData; + SwHistory* m_pHistory; + sal_uInt16 m_nSplitLine; ///< Split: from this BaseLine on will be split + TableFormulaUpdateFlags m_eFlags; + bool m_bModified : 1; + bool m_bBehindSplitLine : 1; + + /** Is sent if a table should be recalculated */ + SwTableFormulaUpdate( const SwTable* ); +}; + +class SwAutoFormatGetDocNode final : public SwMsgPoolItem +{ +public: + const SwNodes* pNodes; + + SwAutoFormatGetDocNode( const SwNodes* pNds ); +}; + +/* + * SwAttrSetChg is sent when something has changed in the SwAttrSet rTheChgdSet. + * 2 Hints are always sent, the old and the new items in the rTheChgdSet. + */ +class SwAttrSetChg final : public SwMsgPoolItem +{ + bool m_bDelSet; + SwAttrSet* m_pChgSet; ///< what has changed + const SwAttrSet* m_pTheChgdSet; ///< is only used to compare +public: + SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet ); + SwAttrSetChg( const SwAttrSetChg& ); + virtual ~SwAttrSetChg() override; + + /// What has changed + const SwAttrSet* GetChgSet() const { return m_pChgSet; } + SwAttrSet* GetChgSet() { return m_pChgSet; } + + /// Where it has changed + const SwAttrSet* GetTheChgdSet() const { return m_pTheChgdSet; } + + sal_uInt16 Count() const { return m_pChgSet->Count(); } + void ClearItem( sal_uInt16 nWhichL ) +#ifdef DBG_UTIL + ; +#else + { m_pChgSet->ClearItem( nWhichL ); } +#endif +}; + +class SwCondCollCondChg final : public SwMsgPoolItem +{ +public: + SwFormat *pChangedFormat; + SwCondCollCondChg( SwFormat *pFormat ); +}; + +class SwVirtPageNumInfo final : public SwMsgPoolItem +{ + const SwPageFrame *m_pPage; + const SwPageFrame *m_pOrigPage; + const SwFrame *m_pFrame; + /** Multiple attributes can be attached to a single paragraph / table + The frame, in the end, has to decide which attribute takes effect and which physical page it involves */ +public: + SwVirtPageNumInfo( const SwPageFrame *pPg ); + + const SwPageFrame *GetPage() const { return m_pPage; } + const SwPageFrame *GetOrigPage() const { return m_pOrigPage;} + const SwFrame *GetFrame() const { return m_pFrame; } + void SetInfo( const SwPageFrame *pPg, + const SwFrame *pF ) { m_pFrame = pF; m_pPage = pPg; } +}; + +class SwFindNearestNode final : public SwMsgPoolItem +{ + const SwNode *m_pNode, *m_pFound; +public: + SwFindNearestNode( const SwNode& rNd ); + void CheckNode( const SwNode& rNd ); + + const SwNode* GetFoundNode() const { return m_pFound; } +}; + +class SwStringMsgPoolItem final : public SwMsgPoolItem +{ + OUString m_sStr; +public: + + const OUString& GetString() const { return m_sStr; } + + SwStringMsgPoolItem( sal_uInt16 nId, const OUString& rStr ) + : SwMsgPoolItem( nId ), m_sStr( rStr ) + {} +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/htmltbl.hxx b/sw/inc/htmltbl.hxx new file mode 100644 index 000000000..8ed20b83f --- /dev/null +++ b/sw/inc/htmltbl.hxx @@ -0,0 +1,439 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_HTMLTBL_HXX +#define INCLUDED_SW_INC_HTMLTBL_HXX + +#include <memory> +#include <vcl/timer.hxx> +#include <editeng/svxenum.hxx> + +#include "swtypes.hxx" +#include "node.hxx" + +class SwTableBox; +class SwTable; +class SwHTMLTableLayout; +class SwDoc; +class SwFrameFormat; + +#define HTMLTABLE_RESIZE_NOW (ULONG_MAX) + +class SwHTMLTableLayoutCnts +{ + std::shared_ptr<SwHTMLTableLayoutCnts> xNext; ///< The next content. + + /// Only one of the following two pointers may be set! + SwTableBox *pBox; ///< A Box. + std::shared_ptr<SwHTMLTableLayout> xTable; ///< A "table within a table". + + /** During first run there are still no boxes. In this case + pStartNode is used instead of pBox. */ + const SwStartNode *pStartNode; + + /** The following counters indicate how often a pass has been + done for this content. Therefore they are compared against + a reference value. If 255 is reached the continue with 0. + This avoids reinitialization on every resize. */ + sal_uInt8 nPass1Done; ///< How many times has Pass 1 been called? + sal_uInt8 nWidthSet; ///< How many times has the width been set? + + bool bNoBreakTag; ///< <NOBR>-Tag over complete content. + +public: + + SwHTMLTableLayoutCnts(const SwStartNode* pSttNd, std::shared_ptr<SwHTMLTableLayout> const& rTab, + bool bNoBreakTag, std::shared_ptr<SwHTMLTableLayoutCnts> const& rNxt); + + void SetTableBox( SwTableBox *pBx ) { pBox = pBx; } + SwTableBox *GetTableBox() const { return pBox; } + + SwHTMLTableLayout *GetTable() const { return xTable.get(); } + + const SwStartNode *GetStartNode() const; + + /// Calculation of next node. + const std::shared_ptr<SwHTMLTableLayoutCnts>& GetNext() const { return xNext; } + + void SetWidthSet( sal_uInt8 nRef ) { nWidthSet = nRef; } + bool IsWidthSet( sal_uInt8 nRef ) const { return nRef==nWidthSet; } + + void SetPass1Done( sal_uInt8 nRef ) { nPass1Done = nRef; } + bool IsPass1Done( sal_uInt8 nRef ) const { return nRef==nPass1Done; } + + bool HasNoBreakTag() const { return bNoBreakTag; } +}; + +class SwHTMLTableLayoutCell +{ + std::shared_ptr<SwHTMLTableLayoutCnts> xContents; ///< Content of cell. + + sal_uInt16 nRowSpan; ///< ROWSPAN of cell. + sal_uInt16 nColSpan; ///< COLSPAN of cell. + sal_uInt16 nWidthOption; ///< Given width of cell in Twip or %. + + bool bPercentWidthOption : 1; ///< nWidth is %-value. + bool bNoWrapOption : 1; ///< NOWRAP-option. + +public: + + SwHTMLTableLayoutCell(std::shared_ptr<SwHTMLTableLayoutCnts> const& rCnts, + sal_uInt16 nRSpan, sal_uInt16 nCSpan, + sal_uInt16 nWidthOpt, bool bPercentWidthOpt, + bool bNWrapOpt ); + + /// Set or get content of a cell. + void SetContents(std::shared_ptr<SwHTMLTableLayoutCnts> const& rCnts) { xContents = rCnts; } + const std::shared_ptr<SwHTMLTableLayoutCnts>& GetContents() const { return xContents; } + + inline void SetProtected(); + + /// Set or get ROWSPAN/COLSPAN of cell. + void SetRowSpan( sal_uInt16 nRSpan ) { nRowSpan = nRSpan; } + sal_uInt16 GetRowSpan() const { return nRowSpan; } + sal_uInt16 GetColSpan() const { return nColSpan; } + + sal_uInt16 GetWidthOption() const { return nWidthOption; } + bool IsPercentWidthOption() const { return bPercentWidthOption; } + + bool HasNoWrapOption() const { return bNoWrapOption; } +}; + +class SwHTMLTableLayoutColumn +{ + + /// Interim values of AutoLayoutPass1, + sal_uLong nMinNoAlign, nMaxNoAlign, nAbsMinNoAlign; + + /// Results of AutoLayoutPass1 + sal_uLong nMin, nMax; + + /// Results of Pass 2. + sal_uInt16 nAbsColWidth; ///< In Twips. + sal_uInt16 nRelColWidth; ///< In Twips or relative to USHRT_MAX. + + sal_uInt16 nWidthOption; ///< Options of <COL> or <TD>/<TH>. + + bool bRelWidthOption : 1; + bool bLeftBorder : 1; + +public: + + SwHTMLTableLayoutColumn( sal_uInt16 nColWidthOpt, bool bRelColWidthOpt, + bool bLBorder ); + + inline void MergeCellWidthOption( sal_uInt16 nWidth, bool bPercent ); + inline void SetWidthOption( sal_uInt16 nWidth ); + + sal_uInt16 GetWidthOption() const { return nWidthOption; } + bool IsRelWidthOption() const { return bRelWidthOption; } + + inline void MergeMinMaxNoAlign( sal_uLong nMin, sal_uLong nMax, sal_uLong nAbsMin ); + sal_uLong GetMinNoAlign() const { return nMinNoAlign; } + sal_uLong GetMaxNoAlign() const { return nMaxNoAlign; } + sal_uLong GetAbsMinNoAlign() const { return nAbsMinNoAlign; } + inline void ClearPass1Info( bool bWidthOpt ); + + inline void SetMinMax( sal_uLong nMin, sal_uLong nMax ); + void SetMax( sal_uLong nVal ) { nMax = nVal; } + void AddToMin( sal_uLong nVal ) { nMin += nVal; } + void AddToMax( sal_uLong nVal ) { nMax += nVal; } + sal_uLong GetMin() const { return nMin; } + sal_uLong GetMax() const { return nMax; } + + void SetAbsColWidth( sal_uInt16 nWidth ) { nAbsColWidth = nWidth; } + sal_uInt16 GetAbsColWidth() const { return nAbsColWidth; } + + void SetRelColWidth( sal_uInt16 nWidth ) { nRelColWidth = nWidth; } + sal_uInt16 GetRelColWidth() const { return nRelColWidth; } + + bool HasLeftBorder() const { return bLeftBorder; } +}; + +class SwHTMLTableLayout +{ + Timer m_aResizeTimer; ///< Timer for DelayedResize. + + std::vector<std::unique_ptr<SwHTMLTableLayoutColumn>> m_aColumns; + std::vector<std::unique_ptr<SwHTMLTableLayoutCell>> m_aCells; + + const SwTable *m_pSwTable; ///< SwTable (Top-Table only). + + sal_uLong m_nMin; ///< Minimal width of table (Twips). + sal_uLong m_nMax; ///< Maximal width of table (Twips). + + sal_uInt16 m_nRows; ///< Row count. + sal_uInt16 m_nCols; ///< Column count. + + sal_uInt16 m_nLeftMargin; ///< Space to left margin (from paragraph). + sal_uInt16 m_nRightMargin; ///< Space to left margin (from paragraph). + + sal_uInt16 m_nInhAbsLeftSpace; ///< Space inherited from surrounding box + sal_uInt16 m_nInhAbsRightSpace; ///< that was added to boxes. + + sal_uInt16 m_nRelLeftFill; ///< Width of boxes relative to alignment + sal_uInt16 m_nRelRightFill; ///< of tables in tables. + + sal_uInt16 m_nRelTabWidth; ///< Relative width of table. + + sal_uInt16 m_nWidthOption; ///< Width of table (in Twips or %). + sal_uInt16 m_nCellPadding; ///< Space to contents (in Twips). + sal_uInt16 m_nCellSpacing; ///< Cell spacing (in Twips). + sal_uInt16 m_nBorder; /** Line strength of outer border, or rather the + space needed for it as calculated by Netscape. */ + + SwTwips m_nLeftBorderWidth; + SwTwips m_nRightBorderWidth; + sal_uInt16 m_nInhLeftBorderWidth; + sal_uInt16 m_nInhRightBorderWidth; + SwTwips m_nBorderWidth; + + sal_uInt16 m_nDelayedResizeAbsAvail; ///< Param for delayed Resize. + sal_uInt16 m_nLastResizeAbsAvail; + + sal_uInt8 m_nPass1Done; ///< Reference-values for + sal_uInt8 m_nWidthSet; ///< the runs through loop. + + SvxAdjust m_eTableAdjust; ///< Alignment of table. + + bool m_bColsOption : 1; ///< Table has a COLS-option. + bool m_bColTags : 1; ///< Table has COL/COLGRP tags. + bool m_bPercentWidthOption : 1; ///< Width is given in percent. + bool m_bUseRelWidth : 1; ///< SwTable gets relative width. + + bool m_bMustResize : 1; ///< Table width must be defined. + bool m_bExportable : 1; ///< Layout may be used for export. + bool m_bBordersChanged : 1; ///< Borders have been changed. + bool m_bMayBeInFlyFrame : 1; ///< Table could be within frame. + + bool m_bDelayedResizeRecalc : 1; ///< Param for delayed Resize. + bool m_bMustNotResize : 1; ///< Table may not be resized. + bool m_bMustNotRecalc : 1; ///< Table may not be adapted to its contents. + + void AddBorderWidth( sal_uLong &rMin, sal_uLong &rMax, sal_uLong& rAbsMin, + sal_uInt16 nCol, sal_uInt16 nColSpan, + bool bSwBorders=true ) const; + void SetBoxWidth( SwTableBox *pBox, sal_uInt16 nCol, sal_uInt16 nColSpan ) const; + + const SwStartNode *GetAnyBoxStartNode() const; + SwFrameFormat *FindFlyFrameFormat() const; + const SwDoc *GetDoc() const { return GetAnyBoxStartNode()->GetDoc(); } + + void Resize_( sal_uInt16 nAbsAvail, bool bRecalc ); + + DECL_LINK( DelayedResize_Impl, Timer*, void ); + + static sal_uInt16 GetBrowseWidthByVisArea( const SwDoc& rDoc ); +public: + + SwHTMLTableLayout( const SwTable *pSwTable, + sal_uInt16 nRows, sal_uInt16 nCols, bool bColsOpt, bool ColTgs, + sal_uInt16 nWidth, bool bPercentWidth, sal_uInt16 nBorderOpt, + sal_uInt16 nCellPad, sal_uInt16 nCellSp, SvxAdjust eAdjust, + sal_uInt16 nLMargin, sal_uInt16 nRMargin, sal_uInt16 nBWidth, + sal_uInt16 nLeftBWidth, sal_uInt16 nRightBWidth ); + + ~SwHTMLTableLayout(); + + sal_uInt16 GetLeftCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan, + bool bSwBorders=true ) const; + sal_uInt16 GetRightCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan, + bool bSwBorders=true ) const; + inline sal_uInt16 GetInhCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan ) const; + + inline void SetInhBorderWidths( sal_uInt16 nLeft, sal_uInt16 nRight ); + + void GetAvail( sal_uInt16 nCol, sal_uInt16 nColSpan, sal_uInt16& rAbsAvail, + sal_uInt16& rRelAvail ) const; + + void AutoLayoutPass1(); + void AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail, + sal_uInt16 nAbsLeftSpace, sal_uInt16 nAbsRightSpace, + sal_uInt16 nParentInhSpace ); + void SetWidths( bool bCallPass2=false, sal_uInt16 nAbsAvail=0, + sal_uInt16 nRelAvail=0, sal_uInt16 nAbsLeftSpace=0, + sal_uInt16 nAbsRightSpace=0, + sal_uInt16 nParentInhSpace=0 ); + + inline SwHTMLTableLayoutColumn *GetColumn( sal_uInt16 nCol ) const; + inline void SetColumn( std::unique_ptr<SwHTMLTableLayoutColumn> pCol, sal_uInt16 nCol ); + + inline SwHTMLTableLayoutCell *GetCell( sal_uInt16 nRow, sal_uInt16 nCol ) const; + inline void SetCell( std::unique_ptr<SwHTMLTableLayoutCell> pCell, sal_uInt16 nRow, sal_uInt16 nCol ); + + sal_uLong GetMin() const { return m_nMin; } + sal_uLong GetMax() const { return m_nMax; } + + inline long GetBrowseWidthMin() const; + + bool HasColsOption() const { return m_bColsOption; } + bool HasColTags() const { return m_bColTags; } + + bool IsTopTable() const { return m_pSwTable != nullptr; } + + void SetMustResize( bool bSet ) { m_bMustResize = bSet; } + void SetMustNotResize( bool bSet ) { m_bMustNotResize = bSet; } + void SetMustNotRecalc( bool bSet ) { m_bMustNotRecalc = bSet; } + + /** Recalculation of table widths for available width that has been passed. + - If bRecalc is set, contents of boxes are included into calculation. + - If bForce is set, table will be recalculated even if this was + disallowed by SetMustNotResize. + - If nDelay > 0 the calculation is delayed accordingly. Resizing calls + occurring during delay-time are ignored, but the delay may be counted + under certain circumstances. + - If nDelay == HTMLTABLE_RESIZE_NOW, resize immediately and do not + consider any resize-calls that might possibly be in order. + - The return value indicates whether the table has been changed. */ + bool Resize( sal_uInt16 nAbsAvail, bool bRecalc=false, bool bForce=false, + sal_uLong nDelay=0 ); + + void BordersChanged( sal_uInt16 nAbsAvail ); + + /** Calculate available width. This works only if a layout or a + SwViewShell exists. Otherwise returns 0. + This is needed by HTML-filter because it doesn't have access to the layout.) */ + static sal_uInt16 GetBrowseWidth( const SwDoc& rDoc ); + + /// Calculates available width by table-frame. + sal_uInt16 GetBrowseWidthByTabFrame( const SwTabFrame& rTabFrame ) const; + + /** Calculates available width by the table-frame or + static GetBrowseWidth if no layout exists. */ + sal_uInt16 GetBrowseWidthByTable( const SwDoc& rDoc ) const; + + /// For Export. + sal_uInt16 GetWidthOption() const { return m_nWidthOption; } + bool HasPercentWidthOption() const { return m_bPercentWidthOption; } + + sal_uInt16 GetCellPadding() const { return m_nCellPadding; } + sal_uInt16 GetCellSpacing() const { return m_nCellSpacing; } + sal_uInt16 GetBorder() const { return m_nBorder; } + + sal_uInt16 GetRowCount() const { return m_nRows; } + sal_uInt16 GetColCount() const { return m_nCols; } + + void SetExportable( bool bSet ) { m_bExportable = bSet; } + bool IsExportable() const { return m_bExportable; } + + bool HaveBordersChanged() const { return m_bBordersChanged; } + + void SetMayBeInFlyFrame( bool bSet ) { m_bMayBeInFlyFrame = bSet; } + bool MayBeInFlyFrame() const { return m_bMayBeInFlyFrame; } +}; + +inline void SwHTMLTableLayoutCell::SetProtected() +{ + nRowSpan = 1; + nColSpan = 1; + xContents.reset(); +} + +inline void SwHTMLTableLayoutColumn::MergeMinMaxNoAlign( sal_uLong nCMin, + sal_uLong nCMax, sal_uLong nAbsMin ) +{ + if( nCMin > nMinNoAlign ) + nMinNoAlign = nCMin; + if( nCMax > nMaxNoAlign ) + nMaxNoAlign = nCMax; + if( nAbsMin > nAbsMinNoAlign ) + nAbsMinNoAlign = nAbsMin; +} + +inline void SwHTMLTableLayoutColumn::ClearPass1Info( bool bWidthOpt ) +{ + nMinNoAlign = nMaxNoAlign = nAbsMinNoAlign = MINLAY; + nMin = nMax = 0; + if( bWidthOpt ) + { + nWidthOption = 0; + bRelWidthOption = false; + } +} + +inline void SwHTMLTableLayoutColumn::MergeCellWidthOption( + sal_uInt16 nWidth, bool bRel ) +{ + if( !nWidthOption || + (bRel==bRelWidthOption && nWidthOption < nWidth) ) + { + nWidthOption = nWidth; + bRelWidthOption = bRel; + } +} + +inline void SwHTMLTableLayoutColumn::SetMinMax( sal_uLong nMn, sal_uLong nMx ) +{ + nMin = nMn; + nMax = nMx; +} + +inline sal_uInt16 SwHTMLTableLayout::GetInhCellSpace( sal_uInt16 nCol, + sal_uInt16 nColSpan ) const +{ + sal_uInt16 nSpace = 0; + if( nCol==0 ) + nSpace = nSpace + m_nInhAbsLeftSpace; + if( nCol+nColSpan==m_nCols ) + nSpace = nSpace + m_nInhAbsRightSpace; + + return nSpace; +} + +inline SwHTMLTableLayoutColumn *SwHTMLTableLayout::GetColumn( sal_uInt16 nCol ) const +{ + return m_aColumns[nCol].get(); +} + +inline void SwHTMLTableLayoutColumn::SetWidthOption( sal_uInt16 nWidth ) +{ + nWidthOption = nWidth; + bRelWidthOption = true; +} + +inline void SwHTMLTableLayout::SetColumn( std::unique_ptr<SwHTMLTableLayoutColumn> pCol, sal_uInt16 nCol ) +{ + m_aColumns[nCol] = std::move(pCol); +} + +inline SwHTMLTableLayoutCell *SwHTMLTableLayout::GetCell( sal_uInt16 nRow, sal_uInt16 nCol ) const +{ + return m_aCells[static_cast<size_t>(nRow)*m_nCols+nCol].get(); +} + +inline void SwHTMLTableLayout::SetCell( std::unique_ptr<SwHTMLTableLayoutCell> pCell, + sal_uInt16 nRow, sal_uInt16 nCol ) +{ + m_aCells[static_cast<size_t>(nRow)*m_nCols+nCol] = std::move(pCell); +} + +inline long SwHTMLTableLayout::GetBrowseWidthMin() const +{ + return static_cast<long>( (!m_nWidthOption || m_bPercentWidthOption) ? m_nMin : m_nRelTabWidth ); +} + +void SwHTMLTableLayout::SetInhBorderWidths( sal_uInt16 nLeft, sal_uInt16 nRight ) +{ + m_nInhLeftBorderWidth = nLeft; + m_nInhRightBorderWidth = nRight; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx new file mode 100644 index 000000000..10256ad1f --- /dev/null +++ b/sw/inc/index.hxx @@ -0,0 +1,194 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_INDEX_HXX +#define INCLUDED_SW_INC_INDEX_HXX + +#include <sal/types.h> +#include "swdllapi.h" + +#include <iostream> + +class SwIndexReg; +struct SwPosition; + +namespace sw { +namespace mark { +class IMark; +} +} + +/// Marks a character position inside a document model node. +class SAL_WARN_UNUSED SW_DLLPUBLIC SwIndex +{ +private: + friend class SwIndexReg; + + sal_Int32 m_nIndex; + SwIndexReg * m_pIndexReg; + // doubly linked list of Indexes registered at m_pIndexReg + SwIndex * m_pNext; + SwIndex * m_pPrev; + + /// Pointer to a mark that owns this position to allow fast lookup of marks of an SwIndexReg. + const sw::mark::IMark* m_pMark; + + SwIndex& ChgValue( const SwIndex& rIdx, sal_Int32 nNewValue ); + void Init(sal_Int32 const nIdx); + void Remove(); + +public: + explicit SwIndex(SwIndexReg *const pReg, sal_Int32 const nIdx = 0); + SwIndex( const SwIndex & ); + SwIndex( const SwIndex &, short nDiff ); + ~SwIndex() { Remove(); } + + SwIndex& operator=( sal_Int32 const ); + SwIndex& operator=( const SwIndex & ); + + sal_Int32 operator++(); + sal_Int32 operator--(); + sal_Int32 operator--(int); + + sal_Int32 operator+=( sal_Int32 const ); + sal_Int32 operator-=( sal_Int32 const ); + + bool operator< ( const SwIndex& ) const; + bool operator<=( const SwIndex& ) const; + bool operator> ( const SwIndex& ) const; + bool operator>=( const SwIndex& ) const; + + bool operator< ( sal_Int32 const nVal ) const { return m_nIndex < nVal; } + bool operator<=( sal_Int32 const nVal ) const { return m_nIndex <= nVal; } + bool operator> ( sal_Int32 const nVal ) const { return m_nIndex > nVal; } + bool operator>=( sal_Int32 const nVal ) const { return m_nIndex >= nVal; } + bool operator==( sal_Int32 const nVal ) const { return m_nIndex == nVal; } + bool operator!=( sal_Int32 const nVal ) const { return m_nIndex != nVal; } + + bool operator==( const SwIndex& rSwIndex ) const + { + return (m_nIndex == rSwIndex.m_nIndex) + && (m_pIndexReg == rSwIndex.m_pIndexReg); + } + + bool operator!=( const SwIndex& rSwIndex ) const + { + return (m_nIndex != rSwIndex.m_nIndex) + || (m_pIndexReg != rSwIndex.m_pIndexReg); + } + + sal_Int32 GetIndex() const { return m_nIndex; } + + // Assignments without creating a temporary object. + SwIndex &Assign(SwIndexReg *, sal_Int32); + + // Returns pointer to IndexArray (for RTTI at SwIndexReg). + const SwIndexReg* GetIdxReg() const { return m_pIndexReg; } + const SwIndex* GetNext() const { return m_pNext; } + + const sw::mark::IMark* GetMark() const { return m_pMark; } + void SetMark(const sw::mark::IMark* pMark); +}; + +SW_DLLPUBLIC std::ostream& operator <<(std::ostream& s, const SwIndex& index); + +class SAL_WARN_UNUSED SwIndexReg +{ + friend class SwIndex; + friend bool sw_PosOk(const SwPosition & aPos); + + const SwIndex * m_pFirst; + const SwIndex * m_pLast; + +protected: + virtual void Update( SwIndex const & rPos, const sal_Int32 nChangeLen, + const bool bNegative = false, const bool bDelete = false ); + + bool HasAnyIndex() const { return nullptr != m_pFirst; } + +public: + SwIndexReg(); + virtual ~SwIndexReg(); + + void MoveTo( SwIndexReg& rArr ); + const SwIndex* GetFirstIndex() const { return m_pFirst; } +}; + +#ifndef DBG_UTIL + +inline sal_Int32 SwIndex::operator++() +{ + return ChgValue( *this, m_nIndex+1 ).m_nIndex; +} + +inline sal_Int32 SwIndex::operator--() +{ + return ChgValue( *this, m_nIndex-1 ).m_nIndex; +} + +inline sal_Int32 SwIndex::operator--(int) +{ + sal_Int32 const nOldIndex = m_nIndex; + ChgValue( *this, m_nIndex-1 ); + return nOldIndex; +} + +inline sal_Int32 SwIndex::operator+=( sal_Int32 const nVal ) +{ + return ChgValue( *this, m_nIndex + nVal ).m_nIndex; +} + +inline sal_Int32 SwIndex::operator-=( sal_Int32 const nVal ) +{ + return ChgValue( *this, m_nIndex - nVal ).m_nIndex; +} + +inline bool SwIndex::operator< ( const SwIndex& rIndex ) const +{ + return m_nIndex < rIndex.m_nIndex; +} + +inline bool SwIndex::operator<=( const SwIndex& rIndex ) const +{ + return m_nIndex <= rIndex.m_nIndex; +} + +inline bool SwIndex::operator> ( const SwIndex& rIndex ) const +{ + return m_nIndex > rIndex.m_nIndex; +} + +inline bool SwIndex::operator>=( const SwIndex& rIndex ) const +{ + return m_nIndex >= rIndex.m_nIndex; +} + +inline SwIndex& SwIndex::operator= ( sal_Int32 const nVal ) +{ + if (m_nIndex != nVal) + { + ChgValue( *this, nVal ); + } + return *this; +} + +#endif // ifndef DBG_UTIL + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/init.hxx b/sw/inc/init.hxx new file mode 100644 index 000000000..b35786410 --- /dev/null +++ b/sw/inc/init.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_INIT_HXX +#define INCLUDED_SW_INC_INIT_HXX + +#include <sal/config.h> + +#include <vector> + +#include <osl/module.h> +#include <osl/module.hxx> + +class SvGlobalName; +class SwViewShell; + +void InitCore(); // bastyp/init.cxx +void FinitCore(); + +namespace sw { + +// basflt/fltini.cxx +class Filters +{ +private: + Filters(Filters const&) = delete; + Filters& operator=(Filters const&) = delete; + +public: + Filters(); + + ~Filters(); +#ifndef DISABLE_DYNLOADING + oslGenericFunction GetMswordLibSymbol( const char *pSymbol ); +#endif + +private: + osl::Module msword_; +}; + +} + +// layout/newfrm.cxx +void FrameInit(); +void FrameFinit(); +void SetShell( SwViewShell *pSh ); + +// text/txtfrm.cxx +void TextInit_(); +void TextFinit(); + +// We collect the GlobalNames of the servers at runtime, who don't want to be notified +// about printer changes. Thereby saving loading a lot of objects (luckily all foreign +// objects are mapped to one ID). +// Initialisation and deinitialisation can be found in init.cxx +extern std::vector<SvGlobalName> *pGlobalOLEExcludeList; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx new file mode 100644 index 000000000..53abd6872 --- /dev/null +++ b/sw/inc/iodetect.hxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_IODETECT_HXX +#define INCLUDED_SW_INC_IODETECT_HXX + +#include <memory> +#include <rtl/ustring.hxx> +#include <tools/lineend.hxx> +#include <tools/solar.h> +#include "swdllapi.h" + +#define FILTER_RTF "RTF" ///< RTF filter +#define sRtfWH "WH_RTF" +#define FILTER_TEXT "TEXT" ///< text filter with default codeset +#define FILTER_BAS "BAS" ///< StarBasic (identical to ANSI) +#define FILTER_WW8 "CWW8" ///< WinWord 97 filter +#define FILTER_TEXT_DLG "TEXT_DLG" ///< text filter with encoding dialog +#define FILTER_XML "CXML" ///< XML filter +#define FILTER_XMLV "CXMLV" ///< XML filter +#define FILTER_XMLVW "CXMLVWEB" ///< XML filter +#define FILTER_DOCX "OXML" +#define sHTML "HTML" +#define sWW5 "WW6" +#define sWW6 "CWW6" + +#define sSWRITER "swriter" +#define sSWRITERWEB "swriter/web" + +class SfxFilter; +class SfxFilterContainer; +class SotStorage; +class SvStream; +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::uno { template <typename> class Reference; } + +struct SwIoDetect +{ + const OUString sName; + + SwIoDetect(const OUString &rN) + : sName(rN) + { + } + + bool IsFilter( const OUString& rNm ) const + { + return rNm.startsWith(sName); + } +}; + +enum ReaderWriterEnum { + READER_WRITER_RTF, + READER_WRITER_BAS, + READER_WRITER_WW6, + READER_WRITER_WW8, + READER_WRITER_RTF_WH, + READER_WRITER_HTML, + READER_WRITER_WW5, + READER_WRITER_XML, + READER_WRITER_TEXT_DLG, + READER_WRITER_TEXT, + READER_WRITER_DOCX, + MAXFILTER +}; + +extern SwIoDetect aFilterDetect[]; + +/** The following class is a wrapper for basic i/o functions of Writer 3.0. + Everything is static. All filter names mentioned are Writer-internal + names, i.e. the names in front of the equality sign in INSTALL.INI, like SWG + or ASCII.*/ + +class SwIoSystem +{ +public: + /// find for an internal format name the corresponding filter entry + SW_DLLPUBLIC static std::shared_ptr<const SfxFilter> + GetFilterOfFormat( const OUString& rFormat, + const SfxFilterContainer* pCnt = nullptr ); + + /** Detect for the given file which filter should be used. The filter name + is returned. If no filter could be found, the name of the ASCII filter + is returned! */ + static std::shared_ptr<const SfxFilter> GetFileFilter(const OUString& rFileName); + + static bool IsValidStgFilter( SotStorage& , const SfxFilter& ); + static bool IsValidStgFilter( const css::uno::Reference < css::embed::XStorage >& rStg, const SfxFilter& rFilter); + + static bool IsDetectableText( const char* pBuf, sal_uLong &rLen, + rtl_TextEncoding *pCharSet, bool *pSwap, LineEnd *pLineEnd ); + + static OUString GetSubStorageName( const SfxFilter& rFltr ); +}; + +extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportFODT(SvStream &rStream); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/istyleaccess.hxx b/sw/inc/istyleaccess.hxx new file mode 100644 index 000000000..b547d55ba --- /dev/null +++ b/sw/inc/istyleaccess.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_ISTYLEACCESS_HXX +#define INCLUDED_SW_INC_ISTYLEACCESS_HXX + +#include <svl/itemset.hxx> +#include <memory> +#include <vector> + +// Management of (automatic) styles +class IStyleAccess +{ +public: + enum SwAutoStyleFamily + { + AUTO_STYLE_CHAR, + AUTO_STYLE_RUBY, + AUTO_STYLE_PARA, + AUTO_STYLE_NOTXT + }; + + virtual ~IStyleAccess() {} + + virtual std::shared_ptr<SfxItemSet> getAutomaticStyle( const SfxItemSet& rSet, + SwAutoStyleFamily eFamily, + const OUString* pParentName = nullptr ) = 0; + virtual void getAllStyles( std::vector<std::shared_ptr<SfxItemSet>> &rStyles, + SwAutoStyleFamily eFamily ) = 0; + /** It's slow to iterate through a stylepool looking for a special name, but if + the style has been inserted via "cacheAutomaticStyle" instead of "getAutomaticStyle", + it's faster */ + virtual std::shared_ptr<SfxItemSet> getByName( const OUString& rName, + SwAutoStyleFamily eFamily ) = 0; + /// insert the style to the pool and the cache (used during import) + virtual std::shared_ptr<SfxItemSet> cacheAutomaticStyle( const SfxItemSet& rSet, + SwAutoStyleFamily eFamily ) = 0; + /// To release the cached styles (shared_pointer!) + virtual void clearCaches() = 0; +}; + +#endif // INCLUDED_SW_INC_ISTYLEACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/itabenum.hxx b/sw/inc/itabenum.hxx new file mode 100644 index 000000000..d5c68cb51 --- /dev/null +++ b/sw/inc/itabenum.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_ITABENUM_HXX +#define INCLUDED_SW_INC_ITABENUM_HXX + +#include <sal/types.h> +#include <o3tl/typed_flags_set.hxx> + +enum class SwInsertTableFlags +{ + NONE = 0x00, + DefaultBorder = 0x01, + Headline = 0x02, + SplitLayout = 0x08, + HeadlineNoBorder = Headline | SplitLayout, + All = DefaultBorder | Headline | SplitLayout +}; +namespace o3tl { + template<> struct typed_flags<SwInsertTableFlags> : is_typed_flags<SwInsertTableFlags, 0x0b> {}; +} + +struct SwInsertTableOptions +{ + SwInsertTableFlags mnInsMode; + sal_uInt16 mnRowsToRepeat; + + SwInsertTableOptions( SwInsertTableFlags nInsMode, sal_uInt16 nRowsToRepeat ) : + mnInsMode( nInsMode ), mnRowsToRepeat( nRowsToRepeat ) {}; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/legacyitem.hxx b/sw/inc/legacyitem.hxx new file mode 100644 index 000000000..de7764b6c --- /dev/null +++ b/sw/inc/legacyitem.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_LEGACYITEM_HXX +#define INCLUDED_SW_LEGACYITEM_HXX + +#include "swdllapi.h" + +////////////////////////////////////////////////////////////////////////////// +// // sw +// SwFormatVertOrient m_aVerticalAlignment; +////////////////////////////////////////////////////////////////////////////// + +class SvStream; +class SwFormatVertOrient; + +namespace legacy +{ + namespace SwFormatVert + { + sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion); + void Create(SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + SvStream& Store(const SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } +} + +#endif // INCLUDED_SW_LEGACYITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/lineinfo.hxx b/sw/inc/lineinfo.hxx new file mode 100644 index 000000000..5bc245894 --- /dev/null +++ b/sw/inc/lineinfo.hxx @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_LINEINFO_HXX +#define INCLUDED_SW_INC_LINEINFO_HXX + +#include "calbck.hxx" +#include <editeng/numitem.hxx> +#include "swdllapi.h" + +class SwCharFormat; +class IDocumentStylePoolAccess; + +enum LineNumberPosition +{ + LINENUMBER_POS_LEFT, + LINENUMBER_POS_RIGHT, + LINENUMBER_POS_INSIDE, + LINENUMBER_POS_OUTSIDE +}; + +class SW_DLLPUBLIC SwLineNumberInfo final : public SwClient /**< purpose of derivation from SwClient: + character style for displaying the numbers. */ +{ + SvxNumberType m_aType; ///< e.g. roman linenumbers + OUString m_aDivider; ///< String for additional interval (vert. lines user defined) + sal_uInt16 m_nPosFromLeft; ///< Position for paint + sal_uInt16 m_nCountBy; ///< Paint only for every n line + sal_uInt16 m_nDividerCountBy; /**< Interval for display of an user defined + string every n lines */ + LineNumberPosition m_ePos; ///< Where should the display occur (number and divider) + bool m_bPaintLineNumbers; ///< Should anything be displayed? + bool m_bCountBlankLines; ///< Count empty lines? + bool m_bCountInFlys; ///< Count also within FlyFrames? + bool m_bRestartEachPage; /**< Restart counting at the first paragraph of each page + (even on follows when paragraphs are split) */ + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; + +public: + SwLineNumberInfo(); + SwLineNumberInfo(const SwLineNumberInfo&); + + SwLineNumberInfo& operator=(const SwLineNumberInfo&); + + SwCharFormat *GetCharFormat( IDocumentStylePoolAccess& rIDSPA ) const; + void SetCharFormat( SwCharFormat* ); + + const SvxNumberType &GetNumType() const { return m_aType; } + void SetNumType( SvxNumberType aNew ){ m_aType = aNew; } + + const OUString& GetDivider() const { return m_aDivider; } + void SetDivider( const OUString &r ) { m_aDivider = r; } + sal_uInt16 GetDividerCountBy() const { return m_nDividerCountBy; } + void SetDividerCountBy( sal_uInt16 n ) { m_nDividerCountBy = n; } + + sal_uInt16 GetPosFromLeft() const { return m_nPosFromLeft; } + void SetPosFromLeft( sal_uInt16 n) { m_nPosFromLeft = n; } + + sal_uInt16 GetCountBy() const { return m_nCountBy; } + void SetCountBy( sal_uInt16 n) { m_nCountBy = n; } + + LineNumberPosition GetPos() const { return m_ePos; } + void SetPos( LineNumberPosition eP ){ m_ePos = eP; } + + bool IsPaintLineNumbers() const { return m_bPaintLineNumbers; } + void SetPaintLineNumbers( bool b ){ m_bPaintLineNumbers = b; } + + bool IsCountBlankLines() const { return m_bCountBlankLines; } + void SetCountBlankLines( bool b ) { m_bCountBlankLines = b; } + + bool IsCountInFlys() const { return m_bCountInFlys; } + void SetCountInFlys( bool b ) { m_bCountInFlys = b; } + + bool IsRestartEachPage() const { return m_bRestartEachPage; } + void SetRestartEachPage( bool b ) { m_bRestartEachPage = b; } + + bool HasCharFormat() const { return GetRegisteredIn() != nullptr; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/linkenum.hxx b/sw/inc/linkenum.hxx new file mode 100644 index 000000000..dcf4e9841 --- /dev/null +++ b/sw/inc/linkenum.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_LINKENUM_HXX +#define INCLUDED_SW_INC_LINKENUM_HXX + +enum UpdateLinks +{ + NEVER, + MANUAL, + AUTOMATIC, + GLOBALSETTING +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/list.hxx b/sw/inc/list.hxx new file mode 100644 index 000000000..d8b3e1694 --- /dev/null +++ b/sw/inc/list.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_LIST_HXX +#define INCLUDED_SW_INC_LIST_HXX + +#include <o3tl/deleter.hxx> +#include <rtl/ustring.hxx> +#include <memory> + +#include "swdllapi.h" + +class SwNumRule; +class SwNodes; +class SwNodeNum; + +class SwListImpl; + +class SwList +{ + public: + SwList( const OUString& sListId, + SwNumRule& rDefaultListStyle, + const SwNodes& rNodes ); + ~SwList(); + + const OUString & GetListId() const; + + SW_DLLPUBLIC const OUString & GetDefaultListStyleName() const; + void SetDefaultListStyleName(OUString const&); + + void InsertListItem( SwNodeNum& rNodeNum, + bool isHiddenRedlines, + const int nLevel ); + static void RemoveListItem( SwNodeNum& rNodeNum ); + + void InvalidateListTree(); + void ValidateListTree(); + + void MarkListLevel( const int nListLevel, + const bool bValue ); + + bool IsListLevelMarked( const int nListLevel ) const; + + private: + SwList( const SwList& ) = delete; + SwList& operator=( const SwList& ) = delete; + + std::unique_ptr<SwListImpl, o3tl::default_delete<SwListImpl>> mpListImpl; +}; +#endif // INCLUDED_SW_INC_LIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx new file mode 100644 index 000000000..3715c6702 --- /dev/null +++ b/sw/inc/mdiexp.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_MDIEXP_HXX +#define INCLUDED_SW_INC_MDIEXP_HXX + +#include <rtl/ustring.hxx> +#include "tblenum.hxx" +#include "swdllapi.h" + +class SwRect; +class Size; +class SwViewShell; +class SwDocShell; + +extern void ScrollMDI(SwViewShell const * pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY); +extern bool IsScrollMDI(SwViewShell const * pVwSh, const SwRect &); +extern void SizeNotify(SwViewShell const * pVwSh, const Size &); + +// Update of status bar during an action. +extern void PageNumNotify( SwViewShell const * pVwSh, + sal_uInt16 nPhyNum, + sal_uInt16 nVirtNum, + const OUString& rPg ); + +enum FlyMode { FLY_DRAG_START, FLY_DRAG, FLY_DRAG_END }; +extern void FrameNotify( SwViewShell* pVwSh, FlyMode eMode = FLY_DRAG ); + +SW_DLLPUBLIC void StartProgress(const char* pMessId, long nStartVal, long nEndVal, SwDocShell *pDocSh = nullptr); +SW_DLLPUBLIC void EndProgress ( SwDocShell const *pDocSh ); +SW_DLLPUBLIC void SetProgressState ( long nPosition, SwDocShell const *pDocShell ); +void RescheduleProgress( SwDocShell const *pDocShell ); + +void RepaintPagePreview( SwViewShell const * pVwSh, const SwRect& rRect ); + +// Read ChgMode for tables from configuration. +TableChgMode GetTableChgDefaultMode(); + +bool JumpToSwMark( SwViewShell const * pVwSh, const OUString& rMark ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/mmaddressblockpage.hrc b/sw/inc/mmaddressblockpage.hrc new file mode 100644 index 000000000..ba026a890 --- /dev/null +++ b/sw/inc/mmaddressblockpage.hrc @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_MMADDRESSBLOCK_HRC +#define INCLUDED_SW_INC_MMADDRESSBLOCK_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* RA_SALUTATION[] = +{ + NC_("RA_SALUTATION", "Dear"), + NC_("RA_SALUTATION", "Hello"), + NC_("RA_SALUTATION", "Hi") +}; + +const char* RA_PUNCTUATION[] = +{ + NC_("RA_PUNCTUATION", ","), + NC_("RA_PUNCTUATION", ":"), + NC_("RA_PUNCTUATION", "!"), + NC_("RA_PUNCTUATION", "(none)") +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx new file mode 100644 index 000000000..5ed47511c --- /dev/null +++ b/sw/inc/modcfg.hxx @@ -0,0 +1,409 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_MODCFG_HXX +#define INCLUDED_SW_INC_MODCFG_HXX + +#include <unotools/configitem.hxx> +#include "swdllapi.h" +#include "authratr.hxx" +#include "SwCapObjType.hxx" +#include "tblenum.hxx" +#include "itabenum.hxx" +#include <caption.hxx> +#include <tools/globname.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <vector> +#include <memory> + +class InsCaptionOpt; + +// text format for the sending of messages ------------------------------ +enum class MailTextFormats +{ + NONE = 0x00, + HTML = 0x01, + RTF = 0x02, + OFFICE = 0x04 +}; +namespace o3tl +{ + template<> struct typed_flags<MailTextFormats> : is_typed_flags<MailTextFormats, 0x07> {}; +} + + +class InsCaptionOptArr +{ +private: + typedef std::vector<std::unique_ptr<InsCaptionOpt>> InsCapOptArr; + InsCapOptArr m_InsCapOptArr; +public: + InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = nullptr); + void Insert(InsCaptionOpt* pObj); +}; + +class SAL_DLLPUBLIC_RTTI SwRevisionConfig final : public utl::ConfigItem +{ + friend class SwModuleOptions; + + AuthorCharAttr m_aInsertAttr; //Revision/TextDisplay/Insert/Attribute // Redlining: author character attributes + //Revision/TextDisplay/Insert/Color + AuthorCharAttr m_aDeletedAttr; //Revision/TextDisplay/Delete/Attribute + //Revision/TextDisplay/Delete/Color + AuthorCharAttr m_aFormatAttr; //Revision/TextDisplay/ChangeAttribute/Attribute + //Revision/TextDisplay/ChangeAttribute/Color + sal_uInt16 m_nMarkAlign; //Revision/LinesChanged/Mark + Color m_aMarkColor; //Revision/LinesChanged/Color + + static const css::uno::Sequence<OUString>& GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwRevisionConfig(); + virtual ~SwRevisionConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +enum class SwCompareMode +{ + Auto = 0, + ByWord, + ByChar +}; + +class SAL_DLLPUBLIC_RTTI SwCompareConfig final : public utl::ConfigItem +{ + friend class SwModuleOptions; + + SwCompareMode m_eCmpMode; //Compare/CompareDocuments; + bool m_bUseRsid; //Compare/Settings/Use RSID + /// Compare/Settings/Store RSID + bool m_bStoreRsid; + bool m_bIgnorePieces; //Compare/Settings/Ignore pieces of length + sal_uInt16 m_nPieceLen; //Compare/Settings/Ignore pieces of length + + static const css::uno::Sequence<OUString>& GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwCompareConfig(); + virtual ~SwCompareConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& ) override { }; + void Load(); + using ConfigItem::SetModified; +}; + +class SAL_DLLPUBLIC_RTTI SwInsertConfig final : public utl::ConfigItem +{ + friend class SwModuleOptions; + + std::unique_ptr<InsCaptionOptArr> m_pCapOptions; + std::unique_ptr<InsCaptionOpt> m_pOLEMiscOpt; + + SvGlobalName m_aGlobalNames[5]; + + bool m_bInsWithCaption; //Insert/Caption/Automatic + bool m_bCaptionOrderNumberingFirst; //#i61007# caption order starting with numbering + + SwInsertTableOptions m_aInsTableOpts; + bool m_bIsWeb; + + const css::uno::Sequence<OUString>& GetPropertyNames() const; + + virtual void ImplCommit() override; + +public: + SwInsertConfig(bool bWeb); + virtual ~SwInsertConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +class SAL_DLLPUBLIC_RTTI SwTableConfig final : public utl::ConfigItem +{ + friend class SwModuleOptions; + + sal_uInt16 m_nTableHMove; //int Table/Shift/Row + sal_uInt16 m_nTableVMove; //int Table/Shift/Column + sal_uInt16 m_nTableHInsert; //int Table/Insert/Row + sal_uInt16 m_nTableVInsert; //int Table/Insert/Column + TableChgMode m_eTableChgMode; //int Table/Change/Effect + + bool m_bInsTableFormatNum; // Table/Input/NumberRecognition // Automatic recognition of numbers. + bool m_bInsTableChangeNumFormat; // Table/Input/NumberFormatRecognition // Automatic recognition of number formats. + bool m_bInsTableAlignNum; // Table/Input/Alignment // Align numbers. + bool m_bSplitVerticalByDefault; // Table/Input/SplitVerticalByDefault // Split vertical by default. + + static const css::uno::Sequence<OUString>& GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwTableConfig(bool bWeb); + virtual ~SwTableConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +class SAL_DLLPUBLIC_RTTI SwMiscConfig final : public utl::ConfigItem +{ + friend class SwModuleOptions; + + OUString m_sWordDelimiter; // Statistics/WordNumber/Delimiter + bool m_bDefaultFontsInCurrDocOnly; // DefaultFont/Document + bool m_bShowIndexPreview; // Index/ShowPreview + bool m_bGrfToGalleryAsLnk; // Misc/GraphicToGalleryAsLink + bool m_bNumAlignSize; // Numbering/Graphic/KeepRatio + bool m_bSinglePrintJob; // FormLetter/PrintOutput/SinglePrintJobs + bool m_bIsNameFromColumn; // FormLetter/FileOutput/FileName/Generation + bool m_bIsPasswordFromColumn; // FormLetter/FileOutput/FilePassword/Generation + bool m_bAskForMailMergeInPrint; // Ask if documents containing fields should be 'mailmerged' + MailTextFormats m_nMailingFormats; // FormLetter/MailingOutput/Formats + OUString m_sNameFromColumn; // FormLetter/FileOutput/FileName/FromDatabaseField (string!) + OUString m_sPasswordFromColumn; // FormLetter/FileOutput/FilePassword/FromDatabaseField (string!) + OUString m_sMailingPath; // FormLetter/FileOutput/Path + OUString m_sMailName; // FormLetter/FileOutput/FileName/FromManualSetting (string!) + + static const css::uno::Sequence<OUString>& GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SwMiscConfig(); + virtual ~SwMiscConfig() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + void Load(); + using ConfigItem::SetModified; +}; + +class SW_DLLPUBLIC SwModuleOptions +{ + SwRevisionConfig m_aRevisionConfig; + SwInsertConfig m_aInsertConfig; + SwInsertConfig m_aWebInsertConfig; + + SwTableConfig m_aTableConfig; + SwTableConfig m_aWebTableConfig; + + SwMiscConfig m_aMiscConfig; + + SwCompareConfig m_aCompareConfig; + + //fiscus: don't show tips of text fields - it's not part of the configuration! + bool m_bHideFieldTips : 1; + +public: + SwModuleOptions(); + + TableChgMode GetTableMode() const { return m_aTableConfig.m_eTableChgMode;} + void SetTableMode( TableChgMode eSet ) { m_aTableConfig.m_eTableChgMode = eSet; + m_aTableConfig.SetModified();} + + sal_uInt16 GetTableHMove() const { return m_aTableConfig.m_nTableHMove;} + void SetTableHMove( sal_uInt16 nSet ) { m_aTableConfig.m_nTableHMove = nSet; + m_aTableConfig.SetModified();} + + sal_uInt16 GetTableVMove() const { return m_aTableConfig.m_nTableVMove;} + void SetTableVMove( sal_uInt16 nSet ) { m_aTableConfig.m_nTableVMove = nSet; + m_aTableConfig.SetModified();} + + sal_uInt16 GetTableHInsert() const {return m_aTableConfig.m_nTableHInsert;} + void SetTableHInsert( sal_uInt16 nSet ) { m_aTableConfig.m_nTableHInsert = nSet; + m_aTableConfig.SetModified();} + + sal_uInt16 GetTableVInsert() const {return m_aTableConfig.m_nTableVInsert;} + void SetTableVInsert( sal_uInt16 nSet ) { m_aTableConfig.m_nTableVInsert = nSet; + m_aTableConfig.SetModified();} + + const AuthorCharAttr &GetInsertAuthorAttr() const { return m_aRevisionConfig.m_aInsertAttr; } + void SetInsertAuthorAttr( AuthorCharAttr const &rAttr ) { m_aRevisionConfig.m_aInsertAttr = rAttr; + m_aRevisionConfig.SetModified();} + + const AuthorCharAttr &GetDeletedAuthorAttr() const { return m_aRevisionConfig.m_aDeletedAttr; } + void SetDeletedAuthorAttr( AuthorCharAttr const &rAttr ) { m_aRevisionConfig.m_aDeletedAttr = rAttr; + m_aRevisionConfig.SetModified();} + + const AuthorCharAttr &GetFormatAuthorAttr() const { return m_aRevisionConfig.m_aFormatAttr; } + void SetFormatAuthorAttr( AuthorCharAttr const &rAttr ) { m_aRevisionConfig.m_aFormatAttr = rAttr; + m_aRevisionConfig.SetModified();} + + sal_uInt16 GetMarkAlignMode() const { return m_aRevisionConfig.m_nMarkAlign; } + void SetMarkAlignMode(sal_uInt16 nMode) { m_aRevisionConfig.m_nMarkAlign = nMode; + m_aRevisionConfig.SetModified();} + + const Color& GetMarkAlignColor() const { return m_aRevisionConfig.m_aMarkColor; } + void SetMarkAlignColor(const Color &rColor) { m_aRevisionConfig.m_aMarkColor = rColor; + m_aRevisionConfig.SetModified();} + + bool IsInsWithCaption(bool bHTML) const + { return !bHTML && m_aInsertConfig.m_bInsWithCaption; } + void SetInsWithCaption( bool bHTML, bool b ) + { if(!bHTML) + m_aInsertConfig.m_bInsWithCaption = b; + m_aInsertConfig.SetModified();} + + bool IsCaptionOrderNumberingFirst() const { return m_aInsertConfig.m_bCaptionOrderNumberingFirst; } + void SetCaptionOrderNumberingFirst( bool bSet ) + { + if(m_aInsertConfig.m_bCaptionOrderNumberingFirst != bSet) + { + m_aInsertConfig.m_bCaptionOrderNumberingFirst = bSet; + m_aInsertConfig.SetModified(); + } + } + + bool IsInsTableFormatNum(bool bHTML) const + { return bHTML ? m_aWebTableConfig.m_bInsTableFormatNum : m_aTableConfig.m_bInsTableFormatNum; } + void SetInsTableFormatNum( bool bHTML, bool b ) + { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; + config.m_bInsTableFormatNum = b; + config.SetModified();} + + bool IsInsTableChangeNumFormat(bool bHTML) const + { return bHTML ? m_aWebTableConfig.m_bInsTableChangeNumFormat : m_aTableConfig.m_bInsTableChangeNumFormat; } + void SetInsTableChangeNumFormat( bool bHTML, bool b ) + { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; + config.m_bInsTableChangeNumFormat = b; + config.SetModified();} + + bool IsInsTableAlignNum(bool bHTML) const + { return bHTML ? m_aWebTableConfig.m_bInsTableAlignNum : m_aTableConfig.m_bInsTableAlignNum; } + void SetInsTableAlignNum( bool bHTML, bool b ) + { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; + config.m_bInsTableAlignNum = b; + config.SetModified();} + + const SwInsertTableOptions& GetInsTableFlags(bool bHTML) const + { return bHTML ? m_aWebInsertConfig.m_aInsTableOpts : m_aInsertConfig.m_aInsTableOpts;} + void SetInsTableFlags( bool bHTML, const SwInsertTableOptions& rOpts ) { + auto & config = bHTML ? m_aWebInsertConfig : m_aInsertConfig; + config.m_aInsTableOpts = rOpts; + config.SetModified();} + + bool IsSplitVerticalByDefault(bool bHTML) const + { return bHTML ? m_aWebTableConfig.m_bSplitVerticalByDefault : m_aTableConfig.m_bSplitVerticalByDefault; } + void SetSplitVerticalByDefault(bool bHTML, bool b) + { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; + config.m_bSplitVerticalByDefault = b; + config.SetModified();} + + const InsCaptionOpt* GetCapOption(bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId); + bool SetCapOption(bool bHTML, const InsCaptionOpt* pOpt); + + bool IsGrfToGalleryAsLnk() const { return m_aMiscConfig.m_bGrfToGalleryAsLnk; } + void SetGrfToGalleryAsLnk( bool b ) { m_aMiscConfig.m_bGrfToGalleryAsLnk = b; + m_aMiscConfig.SetModified();} + + MailTextFormats GetMailingFormats() const { return m_aMiscConfig.m_nMailingFormats;} + void SetMailingFormats( MailTextFormats nSet ) { m_aMiscConfig.m_nMailingFormats = nSet; + m_aMiscConfig.SetModified();} + + void SetSinglePrintJob( bool b ) { m_aMiscConfig.m_bSinglePrintJob = b; + m_aMiscConfig.SetModified();} + + bool IsNameFromColumn() const { return m_aMiscConfig.m_bIsNameFromColumn; } + void SetIsNameFromColumn( bool bSet ) + { + m_aMiscConfig.SetModified(); + m_aMiscConfig.m_bIsNameFromColumn = bSet; + } + + bool IsAskForMailMerge() const { return m_aMiscConfig.m_bAskForMailMergeInPrint;} + + const OUString& GetNameFromColumn() const { return m_aMiscConfig.m_sNameFromColumn; } + void SetNameFromColumn( const OUString& rSet ) { m_aMiscConfig.m_sNameFromColumn = rSet; + m_aMiscConfig.SetModified();} + + bool IsFileEncryptedFromColumn() const { return m_aMiscConfig.m_bIsPasswordFromColumn;} + void SetIsFileEncryptedFromColumn( bool bSet ) + { + m_aMiscConfig.SetModified(); + m_aMiscConfig.m_bIsPasswordFromColumn = bSet; + } + + const OUString& GetPasswordFromColumn() const { return m_aMiscConfig.m_sPasswordFromColumn; } + void SetPasswordFromColumn( const OUString& rSet ) { m_aMiscConfig.m_sPasswordFromColumn = rSet; + m_aMiscConfig.SetModified();} + + const OUString& GetMailingPath() const { return m_aMiscConfig.m_sMailingPath; } + void SetMailingPath(const OUString& sPath) { m_aMiscConfig.m_sMailingPath = sPath; + m_aMiscConfig.SetModified();} + + const OUString& GetWordDelimiter() const { return m_aMiscConfig.m_sWordDelimiter; } + void SetWordDelimiter(const OUString& sDelim) { m_aMiscConfig.m_sWordDelimiter = sDelim; + m_aMiscConfig.SetModified();} + + //convert word delimiter from or to user interface + static OUString ConvertWordDelimiter(const OUString& rDelim, bool bFromUI); + + bool IsShowIndexPreview() const {return m_aMiscConfig.m_bShowIndexPreview;} + void SetShowIndexPreview(bool bSet) + {m_aMiscConfig.m_bShowIndexPreview = bSet; + m_aMiscConfig.SetModified();} + + void SetDefaultFontInCurrDocOnly(bool bSet) + { + m_aMiscConfig.m_bDefaultFontsInCurrDocOnly = bSet; + m_aMiscConfig.SetModified(); + } + + bool IsHideFieldTips() const {return m_bHideFieldTips;} + void SetHideFieldTips(bool bSet) {m_bHideFieldTips = bSet;} + + SwCompareMode GetCompareMode() const { return m_aCompareConfig.m_eCmpMode; } + void SetCompareMode( SwCompareMode eMode ) { m_aCompareConfig.m_eCmpMode = eMode; + m_aCompareConfig.SetModified(); } + + bool IsUseRsid() const { return m_aCompareConfig.m_bUseRsid; } + void SetUseRsid( bool b ) { m_aCompareConfig.m_bUseRsid = b; + m_aCompareConfig.SetModified(); } + + bool IsIgnorePieces() const { return m_aCompareConfig.m_bIgnorePieces; } + void SetIgnorePieces( bool b ) { m_aCompareConfig.m_bIgnorePieces = b; + m_aCompareConfig.SetModified(); } + + sal_uInt16 GetPieceLen() const { return m_aCompareConfig.m_nPieceLen; } + void SetPieceLen( sal_uInt16 nLen ) { m_aCompareConfig.m_nPieceLen = nLen; + m_aCompareConfig.SetModified(); } + + bool IsStoreRsid() const + { + return m_aCompareConfig.m_bStoreRsid; + } + void SetStoreRsid(bool bStoreRsid) + { + m_aCompareConfig.m_bStoreRsid = bStoreRsid; + m_aCompareConfig.SetModified(); + } + +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/modeltoviewhelper.hxx b/sw/inc/modeltoviewhelper.hxx new file mode 100644 index 000000000..d9d32a80f --- /dev/null +++ b/sw/inc/modeltoviewhelper.hxx @@ -0,0 +1,172 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_MODELTOVIEWHELPER_HXX +#define INCLUDED_SW_INC_MODELTOVIEWHELPER_HXX + +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include <o3tl/typed_flags_set.hxx> +#include <vector> + +class SwTextNode; +class SwRootFrame; + +/** Some helpers for converting model strings to view strings. + + A paragraph string does not have its fields expanded, i.e., they are + represented by a special character inside the string with an additional + attribute assigned to it. For some tasks (e.g., SmartTags) it is required + to expand the fields to get the string as it appears in the view. Two + helper functions are provided to convert model positions to view positions + and vice versa. + + CH_TXTATR_BREAKWORD -> SwTextNode will have field attributes associated with these + . . + . . + . . + AAAAA BBBBB # CCCCC # DDDDD + | | | | + | | | | + | --------- + | | . + | | . + | | .......... bounds of a hidden text character attribute + ------ + . + . + .............. a range of text defined in redline region as deleted + + 0000: pass through gives: AAAAA BBBBB # CCCCC # DDDDD + 0001: only expanding fields gives: AAAAA BBBBB foo CCCCC foo DDDDD + 0010: only hiding hiddens gives: AAAAA CCCCC # DDDDD + 0100: only hiding redlines gives: AAAABB # CCCCC # DDDDD + 0011: expanding fields + hiding hiddens gives: AAAAA CCCC foo DDDDD + 0101: expanding fields + hiding redlines gives: AAAA B foo CCCCC foo DDDDD + 0110: hiding hiddens + hiding redlines gives: AAAACCCC # DDDDD + 0111: expanding fields + hiding hiddens + hiding redlines gives: AAAABB foo CCCCC foo DDDDD +*/ + +enum class ExpandMode +{ + PassThrough = 0x0000, + ExpandFields = 0x0001, + ExpandFootnote = 0x0002, + HideInvisible = 0x0004, + HideDeletions = 0x0008, + /// do not expand to content, but replace with zwsp + ReplaceMode = 0x0010, +}; + +namespace o3tl +{ + template<> struct typed_flags<ExpandMode> : is_typed_flags<ExpandMode, 0x001f> {}; +} + +class ModelToViewHelper +{ + /** For each expanded/hidden portion in the model string, there is an entry in + the conversion map. The first value of the ConversionMapEntry points to + the start position in the model string, the second value points to the + associated start position in the view string. The last entry in the + conversion map denotes the lengths of the model resp. view string. + */ + struct ConversionMapEntry + { + ConversionMapEntry(sal_Int32 nModelPos, sal_Int32 nViewPos, bool bVisible) + : m_nModelPos(nModelPos) + , m_nViewPos(nViewPos) + , m_bVisible(bVisible) + { + } + sal_Int32 m_nModelPos; + sal_Int32 m_nViewPos; + bool m_bVisible; + }; + typedef std::vector< ConversionMapEntry > ConversionMap; + + ConversionMap m_aMap; + /// store positions of fields and footnotes for grammar checkers + std::vector<sal_Int32> m_FieldPositions; + std::vector<sal_Int32> m_FootnotePositions; + + OUString m_aRetText; + +public: + + /** This struct defines a position in the model string. + + The 'main' position is given by mnPos. If there's a field located at + this position, mbIsField is set and mnSubPos denotes the position inside + that field. + */ + struct ModelPosition + { + sal_Int32 mnPos; + sal_Int32 mnSubPos; + bool mbIsField; + + ModelPosition() : mnPos(0), mnSubPos(0), mbIsField(false) {} + }; + + ModelToViewHelper(const SwTextNode &rNode, SwRootFrame const* pLayout, + // defaults are appropriate for spell/grammar checking + ExpandMode eMode = ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::ReplaceMode); + ModelToViewHelper() //pass through filter, view == model + { + } + + /** Converts a model position into a view position + + @param nPos + nPos denotes a position in the model string which should be + converted. Note that converting model positions inside fields is + not supported, therefore nPos is not of type ModelPosition. + + @return + the position of nPos in the view string. In case the conversion + could not be performed (e.g., because there is not ConversionMap or + nPos is behind the last entry in the conversion map) nPos will + be returned. + */ + sal_Int32 ConvertToViewPosition( sal_Int32 nModelPos ) const; + + /** Converts a view position into a model position + + @param nPos + nPos denotes a position in the view string which should be + converted. + + @return + the position of nPos in the model string. In case the conversion + could not be performed (e.g., because there is not ConversionMap or + nPos is behind the last entry in the conversion map) a model + model position with mnPos = nPos and mnIsField = false will be + returned. + */ + ModelPosition ConvertToModelPosition( sal_Int32 nViewPos ) const; + + const OUString& getViewText() const { return m_aRetText; } + std::vector<sal_Int32> const& getFieldPositions() const { return m_FieldPositions; } + std::vector<sal_Int32> const& getFootnotePositions() const { return m_FootnotePositions;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx new file mode 100644 index 000000000..bb21e7903 --- /dev/null +++ b/sw/inc/ndarr.hxx @@ -0,0 +1,324 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_NDARR_HXX +#define INCLUDED_SW_INC_NDARR_HXX + +#include <sal/config.h> + +#include <limits> +#include <vector> +#include <memory> + +#include "bparr.hxx" +#include "ndtyp.hxx" +#include <rtl/ustring.hxx> +#include <o3tl/sorted_vector.hxx> + +class Graphic; +class GraphicObject; +class SwAttrSet; +class SfxItemSet; +class SwContentNode; +class SwDoc; +class SwGrfFormatColl; +class SwGrfNode; +class SwNode; +class SwNodeIndex; +class SwNodeRange; +class SwOLENode; +class SwPaM; +class SwSectionData; +class SwSectionFormat; +class SwTOXBase; +class SwSectionNode; +class SwStartNode; +class SwTableBoxFormat; +class SwTableFormat; +class SwTableLine; +class SwTableLineFormat; +class SwTableNode; +class SwTextFormatColl; +class SwTextNode; +class SwUndoTableToText; +class SwUndoTextToTable; +struct SwPosition; + +namespace sw { class DocumentContentOperationsManager; } +namespace svt { class EmbeddedObjectRef; } + + +typedef SwNode * SwNodePtr; +typedef bool (*FnForEach_SwNodes)( const SwNodePtr&, void* pArgs ); +typedef struct _xmlTextWriter *xmlTextWriterPtr; + +struct CompareSwOutlineNodes +{ + bool operator()( SwNode* const& lhs, SwNode* const& rhs) const; +}; + +class SwOutlineNodes : public o3tl::sorted_vector<SwNode*, CompareSwOutlineNodes> +{ +public: + static constexpr auto npos = std::numeric_limits<size_type>::max(); + + bool Seek_Entry(SwNode* rP, size_type* pnPos) const; +}; + +struct SwTableToTextSave; +using SwTableToTextSaves = std::vector<std::unique_ptr<SwTableToTextSave>>; + +class SW_DLLPUBLIC SwNodes final + : private BigPtrArray +{ + friend class SwDoc; + friend class SwNode; + friend class SwNodeIndex; + friend class SwStartNode; + friend class ::sw::DocumentContentOperationsManager; + + SwNodeIndex* m_vIndices; ///< ring of all indices on nodes. + void RemoveNode( sal_uLong nDelPos, sal_uLong nLen, bool bDel ); + + void InsertNode( const SwNodePtr pNode, + const SwNodeIndex& rPos ); + void InsertNode( const SwNodePtr pNode, + sal_uLong nPos ); + + SwDoc* m_pMyDoc; ///< This Doc contains the nodes-array. + + SwNode *m_pEndOfPostIts, *m_pEndOfInserts, ///< These are the fixed ranges. + *m_pEndOfAutotext, *m_pEndOfRedlines; + std::unique_ptr<SwNode> m_pEndOfContent; + + mutable std::unique_ptr<SwOutlineNodes> m_pOutlineNodes; ///< Array of all outline nodes. + + bool m_bInNodesDel : 1; /**< In Case of recursive calling. + Do not update Num/Outline. */ + bool m_bInDelUpdOutline : 1; ///< Flag for updating of Outline. + + // Actions on the nodes. + static void SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEnd ); + void DelNodes( const SwNodeIndex& rStart, sal_uLong nCnt = 1 ); + + void ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSize, + SwNodeIndex& rInsPos, bool bNewFrames ); + + void UpdateOutlineIdx( const SwNode& ); ///< Update all OutlineNodes starting from Node. + + void CopyNodes( const SwNodeRange&, const SwNodeIndex&, + bool bNewFrames, bool bTableInsDummyNode = false ) const; + void DelDummyNodes( const SwNodeRange& rRg ); + + SwNodes(SwNodes const&) = delete; + SwNodes& operator=(SwNodes const&) = delete; + + SwNodes( SwDoc* pDoc ); + +public: + ~SwNodes(); + + typedef std::vector<SwNodeRange> NodeRanges_t; + typedef std::vector<NodeRanges_t> TableRanges_t; + + SwNodePtr operator[]( sal_uLong n ) const; // defined in node.hxx + + sal_uLong Count() const { return BigPtrArray::Count(); } + void ForEach( FnForEach_SwNodes fnForEach, void* pArgs = nullptr ) + { + ForEach( 0, BigPtrArray::Count(), fnForEach, pArgs ); + } + void ForEach( sal_uLong nStt, sal_uLong nEnd, FnForEach_SwNodes fnForEach, void* pArgs ); + void ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd, + FnForEach_SwNodes fnForEach, void* pArgs ); + + /// A still empty section. + SwNode& GetEndOfPostIts() const { return *m_pEndOfPostIts; } + /// Section for all footnotes. + SwNode& GetEndOfInserts() const { return *m_pEndOfInserts; } + /// Section for all Flys/Header/Footers. + SwNode& GetEndOfAutotext() const { return *m_pEndOfAutotext; } + /// Section for all Redlines. + SwNode& GetEndOfRedlines() const { return *m_pEndOfRedlines; } + /** This is the last EndNode of a special section. After it + there is only the regular ContentSection (i.e. the BodyText). */ + SwNode& GetEndOfExtras() const { return *m_pEndOfRedlines; } + /// Regular ContentSection (i.e. the BodyText). + SwNode& GetEndOfContent() const { return *m_pEndOfContent; } + + /** Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) + Implementation in doc.hxx (because one needs to know Doc for it) ! */ + bool IsDocNodes() const; + + static sal_uInt16 GetSectionLevel(const SwNodeIndex &rIndex); + void Delete(const SwNodeIndex &rPos, sal_uLong nNodes = 1); + + bool MoveNodes( const SwNodeRange&, SwNodes& rNodes, const SwNodeIndex&, + bool bNewFrames = true ); + void MoveRange( SwPaM&, SwPosition&, SwNodes& rNodes ); + + void Copy_( const SwNodeRange& rRg, const SwNodeIndex& rInsPos, + bool bNewFrames = true ) const + { CopyNodes( rRg, rInsPos, bNewFrames ); } + + void SectionUp( SwNodeRange *); + void SectionDown( SwNodeRange *pRange, SwStartNodeType = SwNormalStartNode ); + + static void GoStartOfSection(SwNodeIndex *); + static void GoEndOfSection(SwNodeIndex *); + + SwContentNode* GoNext(SwNodeIndex *) const; + static SwContentNode* GoPrevious(SwNodeIndex *); + + /** Go to next content-node that is not protected or hidden + (Both set FALSE ==> GoNext/GoPrevious!!!). */ + SwContentNode* GoNextSection( SwNodeIndex *, bool bSkipHidden = true, + bool bSkipProtect = true ) const; + static SwContentNode* GoPrevSection( SwNodeIndex *, bool bSkipHidden = true, + bool bSkipProtect = true ); + + /** Create an empty section of Start- and EndNote. It may be called + only if a new section with content is to be created, + e.g. at filters/Undo/... */ + static SwStartNode* MakeEmptySection( const SwNodeIndex& rIdx, + SwStartNodeType = SwNormalStartNode ); + + /// Implementations of "Make...Node" are in the given .cxx-files. + SwTextNode *MakeTextNode( const SwNodeIndex & rWhere, + SwTextFormatColl *pColl, + bool bNewFrames = true); ///< in ndtxt.cxx + SwStartNode* MakeTextSection( const SwNodeIndex & rWhere, + SwStartNodeType eSttNdTyp, + SwTextFormatColl *pColl ); + + static SwGrfNode *MakeGrfNode( const SwNodeIndex & rWhere, + const OUString& rGrfName, + const OUString& rFltName, + const Graphic* pGraphic, + SwGrfFormatColl *pColl, + SwAttrSet const * pAutoAttr = nullptr ); ///< in ndgrf.cxx + + static SwGrfNode *MakeGrfNode( const SwNodeIndex & rWhere, + const GraphicObject& rGrfObj, + SwGrfFormatColl *pColl ); ///< in ndgrf.cxx + + SwOLENode *MakeOLENode( const SwNodeIndex & rWhere, + const svt::EmbeddedObjectRef&, + SwGrfFormatColl *pColl ); ///< in ndole.cxx + SwOLENode *MakeOLENode( const SwNodeIndex & rWhere, + const OUString &rName, + sal_Int64 nAspect, + SwGrfFormatColl *pColl, + SwAttrSet const * pAutoAttr ); ///< in ndole.cxx + + /// Array of all OutlineNodes. + const SwOutlineNodes& GetOutLineNds() const { return *m_pOutlineNodes;} + + /// Update all Nodes - Rule/Format-Change. + void UpdateOutlineNode(SwNode & rNd); + + /** Insert nodes for tables. If Lines is given, create the matrix + from lines and boxes, else only the count of boxes. + + New parameter pAttrSet: If pAttrSet is non-null and contains an + adjust item it is propagated to the table cells. If there is an + adjust in pContentTextColl or pHeadlineTextColl this adjust item + overrides the item in pAttrSet. */ + + static SwTableNode* InsertTable( const SwNodeIndex& rNdIdx, + sal_uInt16 nBoxes, SwTextFormatColl* pContentTextColl, + sal_uInt16 nLines, sal_uInt16 nRepeat, + SwTextFormatColl* pHeadlineTextColl, + const SwAttrSet * pAttrSet); + + /// Create balanced table from selected range. + SwTableNode* TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, + SwTableFormat* pTableFormat, + SwTableLineFormat* pLineFormat, + SwTableBoxFormat* pBoxFormat, + SwTextFormatColl* pTextColl, + SwUndoTextToTable* pUndo ); + + std::unique_ptr<SwNodeRange> ExpandRangeForTableBox(const SwNodeRange & rRange); + + /// create a table from a vector of NodeRanges - API support + SwTableNode* TextToTable( const TableRanges_t& rTableNodes, + SwTableFormat* pTableFormat, + SwTableLineFormat* pLineFormat, + SwTableBoxFormat* pBoxFormat ); + + /// Create regular text from what was table. + bool TableToText( const SwNodeRange& rRange, sal_Unicode cCh, + SwUndoTableToText* ); + /// Is in untbl.cxx and may called only by Undo-object. + SwTableNode* UndoTableToText( sal_uLong nStt, sal_uLong nEnd, + const SwTableToTextSaves& rSavedData ); + + /** Insert a new box in the line before InsPos. Its format + is taken from the following one (or from the previous one if we are + at the end). In the line there must be a box already. */ + bool InsBoxen( SwTableNode*, SwTableLine*, SwTableBoxFormat*, + /// Formats for TextNode of box. + SwTextFormatColl*, const SfxItemSet* pAutoAttr, + sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 ); + /** Splits a table at the base-line which contains the index. + All base lines behind it are moved to a new table/ -node. + Is the flag bCalcNewSize set to TRUE, the new SSize for both + tables is calculated from the Maximum of the boxes, provided + SSize is set "absolute" (LONG_MAX). + (Momentarily this is needed only for the RTF-parser.) */ + SwTableNode* SplitTable( const SwNodeIndex& rPos, bool bAfter = true, + bool bCalcNewSize = false ); + /// Two Tables that are following one another are merged. + bool MergeTable( const SwNodeIndex& rPos, bool bWithPrev = true, + sal_uInt16 nMode = 0 ); + + /// Insert a new SwSection. + SwSectionNode* InsertTextSection(SwNodeIndex const& rNdIdx, + SwSectionFormat& rSectionFormat, + SwSectionData const&, + SwTOXBase const*const pTOXBase, + SwNodeIndex const*const pEnd, + bool const bInsAtStart = true, + bool const bCreateFrames = true); + + /// Which Doc contains the nodes-array? + SwDoc* GetDoc() { return m_pMyDoc; } + const SwDoc* GetDoc() const { return m_pMyDoc; } + + /** Search previous / next content node or table node with frames. + If no end is given begin with the FrameIndex, else start search + with that before rFrameIdx and pEnd at the back. + If no valid node is found, return 0. rFrameIdx points to the node with frames. **/ + SwNode* FindPrvNxtFrameNode( SwNodeIndex& rFrameIdx, + const SwNode* pEnd ) const; + + SwNode * DocumentSectionStartNode(SwNode * pNode) const; + SwNode * DocumentSectionEndNode(SwNode * pNode) const; + + /** + * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default) + */ + void dumpAsXml( xmlTextWriterPtr pWriter ) const; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx new file mode 100644 index 000000000..c208552f2 --- /dev/null +++ b/sw/inc/ndgrf.hxx @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_NDGRF_HXX +#define INCLUDED_SW_INC_NDGRF_HXX + +#include <sfx2/lnkbase.hxx> +#include <vcl/GraphicObject.hxx> +#include "ndnotxt.hxx" +#include <memory> + +class SwAsyncRetrieveInputStreamThreadConsumer; + +class SwGrfFormatColl; +class SwDoc; + +// SwGrfNode +class SW_DLLPUBLIC SwGrfNode: public SwNoTextNode +{ + friend class SwNodes; + + GraphicObject maGrfObj; + std::unique_ptr<GraphicObject> mpReplacementGraphic; + tools::SvRef<sfx2::SvBaseLink> mxLink; ///< If graphics only as link then pointer is set. + Size mnGrfSize; + bool mbInSwapIn :1; // to avoid recursion in SwGrfNode::SwapIn + bool mbInBaseLinkSwapIn :1; // to avoid recursion in SwBaseLink::SwapIn + + bool mbChangeTwipSize :1; + bool mbFrameInPaint :1; ///< To avoid Start-/EndActions in Paint via SwapIn. + bool mbScaleImageMap :1; ///< Scale image map in SetTwipSize. + + std::shared_ptr< SwAsyncRetrieveInputStreamThreadConsumer > mpThreadConsumer; + bool mbLinkedInputStreamReady; + css::uno::Reference<css::io::XInputStream> mxInputStream; + bool mbIsStreamReadOnly; + + SwGrfNode( const SwNodeIndex& rWhere, + const OUString& rGrfName, const OUString& rFltName, + const Graphic* pGraphic, + SwGrfFormatColl* pGrfColl, + SwAttrSet const * pAutoAttr ); + ///< Ctor for reading (SW/G) without graphics. + SwGrfNode( const SwNodeIndex& rWhere, + const OUString& rGrfName, const OUString& rFltName, + SwGrfFormatColl* pGrfColl, + SwAttrSet const * pAutoAttr ); + SwGrfNode( const SwNodeIndex& rWhere, + const GraphicObject& rGrfObj, + SwGrfFormatColl* pGrfColl, + SwAttrSet const * pAutoAttr ); + + void InsertLink( const OUString& rGrfName, const OUString& rFltName ); + + /// allow reaction on change of content of GraphicObject, so always call + /// when GraphicObject content changes + void onGraphicChanged(); + +public: + virtual ~SwGrfNode() override; + const Graphic& GetGrf(bool bWait = false) const; + const GraphicObject& GetGrfObj(bool bWait = false) const; + const GraphicObject* GetReplacementGrfObj() const; + + /// isolated only way to set GraphicObject to allow more actions when doing so + void SetGraphic(const Graphic& rGraphic); + + /// wrappers for non-const calls at GraphicObject + void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData, OutputDevice* pFirstFrameOutDev) + { maGrfObj.StartAnimation(pOut, rPt, rSz, nExtraData, pFirstFrameOutDev); } + void StopGraphicAnimation(OutputDevice* pOut, long nExtraData) { maGrfObj.StopAnimation(pOut, nExtraData); } + + virtual Size GetTwipSize() const override; + void SetTwipSize( const Size& rSz ); + + bool IsTransparent() const; + + bool IsAnimated() const { return maGrfObj.IsAnimated(); } + + bool IsChgTwipSize() const { return mbChangeTwipSize; } + void SetChgTwipSize( bool b) + { + mbChangeTwipSize = b; + } + + bool IsFrameInPaint() const { return mbFrameInPaint; } + void SetFrameInPaint( bool b ) { mbFrameInPaint = b; } + + bool IsScaleImageMap() const { return mbScaleImageMap; } + void SetScaleImageMap( bool b ) { mbScaleImageMap = b; } + + /// in ndcopy.cxx + virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override; + + /** Re-read in case graphic was not OK. The current one + gets replaced by the new one. */ + bool ReRead( const OUString& rGrfName, const OUString& rFltName, + const Graphic* pGraphic = nullptr, + bool bModify = true ); +private: + /// Loading of graphic immediately before displaying. + bool SwapIn( bool bWaitForData = false ); + +public: + bool HasEmbeddedStreamName() const { return maGrfObj.HasUserData(); } + + /// Communicate to graphic that node is in Undo-range. + virtual bool SavePersistentData() override; + virtual bool RestorePersistentData() override; + + /// Query link-data. + bool IsGrfLink() const { return mxLink.is(); } + bool IsLinkedFile() const; + bool IsLinkedDDE() const; + const tools::SvRef<sfx2::SvBaseLink>& GetLink() const { return mxLink; } + bool GetFileFilterNms( OUString* pFileNm, OUString* pFilterNm ) const; + void ReleaseLink(); + + /** Scale an image-map: the image-map becomes zoomed in / out by + factor between graphic-size and border-size. */ + void ScaleImageMap(); + + /// Returns the with our graphic attributes filled Graphic-Attr-Structure. + GraphicAttr& GetGraphicAttr( GraphicAttr&, const SwFrame* pFrame ) const; + + std::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > GetThreadConsumer() const { return mpThreadConsumer;} + bool IsLinkedInputStreamReady() const { return mbLinkedInputStreamReady;} + void TriggerAsyncRetrieveInputStream(); + void ApplyInputStream( + const css::uno::Reference<css::io::XInputStream>& xInputStream, + const bool bIsStreamReadOnly ); + void UpdateLinkWithInputStream(); + bool IsAsyncRetrieveInputStreamPossible() const; +}; + +// Inline methods from Node.hxx - it is only now that we know TextNode!! +inline SwGrfNode *SwNode::GetGrfNode() +{ + return SwNodeType::Grf == m_nNodeType ? static_cast<SwGrfNode*>(this) : nullptr; +} + +inline const SwGrfNode *SwNode::GetGrfNode() const +{ + return SwNodeType::Grf == m_nNodeType ? static_cast<const SwGrfNode*>(this) : nullptr; +} + +inline bool SwGrfNode::IsLinkedFile() const +{ + return mxLink.is() && sfx2::SvBaseLinkObjectType::ClientGraphic == mxLink->GetObjType(); +} + +inline bool SwGrfNode::IsLinkedDDE() const +{ + return mxLink.is() && sfx2::SvBaseLinkObjectType::ClientDde == mxLink->GetObjType(); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx new file mode 100644 index 000000000..ceead82ce --- /dev/null +++ b/sw/inc/ndhints.hxx @@ -0,0 +1,218 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_NDHINTS_HXX +#define INCLUDED_SW_INC_NDHINTS_HXX + +#include "swtypes.hxx" + +class SwTextNode; +class SwRegHistory; // Is in RolBck.hxx. +class SwTextAttr; +class SwTextAttrNesting; + +class SfxPoolItem; +class SfxItemSet; +class SwDoc; + +enum class CopyOrNewType { Copy, New }; + +/// if COPY then pTextNode must be given! +SwTextAttr * MakeTextAttr( + SwDoc & rDoc, + SfxPoolItem & rNew, + sal_Int32 const nStt, + sal_Int32 const nEnd, + CopyOrNewType const bIsCopy = CopyOrNewType::New, + SwTextNode *const pTextNode = nullptr ); + +SwTextAttr * MakeTextAttr( + SwDoc & rDoc, + const SfxItemSet & rSet, + sal_Int32 nStt, + sal_Int32 nEnd ); + +/// create redline dummy text hint that must not be inserted into hints array +SwTextAttr* MakeRedlineTextAttr( + SwDoc & rDoc, + SfxPoolItem const & rAttr ); + +struct CompareSwpHtEnd +{ + bool operator()( sal_Int32 nEndPos, const SwTextAttr* rhs ) const; + bool operator()( const SwTextAttr* lhs, const SwTextAttr* rhs ) const; +}; +struct CompareSwpHtWhichStart +{ + bool operator()( const SwTextAttr* lhs, const sal_uInt16 nWhich ) const; + bool operator()( const SwTextAttr* lhs, const SwTextAttr* rhs ) const; +}; + +/// An SwTextAttr container, stores all directly formatted text portions for a text node. +class SwpHints +{ +private: + const SwTextNode& m_rParent; + + // SAL_MAX_SIZE is used by GetStartOf to return + // failure, so just allow SAL_MAX_SIZE-1 hints + static const size_t MAX_HINTS = SAL_MAX_SIZE-1; + + std::vector<SwTextAttr*> m_HintsByStart; + std::vector<SwTextAttr*> m_HintsByEnd; + std::vector<SwTextAttr*> m_HintsByWhichAndStart; + + SwRegHistory* m_pHistory; ///< for Undo + + /// true: the Node is in Split and Frames are moved + bool m_bInSplitNode : 1; + // m_bHiddenByParaField is invalid, call CalcHiddenParaField() + mutable bool m_bCalcHiddenParaField : 1; + // if all fields controlling visibility of the paragraph require to hide it + // (if there's no such fields, or if any field requires to show, then this is false) + mutable bool m_bHiddenByParaField : 1; + bool m_bFootnote : 1; ///< footnotes + bool m_bDDEFields : 1; ///< the TextNode has DDE fields + // Sort on demand to avoid O(n^2) behaviour + mutable bool m_bStartMapNeedsSorting : 1; + mutable bool m_bEndMapNeedsSorting : 1; + mutable bool m_bWhichMapNeedsSorting : 1; + + /// records a new attribute in m_pHistory. + void NoteInHistory( SwTextAttr *pAttr, const bool bNew = false ); + + void CalcFlags( ); + + /** Delete methods may only be called by the TextNode! + Because the TextNode also guarantees removal of the Character for + attributes without an end. */ + friend class SwTextNode; + void DeleteAtPos( size_t nPos ); + /// Delete the given Hint. The Hint must actually be in the array! + void Delete( SwTextAttr const * pTextHt ); + + void SetInSplitNode(bool bInSplit) { m_bInSplitNode = bInSplit; } + void SetCalcHiddenParaField() const { m_bCalcHiddenParaField = true; } + void SetHiddenByParaField( const bool bNew ) const { m_bHiddenByParaField = bNew; } + bool IsHiddenByParaField() const + { + if ( m_bCalcHiddenParaField ) + { + CalcHiddenParaField(); + } + return m_bHiddenByParaField; + } + + void InsertNesting(SwTextAttrNesting & rNewHint); + bool TryInsertNesting(SwTextNode & rNode, SwTextAttrNesting & rNewHint); + void BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint, + const SetAttrMode nMode ); + bool MergePortions( SwTextNode& rNode ); + + void Insert(SwTextAttr* pHt); + SW_DLLPUBLIC void Resort() const; + SW_DLLPUBLIC void ResortStartMap() const; + SW_DLLPUBLIC void ResortEndMap() const; + SW_DLLPUBLIC void ResortWhichMap() const; + + size_t GetIndexOf( const SwTextAttr *pHt ) const; + +#ifdef DBG_UTIL + bool Check(bool) const; +#endif + +public: + SwpHints(const SwTextNode& rParent); + + size_t Count() const { return m_HintsByStart.size(); } + bool Contains( const SwTextAttr *pHt ) const; + SwTextAttr * Get( size_t nPos ) const + { + assert( !(nPos != 0 && m_bStartMapNeedsSorting) && "going to trigger a resort in the middle of an iteration, that's bad" ); + if (m_bStartMapNeedsSorting) + ResortStartMap(); + return m_HintsByStart[nPos]; + } + // Get without triggering resorting - useful if we are modifying start/end pos while iterating + SwTextAttr * GetWithoutResorting( size_t nPos ) const + { + return m_HintsByStart[nPos]; + } + + int GetLastPosSortedByEnd(sal_Int32 nEndPos) const; + SwTextAttr * GetSortedByEnd( size_t nPos ) const + { + assert( !(nPos != 0 && m_bEndMapNeedsSorting) && "going to trigger a resort in the middle of an iteration, that's bad" ); + if (m_bEndMapNeedsSorting) + ResortEndMap(); + return m_HintsByEnd[nPos]; + } + + size_t GetFirstPosSortedByWhichAndStart(sal_uInt16 nWhich) const; + SwTextAttr * GetSortedByWhichAndStart( size_t nPos ) const + { + assert( !(nPos != 0 && m_bWhichMapNeedsSorting) && "going to trigger a resort in the middle of an iteration, that's bad" ); + if (m_bWhichMapNeedsSorting) + ResortWhichMap(); + return m_HintsByWhichAndStart[nPos]; + } + + /// Trigger the sorting if necessary + void SortIfNeedBe() const + { + if (m_bStartMapNeedsSorting) + ResortStartMap(); + if (m_bEndMapNeedsSorting) + ResortEndMap(); + if (m_bWhichMapNeedsSorting) + ResortWhichMap(); + } + SwTextAttr * Cut( const size_t nPosInStart ) + { + SwTextAttr *pHt = m_HintsByStart[nPosInStart]; + DeleteAtPos( nPosInStart ); + return pHt; + } + + bool CanBeDeleted() const { return m_HintsByStart.empty(); } + + /// register a History, which receives all attribute changes (for Undo) + void Register( SwRegHistory* pHist ) { m_pHistory = pHist; } + /// deregister the currently registered History + void DeRegister() { Register(nullptr); } + SwRegHistory* GetHistory() const { return m_pHistory; } + + /// try to insert the hint + /// @return true iff hint successfully inserted + bool TryInsertHint( SwTextAttr * const pHint, SwTextNode & rNode, + const SetAttrMode nMode = SetAttrMode::DEFAULT ); + + bool HasFootnote() const { return m_bFootnote; } + bool IsInSplitNode() const { return m_bInSplitNode; } + + // calc current value of m_bHiddenByParaField, returns true iff changed + bool CalcHiddenParaField() const; // changes mutable state + + // Marks the hint-maps as needing sorting because the position of something has changed + void StartPosChanged() const { m_bStartMapNeedsSorting = true; m_bEndMapNeedsSorting = true; m_bWhichMapNeedsSorting = true; } + void EndPosChanged() const { m_bStartMapNeedsSorting = true; m_bEndMapNeedsSorting = true; m_bWhichMapNeedsSorting = true; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx new file mode 100644 index 000000000..274bc4b20 --- /dev/null +++ b/sw/inc/ndindex.hxx @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_NDINDEX_HXX +#define INCLUDED_SW_INC_NDINDEX_HXX + +#include <iostream> + +#include <tools/solar.h> + +#include "node.hxx" +#include "ring.hxx" +#include "ndarr.hxx" + +/// Marks a node in the document model. +class SW_DLLPUBLIC SwNodeIndex final : public sw::Ring<SwNodeIndex> +{ + SwNode * m_pNode; + + // These are not allowed! + SwNodeIndex( SwNodes& rNds, sal_uInt16 nIdx ) = delete; + SwNodeIndex( SwNodes& rNds, int nIdx ) = delete; + void RegisterIndex( SwNodes& rNodes ) + { + if(!rNodes.m_vIndices) + rNodes.m_vIndices = this; + MoveTo(rNodes.m_vIndices); + } + void DeRegisterIndex( SwNodes& rNodes ) + { + if(rNodes.m_vIndices == this) + rNodes.m_vIndices = GetNextInRing(); + MoveTo(nullptr); + if(rNodes.m_vIndices == this) + rNodes.m_vIndices = nullptr; + } + +public: + SwNodeIndex( SwNodes& rNds, sal_uLong nIdx = 0 ) + : m_pNode( rNds[ nIdx ] ) + { + RegisterIndex( rNds ); + }; + SwNodeIndex( const SwNodeIndex& rIdx, long nDiff = 0 ) + : sw::Ring<SwNodeIndex>() + { + if( nDiff ) + m_pNode = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ]; + else + m_pNode = rIdx.m_pNode; + RegisterIndex( m_pNode->GetNodes() ); + } + + SwNodeIndex( const SwNode& rNd, long nDiff = 0 ) + { + if( nDiff ) + m_pNode = rNd.GetNodes()[ rNd.GetIndex() + nDiff ]; + else + m_pNode = const_cast<SwNode*>(&rNd); + RegisterIndex( m_pNode->GetNodes() ); + } + + virtual ~SwNodeIndex() override + { DeRegisterIndex( m_pNode->GetNodes() ); } + + inline sal_uLong operator++(); + inline sal_uLong operator--(); + inline sal_uLong operator++(int); + inline sal_uLong operator--(int); + + inline sal_uLong operator+=( sal_uLong ); + inline sal_uLong operator-=( sal_uLong ); + + inline bool operator< ( const SwNodeIndex& ) const; + inline bool operator<=( const SwNodeIndex& ) const; + inline bool operator> ( const SwNodeIndex& ) const; + inline bool operator>=( const SwNodeIndex& ) const; + inline bool operator==( const SwNodeIndex& ) const; + inline bool operator!=( const SwNodeIndex& ) const; + + inline bool operator< ( sal_uLong ) const; + inline bool operator<=( sal_uLong ) const; + inline bool operator> ( sal_uLong ) const; + inline bool operator>=( sal_uLong ) const; + inline bool operator==( sal_uLong ) const; + inline bool operator!=( sal_uLong ) const; + + inline SwNodeIndex& operator=( sal_uLong ); + inline SwNodeIndex& operator=( const SwNodeIndex& ); + inline SwNodeIndex& operator=( const SwNode& ); + + // Return value of index as sal_uLong. + inline sal_uLong GetIndex() const; + + // Enables assignments without creation of a temporary object. + inline SwNodeIndex& Assign( SwNodes const & rNds, sal_uLong ); + inline SwNodeIndex& Assign( const SwNode& rNd, long nOffset = 0 ); + + // Gets pointer on NodesArray. + inline const SwNodes& GetNodes() const; + inline SwNodes& GetNodes(); + + SwNodeIndex* GetNext() { return GetNextInRing(); } + SwNode& GetNode() const { return *m_pNode; } +}; + +inline std::ostream &operator <<(std::ostream& s, const SwNodeIndex& index) +{ + return s << "SwNodeIndex (node " << index.GetIndex() << ")"; +}; + +// SwRange + +class SW_DLLPUBLIC SwNodeRange +{ +public: + SwNodeIndex aStart; + SwNodeIndex aEnd; + + SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE ) + : aStart( rS ), aEnd( rE ) {}; + SwNodeRange( const SwNodeRange &rRange ) + : aStart( rRange.aStart ), aEnd( rRange.aEnd ) {}; + + SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx, sal_uLong nEndIdx = 0 ) + : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx ) {}; + + SwNodeRange( const SwNodeIndex& rS, long nSttDiff, const SwNodeIndex& rE, long nEndDiff = 0 ) + : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff ) {}; + SwNodeRange( const SwNode& rS, long nSttDiff, const SwNode& rE, long nEndDiff = 0 ) + : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff ) {}; +}; + +// For inlines node.hxx is needed which in turn needs this one. +// Therefore all inlines accessing m_pNode are implemented here. + +inline sal_uLong SwNodeIndex::GetIndex() const +{ + return m_pNode->GetIndex(); +} +inline const SwNodes& SwNodeIndex::GetNodes() const +{ + return m_pNode->GetNodes(); +} +inline SwNodes& SwNodeIndex::GetNodes() +{ + return m_pNode->GetNodes(); +} +inline bool SwNodeIndex::operator< ( sal_uLong const nOther ) const +{ + return m_pNode->GetIndex() < nOther; +} +inline bool SwNodeIndex::operator<=( sal_uLong const nOther ) const +{ + return m_pNode->GetIndex() <= nOther; +} +inline bool SwNodeIndex::operator> ( sal_uLong const nOther ) const +{ + return m_pNode->GetIndex() > nOther; +} +inline bool SwNodeIndex::operator>=( sal_uLong const nOther ) const +{ + return m_pNode->GetIndex() >= nOther; +} +inline bool SwNodeIndex::operator==( sal_uLong const nOther ) const +{ + return m_pNode->GetIndex() == nOther; +} +inline bool SwNodeIndex::operator!=( sal_uLong const nOther ) const +{ + return m_pNode->GetIndex() != nOther; +} +inline bool SwNodeIndex::operator<( const SwNodeIndex& rIndex ) const +{ + return m_pNode->GetIndex() < rIndex.GetIndex(); +} +inline bool SwNodeIndex::operator<=( const SwNodeIndex& rIndex ) const +{ + return m_pNode->GetIndex() <= rIndex.GetIndex(); +} +inline bool SwNodeIndex::operator>( const SwNodeIndex& rIndex ) const +{ + return m_pNode->GetIndex() > rIndex.GetIndex(); +} +inline bool SwNodeIndex::operator>=( const SwNodeIndex& rIndex ) const +{ + return m_pNode->GetIndex() >= rIndex.GetIndex(); +} +inline bool SwNodeIndex::operator==( const SwNodeIndex& rIdx ) const +{ + return m_pNode == rIdx.m_pNode; +} +inline bool SwNodeIndex::operator!=( const SwNodeIndex& rIdx ) const +{ + return m_pNode != rIdx.m_pNode; +} + +inline sal_uLong SwNodeIndex::operator++() +{ + m_pNode = GetNodes()[ m_pNode->GetIndex()+1 ]; + return m_pNode->GetIndex(); +} +inline sal_uLong SwNodeIndex::operator--() +{ + m_pNode = GetNodes()[ m_pNode->GetIndex()-1 ]; + return m_pNode->GetIndex(); +} +inline sal_uLong SwNodeIndex::operator++(int) +{ + sal_uLong nOldIndex = m_pNode->GetIndex(); + m_pNode = GetNodes()[ nOldIndex + 1 ]; + return nOldIndex; +} +inline sal_uLong SwNodeIndex::operator--(int) +{ + sal_uLong nOldIndex = m_pNode->GetIndex(); + m_pNode = GetNodes()[ nOldIndex - 1 ]; + return nOldIndex; +} + +inline sal_uLong SwNodeIndex::operator+=( sal_uLong const nOffset ) +{ + m_pNode = GetNodes()[ m_pNode->GetIndex() + nOffset ]; + return m_pNode->GetIndex(); +} +inline sal_uLong SwNodeIndex::operator-=( sal_uLong const nOffset ) +{ + m_pNode = GetNodes()[ m_pNode->GetIndex() - nOffset ]; + return m_pNode->GetIndex(); +} + +inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong const nNew ) +{ + m_pNode = GetNodes()[ nNew ]; + return *this; +} + +SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx ) +{ + *this = *(rIdx.m_pNode); + return *this; +} + +SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd ) +{ + if (&m_pNode->GetNodes() != &rNd.GetNodes()) + { + DeRegisterIndex( m_pNode->GetNodes() ); + m_pNode = const_cast<SwNode*>(&rNd); + RegisterIndex( m_pNode->GetNodes() ); + } + else + m_pNode = const_cast<SwNode*>(&rNd); + return *this; +} + +SwNodeIndex& SwNodeIndex::Assign( SwNodes const & rNds, sal_uLong nIdx ) +{ + *this = *rNds[ nIdx ]; + return *this; +} + +SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset ) +{ + *this = rNd; + + if( nOffset ) + m_pNode = m_pNode->GetNodes()[ m_pNode->GetIndex() + nOffset ]; + + return *this; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndnotxt.hxx b/sw/inc/ndnotxt.hxx new file mode 100644 index 000000000..ac2611966 --- /dev/null +++ b/sw/inc/ndnotxt.hxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_NDNOTXT_HXX +#define INCLUDED_SW_INC_NDNOTXT_HXX + +#include <memory> +#include "node.hxx" + +class Size; +namespace tools { class PolyPolygon; } + +// SwNoTextNode + +class SW_DLLPUBLIC SwNoTextNode : public SwContentNode +{ + friend class SwNodes; + friend class SwNoTextFrame; + + std::unique_ptr<tools::PolyPolygon> m_pContour; + bool m_bAutomaticContour : 1; // automatic contour polygon, not manipulated + bool m_bContourMapModeValid : 1; // contour map mode is not the graphics's + // preferred map mode, but either + // MM100 or pixel + bool m_bPixelContour : 1; // contour map mode is invalid and pixel. + + // Creates for all derivations an AttrSet with ranges for frame- and + // graphics-attributes (only called by SwContentNode). + virtual void NewAttrSet( SwAttrPool& ) override; + + SwNoTextNode( const SwNoTextNode& ) = delete; + SwNoTextNode &operator=( const SwNoTextNode& ) = delete; + +protected: + SwNoTextNode( const SwNodeIndex &rWhere, const SwNodeType nNdType, + SwGrfFormatColl *pGrColl, SwAttrSet const * pAutoAttr ); + +public: + virtual ~SwNoTextNode() override; + + virtual SwContentFrame *MakeFrame( SwFrame* ) override; + + SwGrfFormatColl *GetGrfColl() const { return const_cast<SwGrfFormatColl*>(static_cast<const SwGrfFormatColl*>(GetRegisteredIn())); } + + virtual Size GetTwipSize() const = 0; + + virtual bool SavePersistentData(); + virtual bool RestorePersistentData(); + + OUString GetTitle() const; + void SetTitle( const OUString& rTitle ); + OUString GetDescription() const; + void SetDescription( const OUString& rDescription ); + + void SetContour( const tools::PolyPolygon *pPoly, + bool bAutomatic = false ); + const tools::PolyPolygon *HasContour() const; + bool HasContour_() const { return m_pContour!=nullptr; }; + void GetContour( tools::PolyPolygon &rPoly ) const; + void CreateContour(); + + void SetAutomaticContour( bool bSet ) { m_bAutomaticContour = bSet; } + bool HasAutomaticContour() const { return m_bAutomaticContour; } + + // set either a MM100 or pixel contour + void SetContourAPI( const tools::PolyPolygon *pPoly ); + + // get either a MM100 or pixel contour, return false if no contour is set. + bool GetContourAPI( tools::PolyPolygon &rPoly ) const; + + void SetPixelContour( bool bSet ) { m_bPixelContour = bSet; } + bool IsPixelContour() const; + + bool IsContourMapModeValid() const { return m_bContourMapModeValid; } + + // Obtains the graphic with SwapIn for GrfNode via GetData for OLE. + Graphic GetGraphic() const; +}; + +// Inline methods from Node.hxx - we know TextNode only here!! +inline SwNoTextNode *SwNode::GetNoTextNode() +{ + return SwNodeType::NoTextMask & m_nNodeType ? static_cast<SwNoTextNode*>(this) : nullptr; +} +inline const SwNoTextNode *SwNode::GetNoTextNode() const +{ + return SwNodeType::NoTextMask & m_nNodeType ? static_cast<const SwNoTextNode*>(this) : nullptr; +} + +#endif // INCLUDED_SW_INC_NDNOTXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx new file mode 100644 index 000000000..8382a42e5 --- /dev/null +++ b/sw/inc/ndole.hxx @@ -0,0 +1,188 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_NDOLE_HXX +#define INCLUDED_SW_INC_NDOLE_HXX + +#include "ndnotxt.hxx" +#include <svtools/embedhlp.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <rtl/ref.hxx> + +class SwGrfFormatColl; +class SwDoc; +class SwOLENode; +class SwOLEListener_Impl; +class SwEmbedObjectLink; +class DeflateData; + +class SW_DLLPUBLIC SwOLEObj +{ + friend class SwOLENode; + + const SwOLENode* m_pOLENode; + rtl::Reference<SwOLEListener_Impl> m_xListener; + + /** Either ref or name are known. If only name is known, ref is obtained + on demand by GetOleRef() from Sfx. */ + svt::EmbeddedObjectRef m_xOLERef; + OUString m_aName; + + // eventually buffered data if it is a chart OLE + drawinglayer::primitive2d::Primitive2DContainer m_aPrimitive2DSequence; + basegfx::B2DRange m_aRange; + std::unique_ptr<DeflateData> m_pDeflateData; + + SwOLEObj( const SwOLEObj& rObj ) = delete; + + void SetNode( SwOLENode* pNode ); + +public: + SwOLEObj( const svt::EmbeddedObjectRef& pObj ); + SwOLEObj( const OUString &rName, sal_Int64 nAspect ); + ~SwOLEObj() COVERITY_NOEXCEPT_FALSE; + + bool UnloadObject(); + static bool UnloadObject( css::uno::Reference< css::embed::XEmbeddedObject > const & xObj, + const SwDoc* pDoc, + sal_Int64 nAspect ); + + OUString GetDescription(); + + css::uno::Reference < css::embed::XEmbeddedObject > const & GetOleRef(); + svt::EmbeddedObjectRef& GetObject(); + const OUString& GetCurrentPersistName() const { return m_aName; } + OUString GetStyleString(); + bool IsOleRef() const; ///< To avoid unnecessary loading of object. + + // try to get OLE visualization in form of a Primitive2DSequence + // and the corresponding B2DRange. This data may be locally buffered + drawinglayer::primitive2d::Primitive2DContainer const & tryToGetChartContentAsPrimitive2DSequence( + basegfx::B2DRange& rRange, + bool bSynchron); + void resetBufferedData(); + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +// SwOLENode + +class SW_DLLPUBLIC SwOLENode: public SwNoTextNode +{ + friend class SwNodes; + mutable SwOLEObj maOLEObj; + OUString msChartTableName; ///< with chart objects: name of referenced table. + bool mbOLESizeInvalid; /**< Should be considered at SwDoc::PrtOLENotify + (e.g. copied). Is not persistent. */ + + SwEmbedObjectLink* mpObjectLink; + OUString maLinkURL; + + SwOLENode( const SwNodeIndex &rWhere, + const svt::EmbeddedObjectRef&, + SwGrfFormatColl *pGrfColl, + SwAttrSet const * pAutoAttr ); + + SwOLENode( const SwNodeIndex &rWhere, + const OUString &rName, + sal_Int64 nAspect, + SwGrfFormatColl *pGrfColl, + SwAttrSet const * pAutoAttr ); + + SwOLENode( const SwOLENode & ) = delete; + + using SwNoTextNode::GetGraphic; + +public: + const SwOLEObj& GetOLEObj() const { return maOLEObj; } + SwOLEObj& GetOLEObj() { return maOLEObj; } + virtual ~SwOLENode() override; + + /// Is in ndcopy.cxx. + virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override; + + virtual Size GetTwipSize() const override; + + const Graphic* GetGraphic(); + + void GetNewReplacement(); + + virtual bool SavePersistentData() override; + virtual bool RestorePersistentData() override; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; + + bool IsInGlobalDocSection() const; + bool IsOLEObjectDeleted() const; + + bool IsOLESizeInvalid() const { return mbOLESizeInvalid; } + void SetOLESizeInvalid( bool b ){ mbOLESizeInvalid = b; } + + sal_Int64 GetAspect() const { return maOLEObj.GetObject().GetViewAspect(); } + void SetAspect( sal_Int64 nAspect) { maOLEObj.GetObject().SetViewAspect( nAspect ); } + + /** Remove OLE-object from "memory". + inline void Unload() { aOLEObj.Unload(); } */ + OUString GetDescription() const { return maOLEObj.GetDescription(); } + + bool UpdateLinkURL_Impl(); + void BreakFileLink_Impl(); + void DisconnectFileLink_Impl(); + + void CheckFileLink_Impl(); + + // #i99665# + bool IsChart() const; + + const OUString& GetChartTableName() const { return msChartTableName; } + void SetChartTableName( const OUString& rNm ) { msChartTableName = rNm; } + + + // react on visual change (invalidate) + void SetChanged(); +}; + +/// Inline methods from Node.hxx +inline SwOLENode *SwNode::GetOLENode() +{ + return SwNodeType::Ole == m_nNodeType ? static_cast<SwOLENode*>(this) : nullptr; +} + +inline const SwOLENode *SwNode::GetOLENode() const +{ + return SwNodeType::Ole == m_nNodeType ? static_cast<const SwOLENode*>(this) : nullptr; +} + +namespace sw +{ + class DocumentSettingManager; +} + +class PurgeGuard +{ +private: + ::sw::DocumentSettingManager &m_rManager; + bool m_bOrigPurgeOle; +public: + PurgeGuard(const SwDoc& rDoc); + ~PurgeGuard(); +}; + +#endif // _ INCLUDED_SW_INC_NDOLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx new file mode 100644 index 000000000..9edf16dab --- /dev/null +++ b/sw/inc/ndtxt.hxx @@ -0,0 +1,863 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_NDTXT_HXX +#define INCLUDED_SW_INC_NDTXT_HXX + +#include <cppuhelper/weakref.hxx> + +#include "swdllapi.h" +#include "node.hxx" +#include "hintids.hxx" +#include "ndhints.hxx" +#include "SwNumberTreeTypes.hxx" +#include "IDocumentContentOperations.hxx" +#include "modeltoviewhelper.hxx" + +#include <sfx2/Metadatable.hxx> + +#include <memory> +#include <vector> +#include <set> +#include <functional> + +class SfxHint; +class SwNumRule; +class SwNodeNum; +class SvxLRSpaceItem; + +namespace utl { + class TransliterationWrapper; +} +namespace vcl +{ +class Font; +} + +class SwContentFrame; +class SwTextField; +class SwTextInputField; +class SfxItemSet; +class SwUndoTransliterate; +struct SwSpellArgs; +struct SwConversionArgs; +class SwInterHyphInfo; +class SwWrongList; +class SwGrammarMarkUp; +struct SwDocStat; +struct SwParaIdleData_Impl; +enum class ExpandMode; +enum class SwFieldIds : sal_uInt16; +class SwField; + +namespace sw::mark { enum class RestoreMode; } + +namespace com::sun::star { + namespace uno { + template < class > class Sequence; + } + namespace text { class XTextContent; } +} + +typedef std::set< sal_Int32 > SwSoftPageBreakList; + +/// SwTextNode is a paragraph in the document model. +class SW_DLLPUBLIC SwTextNode + : public SwContentNode + , public ::sfx2::Metadatable +{ + friend class SwContentNode; + /// For creating the first TextNode. + friend class SwDoc; ///< CTOR and AppendTextNode() + friend class SwNodes; + friend class SwTextFrame; + friend class SwScriptInfo; + + /** May be 0. It is only then not 0 if it contains hard attributes. + Therefore: never access directly! */ + std::unique_ptr<SwpHints> m_pSwpHints; + + mutable std::unique_ptr<SwNodeNum> mpNodeNum; ///< Numbering for this paragraph. + mutable std::unique_ptr<SwNodeNum> mpNodeNumRLHidden; ///< Numbering for this paragraph (hidden redlines) + + OUString m_Text; + + SwParaIdleData_Impl* m_pParaIdleData_Impl; + + /** Some of the chars this para are hidden. Paragraph has to be reformatted + on changing the view to print preview. */ + mutable bool m_bContainsHiddenChars : 1; + /// The whole paragraph is hidden because of the hidden text attribute + mutable bool m_bHiddenCharsHidePara : 1; + /// The last two flags have to be recalculated if this flag is set: + mutable bool m_bRecalcHiddenCharFlags : 1; + + mutable bool m_bLastOutlineState : 1; + bool m_bNotifiable; + + bool mbEmptyListStyleSetDueToSetOutlineLevelAttr; + + /** boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or + <ResetAllAttr(..)> method is running. + Needed to avoid duplicate handling of attribute change actions. */ + bool mbInSetOrResetAttr; + + std::unique_ptr< OUString > m_pNumStringCache; + + css::uno::WeakReference<css::text::XTextContent> m_wXParagraph; + + // DrawingLayer FillAttributes in a preprocessed form for primitive usage + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes; + + SAL_DLLPRIVATE SwTextNode( const SwNodeIndex &rWhere, SwTextFormatColl *pTextColl, + const SfxItemSet* pAutoAttr = nullptr ); + + /// Copies the attributes at nStart to pDest. + SAL_DLLPRIVATE void CopyAttr( SwTextNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos); + + SAL_DLLPRIVATE SwTextNode* MakeNewTextNode( const SwNodeIndex&, bool bNext = true, + bool bChgFollow = true ); + + SAL_DLLPRIVATE void CutImpl( + SwTextNode * const pDest, const SwIndex & rDestStart, + const SwIndex & rStart, /*const*/ sal_Int32 nLen, + const bool bUpdate = true ); + + /// Move all comprising hard attributes to the AttrSet of the paragraph. + SAL_DLLPRIVATE void MoveTextAttr_To_AttrSet(); // Called by SplitNode. + + /// Create the specific AttrSet. + SAL_DLLPRIVATE virtual void NewAttrSet( SwAttrPool& ) override; + + /// Optimization: Asking for information about hidden characters at SwScriptInfo + /// updates these flags. + bool IsCalcHiddenCharFlags() const + { return m_bRecalcHiddenCharFlags; } + void SetHiddenCharAttribute( bool bNewHiddenCharsHidePara, bool bNewContainsHiddenChars ) const + { + m_bHiddenCharsHidePara = bNewHiddenCharsHidePara; + m_bContainsHiddenChars = bNewContainsHiddenChars; + m_bRecalcHiddenCharFlags = false; + } + + SAL_DLLPRIVATE void CalcHiddenCharFlags() const; + + SAL_DLLPRIVATE void SetLanguageAndFont( const SwPaM &rPaM, + LanguageType nLang, sal_uInt16 nLangWhichId, + const vcl::Font *pFont, sal_uInt16 nFontWhichId ); + + /// Start: Data collected during idle time + + SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew ); + + inline void TryDeleteSwpHints(); + + SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet); + + const SwTextInputField* GetOverlappingInputField( const SwTextAttr& rTextAttr ) const; + + void DelFrames_TextNodePart(); + +public: + enum class WrongState { TODO, PENDING, DONE }; + + bool IsWordCountDirty() const; + WrongState GetWrongDirty() const; + bool IsWrongDirty() const; + bool IsGrammarCheckDirty() const; + bool IsSmartTagDirty() const; + bool IsAutoCompleteWordDirty() const; + void SetWordCountDirty( bool bNew ) const; + void SetWrongDirty(WrongState eNew) const; + void SetGrammarCheckDirty( bool bNew ) const; + void SetSmartTagDirty( bool bNew ) const; + void SetAutoCompleteWordDirty( bool bNew ) const; + void SetWrong( SwWrongList* pNew, bool bDelete = true ); + SwWrongList* GetWrong(); + const SwWrongList* GetWrong() const; + void SetGrammarCheck( SwGrammarMarkUp* pNew, bool bDelete = true ); + SwGrammarMarkUp* GetGrammarCheck(); + // return SwWrongList because *function pointer* return values aren't covariant + SwWrongList const* GetGrammarCheck() const; + void SetSmartTags( SwWrongList* pNew, bool bDelete = true ); + SwWrongList* GetSmartTags(); + SwWrongList const* GetSmartTags() const; + void TryCharSetExpandToNum(const SfxItemSet& pCharSet); + + /// End: Data collected during idle time + +protected: + /// for hanging TextFormatCollections somewhere else (Outline-Numbering!) + virtual void SwClientNotify( const SwModify&, const SfxHint& ) override; + +public: + using SwContentNode::GetAttr; + + const OUString& GetText() const { return m_Text; } + + // returns the maximum number of characters that can still be added to the node + inline sal_Int32 GetSpaceLeft() const; + + /// getters for SwpHints + inline SwpHints &GetSwpHints(); + inline const SwpHints &GetSwpHints() const; + SwpHints *GetpSwpHints() { return m_pSwpHints.get(); } + const SwpHints *GetpSwpHints() const { return m_pSwpHints.get(); } + bool HasHints() const { return m_pSwpHints != nullptr; } + inline SwpHints &GetOrCreateSwpHints(); + + virtual ~SwTextNode() override; + + virtual sal_Int32 Len() const override; + + /// Is in itratr. + void GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, sal_uLong &rAbs ) const; + + /// overriding to handle change of certain paragraph attributes + virtual bool SetAttr( const SfxPoolItem& ) override; + virtual bool SetAttr( const SfxItemSet& rSet ) override; + virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) override; + virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr ) override; + virtual sal_uInt16 ResetAllAttr() override; + + /// insert text content + /// @param rStr text to insert; in case it does not fit into the capacity + /// of the node, the longest prefix that fits is inserted + /// @return the prefix of rStr that was actually inserted + OUString InsertText( const OUString & rStr, const SwIndex & rIdx, + const SwInsertFlags nMode + = SwInsertFlags::DEFAULT ); + + /** delete text content + ATTENTION: must not be called with a range that overlaps the start of + an attribute with both extent and dummy char + */ + void EraseText ( const SwIndex &rIdx, const sal_Int32 nCount = SAL_MAX_INT32, + const SwInsertFlags nMode = SwInsertFlags::DEFAULT ); + + /** delete all attributes. + If neither pSet nor nWhich is given, delete all attributes (except + refmarks, toxmarks, meta) in range. + @param rIdx start position + @param nLen range in which attributes will be deleted + @param pSet if not 0, delete only attributes contained in pSet + @param nWhich if not 0, delete only attributes with matching which + @param bInclRefToxMark + refmarks, toxmarks, and metas will be ignored unless this is true + ATTENTION: setting bInclRefToxMark is only allowed from UNDO! + @param bExactRange From the attributes included in the range, delete + only the ones which have exactly same range. Don't delete the ones + which are simply included in the range. + */ + void RstTextAttr( + const SwIndex &rIdx, + const sal_Int32 nLen, + const sal_uInt16 nWhich = 0, + const SfxItemSet* pSet = nullptr, + const bool bInclRefToxMark = false, + const bool bExactRange = false ); + void GCAttr(); + + // Delete text attribute (needs to be deregistered at Pool!) + void DestroyAttr( SwTextAttr* pAttr ); + + // delete all attributes from SwpHintsArray. + void ClearSwpHintsArr( bool bDelFields ); + + /// initialize the hints after file loading (which takes shortcuts) + void FileLoadedInitHints(); + + /// Insert pAttr into hints array. @return true iff inserted successfully + bool InsertHint( SwTextAttr * const pAttr, + const SetAttrMode nMode = SetAttrMode::DEFAULT ); + /// create new text attribute from rAttr and insert it + /// @return inserted hint; 0 if not sure the hint is inserted + SwTextAttr* InsertItem( SfxPoolItem& rAttr, + const sal_Int32 nStart, const sal_Int32 nEnd, + const SetAttrMode nMode = SetAttrMode::DEFAULT ); + + /** Set these attributes at TextNode. If the whole range is comprised + set them only in AutoAttrSet (SwContentNode::SetAttr). */ + bool SetAttr( const SfxItemSet& rSet, + sal_Int32 nStt, sal_Int32 nEnd, + const SetAttrMode nMode = SetAttrMode::DEFAULT, + SwTextAttr **ppNewTextAttr = nullptr); + /** Query the attributes of textnode over the range. + Introduce 4th optional parameter <bMergeIndentValuesOfNumRule>. + If <bMergeIndentValuesOfNumRule> == true, the indent attributes of + the corresponding list level of an applied list style is merged into + the requested item set as a LR-SPACE item, if <bOnlyTextAttr> == false, + corresponding node has not its own indent attributes and the + position-and-space mode of the list level is SvxNumberFormat::LABEL_ALIGNMENT. */ + bool GetParaAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd, + const bool bOnlyTextAttr = false, + const bool bGetFromChrFormat = true, + const bool bMergeIndentValuesOfNumRule = false, + SwRootFrame const* pLayout = nullptr) const; + + /// Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray. + void FormatToTextAttr( SwTextNode* pNd ); + + /// delete all attributes of type nWhich at nStart (opt. end nEnd) + void DeleteAttributes( const sal_uInt16 nWhich, + const sal_Int32 nStart, const sal_Int32 nEnd = 0 ); + /// delete the attribute pTextAttr + void DeleteAttribute ( SwTextAttr * const pTextAttr ); + + /** Actions on text and attributes. + introduce optional parameter to control, if all attributes have to be copied. */ + void CopyText( SwTextNode * const pDest, + const SwIndex &rStart, + const sal_Int32 nLen, + const bool bForceCopyOfAllAttrs ); + void CopyText( SwTextNode * const pDest, + const SwIndex &rDestStart, + const SwIndex &rStart, + sal_Int32 nLen, + const bool bForceCopyOfAllAttrs = false ); + + void CutText(SwTextNode * const pDest, + const SwIndex & rStart, const sal_Int32 nLen); + inline void CutText(SwTextNode * const pDest, const SwIndex &rDestStart, + const SwIndex & rStart, const sal_Int32 nLen); + + /// replace nDelLen characters at rStart with rText + /// in case the replacement does not fit, it is partially inserted up to + /// the capacity of the node + void ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen, + const OUString & rText ); + void ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen, + const OUString& rText, + const css::uno::Sequence<sal_Int32>& rOffsets ); + + /// Virtual methods from ContentNode. + virtual SwContentFrame *MakeFrame( SwFrame* ) override; + SwTextNode * SplitContentNode(const SwPosition &, + std::function<void (SwTextNode *, sw::mark::RestoreMode)> const* pContentIndexRestore); + virtual SwContentNode *JoinNext() override; + void JoinPrev(); + + SwContentNode *AppendNode( const SwPosition & ); + + /// When appropriate set DontExpand-flag at INet or character styles respectively. + bool DontExpandFormat( const SwIndex& rIdx, bool bFlag = true, + bool bFormatToTextAttributes = true ); + + enum GetTextAttrMode { + DEFAULT, /// DEFAULT: (Start <= nIndex < End) + EXPAND, /// EXPAND : (Start < nIndex <= End) + PARENT, /// PARENT : (Start < nIndex < End) + }; + + /** get the innermost text attribute covering position nIndex. + @param nWhich only attribute with this id is returned. + @param eMode the predicate for matching (@see GetTextAttrMode). + + ATTENTION: this function is not well-defined for those + hints of which several may cover a single position, like + RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK + */ + SwTextAttr *GetTextAttrAt( + sal_Int32 const nIndex, + sal_uInt16 const nWhich, + enum GetTextAttrMode const eMode = DEFAULT ) const; + + /** get the innermost text attributes covering position nIndex. + @param nWhich only attributes with this id are returned. + @param eMode the predicate for matching (@see GetTextAttrMode). + */ + std::vector<SwTextAttr *> GetTextAttrsAt( + sal_Int32 const nIndex, + sal_uInt16 const nWhich ) const; + + /** get the text attribute at position nIndex which owns + the dummy character CH_TXTATR_* at that position, if one exists. + @param nIndex the position in the text + @param nWhich if different from RES_TXTATR_END, return only + attribute with given which id + @return the text attribute at nIndex of type nWhich, if it exists + */ + SwTextAttr *GetTextAttrForCharAt( + const sal_Int32 nIndex, + const sal_uInt16 nWhich = RES_TXTATR_END ) const; + + SwTextField* GetFieldTextAttrAt( + const sal_Int32 nIndex, + const bool bIncludeInputFieldAtStart = false ) const; + + bool Spell(SwSpellArgs*); + bool Convert( SwConversionArgs & ); + + inline SwTextFormatColl *GetTextColl() const; + virtual SwFormatColl *ChgFormatColl( SwFormatColl* ) override; + void ChgTextCollUpdateNum( const SwTextFormatColl* pOld, + const SwTextFormatColl* pNew ); + + /** Copy collection with all auto formats to dest-node. + The latter might be in another document! + (Method in ndcopy.cxx!!). */ + void CopyCollFormat( SwTextNode& rDestNd ); + + // BEGIN OF BULLET/NUMBERING/OUTLINE STUFF: + + /** + Returns numbering rule of this text node. + + @param bInParent search in parent attributes, too + + @return numbering rule of this text node or NULL if none is set + */ + SwNumRule *GetNumRule(bool bInParent = true) const; + + const SwNodeNum* GetNum(SwRootFrame const* pLayout = nullptr) const; + void DoNum(std::function<void (SwNodeNum &)> const&); + + SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const* pLayout = nullptr) const; + + /** + Returns if this text node is an outline. + + @retval true this text node is an outline + @retval false else + */ + bool IsOutline() const; + + bool IsOutlineStateChanged() const; + + void UpdateOutlineState(); + + /** + Notify this textnode that its numbering rule has changed. + */ + void NumRuleChgd(); + + /** Returns outline of numbering string + + Introduce parameter <_bInclPrefixAndSuffixStrings> in order to control, + if the prefix and the suffix strings have to been included or not. + + @param _bInclPrefixAndSuffixStrings + optional input parameter - boolean indicating, if the prefix and the + suffix strings have to been included or not. default value = <true> + + @param _nRestrictToThisLevel + optional input parameter - unsigned integer indicating the maximum outline + level to which the output string must be restricted to. Default value is + MAXLEVEL + */ + OUString GetNumString( const bool _bInclPrefixAndSuffixStrings = true, + const unsigned int _nRestrictToThisLevel = MAXLEVEL, + SwRootFrame const* pLayout = nullptr) const; + + /** + Returns the additional indents of this text node and its numbering. + + @param bTextLeft ??? + + @return additional indents + */ + long GetLeftMarginWithNum( bool bTextLeft = false ) const; + + /** + Returns the combined first line indent of this text node and + its numbering. + + @param the first line indent of this text node taking the + numbering into account (return parameter) + + @retval true this node has SwNodeNum and has numbering rule + @retval false else + */ + bool GetFirstLineOfsWithNum( short& rFirstOffset ) const; + + SwTwips GetAdditionalIndentForStartingNewList() const; + + void ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const; + + /** return left margin for tab stop position calculation + + Needed for text formatting + Method considers new list level attributes, which also can provide a left margin value + */ + long GetLeftMarginForTabCalculation() const; + + /** Returns if this text node has a number. + + This text node has a number if it has a SwNodeNum and a + numbering rule and the numbering format specified for the + level of the SwNodeNum is of an enumeration type. + + @retval true This text node has a number. + @retval false else + */ + bool HasNumber() const; + + /** Returns if this text node has a bullet. + + This text node has a bullet if it has a SwNodeNum and a + numbering rule and the numbering format specified for the + level of the SwNodeNum is of a bullet type. + + @retval true This text node has a bullet. + @retval false else + */ + bool HasBullet() const; + + /** Returns is this text node is numbered. + + This node is numbered if it has a SwNodeNum and it has a + numbering rule and has not a hidden SwNodeNum. + + ATTENTION: Returns true even if the SwNumFormat has type + SVX_NUM_NUMBER_NONE. + + @retval true This node is numbered. + @retval false else + */ + bool IsNumbered(SwRootFrame const* pLayout = nullptr) const; + + /** Returns if this text node has a marked label. + + @retval true This text node has a marked label. + @retval false else + */ + bool HasMarkedLabel() const; + + /** Sets the list level of this text node. + + Side effect, when the text node is a list item: + The text node's representation in the list tree (<SwNodeNum> instance) + is updated. + + @param nLevel level to set + */ + void SetAttrListLevel(int nLevel); + + bool HasAttrListLevel() const; + + int GetAttrListLevel() const; + + /** Returns the actual list level of this text node, when it is a list item + + @return the actual list level of this text node, if it is a list item, + -1 otherwise + */ + int GetActualListLevel() const; + + /** + Returns outline level of this text node. + + If a text node has an outline number (i.e. it has an SwNodeNum + and an outline numbering rule) the outline level is the level of + this SwNodeNum. + + If a text node has no outline number and has a paragraph style + attached the outline level is the outline level of the + paragraph style. + + Otherwise the text node has no outline level (NO_NUMBERING). + + NOTE: The outline level of text nodes is subject to change. The + plan is to have an SwTextNode::nOutlineLevel member that is + updated from a paragraph style upon appliance of that paragraph + style. + + @return outline level or NO_NUMBERING if there is no outline level + */ + int GetAttrOutlineLevel() const; + + /** + Sets the out line level *at* a text node. + + @param nLevel the level to be set + + If the text node has an outline number the level is set at the + outline number. + + If the text node has no outline number but has a paragraph + style applied the outline level is set at the paragraph style. + + NOTE: This is subject to change, see GetOutlineLevel. + */ + void SetAttrOutlineLevel(int nLevel); + + bool IsEmptyListStyleDueToSetOutlineLevelAttr() const { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;} + void SetEmptyListStyleDueToSetOutlineLevelAttr(); + void ResetEmptyListStyleDueToResetOutlineLevelAttr(); + + /** + Returns the width of leading tabs/blanks in this paragraph. + This space will be converted into numbering indent if the paragraph + is set to be numbered. + + @return the width of the leading whitespace + */ + SwTwips GetWidthOfLeadingTabs() const; + + /** + Returns if the paragraph has a visible numbering or bullet. + This includes all kinds of numbering/bullet/outlines. + Note: This function returns false, if the numbering format is + SVX_NUM_NUMBER_NONE or if the numbering/bullet has been deleted. + + @return true if the paragraph has a visible numbering/bullet/outline + */ + bool HasVisibleNumberingOrBullet() const; + + void SetListId(OUString const& rListId); + OUString GetListId() const; + + /** Determines, if the list level indent attributes can be applied to the + paragraph. + + The list level indents can be applied to the paragraph under the one + of following conditions: + - the list style is directly applied to the paragraph and the paragraph + has no own indent attributes. + - the list style is applied to the paragraph through one of its paragraph + styles, the paragraph has no own indent attributes and on the paragraph + style hierarchy from the paragraph to the paragraph style with the + list style no indent attributes are found. + + @return boolean + */ + bool AreListLevelIndentsApplicable() const; + + /** Retrieves the list tab stop position, if the paragraph's list level defines + one and this list tab stop has to merged into the tap stops of the paragraph + + @param nListTabStopPosition + output parameter - containing the list tab stop position + + @return boolean - indicating, if a list tab stop position is provided + */ + bool GetListTabStopPosition( long& nListTabStopPosition ) const; + + /** Retrieves the character following the list label, if the paragraph's + list level defines one. + + @return the list tab stop position as string + */ + OUString GetLabelFollowedBy() const; + + // END OF BULLET/NUMBERING/OUTLINE STUFF: + + void fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const; + + LanguageType GetLang( const sal_Int32 nBegin, const sal_Int32 nLen = 0, + sal_uInt16 nScript = 0 ) const; + + /// in ndcopy.cxx + bool IsSymbolAt(sal_Int32 nBegin) const; // In itratr.cxx. + virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override; + + /// Interactive hyphenation: we find TextFrame and call its CalcHyph. + bool Hyphenate( SwInterHyphInfo &rHyphInf ); + void DelSoftHyph( const sal_Int32 nStart, const sal_Int32 nEnd ); + + /** add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, + when <bWithNum = true> that a space is inserted after the string for + the list label. + add 5th optional parameter <bWithSpacesForLevel> indicating, if additional + spaces are inserted in front of the expanded text string depending on + the list level. */ + OUString GetExpandText( SwRootFrame const* pLayout, + const sal_Int32 nIdx = 0, + const sal_Int32 nLen = -1, + const bool bWithNum = false, + const bool bAddSpaceAfterListLabelStr = false, + const bool bWithSpacesForLevel = false, + const ExpandMode eAdditionalMode = ExpandMode::ExpandFootnote) const; + bool CopyExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx, + sal_Int32 nIdx, sal_Int32 nLen, + SwRootFrame const* pLayout, + bool bWithNum = false, bool bWithFootnote = true, + bool bReplaceTabsWithSpaces = false ) const; + + OUString GetRedlineText() const; + + /** @return actual count of initial chars for initial-function. + If nWishLen == 0 that of first word. */ + sal_Int32 GetDropLen(sal_Int32 nWishLen) const; + + /// Passes back info needed on the dropcap dimensions + bool GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescent) const; + + /// Hidden Paragraph Field: + bool CalcHiddenParaField() + { return m_pSwpHints && m_pSwpHints->CalcHiddenParaField(); } + /// set CalcVisible flags + void SetCalcHiddenParaField() + { if (m_pSwpHints) m_pSwpHints->SetCalcHiddenParaField(); } + + /// is the paragraph visible? + bool IsHiddenByParaField() const + { return m_pSwpHints && m_pSwpHints->IsHiddenByParaField(); } + + /// Hidden Paragraph Field: + + bool HasHiddenCharAttribute( bool bWholePara ) const + { + if ( m_bRecalcHiddenCharFlags ) + CalcHiddenCharFlags(); + return bWholePara ? m_bHiddenCharsHidePara : m_bContainsHiddenChars; + } + + void SetCalcHiddenCharFlags() const + { m_bRecalcHiddenCharFlags = true; } + + /** @return if the node is hidden due to + 1. HiddenParaField + 2. HiddenCharAttribute + 3. HiddenSection */ + + bool IsHidden() const; + + + /// override SwIndexReg + virtual void Update( + SwIndex const & rPos, + const sal_Int32 nChangeLen, + const bool bNegative = false, + const bool bDelete = false ) override; + + /// change text to Upper/Lower/Hiragana/Katakana/... + void TransliterateText( utl::TransliterationWrapper& rTrans, + sal_Int32 nStart, sal_Int32 nEnd, + SwUndoTransliterate* pUndo ); + + /// count words in given range - returns true if we refreshed out count + bool CountWords( SwDocStat& rStat, sal_Int32 nStart, sal_Int32 nEnd ) const; + + /** Checks some global conditions like loading or destruction of document + to economize notifications */ + bool IsNotificationEnabled() const; + + /// Checks a temporary notification blocker and the global conditions of IsNotificationEnabled() + bool IsNotifiable() const; + + void SetListRestart( bool bRestart ); + bool IsListRestart() const; + + void SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNum ); + bool HasAttrListRestartValue() const; + SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const; + SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const; + + void SetCountedInList( bool bCounted ); + bool IsCountedInList() const; + + void AddToList(); + void AddToListRLHidden(); + void RemoveFromList(); + void RemoveFromListRLHidden(); + bool IsInList() const; + + bool IsFirstOfNumRule(SwRootFrame const& rLayout) const; + + SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextContent> const& GetXParagraph() const + { return m_wXParagraph; } + SAL_DLLPRIVATE void SetXParagraph(css::uno::Reference<css::text::XTextContent> const& xParagraph) + { m_wXParagraph = xParagraph; } + + /// sfx2::Metadatable + virtual ::sfx2::IXmlIdRegistry& GetRegistry() override; + virtual bool IsInClipboard() const override; + virtual bool IsInUndo() const override; + virtual bool IsInContent() const override; + virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override; + + bool IsCollapse() const; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; + + sal_uInt32 GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const; + sal_uInt32 GetParRsid() const; + + bool CompareRsid( const SwTextNode &rTextNode, sal_Int32 nStt1, sal_Int32 nStt2 ) const; + bool CompareParRsid( const SwTextNode &rTextNode ) const; + + // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override; + + /// In MS Word, the font underline setting of the paragraph end position won't affect the formatting of numbering, so we ignore it + static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich); +}; + +inline SwpHints & SwTextNode::GetSwpHints() +{ + assert( m_pSwpHints ); + return *m_pSwpHints; +} +inline const SwpHints &SwTextNode::GetSwpHints() const +{ + assert( m_pSwpHints ); + return *m_pSwpHints; +} + +inline SwpHints& SwTextNode::GetOrCreateSwpHints() +{ + if ( !m_pSwpHints ) + { + m_pSwpHints.reset(new SwpHints(*this)); + } + return *m_pSwpHints; +} + +inline void SwTextNode::TryDeleteSwpHints() +{ + if ( m_pSwpHints && m_pSwpHints->CanBeDeleted() ) + { + m_pSwpHints.reset(); + } +} + +inline SwTextFormatColl* SwTextNode::GetTextColl() const +{ + return static_cast<SwTextFormatColl*>(const_cast<SwModify*>(GetRegisteredIn())); +} + +/// Inline methods from Node.hxx +inline SwTextNode *SwNode::GetTextNode() +{ + return SwNodeType::Text == m_nNodeType ? static_cast<SwTextNode*>(this) : nullptr; +} + +inline const SwTextNode *SwNode::GetTextNode() const +{ + return SwNodeType::Text == m_nNodeType ? static_cast<const SwTextNode*>(this) : nullptr; +} + +inline void +SwTextNode::CutText(SwTextNode * const pDest, const SwIndex & rDestStart, + const SwIndex & rStart, const sal_Int32 nLen) +{ + CutImpl( pDest, rDestStart, rStart, nLen ); +} + +inline sal_Int32 SwTextNode::GetSpaceLeft() const +{ + // do not fill the String up to the max - need to be able to have a + // SwPosition "behind" the last character, i.e., at index TXTNODE_MAX + 1 + const sal_Int32 TXTNODE_MAX = SAL_MAX_INT32 - 2; + return TXTNODE_MAX-m_Text.getLength(); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndtyp.hxx b/sw/inc/ndtyp.hxx new file mode 100644 index 000000000..50c1f6999 --- /dev/null +++ b/sw/inc/ndtyp.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_NDTYP_HXX +#define INCLUDED_SW_INC_NDTYP_HXX + +#include <sal/types.h> +#include <o3tl/typed_flags_set.hxx> + +// IDs for different nodes. The member indicating the type of node is +// in base class. +enum class SwNodeType : sal_uInt8 { + NONE = 0x00, + End = 0x01, + Start = 0x02, + Table = 0x04 | Start, ///< SwTableNode is derived from SwStartNode. + Text = 0x08, + Grf = 0x10, + Ole = 0x20, + Section = 0x40 | Start, ///< SwSectionNode is derived from SwStartNode. + PlaceHolder = 0x80, + +// NoTextNode (if any of the 2 bits are set). + NoTextMask = Grf | Ole, +// ContentNode (if any of the 3 bits are set). + ContentMask = Text | NoTextMask, +}; +namespace o3tl { + template<> struct typed_flags<SwNodeType> : is_typed_flags<SwNodeType, 0xff> {}; +} + +// Special types of StartNodes that are not derivations but keep +// "sections" together. +enum SwStartNodeType +{ + SwNormalStartNode = 0, + SwTableBoxStartNode, + SwFlyStartNode, + SwFootnoteStartNode, + SwHeaderStartNode, + SwFooterStartNode +}; + +// is the node the first and/or last node of a section? +// This information is used for the export filters. Our layout never have a +// distance before or after if the node is the first or last in a section. +const sal_uInt8 ND_HAS_PREV_LAYNODE = 0x01; +const sal_uInt8 ND_HAS_NEXT_LAYNODE = 0x02; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx new file mode 100644 index 000000000..6f1fa1bae --- /dev/null +++ b/sw/inc/node.hxx @@ -0,0 +1,748 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_NODE_HXX +#define INCLUDED_SW_INC_NODE_HXX + +#include <sal/types.h> + +#include "swdllapi.h" +#include "ndarr.hxx" +#include "ndtyp.hxx" +#include "index.hxx" +#include "fmtcol.hxx" + +#include <memory> +#include <vector> + +class SwContentFrame; +class SwContentNode; +class SwDoc; +class SwEndNode; +class SwFrame; +class SwFrameFormat; +class SwGrfNode; +class SwNoTextNode; +class SwNodeIndex; +class SwOLENode; +class SwRect; +class SwSection; +class SwSectionFormat; +class SwTOXBase; +class SwSectionNode; +class SwStartNode; +class SwTabFrame; +class SwRootFrame; +class SwTable; +class SwTableNode; +class SwTableBox; +class SwTextNode; +class SwPageDesc; +class SwViewShell; +struct SwPosition; +class IStyleAccess; +class IDocumentSettingAccess; +class IDocumentDeviceAccess; +class IDocumentMarkAccess; +class IDocumentRedlineAccess; +class IDocumentStylePoolAccess; +class IDocumentLinksAdministration; +class IDocumentFieldsAccess; +class IDocumentContentOperations; +class IDocumentListItems; +class Point; +enum class SvxFrameDirection; +typedef std::vector<SwOLENode*> SwOLENodes; // docary.hxx + +namespace drawinglayer::attribute { + class SdrAllFillAttributesHelper; + typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +} + +/// Base class of the Writer document model elements. +class SW_DLLPUBLIC SwNode + : private BigPtrEntry +{ + friend class SwNodes; + + SwNodeType m_nNodeType; + + /// For text nodes: level of auto format. Was put here because we had still free bits. + sal_uInt8 m_nAFormatNumLvl : 3; + bool m_bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag + +public: + /// sw_redlinehide: redline node merge state + enum class Merge { None, First, NonFirst, Hidden }; + bool IsCreateFrameWhenHidingRedlines() const { + return m_eMerge == Merge::None || m_eMerge == Merge::First; + } + void SetRedlineMergeFlag(Merge const eMerge) { m_eMerge = eMerge; } + Merge GetRedlineMergeFlag() const { return m_eMerge; } +private: + Merge m_eMerge; + +#ifdef DBG_UTIL + static long s_nSerial; + long m_nSerial; +#endif + + /// all SwFrameFormat that are anchored at the node + /// invariant: SwFrameFormat is in the list iff + /// SwFrameFormat::GetAnchor().GetContentAnchor() points to this node + std::unique_ptr<std::vector<SwFrameFormat*>> m_pAnchoredFlys; + +protected: + SwStartNode* m_pStartOfSection; + + SwNode( const SwNodeIndex &rWhere, const SwNodeType nNodeId ); + + /// for the initial StartNode + SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNodeId ); + +public: + /** the = 0 forces the class to be an abstract base class, but the dtor can be still called + from subclasses */ + virtual ~SwNode() override = 0; + +#ifdef DBG_UTIL + long GetSerial() const { return m_nSerial; } +#endif + + sal_uInt16 GetSectionLevel() const; + + inline sal_uLong StartOfSectionIndex() const; + const SwStartNode* StartOfSectionNode() const { return m_pStartOfSection; } + SwStartNode* StartOfSectionNode() { return m_pStartOfSection; } + + inline sal_uLong EndOfSectionIndex() const; + inline const SwEndNode* EndOfSectionNode() const; + inline SwEndNode* EndOfSectionNode(); + + sal_uInt8 GetAutoFormatLvl() const { return m_nAFormatNumLvl; } + void SetAutoFormatLvl( sal_uInt8 nVal ) { m_nAFormatNumLvl = nVal; } + + bool IsIgnoreDontExpand() const { return m_bIgnoreDontExpand; } + void SetIgnoreDontExpand( bool bNew ) { m_bIgnoreDontExpand = bNew; } + + SwNodeType GetNodeType() const { return m_nNodeType; } + + inline SwStartNode *GetStartNode(); + inline const SwStartNode *GetStartNode() const; + inline SwContentNode *GetContentNode(); + inline const SwContentNode *GetContentNode() const; + inline SwEndNode *GetEndNode(); + inline const SwEndNode *GetEndNode() const; + inline SwTextNode *GetTextNode(); + inline const SwTextNode *GetTextNode() const; + inline SwOLENode *GetOLENode(); + inline const SwOLENode *GetOLENode() const; + inline SwNoTextNode *GetNoTextNode(); + inline const SwNoTextNode *GetNoTextNode() const; + inline SwGrfNode *GetGrfNode(); + inline const SwGrfNode *GetGrfNode() const; + inline SwTableNode *GetTableNode(); + inline const SwTableNode *GetTableNode() const; + inline SwSectionNode *GetSectionNode(); + inline const SwSectionNode *GetSectionNode() const; + + inline bool IsStartNode() const; + inline bool IsContentNode() const; + inline bool IsEndNode() const; + inline bool IsTextNode() const; + inline bool IsTableNode() const; + inline bool IsSectionNode() const; + inline bool IsOLENode() const; + inline bool IsNoTextNode() const; + inline bool IsGrfNode() const; + + /** + Checks if this node is in redlines. + + @retval true this node is in redlines + @retval false else + */ + bool IsInRedlines() const; + + /** Search table node, in which it is. If it is in no table + @return 0. */ + SwTableNode *FindTableNode(); + inline const SwTableNode *FindTableNode() const; + + /** Search section node, in which it is. If it is in no section + @return 0. */ + SwSectionNode *FindSectionNode(); + inline const SwSectionNode *FindSectionNode() const; + + SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ); + inline const SwStartNode* FindSttNodeByType( SwStartNodeType eTyp ) const; + + const SwStartNode* FindTableBoxStartNode() const + { return FindSttNodeByType( SwTableBoxStartNode ); } + const SwStartNode* FindFlyStartNode() const + { return FindSttNodeByType( SwFlyStartNode ); } + const SwStartNode* FindFootnoteStartNode() const + { return FindSttNodeByType( SwFootnoteStartNode ); } + const SwStartNode* FindHeaderStartNode() const + { return FindSttNodeByType( SwHeaderStartNode ); } + const SwStartNode* FindFooterStartNode() const + { return FindSttNodeByType( SwFooterStartNode ); } + + /// Node is in which nodes-array/doc? + inline SwNodes& GetNodes(); + inline const SwNodes& GetNodes() const; + inline SwDoc* GetDoc(); + inline const SwDoc* GetDoc() const; + + /** Provides access to the document setting interface + */ + const IDocumentSettingAccess* getIDocumentSettingAccess() const; + + /** Provides access to the document device interface + */ + const IDocumentDeviceAccess& getIDocumentDeviceAccess() const; + + /** Provides access to the document bookmark interface + */ + const IDocumentMarkAccess* getIDocumentMarkAccess() const; + + /** Provides access to the document redline interface + */ + const IDocumentRedlineAccess& getIDocumentRedlineAccess() const; + + /** Provides access to the document style pool interface + */ + const IDocumentStylePoolAccess& getIDocumentStylePoolAccess() const; + + /** Provides access to the document draw model interface + */ + const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const; + + /** Provides access to the document layout interface + */ + const IDocumentLayoutAccess& getIDocumentLayoutAccess() const; + IDocumentLayoutAccess& getIDocumentLayoutAccess(); + + /** Provides access to the document links administration interface + */ + const IDocumentLinksAdministration& getIDocumentLinksAdministration() const; + IDocumentLinksAdministration& getIDocumentLinksAdministration(); + + /** Provides access to the document fields administration interface + */ + const IDocumentFieldsAccess& getIDocumentFieldsAccess() const; + IDocumentFieldsAccess& getIDocumentFieldsAccess(); + + /** Provides access to the document content operations interface + */ + IDocumentContentOperations& getIDocumentContentOperations(); + + /** Provides access to the document automatic styles interface + */ + IStyleAccess& getIDocumentStyleAccess(); + + /** Provides access to the document's numbered items interface */ + IDocumentListItems& getIDocumentListItems(); + + /// Is node in the visible area of the Shell? + bool IsInVisibleArea( SwViewShell const * pSh ) const; + /// Is node in a protected area? + bool IsInProtectSect() const; + /** Is node in something that is protected (range, frame, + table cells ... including anchor in case of frames or footnotes)? */ + bool IsProtect() const; + + /** Search PageDesc with which this node is formatted. If layout is existent + search over layout, else only the hard way is left: search over the nodes + to the front!! */ + const SwPageDesc* FindPageDesc( size_t* pPgDescNdIdx = nullptr ) const; + + /// If node is in a fly return the respective format. + SwFrameFormat* GetFlyFormat() const; + + /// If node is in a table return the respective table box. + SwTableBox* GetTableBox() const; + + sal_uLong GetIndex() const { return GetPos(); } + + const SwTextNode* FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const* pLayout = nullptr) const; + + sal_uInt8 HasPrevNextLayNode() const; + + std::vector<SwFrameFormat *> const* GetAnchoredFlys() const { return m_pAnchoredFlys.get(); } + void AddAnchoredFly(SwFrameFormat *); + void RemoveAnchoredFly(SwFrameFormat *); + + /** + * Dumps the node structure to the given destination (file nodes.xml in the current directory by default) + */ + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; + +private: + SwNode( const SwNode & rNodes ) = delete; + SwNode & operator= ( const SwNode & rNodes ) = delete; +}; + +/// Starts a section of nodes in the document model. +class SAL_DLLPUBLIC_RTTI SwStartNode: public SwNode +{ + friend class SwNode; + friend class SwNodes; + friend class SwEndNode; ///< to set the theEndOfSection !! + + SwEndNode* m_pEndOfSection; + SwStartNodeType m_eStartNodeType; + + /// for the initial StartNode + SwStartNode( SwNodes& rNodes, sal_uLong nPos ); + +protected: + SwStartNode( const SwNodeIndex &rWhere, + const SwNodeType nNodeType = SwNodeType::Start, + SwStartNodeType = SwNormalStartNode ); +public: + SwStartNodeType GetStartNodeType() const { return m_eStartNodeType; } + + /// Call ChkCondcoll to all ContentNodes of section. + void CheckSectionCondColl() const; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; + +private: + SwStartNode( const SwStartNode & rNode ) = delete; + SwStartNode & operator= ( const SwStartNode & rNode ) = delete; +}; + +/// Ends a section of nodes in the document model. +class SwEndNode : public SwNode +{ + friend class SwNodes; + friend class SwTableNode; ///< To enable creation of its EndNote. + friend class SwSectionNode; ///< To enable creation of its EndNote. + + /// for the initial StartNode + SwEndNode( SwNodes& rNodes, sal_uLong nPos, SwStartNode& rSttNd ); + +protected: + SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd ); + +private: + SwEndNode( const SwEndNode & rNode ) = delete; + SwEndNode & operator= ( const SwEndNode & rNode ) = delete; +}; + +// SwContentNode + +class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public SwNode, public SwIndexReg +{ + + sw::WriterMultiListener m_aCondCollListener; + SwFormatColl* m_pCondColl; + mutable bool mbSetModifyAtAttr; + +protected: + SwContentNode( const SwNodeIndex &rWhere, const SwNodeType nNodeType, + SwFormatColl *pFormatColl ); + /** the = 0 forces the class to be an abstract base class, but the dtor can be still called + from subclasses */ + virtual ~SwContentNode() override = 0; + + /** Attribute-set for all auto attributes of a ContentNode. + (e.g. TextNode or NoTextNode). */ + std::shared_ptr<const SfxItemSet> mpAttrSet; + + /// Make respective nodes create the specific AttrSets. + virtual void NewAttrSet( SwAttrPool& ) = 0; + + /** There some functions that like to remove items from the internal + SwAttrSet (handle): */ + sal_uInt16 ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds ); + + virtual void SwClientNotify( const SwModify&, const SfxHint& rHint) override; + +public: + + /** MakeFrame will be called for a certain layout + pSib is another SwFrame of the same layout (e.g. the SwRootFrame itself, a sibling, the parent) */ + virtual SwContentFrame *MakeFrame( SwFrame* pSib ) = 0; + + virtual SwContentNode *JoinNext(); + /** Is it possible to join two nodes? + In pIdx the second position can be returned. */ + bool CanJoinNext( SwNodeIndex* pIdx =nullptr ) const; + bool CanJoinPrev( SwNodeIndex* pIdx =nullptr ) const; + + void MakeStartIndex( SwIndex * pIdx ) { pIdx->Assign( this, 0 ); } + void MakeEndIndex( SwIndex * pIdx ) { pIdx->Assign( this, Len() ); } + + bool GoNext(SwIndex *, sal_uInt16 nMode ) const; + bool GoPrevious(SwIndex *, sal_uInt16 nMode ) const; + + /// @see GetFrameOfModify + SwContentFrame *getLayoutFrame( const SwRootFrame*, + const SwPosition *pPos = nullptr, + std::pair<Point, bool> const* pViewPosAndCalcFrame = nullptr) const; + /** @return the real size of the frame or an empty rectangle if + no layout exists. Needed for export filters. */ + SwRect FindLayoutRect( const bool bPrtArea = false, + const Point* pPoint = nullptr ) const; + SwRect FindPageFrameRect() const; + + /** Method creates all views of document for given node. The content + frames that are created are put in the respective layout. */ + void MakeFramesForAdjacentContentNode(SwContentNode& rNode); + + /** Method deletes all views of document for the node. The content- + frames are removed from the respective layout. + */ + void DelFrames(SwRootFrame const* pLayout); + + /** @return count of elements of node content. Default is 1. + There are differences between text node and formula node. */ + virtual sal_Int32 Len() const; + + virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const = 0; + + /// Get information from Client. + virtual bool GetInfo( SfxPoolItem& ) const override; + + /// SS for PoolItems: hard attributation. + + /// If bInParent is FALSE search for attribute only in this node. + const SfxPoolItem& GetAttr( sal_uInt16 nWhich, bool bInParent=true ) const; + bool GetAttr( SfxItemSet& rSet ) const; + /// made virtual + virtual bool SetAttr( const SfxPoolItem& ); + virtual bool SetAttr( const SfxItemSet& rSet ); + virtual bool ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ); + virtual bool ResetAttr( const std::vector<sal_uInt16>& rWhichArr ); + virtual sal_uInt16 ResetAllAttr(); + + /// Obtains attribute that is not delivered via conditional style! + const SfxPoolItem* GetNoCondAttr( sal_uInt16 nWhich, bool bInParents ) const; + + /** Does node has already its own auto-attributes? + Access to SwAttrSet. */ + inline const SwAttrSet &GetSwAttrSet() const; + const SwAttrSet *GetpSwAttrSet() const { return static_cast<const SwAttrSet*>(mpAttrSet.get()); } + bool HasSwAttrSet() const { return mpAttrSet != nullptr; } + + virtual SwFormatColl* ChgFormatColl( SwFormatColl* ); + SwFormatColl* GetFormatColl() const { return const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); } + +//FEATURE::CONDCOLL + inline SwFormatColl& GetAnyFormatColl() const; + void SetCondFormatColl( SwFormatColl* ); + inline SwFormatColl* GetCondFormatColl() const; + + bool IsAnyCondition( SwCollCondition& rTmp ) const; + void ChkCondColl(); +//FEATURE::CONDCOLL + + /** Invalidates NumRule at the node. NumRule is updated + on EndAction of a Shell at the latest. */ + bool InvalidateNumRule(); + + /** determines the text direction for a certain + position. @return -1, if text direction could *not* be determined. */ + SvxFrameDirection GetTextDirection( const SwPosition& rPos, + const Point* pPt ) const; + + void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; } + bool GetModifyAtAttr() const { return mbSetModifyAtAttr; } + + static std::unique_ptr<SwOLENodes> CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize ); + + // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; + + virtual void ModifyNotification(const SfxPoolItem* pOld, const SfxPoolItem* pNew) override + { + SwClientNotify(*this, sw::LegacyModifyHint(pOld, pNew)); + } + +private: + SwContentNode( const SwContentNode & rNode ) = delete; + SwContentNode & operator= ( const SwContentNode & rNode ) = delete; +}; + +// SwTableNode + +class SW_DLLPUBLIC SwTableNode : public SwStartNode, public sw::BroadcastingModify +{ + friend class SwNodes; + std::unique_ptr<SwTable> m_pTable; +protected: + virtual ~SwTableNode() override; + +public: + SwTableNode( const SwNodeIndex & ); + + const SwTable& GetTable() const { return *m_pTable; } + SwTable& GetTable() { return *m_pTable; } + SwTabFrame *MakeFrame( SwFrame* ); + + /// Creates the frms for the table node (i.e. the TabFrames). + void MakeOwnFrames(SwNodeIndex* pIdxBehind); + + /** Method deletes all views of document for the node. + The content frames are removed from the respective layout. */ + void DelFrames(SwRootFrame const* pLayout = nullptr); + + /** Method creates all views of the document for the previous node. + The content frames that are created are put into the respective layout. */ + void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx); + + SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const; + void SetNewTable( std::unique_ptr<SwTable> , bool bNewFrames=true ); + + // Removes redline objects that relate to this table from the 'Extra Redlines' table + void RemoveRedlines(); + +private: + SwTableNode( const SwTableNode & rNode ) = delete; + SwTableNode & operator= ( const SwTableNode & rNode ) = delete; +}; + +class SAL_DLLPUBLIC_RTTI SwSectionNode + : public SwStartNode +{ + friend class SwNodes; + +private: + SwSectionNode(const SwSectionNode&) = delete; + SwSectionNode& operator=(const SwSectionNode&) = delete; + + std::unique_ptr<SwSection> const m_pSection; + +protected: + virtual ~SwSectionNode() override; + +public: + SwSectionNode(SwNodeIndex const&, + SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase); + + const SwSection& GetSection() const { return *m_pSection; } + SwSection& GetSection() { return *m_pSection; } + + SwFrame *MakeFrame( SwFrame* ); + + /** Creates the frms for the SectionNode (i.e. the SectionFrames). + On default the frames are created until the end of the range. + When another NodeIndex pEnd is passed a MakeFrames is called up to it. + Used by TableToText. */ + void MakeOwnFrames(SwNodeIndex* pIdxBehind, SwNodeIndex* pEnd = nullptr); + + /** Method deletes all views of document for the node. The + content frames are removed from the respective layout. */ + void DelFrames(SwRootFrame const* pLayout = nullptr, bool bForce = false); + + /** Method creates all views of document for the previous node. + The content frames created are put into the respective layout. */ + void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx); + + SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const; + + /// Set pointer in format of section on itself. + void NodesArrChgd(); + + /** Check for not hidden areas whether there is content that is not in + a hidden sub-area. */ + bool IsContentHidden() const; + +}; + +/** This class is internal, used only during DocumentContentOperationsManager::CopyWithFlyInFly(), and for undo. + +Some of the nodes are then replaced with SwPlaceholderNode, and at the end of the operation, removed again. +FIXME find out if this is really necessary, and if we can avoid creation of the SwPlaceholderNodes in the first place. +*/ +class SwPlaceholderNode final : private SwNode +{ +private: + friend class SwNodes; + SwPlaceholderNode(const SwNodeIndex &rWhere); +}; + +inline SwEndNode *SwNode::GetEndNode() +{ + return SwNodeType::End == m_nNodeType ? static_cast<SwEndNode*>(this) : nullptr; +} +inline const SwEndNode *SwNode::GetEndNode() const +{ + return SwNodeType::End == m_nNodeType ? static_cast<const SwEndNode*>(this) : nullptr; +} +inline SwStartNode *SwNode::GetStartNode() +{ + return SwNodeType::Start & m_nNodeType ? static_cast<SwStartNode*>(this) : nullptr; +} +inline const SwStartNode *SwNode::GetStartNode() const +{ + return SwNodeType::Start & m_nNodeType ? static_cast<const SwStartNode*>(this) : nullptr; +} +inline SwTableNode *SwNode::GetTableNode() +{ + return SwNodeType::Table == m_nNodeType ? static_cast<SwTableNode*>(this) : nullptr; +} +inline const SwTableNode *SwNode::GetTableNode() const +{ + return SwNodeType::Table == m_nNodeType ? static_cast<const SwTableNode*>(this) : nullptr; +} +inline SwSectionNode *SwNode::GetSectionNode() +{ + return SwNodeType::Section == m_nNodeType ? static_cast<SwSectionNode*>(this) : nullptr; +} +inline const SwSectionNode *SwNode::GetSectionNode() const +{ + return SwNodeType::Section == m_nNodeType ? static_cast<const SwSectionNode*>(this) : nullptr; +} +inline SwContentNode *SwNode::GetContentNode() +{ + return SwNodeType::ContentMask & m_nNodeType ? static_cast<SwContentNode*>(this) : nullptr; +} +inline const SwContentNode *SwNode::GetContentNode() const +{ + return SwNodeType::ContentMask & m_nNodeType ? static_cast<const SwContentNode*>(this) : nullptr; +} + +inline bool SwNode::IsStartNode() const +{ + return bool(SwNodeType::Start & m_nNodeType); +} +inline bool SwNode::IsContentNode() const +{ + return bool(SwNodeType::ContentMask & m_nNodeType); +} +inline bool SwNode::IsEndNode() const +{ + return SwNodeType::End == m_nNodeType; +} +inline bool SwNode::IsTextNode() const +{ + return SwNodeType::Text == m_nNodeType; +} +inline bool SwNode::IsTableNode() const +{ + return SwNodeType::Table == m_nNodeType; +} +inline bool SwNode::IsSectionNode() const +{ + return SwNodeType::Section == m_nNodeType; +} +inline bool SwNode::IsNoTextNode() const +{ + return bool(SwNodeType::NoTextMask & m_nNodeType); +} +inline bool SwNode::IsOLENode() const +{ + return SwNodeType::Ole == m_nNodeType; +} +inline bool SwNode::IsGrfNode() const +{ + return SwNodeType::Grf == m_nNodeType; +} + +inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const +{ + return const_cast<SwNode*>(this)->FindSttNodeByType( eTyp ); +} +inline const SwTableNode* SwNode::FindTableNode() const +{ + return const_cast<SwNode*>(this)->FindTableNode(); +} +inline const SwSectionNode* SwNode::FindSectionNode() const +{ + return const_cast<SwNode*>(this)->FindSectionNode(); +} +inline sal_uLong SwNode::StartOfSectionIndex() const +{ + return m_pStartOfSection->GetIndex(); +} +inline sal_uLong SwNode::EndOfSectionIndex() const +{ + const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection; + return pStNd->m_pEndOfSection->GetIndex(); +} +inline const SwEndNode* SwNode::EndOfSectionNode() const +{ + const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection; + return pStNd->m_pEndOfSection; +} +inline SwEndNode* SwNode::EndOfSectionNode() +{ + const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : m_pStartOfSection; + return pStNd->m_pEndOfSection; +} + +inline SwNodes& SwNode::GetNodes() +{ + return static_cast<SwNodes&>(GetArray()); +} +inline const SwNodes& SwNode::GetNodes() const +{ + return static_cast<SwNodes&>(GetArray()); +} + +inline SwDoc* SwNode::GetDoc() +{ + return GetNodes().GetDoc(); +} +inline const SwDoc* SwNode::GetDoc() const +{ + return GetNodes().GetDoc(); +} + +inline SwFormatColl* SwContentNode::GetCondFormatColl() const +{ + return m_pCondColl; +} + +inline SwFormatColl& SwContentNode::GetAnyFormatColl() const +{ + return m_pCondColl + ? *m_pCondColl + : *const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(GetRegisteredIn())); +} + +inline const SwAttrSet& SwContentNode::GetSwAttrSet() const +{ + return mpAttrSet ? *GetpSwAttrSet() : GetAnyFormatColl().GetAttrSet(); +} + +//FEATURE::CONDCOLL + +inline const SfxPoolItem& SwContentNode::GetAttr( sal_uInt16 nWhich, + bool bInParents ) const +{ + return GetSwAttrSet().Get( nWhich, bInParents ); +} + +inline SwPlaceholderNode::SwPlaceholderNode(const SwNodeIndex &rWhere) + : SwNode(rWhere, SwNodeType::PlaceHolder) +{ +} + +inline SwNodePtr SwNodes::operator[]( sal_uLong n ) const +{ + return static_cast<SwNodePtr>(BigPtrArray::operator[] ( n )); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx new file mode 100644 index 000000000..6152e6bee --- /dev/null +++ b/sw/inc/numrule.hxx @@ -0,0 +1,305 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_NUMRULE_HXX +#define INCLUDED_SW_INC_NUMRULE_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <editeng/numitem.hxx> +#include <i18nlangtag/lang.h> +#include "swdllapi.h" +#include "swtypes.hxx" +#include "calbck.hxx" +#include "SwNumberTreeTypes.hxx" +#include "ndarr.hxx" +#include <unordered_map> +#include <memory> +#include <vector> +#include "charfmt.hxx" + +class SwTextFormatColl; +class IDocumentListsAccess; +class SwNodeNum; +namespace vcl { class Font; } +class SvxBrushItem; +class SfxGrabBagItem; +class SwDoc; +class SwFormatVertOrient; +class SwTextNode; +class Size; + +const sal_Unicode cBulletChar = 0x2022; ///< Character for lists. + +class SW_DLLPUBLIC SwNumFormat final : public SvxNumberFormat, public SwClient +{ + std::unique_ptr<SwFormatVertOrient> m_pVertOrient; + //For i120928,record the cp info of graphic within bullet + sal_Unicode m_cGrfBulletCP; + SAL_DLLPRIVATE void UpdateNumNodes( SwDoc* pDoc ); + + using SvxNumberFormat::operator ==; + using SvxNumberFormat::operator !=; + + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override; + +public: + SwNumFormat(); + SwNumFormat( const SwNumFormat& ); + SwNumFormat( const SvxNumberFormat&, SwDoc* pDoc); + + virtual ~SwNumFormat() override; + + SwNumFormat& operator=( const SwNumFormat& ); + + bool operator==( const SwNumFormat& ) const; + bool operator!=( const SwNumFormat& r ) const { return !(*this == r); } + + SwCharFormat* GetCharFormat() const { return const_cast<SwCharFormat*>(static_cast<const SwCharFormat*>(GetRegisteredIn())); } + void SetCharFormat( SwCharFormat* ); + + using SvxNumberFormat::SetCharFormatName; + virtual OUString GetCharFormatName() const override; + + //For i120928,access the cp info of graphic within bullet + void SetGrfBulletCP(sal_Unicode cP){m_cGrfBulletCP = cP;} + sal_Unicode GetGrfBulletCP() const {return m_cGrfBulletCP;} + + virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = nullptr, const sal_Int16* pOrient = nullptr) override; + + const SwFormatVertOrient* GetGraphicOrientation() const; + + bool IsEnumeration() const; // #i22362# + bool IsItemize() const; // #i29560# +}; + +enum SwNumRuleType { OUTLINE_RULE = 0, NUM_RULE = 1, RULE_END = 2 }; +class SW_DLLPUBLIC SwNumRule +{ + +public: + typedef std::vector< SwTextNode* > tTextNodeList; + typedef std::vector< SwTextFormatColl* > tParagraphStyleList; + + struct Extremities + { + sal_uInt16 nPrefixChars; + sal_uInt16 nSuffixChars; + }; + +private: + friend void FinitCore(); + + static SwNumFormat* maBaseFormats [ RULE_END ][ MAXLEVEL ]; + static const sal_uInt16 maDefNumIndents[ MAXLEVEL ]; + /// default list level properties for position-and-space mode LABEL_ALIGNMENT + static SwNumFormat* maLabelAlignmentBaseFormats [ RULE_END ][ MAXLEVEL ]; + static sal_uInt16 mnRefCount; + + std::unique_ptr<SwNumFormat> maFormats[ MAXLEVEL ]; + + /** container for associated text nodes */ + tTextNodeList maTextNodeList; + + /** container for associated paragraph styles */ + tParagraphStyleList maParagraphStyleList; + + /** unordered_map containing "name->rule" relation */ + std::unordered_map<OUString, SwNumRule *> * mpNumRuleMap; + + OUString msName; + SwNumRuleType meRuleType; + sal_uInt16 mnPoolFormatId; ///< Id-for NumRules created "automatically" + sal_uInt16 mnPoolHelpId; ///< HelpId for this Pool-style. + sal_uInt8 mnPoolHlpFileId; ///< FilePos at Doc on style helps. + bool mbAutoRuleFlag : 1; + bool mbInvalidRuleFlag : 1; + bool mbContinusNum : 1; ///< Continuous numbering without levels. + bool mbAbsSpaces : 1; ///< Levels represent absolute indents. + bool mbHidden : 1; ///< Is the numbering rule to be hidden in the UI? + bool mbCountPhantoms; + bool mbUsedByRedline; /// it needs to export as part of tracked numbering change + + const SvxNumberFormat::SvxNumPositionAndSpaceMode meDefaultNumberFormatPositionAndSpaceMode; + OUString msDefaultListId; + std::shared_ptr<SfxGrabBagItem> mpGrabBagItem; ///< Style InteropGrabBag. + +public: + /// add parameter <eDefaultNumberFormatPositionAndSpaceMode> + SwNumRule( const OUString& rNm, + const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode, + SwNumRuleType = NUM_RULE ); + + SwNumRule( const SwNumRule& ); + ~SwNumRule(); + + SwNumRule& operator=( const SwNumRule& ); + bool operator==( const SwNumRule& ) const; + bool operator!=( const SwNumRule& r ) const { return !(*this == r); } + + const SwNumFormat* GetNumFormat( sal_uInt16 i ) const; + const SwNumFormat& Get( sal_uInt16 i ) const; + + bool IsHidden( ) const { return mbHidden; } + void SetHidden( bool bValue ) { mbHidden = bValue; } + + void Set( sal_uInt16 i, const SwNumFormat* ); + void Set( sal_uInt16 i, const SwNumFormat& ); + OUString MakeNumString( const SwNodeNum&, bool bInclStrings = true ) const; + /** - add optional parameter <_nRestrictToThisLevel> in order to + restrict returned string to this level. */ + OUString MakeNumString( const SwNumberTree::tNumberVector & rNumVector, + const bool bInclStrings = true, + const bool bOnlyArabic = false, + const unsigned int _nRestrictToThisLevel = MAXLEVEL, + Extremities* pExtremities = nullptr, + LanguageType nLang = LANGUAGE_SYSTEM) const; + OUString MakeRefNumString( const SwNodeNum& rNodeNum, + const bool bInclSuperiorNumLabels, + const int nRestrictInclToThisLevel ) const; + OUString MakeParagraphStyleListString() const; + + /** @return list of associated text nodes */ + void GetTextNodeList( SwNumRule::tTextNodeList& rTextNodeList ) const; + SwNumRule::tTextNodeList::size_type GetTextNodeListSize() const; + + void AddTextNode( SwTextNode& rTextNode ); + void RemoveTextNode( SwTextNode& rTextNode ); + + SwNumRule::tParagraphStyleList::size_type GetParagraphStyleListSize() const; + void AddParagraphStyle( SwTextFormatColl& rTextFormatColl ); + void RemoveParagraphStyle( SwTextFormatColl& rTextFormatColl ); + + void SetDefaultListId( const OUString& sDefaultListId ) + { + msDefaultListId = sDefaultListId; + } + const OUString& GetDefaultListId() const + { + return msDefaultListId; + } + /** + Register this rule in a "name->numrule" map. + + @param pNumRuleMap map to register in + */ + void SetNumRuleMap( + std::unordered_map<OUString, SwNumRule *>* pNumRuleMap ); + + static OUString GetOutlineRuleName(); + + static sal_uInt16 GetNumIndent( sal_uInt8 nLvl ); + static sal_uInt16 GetBullIndent( sal_uInt8 nLvl ); + + SwNumRuleType GetRuleType() const { return meRuleType; } + void SetRuleType( SwNumRuleType eNew ) { meRuleType = eNew; + mbInvalidRuleFlag = true; } + + /** A kind of copy-constructor to make sure the num formats are + attached to the correctCharFormats of a document!! + (Copies the NumFormats and returns itself). */ + SwNumRule& CopyNumRule( SwDoc*, const SwNumRule& ); + + /** Tests whether the CharFormats are from the given doc + and copies them if appropriate. */ + void CheckCharFormats( SwDoc* pDoc ); + + const OUString& GetName() const { return msName; } + + void SetName( const OUString& rNm, + IDocumentListsAccess& rDocListAccess ); + + bool IsAutoRule() const { return mbAutoRuleFlag; } + void SetAutoRule( bool bFlag ) { mbAutoRuleFlag = bFlag; } + + bool IsInvalidRule() const { return mbInvalidRuleFlag; } + void SetInvalidRule( bool bFlag ); + + bool IsContinusNum() const { return mbContinusNum; } + void SetContinusNum( bool bFlag ) { mbContinusNum = bFlag; } + + bool IsAbsSpaces() const { return mbAbsSpaces; } + void SetAbsSpaces( bool bFlag ) { mbAbsSpaces = bFlag; } + + bool IsOutlineRule() const { return meRuleType == OUTLINE_RULE; } + + bool IsCountPhantoms() const { return mbCountPhantoms; } + void SetCountPhantoms(bool bCountPhantoms); + + bool IsUsedByRedline() const { return mbUsedByRedline; } + void SetUsedByRedline(bool bUsed ) { mbUsedByRedline = bUsed; } + + /// Query and set PoolFormat IDs. + sal_uInt16 GetPoolFormatId() const { return mnPoolFormatId; } + void SetPoolFormatId( sal_uInt16 nId ) { mnPoolFormatId = nId; } + + /// Query and set Help-IDs for document styles. + sal_uInt16 GetPoolHelpId() const { return mnPoolHelpId; } + void SetPoolHelpId( sal_uInt16 nId ) { mnPoolHelpId = nId; } + sal_uInt8 GetPoolHlpFileId() const { return mnPoolHlpFileId; } + void SetPoolHlpFileId( sal_uInt8 nId ) { mnPoolHlpFileId = nId; } + + void SetSvxRule(const SvxNumRule&, SwDoc* pDoc); + SvxNumRule MakeSvxNumRule() const; + + /// change indent of all list levels by given difference + void ChangeIndent( const sal_Int32 nDiff ); + /// set indent of certain list level to given value + void SetIndent( const short nNewIndent, + const sal_uInt16 nListLevel ); + /** set indent of first list level to given value and change other list level's + indents accordingly */ + void SetIndentOfFirstListLevelAndChangeOthers( const short nNewIndent ); + + void Validate(); + void dumpAsXml(xmlTextWriterPtr w) const; + void GetGrabBagItem(css::uno::Any& rVal) const; + void SetGrabBagItem(const css::uno::Any& rVal); +}; + +/// namespace for static functions and methods for numbering and bullets +namespace numfunc +{ + /** retrieve font family name used for the default bullet list characters */ + OUString const & GetDefBulletFontname(); + + /** determine if default bullet font is user defined + + The default bullet font is user defined, if it is given in the user configuration + */ + bool IsDefBulletFontUserDefined(); + + /** retrieve font used for the default bullet list characters */ + SW_DLLPUBLIC const vcl::Font& GetDefBulletFont(); + + /** retrieve unicode of character used for the default bullet list for the given list level */ + sal_Unicode GetBulletChar( sal_uInt8 nLevel ); + + /** configuration, if at first position of the first list item the <TAB>-key + increased the indent of the complete list or only demotes this list item. + The same for <SHIFT-TAB>-key at the same position for decreasing the + indent of the complete list or only promotes this list item. + */ + bool ChangeIndentOnTabAtFirstPosOfFirstListItem(); + + SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode(); +} + +#endif // INCLUDED_SW_INC_NUMRULE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/optload.hrc b/sw/inc/optload.hrc new file mode 100644 index 000000000..201fbff59 --- /dev/null +++ b/sw/inc/optload.hrc @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_OPTLOAD_HRC +#define INCLUDED_SW_INC_OPTLOAD_HRC + +#include <tools/fldunit.hxx> +#include <utility> + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const std::pair<const char*, FieldUnit> STR_ARR_METRIC[] = +{ + { NC_("STR_ARR_METRIC", "Millimeter") , FieldUnit::MM }, + { NC_("STR_ARR_METRIC", "Centimeter") , FieldUnit::CM }, + { NC_("STR_ARR_METRIC", "Meter") , FieldUnit::M }, + { NC_("STR_ARR_METRIC", "Kilometer") , FieldUnit::KM }, + { NC_("STR_ARR_METRIC", "Inch") , FieldUnit::INCH }, + { NC_("STR_ARR_METRIC", "Foot") , FieldUnit::FOOT }, + { NC_("STR_ARR_METRIC", "Miles") , FieldUnit::MILE }, + { NC_("STR_ARR_METRIC", "Pica") , FieldUnit::PICA }, + { NC_("STR_ARR_METRIC", "Point") , FieldUnit::POINT }, + { NC_("STR_ARR_METRIC", "Char") , FieldUnit::CHAR }, + { NC_("STR_ARR_METRIC", "Line") , FieldUnit::LINE } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/outline.hrc b/sw/inc/outline.hrc new file mode 100644 index 000000000..c3202a39e --- /dev/null +++ b/sw/inc/outline.hrc @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_OUTLINE_HRC +#define INCLUDED_SW_INC_OUTLINE_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* OUTLINE_STYLE[] = +{ + NC_("numberingnamedialog|liststore1", "Untitled 1"), + NC_("numberingnamedialog|liststore1", "Untitled 2"), + NC_("numberingnamedialog|liststore1", "Untitled 3"), + NC_("numberingnamedialog|liststore1", "Untitled 4"), + NC_("numberingnamedialog|liststore1", "Untitled 5"), + NC_("numberingnamedialog|liststore1", "Untitled 6"), + NC_("numberingnamedialog|liststore1", "Untitled 7"), + NC_("numberingnamedialog|liststore1", "Untitled 8"), + NC_("numberingnamedialog|liststore1", "Untitled 9"), +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx new file mode 100644 index 000000000..c5044e19a --- /dev/null +++ b/sw/inc/pagedesc.hxx @@ -0,0 +1,445 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PAGEDESC_HXX +#define INCLUDED_SW_INC_PAGEDESC_HXX + +#include <tools/fract.hxx> +#include <tools/color.hxx> +#include "swdllapi.h" +#include "swtypes.hxx" +#include "frmfmt.hxx" +#include <editeng/numitem.hxx> +#include <editeng/borderline.hxx> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/text/HorizontalAdjust.hpp> +#include <o3tl/typed_flags_set.hxx> + +#include <boost/multi_index_container.hpp> +#include <boost/multi_index/identity.hpp> +#include <boost/multi_index/ordered_index.hpp> +#include <boost/multi_index/random_access_index.hpp> + +using namespace ::com::sun::star; + + +class SfxPoolItem; +class SwTextFormatColl; +class SwNode; +class SwPageDescs; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +/// Footnote information. +class SW_DLLPUBLIC SwPageFootnoteInfo +{ +private: + SwTwips m_nMaxHeight; ///< maximum height of the footnote area. + sal_uLong m_nLineWidth; ///< width of separator line + SvxBorderLineStyle m_eLineStyle; ///< Style of the separator line + Color m_LineColor; ///< color of the separator line + Fraction m_Width; ///< percentage width of the separator line. + css::text::HorizontalAdjust m_eAdjust; ///< line adjustment. + SwTwips m_nTopDist; ///< distance between body and separator. + SwTwips m_nBottomDist; ///< distance between separator and first footnote + +public: + SwTwips GetHeight() const { return m_nMaxHeight; } + sal_uLong GetLineWidth() const { return m_nLineWidth; } + const Color& GetLineColor() const { return m_LineColor;} + SvxBorderLineStyle GetLineStyle() const { return m_eLineStyle; } + const Fraction& GetWidth() const { return m_Width; } + css::text::HorizontalAdjust GetAdj() const { return m_eAdjust; } + SwTwips GetTopDist() const { return m_nTopDist; } + SwTwips GetBottomDist() const { return m_nBottomDist; } + + void SetHeight(SwTwips const nNew) { m_nMaxHeight = nNew; } + void SetLineWidth(sal_uLong const nSet) { m_nLineWidth = nSet; } + void SetLineStyle(SvxBorderLineStyle const eSet) {m_eLineStyle = eSet;} + void SetLineColor(const Color& rCol) { m_LineColor = rCol;} + void SetWidth(const Fraction & rNew) { m_Width = rNew; } + void SetAdj(css::text::HorizontalAdjust const eNew) { m_eAdjust = eNew; } + void SetTopDist (SwTwips const nNew) { m_nTopDist = nNew; } + void SetBottomDist(SwTwips const nNew) { m_nBottomDist = nNew; } + + SwPageFootnoteInfo(); + SwPageFootnoteInfo( const SwPageFootnoteInfo& ); + SwPageFootnoteInfo& operator=( const SwPageFootnoteInfo& ); + + bool operator ==( const SwPageFootnoteInfo& ) const; +}; + +/* + * Use of UseOnPage (m_eUse) and of FrameFormats + * + * RIGHT - m_Master only for right hand (odd) pages, left hand (even) pages + * always empty. + * LEFT - m_Left for left-hand pages, right-hand pages always empty. + * m_Left is a copy of master. + * ALL - m_Master for right hand pages, m_Left for left hand pages. + * - m_Left is a copy of master. + * MIRROR - m_Master for right hand pages, m_Left for left hand pagers. + * m_Left is a copy of master, margins are mirrored. + * + * UI works exclusively on master! m_Left is adjusted on Chg at document + * according to m_eUse. + * + * In order to simplify the work of the filters some more values are placed + * into m_eUse: + * + * HEADERSHARE - Content of header is equal on left and right hand pages. + * FOOTERSHARE - Content of footer is equal on left and right hand pages. + * + * The values are masked out in the respective getter and setter methods. + * Access to complete m_eUse including the information on header and footer + * via ReadUseOn(), WriteUseOn() (for Filter and CopyCTor)! + * + * The Frameformats for header/footer are adjusted by the UI according to + * the attributes for header and footer at master (height, margin, back- + * ground ...) + * Header/footer for left hand pages are copied or mirrored (Chg at + * document). + * The respective attribute for content is cared for automatically on Chg at + * document (contents are created or removed according to SHARE-information). + */ + +enum class UseOnPage : sal_uInt16 +{ + NONE = 0x0000, ///< For internal use only. + Left = 0x0001, + Right = 0x0002, + All = 0x0003, + Mirror = 0x0007, + HeaderShare = 0x0040, + FooterShare = 0x0080, + FirstShare = 0x0100, + NoHeaderShare = 0xFFBF, ///< For internal use only. + NoFooterShare = 0xFF7F, ///< For internal use only. + NoFirstShare = 0xFEFF +}; +namespace o3tl { + template<> struct typed_flags<UseOnPage> : is_typed_flags<UseOnPage, 0xffff> {}; +} + +class SW_DLLPUBLIC SwPageDesc + : public SwModify + , public sw::BroadcasterMixin +{ + friend class SwDoc; + friend class SwPageDescs; + + OUString m_StyleName; + SvxNumberType m_NumType; + SwFrameFormat m_Master; + SwFrameFormat m_Left; + // FIXME epicycles growing here - page margins need to be stored differently + SwFrameFormat m_FirstMaster; + SwFrameFormat m_FirstLeft; + sw::WriterMultiListener m_aDepends; ///< Because of grid alignment (Registerhaltigkeit). + mutable const SwTextFormatColl* m_pTextFormatColl; + SwPageDesc *m_pFollow; + sal_uInt16 m_nRegHeight; ///< Sentence spacing and fontascent of style. + sal_uInt16 m_nRegAscent; ///< For grid alignment (Registerhaltigkeit). + drawing::TextVerticalAdjust m_nVerticalAdjustment; // doc/docx: vertically center / justify / bottom + UseOnPage m_eUse; + bool m_IsLandscape; + bool m_IsHidden; + + /// Footnote information. + SwPageFootnoteInfo m_FootnoteInfo; + + /// Backref to the assigned SwPageDescs list to handle renames. + SwPageDescs *m_pdList; + + /** Called for mirroring of Chg (doc). + No adjustment at any other place. */ + SAL_DLLPRIVATE void Mirror(); + + SAL_DLLPRIVATE void ResetAllAttr(); + + SAL_DLLPRIVATE SwPageDesc(const OUString&, SwFrameFormat*, SwDoc *pDc ); + + struct change_name + { + change_name(const OUString &rName) : mName(rName) {} + void operator()(SwPageDesc *pPageDesc) { pPageDesc->m_StyleName = mName; } + const OUString &mName; + }; + +protected: + virtual void SwClientNotify(const SwModify&, const SfxHint&) override; + +public: + const OUString& GetName() const { return m_StyleName; } + bool SetName(const OUString& rNewName); + + bool GetLandscape() const { return m_IsLandscape; } + void SetLandscape( bool bNew ) { m_IsLandscape = bNew; } + + const SvxNumberType &GetNumType() const { return m_NumType; } + void SetNumType(const SvxNumberType& rNew) { m_NumType = rNew; } + + const SwPageFootnoteInfo &GetFootnoteInfo() const { return m_FootnoteInfo; } + SwPageFootnoteInfo &GetFootnoteInfo() { return m_FootnoteInfo; } + void SetFootnoteInfo(const SwPageFootnoteInfo &rNew) { m_FootnoteInfo = rNew; } + + inline bool IsHeaderShared() const; + inline bool IsFooterShared() const; + inline void ChgHeaderShare( bool bNew ); + inline void ChgFooterShare( bool bNew ); + bool IsFirstShared() const; + void ChgFirstShare( bool bNew ); + + bool IsHidden() const { return m_IsHidden; } + void SetHidden(bool const bValue) { m_IsHidden = bValue; } + + /// Same as WriteUseOn(), but the >= HeaderShare part of the bitfield is not modified. + inline void SetUseOn( UseOnPage eNew ); + inline UseOnPage GetUseOn() const; + + void WriteUseOn(UseOnPage const eNew) { m_eUse = eNew; } + UseOnPage ReadUseOn() const { return m_eUse; } + + SwFrameFormat &GetMaster() { return m_Master; } + SwFrameFormat &GetLeft() { return m_Left; } + SwFrameFormat &GetFirstMaster() { return m_FirstMaster; } + SwFrameFormat &GetFirstLeft() { return m_FirstLeft; } + const SwFrameFormat &GetMaster() const { return m_Master; } + const SwFrameFormat &GetLeft() const { return m_Left; } + const SwFrameFormat &GetFirstMaster() const { return m_FirstMaster; } + const SwFrameFormat &GetFirstLeft() const { return m_FirstLeft; } + + /** Reset all attrs of the format but keep the ones a pagedesc + cannot live without. */ + inline void ResetAllMasterAttr(); + + /** Layout uses the following methods to obtain a format in order + to be able to create a page. */ + SwFrameFormat *GetRightFormat(bool const bFirst = false); + inline const SwFrameFormat *GetRightFormat(bool const bFirst = false) const; + SwFrameFormat *GetLeftFormat(bool const bFirst = false); + inline const SwFrameFormat *GetLeftFormat(bool const bFirst = false) const; + + sal_uInt16 GetRegHeight() const { return m_nRegHeight; } + sal_uInt16 GetRegAscent() const { return m_nRegAscent; } + void SetRegHeight(sal_uInt16 const nNew) { m_nRegHeight = nNew; } + void SetRegAscent(sal_uInt16 const nNew) { m_nRegAscent = nNew; } + + drawing::TextVerticalAdjust GetVerticalAdjustment () const {return m_nVerticalAdjustment; } + void SetVerticalAdjustment (const drawing::TextVerticalAdjust nVA) {m_nVerticalAdjustment = nVA; } + + inline void SetFollow( const SwPageDesc* pNew ); + const SwPageDesc* GetFollow() const { return m_pFollow; } + SwPageDesc* GetFollow() { return m_pFollow; } + + void SetRegisterFormatColl( const SwTextFormatColl* rFormat ); + const SwTextFormatColl* GetRegisterFormatColl() const; + void RegisterChange(); + + /// Query and set PoolFormat-Id. + sal_uInt16 GetPoolFormatId() const { return m_Master.GetPoolFormatId(); } + void SetPoolFormatId(sal_uInt16 const nId) { m_Master.SetPoolFormatId(nId); } + sal_uInt16 GetPoolHelpId() const { return m_Master.GetPoolHelpId(); } + void SetPoolHelpId(sal_uInt16 const nId){ m_Master.SetPoolHelpId(nId); } + sal_uInt8 GetPoolHlpFileId() const { return m_Master.GetPoolHlpFileId(); } + void SetPoolHlpFileId(sal_uInt8 const nId) { m_Master.SetPoolHlpFileId(nId); } + + /// Query information from Client. + virtual bool GetInfo( SfxPoolItem& ) const override; + + const SwFrameFormat* GetPageFormatOfNode( const SwNode& rNd, + bool bCheckForThisPgDc = true ) const; + bool IsFollowNextPageOfNode( const SwNode& rNd ) const; + + /// Given a SwNode return the pagedesc in use at that location. + static const SwPageDesc* GetPageDescOfNode(const SwNode& rNd); + + static SwPageDesc* GetByName(SwDoc& rDoc, const OUString& rName); + + SwPageDesc& operator=( const SwPageDesc& ); + + SwPageDesc( const SwPageDesc& ); + virtual ~SwPageDesc() override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +namespace std { + template<> + struct less<SwPageDesc*> { + bool operator()(const SwPageDesc *pPageDesc, const OUString &rName) const + { return pPageDesc->GetName() < rName; } + bool operator()(const OUString &rName, const SwPageDesc *pPageDesc) const + { return rName < pPageDesc->GetName(); } + bool operator()(const SwPageDesc *lhs, const SwPageDesc *rhs) const + { return lhs->GetName() < rhs->GetName(); } + }; +} + +inline void SwPageDesc::SetFollow( const SwPageDesc* pNew ) +{ + m_pFollow = pNew ? const_cast<SwPageDesc*>(pNew) : this; +} + +inline bool SwPageDesc::IsHeaderShared() const +{ + return bool(m_eUse & UseOnPage::HeaderShare); +} +inline bool SwPageDesc::IsFooterShared() const +{ + return bool(m_eUse & UseOnPage::FooterShare); +} +inline void SwPageDesc::ChgHeaderShare( bool bNew ) +{ + if ( bNew ) + m_eUse |= UseOnPage::HeaderShare; + else + m_eUse &= UseOnPage::NoHeaderShare; +} +inline void SwPageDesc::ChgFooterShare( bool bNew ) +{ + if ( bNew ) + m_eUse |= UseOnPage::FooterShare; + else + m_eUse &= UseOnPage::NoFooterShare; +} +inline void SwPageDesc::SetUseOn( UseOnPage eNew ) +{ + UseOnPage eTmp = UseOnPage::NONE; + if (m_eUse & UseOnPage::HeaderShare) + eTmp = UseOnPage::HeaderShare; + if (m_eUse & UseOnPage::FooterShare) + eTmp |= UseOnPage::FooterShare; + if (m_eUse & UseOnPage::FirstShare) + eTmp |= UseOnPage::FirstShare; + m_eUse = eTmp | eNew; + +} +inline UseOnPage SwPageDesc::GetUseOn() const +{ + UseOnPage eRet = m_eUse; + eRet &= UseOnPage::NoHeaderShare; + eRet &= UseOnPage::NoFooterShare; + eRet &= UseOnPage::NoFirstShare; + return eRet; +} + +inline void SwPageDesc::ResetAllMasterAttr() +{ + ResetAllAttr(); +} + +inline const SwFrameFormat *SwPageDesc::GetRightFormat(bool const bFirst) const +{ + return const_cast<SwPageDesc*>(this)->GetRightFormat(bFirst); +} +inline const SwFrameFormat *SwPageDesc::GetLeftFormat(bool const bFirst) const +{ + return const_cast<SwPageDesc*>(this)->GetLeftFormat(bFirst); +} + +class SwPageDescExt +{ +public: + SwPageDesc m_PageDesc; +private: + SwDoc * m_pDoc; + OUString m_sFollow; + + void SetPageDesc(const SwPageDesc & rPageDesc); + +public: + SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc * pDoc); + SwPageDescExt(const SwPageDescExt & rSrc); + ~SwPageDescExt(); + + SwPageDescExt & operator = (const SwPageDescExt & rSrc); + SwPageDescExt & operator = (const SwPageDesc & rSrc); + + OUString const & GetName() const; + + operator SwPageDesc() const; // #i7983# +}; + +namespace sw { + class PageFootnoteHint final : public SfxHint {}; + + SW_DLLPUBLIC SwTwips FootnoteSeparatorHeight(SwPageFootnoteInfo const&); +} + +typedef boost::multi_index_container< + SwPageDesc*, + boost::multi_index::indexed_by< + boost::multi_index::random_access<>, + boost::multi_index::ordered_unique< + boost::multi_index::identity<SwPageDesc*> > + > + > + SwPageDescsBase; + +class SwPageDescs final +{ + // function updating ByName index via modify + friend bool SwPageDesc::SetName( const OUString& rNewName ); + + typedef SwPageDescsBase::nth_index<0>::type ByPos; + typedef SwPageDescsBase::nth_index<1>::type ByName; + typedef ByPos::iterator iterator; + + iterator find_( const OUString &name ) const; + + SwPageDescsBase m_Array; + ByPos &m_PosIndex; + ByName &m_NameIndex; + +public: + typedef ByPos::const_iterator const_iterator; + typedef SwPageDescsBase::size_type size_type; + typedef SwPageDescsBase::value_type value_type; + + SwPageDescs(); + + // frees all SwPageDesc! + ~SwPageDescs(); + + void clear() { return m_Array.clear(); } + bool empty() const { return m_Array.empty(); } + size_t size() const { return m_Array.size(); } + + std::pair<const_iterator,bool> push_back( const value_type& x ); + void erase( const value_type& x ); + void erase( size_type index ); + void erase( const_iterator const& position ); + + const_iterator find( const OUString &name ) const + { return find_( name ); } + const value_type& operator[]( size_t index_ ) const + { return m_PosIndex.operator[]( index_ ); } + const value_type& front() const { return m_PosIndex.front(); } + const value_type& back() const { return m_PosIndex.back(); } + const_iterator begin() const { return m_PosIndex.begin(); } + const_iterator end() const { return m_PosIndex.end(); } + + bool contains( const value_type& x ) const + { return x->m_pdList == this; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +#endif // INCLUDED_SW_INC_PAGEDESC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pageformatpanel.hrc b/sw/inc/pageformatpanel.hrc new file mode 100644 index 000000000..70a8bbbc1 --- /dev/null +++ b/sw/inc/pageformatpanel.hrc @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_INC_PAGEFORMATPANEL_HRC +#define INCLUDED_SW_INC_PAGEFORMATPANEL_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +namespace sw +{ + +// To translators: this is a listbox labelled by "Margins:", inch units +const std::pair<const char*, int> RID_PAGEFORMATPANEL_MARGINS_INCH[] = +{ + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "None"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Narrow"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Moderate"), 0 }, + // Normal (0.75") + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (%1)"), 75 }, + // Normal (1") + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (%1)"), 100 }, + // Normal (1.25") + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (%1)"), 125 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Wide"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Mirrored"), 0 } +}; + +// To translators: this is a listbox labelled by "Margins:", cm units +const std::pair<const char*, int> RID_PAGEFORMATPANEL_MARGINS_CM[] = +{ + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "None"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Narrow"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Moderate"), 0 }, + // Normal (1.9 cm) + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (%1)"), 190 }, + // Normal (2.54 cm) + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (%1)"), 254 }, + // Normal (3.18 cm) + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (%1)"), 318 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Wide"), 0 }, + { NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Mirrored"), 0 } +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/inc/pagepreviewlayout.hxx b/sw/inc/pagepreviewlayout.hxx new file mode 100644 index 000000000..d2af5f846 --- /dev/null +++ b/sw/inc/pagepreviewlayout.hxx @@ -0,0 +1,489 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_PAGEPREVIEWLAYOUT_HXX +#define INCLUDED_SW_INC_PAGEPREVIEWLAYOUT_HXX + +// template class <std::vector> +#include <vector> +// datatypes sal_xyz +#include <sal/types.h> +// classes <Point>, <Size> and <Rectangle> +#include <tools/gen.hxx> +// RenderContext type +#include <vcl/outdev.hxx> +// datatype <SwTwips> +#include "swtypes.hxx" +#include <prevwpage.hxx> + +class SwViewShell; +class SwRootFrame; +class SwPageFrame; +class Fraction; +struct PreviewPage; + +/** page preview functionality in the writer */ +class SwPagePreviewLayout +{ +private: + friend class SwViewShell; + + /// number of horizontal and vertical twips for spacing between the pages. + static constexpr SwTwips gnXFree = 4 * 142; + static constexpr SwTwips gnYFree = 4 * 142; + + /// view shell the print preview is generated for. + SwViewShell& mrParentViewShell; + /// top layout frame of the layout for accessing the pages + const SwRootFrame& mrLayoutRootFrame; + + /** boolean indicating, if the layout information (number of columns and rows) + are valid. */ + bool mbLayoutInfoValid; + /** boolean indicating, if the calculated print preview layout sizes + ( windows size in twips, maximal page size, column width, row height, + width and height of a print preview page, size of the print preview + document ) are valid */ + bool mbLayoutSizesValid; + /** boolean indicating, if the paint information ( physical number of + start page, start column and row, paint offsets, rectangle visible of + the print preview document. */ + bool mbPaintInfoValid; + + Size maWinSize; + sal_uInt16 mnCols; + sal_uInt16 mnRows; + sal_uInt16 mnPages; + // #i18143# - the book preview is controlled by this flag + bool mbBookPreview; + bool mbBookPreviewModeToggled; + + Size maMaxPageSize; + tools::Rectangle maPreviewDocRect; + SwTwips mnColWidth; + SwTwips mnRowHeight; + SwTwips mnPreviewLayoutWidth; + SwTwips mnPreviewLayoutHeight; + bool mbDoesLayoutColsFitIntoWindow; + bool mbDoesLayoutRowsFitIntoWindow; + + sal_uInt16 mnPaintPhyStartPageNum; + sal_uInt16 mnPaintStartCol; + sal_uInt16 mnPaintStartRow; + bool mbNoPageVisible; + Point maPaintStartPageOffset; + Point maPaintPreviewDocOffset; + Point maAdditionalPaintOffset; + tools::Rectangle maPaintedPreviewDocRect; + sal_uInt16 mnSelectedPageNum; + + std::vector<std::unique_ptr<PreviewPage>> maPreviewPages; + + /** #i22014# - internal booleans to indicate, that a new print + preview layout has been created during a paint. */ + mutable bool mbInPaint; + mutable bool mbNewLayoutDuringPaint; + + bool mbPrintEmptyPages; + + /** clear internal data about current page preview */ + void Clear_(); + + /** helper method to clear preview page layout sizes */ + void ClearPreviewLayoutSizes(); + + /** helper method to clear data in preview page vectors */ + void ClearPreviewPageData(); + + /** calculate page preview layout sizes */ + void CalcPreviewLayoutSizes(); + + /** apply new zoom at given view shell + + @param _aNewZoom + input parameter - new zoom percentage + */ + void ApplyNewZoomAtViewShell( sal_uInt8 _aNewZoom ); + + /** calculate additional paint offset + + helper method called by <Prepare> in order to calculate an additional + paint offset to center output in given window size. + The booleans <mbDoesLayoutRowsFitIntoWindow> and <mbDoesLayoutColsFitIntoWindow> + are also determined. + preconditions: + (1) preview layout is given (number of rows and columns). + (2) window size is given. + (3) height of row and width of column are calculated. + (4) paint offset of start page is calculated. + */ + void CalcAdditionalPaintOffset(); + + /** calculate painted preview document rectangle + + helper method called by <Prepare> in order to calculate the rectangle, + which will be painted for the document arranged by the given preview + layout. + preconditions: + (1) paint offset of document preview is calculated. + (2) size of document preview is calculated. + (3) additional paint offset is calculated - see <CalcAdditionalPaintOffset>. + */ + void CalcDocPreviewPaintRect(); + + /** determines preview data for a given page and a given preview offset + + @param _rPage + input parameter - constant reference to page frame, for which the + preview data will be calculated. + + @param _rPreviewOffset + input parameter - constant reference to the offset the given page has + in the current preview window. + Note: Offset can be negative. + + @param _opPreviewPage + output parameter - calculated preview data. + */ + void CalcPreviewDataForPage( const SwPageFrame& _rPage, + const Point& _rPreviewOffset, + PreviewPage* _opPreviewPage ); + + /** calculate preview pages + + helper method called by <Prepare> in order to determine which pages + will be visible in the current preview and calculate the data needed + to paint these pages. Also the accessible pages with its needed data + are determined. + */ + void CalcPreviewPages(); + + /** get preview page by physical page number + + @param _nPageNum + input parameter - physical page number of page, for which the preview + page will be returned. + + @return pointer to preview page of current preview pages. If page doesn't + belongs to current preview pages, <0> is returned. + */ + const PreviewPage* GetPreviewPageByPageNum( const sal_uInt16 _nPageNum ) const; + + /** paint selection mark at page */ + void PaintSelectMarkAtPage(vcl::RenderContext& rRenderContext, const PreviewPage* _aSelectedPreviewPage) const; + +public: + /** constructor of <SwPagePreviewLayout> + + @param _rParentViewShell + input parameter - reference to the view shell the page preview + layout belongs to. Reference will be hold as member <mrParentViewShell>. + Adjustments/Changes at this view shell: + (1) Adjustment of the mapping mode at the output device. + (2) Change of the zoom at the view options. + (3) Preparations for paint of the page preview. + + @param _rLayoutRootFrame + input parameter - constant reference to the root frame of the layout. + Reference will be hold as member <mrLayoutRootFrame> in order to get + access to the page frames. + */ + SwPagePreviewLayout( SwViewShell& _rParentViewShell, + const SwRootFrame& _rLayoutRootFrame ); + + /** destructor of <SwPagePreviewLayout> */ + ~SwPagePreviewLayout() + { + ClearPreviewPageData(); + } + + /** init page preview layout + + initialize the page preview settings for a given layout. + side effects: + (1) If parameter <_bCalcScale> is true, mapping mode with calculated + scaling is set at the output device and the zoom at the view options of + the given view shell is set with the calculated scaling. + + @param _nCols + input parameter - initial number of page columns in the preview. + + @param _nRows + input parameter - initial number of page rows in the preview. + + @param _rPxWinSize + input parameter - window size in which the preview will be displayed and + for which the scaling will be calculated. + */ + void Init( const sal_uInt16 _nCols, + const sal_uInt16 _nRows, + const Size& _rPxWinSize + ); + + /** method to adjust page preview layout to document changes */ + void ReInit(); + + /** prepare paint of page preview + + With the valid preview layout settings - calculated and set by method + <Init(..)> - the paint of a specific part of the virtual preview + document is prepared. The corresponding part is given by either + a start page (parameter <_nProposedStartPageNum>) or an absolute position + (parameter <_aProposedStartPoint>). + The accessibility preview will also be updated via a corresponding + method call. + + @param _nProposedStartPageNum [0..<number of document pages>] + input parameter - proposed number of page, which should be painted in + the left-top-corner in the current output device. input parameter + <_bStartWithPageAtFirstCol> influences, if proposed page is actual + painted in the left-top-corner. + + @param _nProposedStartPos [(0,0)..<PreviewDocumentSize>] + input parameter - proposed absolute position in the virtual preview + document, which should be painted in the left-top-corner in the current + output device. + + @param _rPxWinSize + input parameter - pixel size of window the preview will be painted in. + + @param _onStartPageNum + output parameter - physical number of page, which will be painted in the + left-top-corner in the current output device. + + @param _orDocPreviewPaintRect + output parameter - rectangle of preview document, which will be painted. + + @param _bStartWithPageAtFirstCol + input parameter with default value "true" - controls, if start page + is set to page in first column the proposed start page is located. + + @return boolean, indicating, if prepare of preview paint was successful. + */ + bool Prepare( const sal_uInt16 _nProposedStartPageNum, + const Point& rProposedStartPos, + const Size& _rPxWinSize, + sal_uInt16& _onStartPageNum, + tools::Rectangle& _orDocPreviewPaintRect, + const bool _bStartWithPageAtFirstCol = true + ); + + /** get selected page number */ + sal_uInt16 SelectedPage() + { + return mnSelectedPageNum; + } + + /** set selected page number */ + void SetSelectedPage( sal_uInt16 _nSelectedPageNum ) + { + mnSelectedPageNum = _nSelectedPageNum; + } + + /** paint prepared preview + + @param _aOutRect + input parameter - Twip rectangle of window, which should be painted. + + @return boolean, indicating, if paint of preview was performed + */ + bool Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rOutRect) const; + + /** repaint pages on page preview + + method to invalidate visible pages due to changes in a different + view shell. + */ + void Repaint(const tools::Rectangle& rInvalidCoreRect) const; + + /** paint to mark new selected page + + Perform paint for current selected page in order to unmark it. + Set new selected page and perform paint to mark this page. + + @param _nNewSelectedPage + input parameter - physical number of page, which will be marked as selected. + */ + void MarkNewSelectedPage( const sal_uInt16 _nSelectedPage ); + + /** calculate start position for new scale + + calculate new start position for a new scale. Calculation bases on the + current visible part of the document arranged in the given preview layout. + preconditions: + (1) new scaling is already set at the given output device. + + @return Point, start position for new scale + */ + Point GetPreviewStartPosForNewScale( const Fraction& _aNewScale, + const Fraction& _aOldScale, + const Size& _aNewWinSize ) const; + + /** determines, if page with given page number is visible in preview + + @param _nPageNum + input parameter - physical number of page, for which it will be + determined, if it is visible. + + @return boolean, indicating, if page with given page number is visible + in preview. + */ + bool IsPageVisible( const sal_uInt16 _nPageNum ) const; + + /** calculate data to bring new selected page into view. + + @param _nHoriMove + input parameter - positive/negative number of columns the current + selected page have to be moved. + + @param _nVertMove + input parameter - positive/negative number of rows the current + selected page have to be moved. + + @param _orNewSelectedPage + output parameter - number of new selected page + + @param _orNewStartPage + output parameter - number of new start page + + @param _orNewStartPos + output parameter - new start position in document preview + */ + void CalcStartValuesForSelectedPageMove( const sal_Int16 _nHoriMove, + const sal_Int16 _nVertMove, + sal_uInt16& _orNewSelectedPage, + sal_uInt16& _orNewStartPage, + Point& _orNewStartPos ) const; + + /** checks, if given position is inside a shown document page + + @param _aPreviewPos + input parameter - position inside the visible preview window. + + @param _orDocPos + output parameter - corresponding position in the document, if given + preview position is inside a shown document page, not an empty page. + If not, its value is <Point( 0, 0 )>. + + @param _obPosInEmptyPage + output parameter - indicates, that given preview position lays inside + an shown empty page. + + @param _onPageNum + output parameter - corresponding physical number of page, if given + preview position is inside a shown document page, considers also empty + pages. If not, its value is <0>. + + @return boolean - indicating, that given preview position lays inside + a shown document preview page, not an empty page. + */ + bool IsPreviewPosInDocPreviewPage( const Point& rPreviewPos, + Point& _orDocPos, + bool& _obPosInEmptyPage, + sal_uInt16& _onPageNum ) const; + + bool DoesPreviewLayoutRowsFitIntoWindow() const + { + return mbDoesLayoutRowsFitIntoWindow; + } + + bool DoesPreviewLayoutColsFitIntoWindow() const + { + return mbDoesLayoutColsFitIntoWindow; + } + + bool PreviewLayoutValid() const + { + return mbLayoutInfoValid && mbLayoutSizesValid && mbPaintInfoValid; + } + + /** determine preview window page scroll amount + + @param _nWinPagesToScroll + input parameter - number of preview window pages the scroll amount has + to be calculated for. Negative values for preview window page up + scrolling, positive values for preview window page down scrolling. + + @return scroll amount in SwTwips + */ + SwTwips GetWinPagesScrollAmount( const sal_Int16 _nWinPagesToScroll ) const; + + /** determine row the page with the given number is in + + @param _nPageNum + input parameter - physical page number of page, for which the row in + preview layout has to be calculated. + + @return number of row the page with the given physical page number is in + */ + sal_uInt16 GetRowOfPage( sal_uInt16 _nPageNum ) const; + + /** determine column the page with the given number is in + + @param _nPageNum + input parameter - physical page number of page, for which the column in + preview layout has to be calculated. + + @return number of column the page with the given physical page number is in + */ + sal_uInt16 GetColOfPage( sal_uInt16 _nPageNum ) const; + + Size GetPreviewDocSize() const; + + /** get size of a preview page by its physical page number + + @param _nPageNum + input parameter - physical page number of preview page, for which the + page size has to be returned. + + @return an object of class <Size> + */ + Size GetPreviewPageSizeByPageNum( sal_uInt16 _nPageNum ) const; + + /** get virtual page number by its physical page number + + @param _nPageNum + input parameter - physical page number of preview page, for which the + virtual page number has to be determined. + + @return virtual page number of page given by its physical page number, + if the page is in the current preview pages vector, otherwise 0. + */ + sal_uInt16 GetVirtPageNumByPageNum( sal_uInt16 _nPageNum ) const; + + /** enable/disable book preview */ + bool SetBookPreviewMode( const bool _bEnableBookPreview, + sal_uInt16& _onStartPageNum, + tools::Rectangle& _orDocPreviewPaintRect ); + + /** Convert relative to absolute page numbers (see PrintEmptyPages) */ + sal_uInt16 ConvertRelativeToAbsolutePageNum( sal_uInt16 _nRelPageNum ) const; + + /** Convert absolute to relative page numbers (see PrintEmptyPages) */ + sal_uInt16 ConvertAbsoluteToRelativePageNum( sal_uInt16 _nAbsPageNum ) const; + + SwViewShell& GetParentViewShell() + { + return mrParentViewShell; + } +}; + +#endif // INCLUDED_SW_INC_PAGEPREVIEWLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx new file mode 100644 index 000000000..f94c796d1 --- /dev/null +++ b/sw/inc/pam.hxx @@ -0,0 +1,284 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PAM_HXX +#define INCLUDED_SW_INC_PAM_HXX + +#include <sal/types.h> +#include "ring.hxx" +#include "index.hxx" +#include "ndindex.hxx" +#include "swdllapi.h" + +#include <iostream> + +class SwDoc; +class SwPaM; +class Point; + +/// Marks a position in the document model. +struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition +{ + SwNodeIndex nNode; + SwIndex nContent; + + SwPosition( const SwNodeIndex &rNode, const SwIndex &rContent ); + explicit SwPosition( const SwNodeIndex &rNode ); + explicit SwPosition( const SwNode& rNode ); + explicit SwPosition( SwContentNode& rNode, const sal_Int32 nOffset = 0 ); + + /** + Returns the document this position is in. + + @return the document this position is in. + */ + SwDoc * GetDoc() const; + + bool operator < (const SwPosition &) const; + bool operator > (const SwPosition &) const; + bool operator <=(const SwPosition &) const; + bool operator >=(const SwPosition &) const; + bool operator ==(const SwPosition &) const; + bool operator !=(const SwPosition &) const; + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +SW_DLLPUBLIC std::ostream &operator <<(std::ostream& s, const SwPosition& position); + +// Result of comparing positions. +enum class SwComparePosition { + Before, ///< Pos1 before Pos2. + Behind, ///< Pos1 behind Pos2. + Inside, ///< Pos1 completely contained in Pos2. + Outside, ///< Pos2 completely contained in Pos1. + Equal, ///< Pos1 is as large as Pos2. + OverlapBefore, ///< Pos1 overlaps Pos2 at the beginning. + OverlapBehind, ///< Pos1 overlaps Pos2 at the end. + CollideStart, ///< Pos1 start touches at Pos2 end. + CollideEnd ///< Pos1 end touches at Pos2 start. +}; + +template<typename T> +SwComparePosition ComparePosition( + const T& rStt1, const T& rEnd1, + const T& rStt2, const T& rEnd2 ) +{ + SwComparePosition nRet; + if( rStt1 < rStt2 ) + { + if( rEnd1 > rStt2 ) + { + if( rEnd1 >= rEnd2 ) + nRet = SwComparePosition::Outside; + else + nRet = SwComparePosition::OverlapBefore; + + } + else if( rEnd1 == rStt2 ) + nRet = SwComparePosition::CollideEnd; + else + nRet = SwComparePosition::Before; + } + else if( rEnd2 > rStt1 ) + { + if( rEnd2 >= rEnd1 ) + { + if( rEnd2 == rEnd1 && rStt2 == rStt1 ) + nRet = SwComparePosition::Equal; + else + nRet = SwComparePosition::Inside; + } + else + { + if (rStt1 == rStt2) + nRet = SwComparePosition::Outside; + else + nRet = SwComparePosition::OverlapBehind; + } + } + else if( rEnd2 == rStt1 ) + nRet = SwComparePosition::CollideStart; + else + nRet = SwComparePosition::Behind; + return nRet; +} + +/// SwPointAndMark / SwPaM +struct SwMoveFnCollection; +SW_DLLPUBLIC extern SwMoveFnCollection const & fnMoveForward; ///< SwPam::Move()/Find() default argument. +SW_DLLPUBLIC extern SwMoveFnCollection const & fnMoveBackward; + +using SwGoInDoc = auto (*)(SwPaM& rPam, SwMoveFnCollection const & fnMove) -> bool; +SW_DLLPUBLIC bool GoInDoc( SwPaM&, SwMoveFnCollection const &); +bool GoInSection( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInNode( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoInContent( SwPaM&, SwMoveFnCollection const &); +bool GoInContentCells( SwPaM&, SwMoveFnCollection const &); +bool GoInContentSkipHidden( SwPaM&, SwMoveFnCollection const &); +bool GoInContentCellsSkipHidden( SwPaM&, SwMoveFnCollection const &); + +/// PaM is Point and Mark: a selection of the document model. +class SAL_WARN_UNUSED SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM> +{ + SwPosition m_Bound1; + SwPosition m_Bound2; + SwPosition * m_pPoint; ///< points at either m_Bound1 or m_Bound2 + SwPosition * m_pMark; ///< points at either m_Bound1 or m_Bound2 + bool m_bIsInFrontOfLabel; + + SwPaM(SwPaM const& rPaM) = delete; + +public: + explicit SwPaM( const SwPosition& rPos, SwPaM* pRing = nullptr ); + SwPaM( const SwPosition& rMk, const SwPosition& rPt, SwPaM* pRing = nullptr ); + SwPaM( const SwNodeIndex& rMk, const SwNodeIndex& rPt, + long nMkOffset = 0, long nPtOffset = 0, SwPaM* pRing = nullptr ); + SwPaM( const SwNode& rMk, const SwNode& rPt, + long nMkOffset = 0, long nPtOffset = 0, SwPaM* pRing = nullptr ); + SwPaM( const SwNodeIndex& rMk, sal_Int32 nMkContent, + const SwNodeIndex& rPt, sal_Int32 nPtContent, SwPaM* pRing = nullptr ); + SwPaM( const SwNode& rMk, sal_Int32 nMkContent, + const SwNode& rPt, sal_Int32 nPtContent, SwPaM* pRing = nullptr ); + SwPaM( const SwNode& rNd, sal_Int32 nContent = 0, SwPaM* pRing = nullptr ); + SwPaM( const SwNodeIndex& rNd, sal_Int32 nContent = 0, SwPaM* pRing = nullptr ); + virtual ~SwPaM() override; + + /// this takes a second parameter, which indicates the Ring that + /// the new PaM should be part of (may be null) + SwPaM(SwPaM const& rPaM, SwPaM * pRing); + /// @@@ semantic: no copy assignment for super class Ring. + SwPaM& operator=( const SwPaM & ); + + /// Movement of cursor. + bool Move( SwMoveFnCollection const & fnMove = fnMoveForward, + SwGoInDoc fnGo = GoInContent ); + + bool IsInFrontOfLabel() const { return m_bIsInFrontOfLabel; } + void SetInFrontOfLabel_( bool bNew ) { m_bIsInFrontOfLabel = bNew; } + + /// Unless this is called, the getter method of Mark will return Point. + virtual void SetMark(); + + void DeleteMark() + { + if (m_pMark != m_pPoint) + { + /** clear the mark position; this helps if mark's SwIndex is + registered at some node, and that node is then deleted */ + *m_pMark = SwPosition( SwNodeIndex( GetNode().GetNodes() ) ); + m_pMark = m_pPoint; + } + } +#ifdef DBG_UTIL + void Exchange(); + +#else + void Exchange() + { + if (m_pPoint != m_pMark) + { + SwPosition *pTmp = m_pPoint; + m_pPoint = m_pMark; + m_pMark = pTmp; + } + } +#endif + + /** A PaM marks a selection if Point and Mark are distinct positions. + @return true if the PaM spans a selection + */ + bool HasMark() const { return m_pPoint != m_pMark; } + + const SwPosition *GetPoint() const { return m_pPoint; } + SwPosition *GetPoint() { return m_pPoint; } + const SwPosition *GetMark() const { return m_pMark; } + SwPosition *GetMark() { return m_pMark; } + + const SwPosition *Start() const + { return (*m_pPoint) <= (*m_pMark) ? m_pPoint : m_pMark; } + SwPosition *Start() + { return (*m_pPoint) <= (*m_pMark) ? m_pPoint : m_pMark; } + + const SwPosition *End() const + { return (*m_pPoint) > (*m_pMark) ? m_pPoint : m_pMark; } + SwPosition *End() + { return (*m_pPoint) > (*m_pMark) ? m_pPoint : m_pMark; } + + /// @return current Node at Point/Mark + SwNode & GetNode ( bool bPoint = true ) const + { + return ( bPoint ? m_pPoint->nNode : m_pMark->nNode ).GetNode(); + } + + /// @return current ContentNode at Point/Mark + SwContentNode* GetContentNode( bool bPoint = true ) const + { + return GetNode(bPoint).GetContentNode(); + } + + /** + Normalizes PaM, i.e. sort point and mark. + + @param bPointFirst true: If the point is behind the mark then swap. + false: If the mark is behind the point then swap. + */ + void Normalize(bool bPointFirst = true); + + /// @return the document (SwDoc) at which the PaM is registered + SwDoc* GetDoc() const { return m_pPoint->nNode.GetNode().GetDoc(); } + + SwPosition& GetBound( bool bOne = true ) + { return bOne ? m_Bound1 : m_Bound2; } + const SwPosition& GetBound( bool bOne = true ) const + { return bOne ? m_Bound1 : m_Bound2; } + + /// Get number of page which contains cursor. + sal_uInt16 GetPageNum( bool bAtPoint = true, const Point* pLayPos = nullptr ); + + /** Is in something protected (readonly) or selection contains + something protected. */ + bool HasReadonlySel( bool bFormView ) const; + + bool ContainsPosition(const SwPosition & rPos) const + { + return *Start() <= rPos && rPos <= *End(); + } + + OUString GetText() const; + void InvalidatePaM(); + SwPaM* GetNext() + { return GetNextInRing(); } + const SwPaM* GetNext() const + { return GetNextInRing(); } + SwPaM* GetPrev() + { return GetPrevInRing(); } + const SwPaM* GetPrev() const + { return GetPrevInRing(); } + bool IsMultiSelection() const + { return !unique(); } + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +SW_DLLPUBLIC std::ostream &operator <<(std::ostream& s, const SwPaM& pam); + +bool CheckNodesRange(const SwNodeIndex&, const SwNodeIndex&, bool bChkSection); + +#endif // INCLUDED_SW_INC_PAM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx new file mode 100644 index 000000000..7cc18282e --- /dev/null +++ b/sw/inc/paratr.hxx @@ -0,0 +1,223 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PARATR_HXX +#define INCLUDED_SW_INC_PARATR_HXX +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "calbck.hxx" +#include "swatrset.hxx" +#include "format.hxx" +#include "charfmt.hxx" +#include <editeng/adjustitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/spltitem.hxx> +#include <editeng/widwitem.hxx> +#include <editeng/orphitem.hxx> +#include <editeng/tstpitem.hxx> +#include <editeng/hyphenzoneitem.hxx> +#include <editeng/scriptspaceitem.hxx> +#include <editeng/hngpnctitem.hxx> +#include <editeng/forbiddenruleitem.hxx> +#include <editeng/paravertalignitem.hxx> +#include <editeng/pgrditem.hxx> + +class IntlWrapper; + +#define DROP_WHOLEWORD ((sal_uInt16)0x0001) + +/** If SwFormatDrop is a Client, it is the CharFormat that describes the font for the + DropCaps. If it is not a Client, formatting uses the CharFormat of the paragraph. + If the CharFormat is modified, this change is propagated to the paragraphs + via the Modify of SwFormatDrop. */ +class SW_DLLPUBLIC SwFormatDrop: public SfxPoolItem, public SwClient +{ + SwModify* m_pDefinedIn; /**< Modify-Object, that contains DropCaps. + Can only be TextFormatCollection/TextNode. */ + sal_uInt16 m_nDistance; ///< Distance to beginning of text. + sal_uInt8 m_nLines; ///< Line count. + sal_uInt8 m_nChars; ///< Character count. + bool m_bWholeWord; ///< First word with initials. +public: + static SfxPoolItem* CreateDefault(); + + SwFormatDrop(); + virtual ~SwFormatDrop() override; + + // @@@ public copy ctor, but no copy assignment? + SwFormatDrop( const SwFormatDrop & ); +private: + // @@@ public copy ctor, but no copy assignment? + SwFormatDrop & operator= (const SwFormatDrop &) = delete; + +protected: + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; + +public: + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwFormatDrop* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + sal_uInt8 GetLines() const { return m_nLines; } + sal_uInt8 &GetLines() { return m_nLines; } + + sal_uInt8 GetChars() const { return m_nChars; } + sal_uInt8 &GetChars() { return m_nChars; } + + bool GetWholeWord() const { return m_bWholeWord; } + bool &GetWholeWord() { return m_bWholeWord; } + + sal_uInt16 GetDistance() const { return m_nDistance; } + sal_uInt16 &GetDistance() { return m_nDistance; } + + const SwCharFormat *GetCharFormat() const { return static_cast<const SwCharFormat*>(GetRegisteredIn()); } + SwCharFormat *GetCharFormat() { return static_cast<SwCharFormat*>(GetRegisteredIn()); } + void SetCharFormat( SwCharFormat *pNew ); + /// Get information from Client. + virtual bool GetInfo( SfxPoolItem& ) const override; + + /// Get and set Modify pointer. + const SwModify* GetDefinedIn() const { return m_pDefinedIn; } + void ChgDefinedIn( const SwModify* pNew ) + { m_pDefinedIn = const_cast<SwModify*>(pNew); } +}; + +class SwRegisterItem : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + inline SwRegisterItem( const bool bRegister = false ); + + /// "pure virtual methods" of SfxPoolItem + virtual SwRegisterItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +inline SwRegisterItem::SwRegisterItem( const bool bRegister ) : + SfxBoolItem( RES_PARATR_REGISTER, bRegister ) +{} + +class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SwNumRuleItem() + : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {} + + SwNumRuleItem( const OUString& rRuleName ) + : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {} + + SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy + + /// "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwNumRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +class SwParaConnectBorderItem : public SfxBoolItem +{ +public: + + inline SwParaConnectBorderItem( const bool bConnect = true ); + + /// "pure virtual methods" of SfxPoolItem + virtual SwParaConnectBorderItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; +}; + +inline SwParaConnectBorderItem::SwParaConnectBorderItem( const bool bConnect ) : + SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect ) +{} + +// Implementation of paragraph-attributes methods of SwAttrSet +inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const + { return Get( RES_PARATR_LINESPACING,bInP); } +inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const + { return Get( RES_PARATR_ADJUST,bInP); } +inline const SvxFormatSplitItem &SwAttrSet::GetSplit(bool bInP) const + { return Get( RES_PARATR_SPLIT,bInP); } +inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const + { return Get( RES_PARATR_REGISTER,bInP); } +inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const + { return Get( RES_PARATR_WIDOWS,bInP); } +inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const + { return Get( RES_PARATR_ORPHANS,bInP); } +inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const + { return Get( RES_PARATR_TABSTOP,bInP); } +inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const + { return Get(RES_PARATR_HYPHENZONE,bInP); } +inline const SwFormatDrop &SwAttrSet::GetDrop(bool bInP) const + { return Get(RES_PARATR_DROP,bInP); } +inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const + { return Get(RES_PARATR_NUMRULE,bInP); } +inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const + { return Get(RES_PARATR_SCRIPTSPACE,bInP); } +inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(bool bInP) const + { return Get(RES_PARATR_HANGINGPUNCTUATION,bInP); } +inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const + { return Get(RES_PARATR_FORBIDDEN_RULES, bInP); } +inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const + { return Get( RES_PARATR_VERTALIGN, bInP ); } +inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const + { return Get( RES_PARATR_SNAPTOGRID, bInP ); } +inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(bool bInP) const + { return Get( RES_PARATR_CONNECT_BORDER, bInP ); } + +// Implementation of paragraph-attributes methods of SwFormat +inline const SvxLineSpacingItem &SwFormat::GetLineSpacing(bool bInP) const + { return m_aSet.GetLineSpacing(bInP); } +inline const SvxTabStopItem &SwFormat::GetTabStops(bool bInP) const + { return m_aSet.GetTabStops(bInP); } +inline const SwFormatDrop &SwFormat::GetDrop(bool bInP) const + { return m_aSet.GetDrop(bInP); } +inline const SwNumRuleItem &SwFormat::GetNumRule(bool bInP) const + { return m_aSet.GetNumRule(bInP); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pausethreadstarting.hxx b/sw/inc/pausethreadstarting.hxx new file mode 100644 index 000000000..606863909 --- /dev/null +++ b/sw/inc/pausethreadstarting.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PAUSETHREADSTARTING_HXX +#define INCLUDED_SW_INC_PAUSETHREADSTARTING_HXX + +#include <sal/types.h> + +/** Helper class to pause starting of threads during existence of an instance + of this class + + #i73788# +*/ +class SwPauseThreadStarting +{ + public: + + SwPauseThreadStarting(); + ~SwPauseThreadStarting() COVERITY_NOEXCEPT_FALSE; + + private: + + bool mbPausedThreadStarting; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_msword.cxx b/sw/inc/pch/precompiled_msword.cxx new file mode 100644 index 000000000..16cc0c969 --- /dev/null +++ b/sw/inc/pch/precompiled_msword.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#include "precompiled_msword.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx new file mode 100644 index 000000000..4da659a51 --- /dev/null +++ b/sw/inc/pch/precompiled_msword.hxx @@ -0,0 +1,585 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-04-25 20:55:41 using: + ./bin/update_pch sw msword --cutoff=4 --exclude:system --include:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./sw/inc/pch/precompiled_msword.hxx "make sw.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <array> +#include <assert.h> +#include <cassert> +#include <climits> +#include <cmath> +#include <cstddef> +#include <cstring> +#include <deque> +#include <float.h> +#include <functional> +#include <initializer_list> +#include <iomanip> +#include <iostream> +#include <iterator> +#include <limits.h> +#include <limits> +#include <list> +#include <locale> +#include <map> +#include <math.h> +#include <memory> +#include <new> +#include <optional> +#include <ostream> +#include <set> +#include <stddef.h> +#include <string.h> +#include <string> +#include <string_view> +#include <type_traits> +#include <typeinfo> +#include <unordered_map> +#include <unordered_set> +#include <utility> +#include <vector> +#include <boost/multi_index/composite_key.hpp> +#include <boost/multi_index/identity.hpp> +#include <boost/multi_index/mem_fun.hpp> +#include <boost/multi_index/ordered_index.hpp> +#include <boost/multi_index/random_access_index.hpp> +#include <boost/multi_index_container.hpp> +#include <boost/property_tree/ptree_fwd.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/diagnose.h> +#include <osl/doublecheckedlocking.h> +#include <osl/endian.h> +#include <osl/file.hxx> +#include <osl/getglobalmutex.hxx> +#include <osl/interlck.h> +#include <osl/mutex.h> +#include <osl/mutex.hxx> +#include <osl/thread.h> +#include <osl/time.h> +#include <rtl/alloc.h> +#include <rtl/character.hxx> +#include <rtl/cipher.h> +#include <rtl/digest.h> +#include <rtl/instance.hxx> +#include <rtl/locale.h> +#include <rtl/math.h> +#include <rtl/math.hxx> +#include <rtl/random.h> +#include <rtl/ref.hxx> +#include <rtl/strbuf.h> +#include <rtl/strbuf.hxx> +#include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/tencinfo.h> +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/ustrbuf.h> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <rtl/uuid.h> +#include <sal/config.h> +#include <sal/detail/log.h> +#include <sal/log.hxx> +#include <sal/macros.h> +#include <sal/mathconf.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <sal/typesizes.h> +#include <vcl/GraphicExternalLink.hxx> +#include <vcl/GraphicObject.hxx> +#include <vcl/IDialogRenderable.hxx> +#include <vcl/Scanline.hxx> +#include <vcl/alpha.hxx> +#include <vcl/animate/Animation.hxx> +#include <vcl/animate/AnimationBitmap.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/cairo.hxx> +#include <vcl/checksum.hxx> +#include <vcl/devicecoordinate.hxx> +#include <vcl/dllapi.h> +#include <vcl/errcode.hxx> +#include <vcl/fntstyle.hxx> +#include <vcl/font.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/gfxlink.hxx> +#include <vcl/graph.hxx> +#include <vcl/idle.hxx> +#include <vcl/keycod.hxx> +#include <vcl/keycodes.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/menu.hxx> +#include <vcl/metaactiontypes.hxx> +#include <vcl/outdev.hxx> +#include <vcl/outdevmap.hxx> +#include <vcl/outdevstate.hxx> +#include <vcl/ptrstyle.hxx> +#include <vcl/region.hxx> +#include <vcl/salnativewidgets.hxx> +#include <vcl/scopedbitmapaccess.hxx> +#include <vcl/svapp.hxx> +#include <vcl/task.hxx> +#include <vcl/timer.hxx> +#include <vcl/uitest/factory.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/vclreferencebase.hxx> +#include <vcl/vectorgraphicdata.hxx> +#include <vcl/wall.hxx> +#include <vcl/weld.hxx> +#include <vcl/window.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/b2irange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/tuple/b2i64tuple.hxx> +#include <basegfx/tuple/b2ituple.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/utils/common.hxx> +#include <basegfx/vector/b2dsize.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <basic/basicdllapi.h> +#include <basic/sbdef.hxx> +#include <basic/sbx.hxx> +#include <basic/sbxcore.hxx> +#include <basic/sbxdef.hxx> +#include <basic/sbxobj.hxx> +#include <basic/sbxvar.hxx> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> +#include <com/sun/star/awt/GradientStyle.hpp> +#include <com/sun/star/awt/Key.hpp> +#include <com/sun/star/awt/KeyGroup.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/awt/SystemPointer.hpp> +#include <com/sun/star/awt/XBitmap.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/document/EventObject.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/drawing/BitmapMode.hpp> +#include <com/sun/star/drawing/DashStyle.hpp> +#include <com/sun/star/drawing/Hatch.hpp> +#include <com/sun/star/drawing/HatchStyle.hpp> +#include <com/sun/star/drawing/LineCap.hpp> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/geometry/IntegerRectangle2D.hpp> +#include <com/sun/star/graphic/XPrimitive2D.hpp> +#include <com/sun/star/i18n/Calendar2.hpp> +#include <com/sun/star/i18n/CollatorOptions.hpp> +#include <com/sun/star/i18n/ForbiddenCharacters.hpp> +#include <com/sun/star/i18n/LanguageCountryInfo.hpp> +#include <com/sun/star/i18n/LocaleDataItem2.hpp> +#include <com/sun/star/i18n/LocaleItem.hpp> +#include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/reservedWords.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/style/TabAlign.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/text/RubyAdjust.hpp> +#include <com/sun/star/text/textfield/Type.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/TypeClass.hdl> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XWeak.hpp> +#include <com/sun/star/uno/genfunc.h> +#include <com/sun/star/uno/genfunc.hxx> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/XAccounting.hpp> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/processfactory.hxx> +#include <comphelper/propertysequence.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <comphelper/servicehelper.hxx> +#include <comphelper/string.hxx> +#include <comphelper/weak.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/compbase_ex.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implbase_ex.hxx> +#include <cppuhelper/implbase_ex_post.hxx> +#include <cppuhelper/implbase_ex_pre.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakagg.hxx> +#include <cppuhelper/weakref.hxx> +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/primitive2d/CommonTypes.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> +#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <editeng/autokernitem.hxx> +#include <editeng/blinkitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/charhiddenitem.hxx> +#include <editeng/charreliefitem.hxx> +#include <editeng/charrotateitem.hxx> +#include <editeng/charscaleitem.hxx> +#include <editeng/cmapitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/contouritem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/editdata.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/editobj.hxx> +#include <editeng/editstat.hxx> +#include <editeng/editview.hxx> +#include <editeng/eedata.hxx> +#include <editeng/emphasismarkitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/flditem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/forbiddencharacterstable.hxx> +#include <editeng/formatbreakitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <editeng/hyphenzoneitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/opaqitem.hxx> +#include <editeng/outliner.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/paragraphdata.hxx> +#include <editeng/paravertalignitem.hxx> +#include <editeng/pgrditem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/spltitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/svxfont.hxx> +#include <editeng/tstpitem.hxx> +#include <editeng/twolinesitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/widwitem.hxx> +#include <filter/msfilter/msfilterdllapi.h> +#include <i18nlangtag/i18nlangtagdllapi.h> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <i18nutil/transliteration.hxx> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/enumarray.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/sorted_vector.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/underlyingenumvalue.hxx> +#include <ooo/vba/XHelperInterface.hpp> +#include <ooo/vba/word/XParagraphFormat.hpp> +#include <oox/dllapi.h> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/export/utils.hxx> +#include <oox/helper/binarystreambase.hxx> +#include <oox/helper/helper.hxx> +#include <oox/helper/refmap.hxx> +#include <oox/helper/storagebase.hxx> +#include <oox/token/tokens.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <sax/fshelper.hxx> +#include <sax/saxdllapi.h> +#include <sfx2/dllapi.h> +#include <sfx2/docfile.hxx> +#include <sot/formats.hxx> +#include <sot/object.hxx> +#include <sot/sotdllapi.h> +#include <svl/SfxBroadcaster.hxx> +#include <svl/broadcast.hxx> +#include <svl/cenumitm.hxx> +#include <svl/cintitem.hxx> +#include <svl/custritm.hxx> +#include <svl/eitem.hxx> +#include <svl/grabbagitem.hxx> +#include <svl/hint.hxx> +#include <svl/intitem.hxx> +#include <svl/itemiter.hxx> +#include <svl/itemset.hxx> +#include <svl/languageoptions.hxx> +#include <svl/lstner.hxx> +#include <svl/metitem.hxx> +#include <svl/poolitem.hxx> +#include <svl/stritem.hxx> +#include <svl/style.hxx> +#include <svl/stylesheetuser.hxx> +#include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> +#include <svl/undo.hxx> +#include <svl/urihelper.hxx> +#include <svl/whiter.hxx> +#include <svtools/colorcfg.hxx> +#include <svtools/optionsdrawinglayer.hxx> +#include <svtools/svtdllapi.h> +#include <svx/DiagramDataInterface.hxx> +#include <svx/XPropertyEntry.hxx> +#include <svx/ipolypolygoneditorcontroller.hxx> +#include <svx/itextprovider.hxx> +#include <svx/msdffdef.hxx> +#include <svx/sdmetitm.hxx> +#include <svx/sdooitm.hxx> +#include <svx/sdr/animation/scheduler.hxx> +#include <svx/sdr/overlay/overlayobject.hxx> +#include <svx/sdr/overlay/overlayobjectlist.hxx> +#include <svx/sdr/properties/defaultproperties.hxx> +#include <svx/sdr/properties/properties.hxx> +#include <svx/sdrobjectuser.hxx> +#include <svx/sdtaditm.hxx> +#include <svx/sdtaitm.hxx> +#include <svx/sdtakitm.hxx> +#include <svx/selectioncontroller.hxx> +#include <svx/shapeproperty.hxx> +#include <svx/svddef.hxx> +#include <svx/svddrag.hxx> +#include <svx/svdedtv.hxx> +#include <svx/svdedxv.hxx> +#include <svx/svdglev.hxx> +#include <svx/svdglue.hxx> +#include <svx/svdhdl.hxx> +#include <svx/svdhlpln.hxx> +#include <svx/svdlayer.hxx> +#include <svx/svdmark.hxx> +#include <svx/svdmodel.hxx> +#include <svx/svdmrkv.hxx> +#include <svx/svdoattr.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdoedge.hxx> +#include <svx/svdoole2.hxx> +#include <svx/svdorect.hxx> +#include <svx/svdotext.hxx> +#include <svx/svdouno.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdpntv.hxx> +#include <svx/svdpoev.hxx> +#include <svx/svdsnpv.hxx> +#include <svx/svdsob.hxx> +#include <svx/svdtext.hxx> +#include <svx/svdtrans.hxx> +#include <svx/svdtypes.hxx> +#include <svx/svdundo.hxx> +#include <svx/svdxcgv.hxx> +#include <svx/svxdllapi.h> +#include <svx/unoapi.hxx> +#include <svx/xdash.hxx> +#include <svx/xdef.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xflclit.hxx> +#include <svx/xgrad.hxx> +#include <svx/xhatch.hxx> +#include <svx/xit.hxx> +#include <svx/xpoly.hxx> +#include <svx/xtable.hxx> +#include <tools/color.hxx> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> +#include <tools/fldunit.hxx> +#include <tools/fontenum.hxx> +#include <tools/fract.hxx> +#include <tools/gen.hxx> +#include <tools/helpers.hxx> +#include <tools/lineend.hxx> +#include <tools/link.hxx> +#include <tools/mapunit.hxx> +#include <tools/poly.hxx> +#include <tools/ref.hxx> +#include <tools/solar.h> +#include <tools/stream.hxx> +#include <tools/time.hxx> +#include <tools/toolsdllapi.h> +#include <tools/weakbase.h> +#include <tools/weakbase.hxx> +#include <tools/wintypes.hxx> +#include <typelib/typeclass.h> +#include <typelib/typedescription.h> +#include <typelib/uik.h> +#include <ucbhelper/ucbhelperdllapi.h> +#include <uno/any2.h> +#include <uno/data.h> +#include <uno/sequence2.h> +#include <unotools/calendarwrapper.hxx> +#include <unotools/configitem.hxx> +#include <unotools/fltrcfg.hxx> +#include <unotools/fontdefs.hxx> +#include <unotools/localedatawrapper.hxx> +#include <unotools/nativenumberwrapper.hxx> +#include <unotools/options.hxx> +#include <unotools/readwritemutexguard.hxx> +#include <unotools/syslocale.hxx> +#include <unotools/transliterationwrapper.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/unotoolsdllapi.h> +#include <vbahelper/vbadllapi.h> +#include <vbahelper/vbahelper.hxx> +#include <vbahelper/vbahelperinterface.hxx> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <IDocumentDrawModelAccess.hxx> +#include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> +#include <IDocumentMarkAccess.hxx> +#include <IDocumentSettingAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> +#include <IMark.hxx> +#include <SwRewriter.hxx> +#include <bparr.hxx> +#include <breakit.hxx> +#include <calbck.hxx> +#include <charfmt.hxx> +#include <doc.hxx> +#include <docary.hxx> +#include <docsh.hxx> +#include <docufld.hxx> +#include <drawdoc.hxx> +#include <fchrfmt.hxx> +#include <fldbas.hxx> +#include <fmtanchr.hxx> +#include <fmtautofmt.hxx> +#include <fmtclds.hxx> +#include <fmtcntnt.hxx> +#include <fmtcol.hxx> +#include <fmtflcnt.hxx> +#include <fmtfld.hxx> +#include <fmtfsize.hxx> +#include <fmtftn.hxx> +#include <fmthdft.hxx> +#include <fmtinfmt.hxx> +#include <fmtline.hxx> +#include <fmtornt.hxx> +#include <fmtpdsc.hxx> +#include <fmtrfmrk.hxx> +#include <fmtrowsplt.hxx> +#include <fmtruby.hxx> +#include <fmturl.hxx> +#include <format.hxx> +#include <frmatr.hxx> +#include <frmfmt.hxx> +#include <ftninfo.hxx> +#include <grfatr.hxx> +#include <hintids.hxx> +#include <index.hxx> +#include <lineinfo.hxx> +#include <mdiexp.hxx> +#include <msfilter.hxx> +#include <ndarr.hxx> +#include <ndgrf.hxx> +#include <ndhints.hxx> +#include <ndindex.hxx> +#include <ndole.hxx> +#include <ndtxt.hxx> +#include <ndtyp.hxx> +#include <node.hxx> +#include <numrule.hxx> +#include <pagedesc.hxx> +#include <pam.hxx> +#include <paratr.hxx> +#include <poolfmt.hxx> +#include <redline.hxx> +#include <reffld.hxx> +#include <ring.hxx> +#include <section.hxx> +#include <shellio.hxx> +#include <swdllapi.h> +#include <swerror.h> +#include <swmodule.hxx> +#include <swrect.hxx> +#include <swtable.hxx> +#include <swtypes.hxx> +#include <swundo.hxx> +#include <tox.hxx> +#include <txatbase.hxx> +#include <txtftn.hxx> +#include <undobj.hxx> +#include <unobaseclass.hxx> +#include <viewsh.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_sw.cxx b/sw/inc/pch/precompiled_sw.cxx new file mode 100644 index 000000000..8688745b1 --- /dev/null +++ b/sw/inc/pch/precompiled_sw.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#include "precompiled_sw.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx new file mode 100644 index 000000000..d52da985f --- /dev/null +++ b/sw/inc/pch/precompiled_sw.hxx @@ -0,0 +1,663 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-04-25 20:55:50 using: + ./bin/update_pch sw sw --cutoff=7 --exclude:system --exclude:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./sw/inc/pch/precompiled_sw.hxx "make sw.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <array> +#include <assert.h> +#include <cassert> +#include <cstddef> +#include <deque> +#include <functional> +#include <initializer_list> +#include <limits.h> +#include <limits> +#include <list> +#include <map> +#include <memory> +#include <new> +#include <optional> +#include <ostream> +#include <set> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <string_view> +#include <type_traits> +#include <unordered_map> +#include <unordered_set> +#include <utility> +#include <vector> +#include <boost/circular_buffer.hpp> +#include <boost/property_tree/json_parser.hpp> +#include <boost/property_tree/ptree_fwd.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/conditn.hxx> +#include <osl/diagnose.h> +#include <osl/doublecheckedlocking.h> +#include <osl/endian.h> +#include <osl/file.hxx> +#include <osl/getglobalmutex.hxx> +#include <osl/interlck.h> +#include <osl/module.hxx> +#include <osl/mutex.hxx> +#include <osl/thread.hxx> +#include <rtl/alloc.h> +#include <rtl/bootstrap.hxx> +#include <rtl/character.hxx> +#include <rtl/instance.hxx> +#include <rtl/math.hxx> +#include <rtl/ref.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/string.h> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/tencinfo.h> +#include <rtl/textenc.h> +#include <rtl/unload.h> +#include <rtl/uri.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.hxx> +#include <sal/config.h> +#include <sal/detail/log.h> +#include <sal/log.hxx> +#include <sal/macros.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <sal/typesizes.h> +#include <vcl/EnumContext.hxx> +#include <vcl/GraphicObject.hxx> +#include <vcl/Scanline.hxx> +#include <vcl/alpha.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/builderpage.hxx> +#include <vcl/commandevent.hxx> +#include <vcl/dllapi.h> +#include <vcl/dockwin.hxx> +#include <vcl/errcode.hxx> +#include <vcl/errinf.hxx> +#include <vcl/event.hxx> +#include <vcl/fntstyle.hxx> +#include <vcl/font.hxx> +#include <vcl/graph.hxx> +#include <vcl/help.hxx> +#include <vcl/idle.hxx> +#include <vcl/image.hxx> +#include <vcl/imap.hxx> +#include <vcl/imapobj.hxx> +#include <vcl/keycod.hxx> +#include <vcl/metric.hxx> +#include <vcl/outdev.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/transfer.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/virdev.hxx> +#include <vcl/weld.hxx> +#include <vcl/window.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/datatransfer/XTransferable2.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> +#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp> +#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/TypeClass.hdl> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/XAccounting.hpp> +#include <com/sun/star/xml/sax/XFastContextHandler.hpp> +#include <comphelper/classids.hxx> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/fileformat.h> +#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/lok.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/propertysequence.hxx> +#include <comphelper/scopeguard.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> +#include <comphelper/storagehelper.hxx> +#include <comphelper/string.hxx> +#include <comphelper/weak.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/compbase_ex.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/primitive2d/CommonTypes.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> +#include <editeng/acorrcfg.hxx> +#include <editeng/adjustitem.hxx> +#include <editeng/blinkitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/charhiddenitem.hxx> +#include <editeng/charrotateitem.hxx> +#include <editeng/cmapitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/contouritem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/editeng.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/editview.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/formatbreakitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <editeng/hyphenzoneitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/memberids.h> +#include <editeng/opaqitem.hxx> +#include <editeng/orphitem.hxx> +#include <editeng/outliner.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/paperinf.hxx> +#include <editeng/pbinitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/protitem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/sizeitem.hxx> +#include <editeng/spltitem.hxx> +#include <editeng/svxacorr.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/tstpitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/widwitem.hxx> +#include <editeng/xmlcnitm.hxx> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <libxml/xmlwriter.h> +#include <o3tl/any.hxx> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/deleter.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/sorted_vector.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/underlyingenumvalue.hxx> +#include <salhelper/salhelperdllapi.h> +#include <salhelper/simplereferenceobject.hxx> +#include <salhelper/singletonref.hxx> +#include <sax/fastattribs.hxx> +#include <sfx2/app.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/dllapi.h> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/event.hxx> +#include <sfx2/fcontnr.hxx> +#include <sfx2/filedlghelper.hxx> +#include <sfx2/frame.hxx> +#include <sfx2/htmlmode.hxx> +#include <sfx2/linkmgr.hxx> +#include <sfx2/lokhelper.hxx> +#include <sfx2/msg.hxx> +#include <sfx2/objface.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/request.hxx> +#include <sfx2/shell.hxx> +#include <sfx2/stbitem.hxx> +#include <sfx2/tabdlg.hxx> +#include <sfx2/tbxctrl.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/viewsh.hxx> +#include <sot/exchange.hxx> +#include <sot/formats.hxx> +#include <sot/storage.hxx> +#include <svl/SfxBroadcaster.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> +#include <svl/eitem.hxx> +#include <svl/hint.hxx> +#include <svl/intitem.hxx> +#include <svl/itemiter.hxx> +#include <svl/itempool.hxx> +#include <svl/itemprop.hxx> +#include <svl/itemset.hxx> +#include <svl/languageoptions.hxx> +#include <svl/listener.hxx> +#include <svl/lstner.hxx> +#include <svl/macitem.hxx> +#include <svl/metitem.hxx> +#include <svl/poolitem.hxx> +#include <svl/ptitem.hxx> +#include <svl/slstitm.hxx> +#include <svl/srchitem.hxx> +#include <svl/stritem.hxx> +#include <svl/style.hxx> +#include <svl/stylesheetuser.hxx> +#include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> +#include <svl/urihelper.hxx> +#include <svl/whiter.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> +#include <svtools/ctrltool.hxx> +#include <svtools/embedhlp.hxx> +#include <svtools/htmlcfg.hxx> +#include <svtools/htmlkywd.hxx> +#include <svtools/htmlout.hxx> +#include <svtools/htmltokn.h> +#include <svtools/popupwindowcontroller.hxx> +#include <svtools/svtdllapi.h> +#include <svx/dataaccessdescriptor.hxx> +#include <svx/drawitem.hxx> +#include <svx/hlnkitem.hxx> +#include <svx/pageitem.hxx> +#include <svx/ruler.hxx> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svx/srchdlg.hxx> +#include <svx/svddef.hxx> +#include <svx/svditer.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdogrp.hxx> +#include <svx/svdotext.hxx> +#include <svx/svdouno.hxx> +#include <svx/svdoutl.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdpagv.hxx> +#include <svx/svdtypes.hxx> +#include <svx/svdview.hxx> +#include <svx/svxdlg.hxx> +#include <svx/svxdllapi.h> +#include <svx/unobrushitemhelper.hxx> +#include <svx/unomid.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/xdef.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xflclit.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/color.hxx> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <tools/datetimeutils.hxx> +#include <tools/diagnose_ex.h> +#include <tools/fldunit.hxx> +#include <tools/fontenum.hxx> +#include <tools/fract.hxx> +#include <tools/gen.hxx> +#include <tools/globname.hxx> +#include <tools/link.hxx> +#include <tools/mapunit.hxx> +#include <tools/ref.hxx> +#include <tools/solar.h> +#include <tools/stream.hxx> +#include <tools/time.hxx> +#include <tools/toolsdllapi.h> +#include <tools/urlobj.hxx> +#include <typelib/typedescription.h> +#include <uno/any2.h> +#include <uno/sequence2.h> +#include <unotools/accessiblestatesethelper.hxx> +#include <unotools/charclass.hxx> +#include <unotools/configitem.hxx> +#include <unotools/configmgr.hxx> +#include <unotools/lingucfg.hxx> +#include <unotools/localedatawrapper.hxx> +#include <unotools/moduleoptions.hxx> +#include <unotools/options.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/syslocale.hxx> +#include <unotools/tempfile.hxx> +#include <unotools/transliterationwrapper.hxx> +#include <unotools/unotoolsdllapi.h> +#include <unotools/useroptions.hxx> +#include <xmloff/dllapi.h> +#include <xmloff/families.hxx> +#include <xmloff/nmspmap.hxx> +#include <xmloff/odffields.hxx> +#include <xmloff/xmlictxt.hxx> +#include <xmloff/xmlnmspe.hxx> +#include <xmloff/xmlstyle.hxx> +#include <xmloff/xmluconv.hxx> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <AnnotationWin.hxx> +#include <DocumentContentOperationsManager.hxx> +#include <DocumentRedlineManager.hxx> +#include <DocumentSettingManager.hxx> +#include <EnhancedPDFExportHelper.hxx> +#include <FrameControlsManager.hxx> +#include <IDocumentChartDataProviderAccess.hxx> +#include <IDocumentContentOperations.hxx> +#include <IDocumentDeviceAccess.hxx> +#include <IDocumentDrawModelAccess.hxx> +#include <IDocumentFieldsAccess.hxx> +#include <IDocumentLayoutAccess.hxx> +#include <IDocumentLinksAdministration.hxx> +#include <IDocumentMarkAccess.hxx> +#include <IDocumentRedlineAccess.hxx> +#include <IDocumentSettingAccess.hxx> +#include <IDocumentState.hxx> +#include <IDocumentStatistics.hxx> +#include <IDocumentStylePoolAccess.hxx> +#include <IDocumentUndoRedo.hxx> +#include <IMark.hxx> +#include <PostItMgr.hxx> +#include <SwGrammarMarkUp.hxx> +#include <SwNodeNum.hxx> +#include <SwPortionHandler.hxx> +#include <SwRewriter.hxx> +#include <SwSmartTagMgr.hxx> +#include <SwStyleNameMapper.hxx> +#include <TextCursorHelper.hxx> +#include <UndoAttribute.hxx> +#include <UndoCore.hxx> +#include <UndoDelete.hxx> +#include <UndoManager.hxx> +#include <UndoRedline.hxx> +#include <UndoTable.hxx> +#include <accmap.hxx> +#include <acorrect.hxx> +#include <anchoredobject.hxx> +#include <authfld.hxx> +#include <basesh.hxx> +#include <bodyfrm.hxx> +#include <bookmrk.hxx> +#include <breakit.hxx> +#include <calbck.hxx> +#include <calc.hxx> +#include <cellatr.hxx> +#include <cellfrm.hxx> +#include <charatr.hxx> +#include <charfmt.hxx> +#include <chpfld.hxx> +#include <cmdid.h> +#include <cntfrm.hxx> +#include <crossrefbookmark.hxx> +#include <crsrsh.hxx> +#include <crstate.hxx> +#include <dbfld.hxx> +#include <dbg_lay.hxx> +#include <dbmgr.hxx> +#include <dcontact.hxx> +#include <ddefld.hxx> +#include <dflyobj.hxx> +#include <doc.hxx> +#include <docary.hxx> +#include <docfld.hxx> +#include <docsh.hxx> +#include <docstat.hxx> +#include <docstyle.hxx> +#include <doctxm.hxx> +#include <docufld.hxx> +#include <drawbase.hxx> +#include <drawdoc.hxx> +#include <dview.hxx> +#include <editsh.hxx> +#include <edtwin.hxx> +#include <expfld.hxx> +#include <fchrfmt.hxx> +#include <fesh.hxx> +#include <fldbas.hxx> +#include <flddat.hxx> +#include <fldmgr.hxx> +#include <flyfrm.hxx> +#include <flyfrms.hxx> +#include <fmtanchr.hxx> +#include <fmtautofmt.hxx> +#include <fmtclbl.hxx> +#include <fmtclds.hxx> +#include <fmtcnct.hxx> +#include <fmtcntnt.hxx> +#include <fmtcol.hxx> +#include <fmteiro.hxx> +#include <fmtflcnt.hxx> +#include <fmtfld.hxx> +#include <fmtfollowtextflow.hxx> +#include <fmtfsize.hxx> +#include <fmtftn.hxx> +#include <fmtftntx.hxx> +#include <fmthdft.hxx> +#include <fmtinfmt.hxx> +#include <fmtline.hxx> +#include <fmtlsplt.hxx> +#include <fmtmeta.hxx> +#include <fmtornt.hxx> +#include <fmtpdsc.hxx> +#include <fmtrfmrk.hxx> +#include <fmtrowsplt.hxx> +#include <fmtruby.hxx> +#include <fmtsrnd.hxx> +#include <fmturl.hxx> +#include <fmtwrapinfluenceonobjpos.hxx> +#include <fntcache.hxx> +#include <frame.hxx> +#include <frameformats.hxx> +#include <frmatr.hxx> +#include <frmfmt.hxx> +#include <frmmgr.hxx> +#include <frmtool.hxx> +#include <ftnfrm.hxx> +#include <ftnidx.hxx> +#include <ftninfo.hxx> +#include <globdoc.hxx> +#include <glosdoc.hxx> +#include <gloshdl.hxx> +#include <gloslst.hxx> +#include <grfatr.hxx> +#include <helpids.h> +#include <hintids.hxx> +#include <hints.hxx> +#include <htmltbl.hxx> +#include <initui.hxx> +#include <iodetect.hxx> +#include <istyleaccess.hxx> +#include <layact.hxx> +#include <layouter.hxx> +#include <lineinfo.hxx> +#include <list.hxx> +#include <mdiexp.hxx> +#include <modcfg.hxx> +#include <mvsave.hxx> +#include <ndgrf.hxx> +#include <ndindex.hxx> +#include <ndnotxt.hxx> +#include <ndole.hxx> +#include <ndtxt.hxx> +#include <node.hxx> +#include <node2lay.hxx> +#include <notxtfrm.hxx> +#include <numrule.hxx> +#include <objectformatter.hxx> +#include <pagedesc.hxx> +#include <pagefrm.hxx> +#include <pam.hxx> +#include <pamtyp.hxx> +#include <paratr.hxx> +#include <poolfmt.hxx> +#include <printdata.hxx> +#include <prtopt.hxx> +#include <pview.hxx> +#include <redline.hxx> +#include <reffld.hxx> +#include <rolbck.hxx> +#include <rootfrm.hxx> +#include <rowfrm.hxx> +#include <scriptinfo.hxx> +#include <sectfrm.hxx> +#include <section.hxx> +#include <shellio.hxx> +#include <shellres.hxx> +#include <sortedobjs.hxx> +#include <srcview.hxx> +#include <swabstdlg.hxx> +#include <swatrset.hxx> +#include <swcache.hxx> +#include <swcrsr.hxx> +#include <swddetbl.hxx> +#include <swdll.hxx> +#include <swdllapi.h> +#include <swdtflvr.hxx> +#include <swerror.h> +#include <swfont.hxx> +#include <swmodule.hxx> +#include <swrect.hxx> +#include <swserv.hxx> +#include <swtable.hxx> +#include <swtblfmt.hxx> +#include <swtypes.hxx> +#include <swundo.hxx> +#include <swunohelper.hxx> +#include <swwait.hxx> +#include <tabcol.hxx> +#include <tabfrm.hxx> +#include <tblafmt.hxx> +#include <tblsel.hxx> +#include <textboxhelper.hxx> +#include <textsh.hxx> +#include <tgrditem.hxx> +#include <tox.hxx> +#include <txatbase.hxx> +#include <txtatr.hxx> +#include <txtflcnt.hxx> +#include <txtfld.hxx> +#include <txtfly.hxx> +#include <txtfrm.hxx> +#include <txtftn.hxx> +#include <txtinet.hxx> +#include <txttxmrk.hxx> +#include <uiitems.hxx> +#include <uitool.hxx> +#include <undobj.hxx> +#include <unobaseclass.hxx> +#include <unochart.hxx> +#include <unocoll.hxx> +#include <unocrsr.hxx> +#include <unocrsrhelper.hxx> +#include <unodraw.hxx> +#include <unofldmid.h> +#include <unoframe.hxx> +#include <unomap.hxx> +#include <unomid.h> +#include <unoparagraph.hxx> +#include <unoport.hxx> +#include <unoprnms.hxx> +#include <unosett.hxx> +#include <unotbl.hxx> +#include <unotextcursor.hxx> +#include <unotextrange.hxx> +#include <unotxdoc.hxx> +#include <usrfld.hxx> +#include <usrpref.hxx> +#include <view.hxx> +#include <viewimp.hxx> +#include <viewopt.hxx> +#include <viewsh.hxx> +#include <viscrs.hxx> +#include <wdocsh.hxx> +#include <wrong.hxx> +#include <wrtsh.hxx> +#include <wview.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_swui.cxx b/sw/inc/pch/precompiled_swui.cxx new file mode 100644 index 000000000..37c13dbdc --- /dev/null +++ b/sw/inc/pch/precompiled_swui.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#include "precompiled_swui.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_swui.hxx b/sw/inc/pch/precompiled_swui.hxx new file mode 100644 index 000000000..abebf5846 --- /dev/null +++ b/sw/inc/pch/precompiled_swui.hxx @@ -0,0 +1,598 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-04-25 20:55:57 using: + ./bin/update_pch sw swui --cutoff=3 --exclude:system --include:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./sw/inc/pch/precompiled_swui.hxx "make sw.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <array> +#include <assert.h> +#include <cassert> +#include <cmath> +#include <cstddef> +#include <cstring> +#include <deque> +#include <float.h> +#include <functional> +#include <initializer_list> +#include <iomanip> +#include <iostream> +#include <limits.h> +#include <limits> +#include <list> +#include <map> +#include <math.h> +#include <memory> +#include <new> +#include <optional> +#include <ostream> +#include <set> +#include <stack> +#include <stddef.h> +#include <string.h> +#include <string> +#include <string_view> +#include <type_traits> +#include <typeinfo> +#include <unordered_map> +#include <utility> +#include <vector> +#include <boost/property_tree/ptree_fwd.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/diagnose.h> +#include <osl/doublecheckedlocking.h> +#include <osl/endian.h> +#include <osl/getglobalmutex.hxx> +#include <osl/interlck.h> +#include <osl/mutex.h> +#include <osl/mutex.hxx> +#include <rtl/alloc.h> +#include <rtl/instance.hxx> +#include <rtl/locale.h> +#include <rtl/math.h> +#include <rtl/math.hxx> +#include <rtl/ref.hxx> +#include <rtl/strbuf.h> +#include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <rtl/uuid.h> +#include <sal/config.h> +#include <sal/detail/log.h> +#include <sal/log.hxx> +#include <sal/macros.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <sal/typesizes.h> +#include <vcl/AccessibleBrowseBoxObjType.hxx> +#include <vcl/EnumContext.hxx> +#include <vcl/GraphicExternalLink.hxx> +#include <vcl/GraphicObject.hxx> +#include <vcl/IDialogRenderable.hxx> +#include <vcl/ITiledRenderable.hxx> +#include <vcl/NotebookBarAddonsMerger.hxx> +#include <vcl/Scanline.hxx> +#include <vcl/accessibletableprovider.hxx> +#include <vcl/alpha.hxx> +#include <vcl/animate/Animation.hxx> +#include <vcl/animate/AnimationBitmap.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/builder.hxx> +#include <vcl/builderpage.hxx> +#include <vcl/cairo.hxx> +#include <vcl/checksum.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/customweld.hxx> +#include <vcl/devicecoordinate.hxx> +#include <vcl/dllapi.h> +#include <vcl/dndhelp.hxx> +#include <vcl/dockwin.hxx> +#include <vcl/edit.hxx> +#include <vcl/errcode.hxx> +#include <vcl/event.hxx> +#include <vcl/floatwin.hxx> +#include <vcl/fntstyle.hxx> +#include <vcl/font.hxx> +#include <vcl/gfxlink.hxx> +#include <vcl/glyphitem.hxx> +#include <vcl/graph.hxx> +#include <vcl/headbar.hxx> +#include <vcl/idle.hxx> +#include <vcl/image.hxx> +#include <vcl/keycod.hxx> +#include <vcl/keycodes.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/menu.hxx> +#include <vcl/metaactiontypes.hxx> +#include <vcl/metric.hxx> +#include <vcl/outdev.hxx> +#include <vcl/outdevmap.hxx> +#include <vcl/outdevstate.hxx> +#include <vcl/print.hxx> +#include <vcl/ptrstyle.hxx> +#include <vcl/region.hxx> +#include <vcl/salnativewidgets.hxx> +#include <vcl/scopedbitmapaccess.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/syswin.hxx> +#include <vcl/task.hxx> +#include <vcl/textfilter.hxx> +#include <vcl/timer.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/transfer.hxx> +#include <vcl/uitest/factory.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/vclreferencebase.hxx> +#include <vcl/vectorgraphicdata.hxx> +#include <vcl/wall.hxx> +#include <vcl/weld.hxx> +#include <vcl/window.hxx> +#include <vcl/windowstate.hxx> +#include <vcl/wizardmachine.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/tuple/b2ituple.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/utils/common.hxx> +#include <basegfx/vector/b2dsize.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <basic/basicdllapi.h> +#include <basic/sbxcore.hxx> +#include <basic/sbxdef.hxx> +#include <com/sun/star/awt/GradientStyle.hpp> +#include <com/sun/star/awt/Key.hpp> +#include <com/sun/star/awt/KeyGroup.hpp> +#include <com/sun/star/awt/SystemPointer.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/datatransfer/DataFlavor.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/datatransfer/XTransferable2.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> +#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp> +#include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/document/EventObject.hpp> +#include <com/sun/star/document/XCmisDocument.hpp> +#include <com/sun/star/document/XDocumentEventBroadcaster.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentRecovery.hpp> +#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp> +#include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/document/XEventBroadcaster.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/document/XScriptInvocationContext.hpp> +#include <com/sun/star/document/XShapeEventBroadcaster.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/document/XUndoManagerSupplier.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/drawing/DashStyle.hpp> +#include <com/sun/star/drawing/HatchStyle.hpp> +#include <com/sun/star/drawing/LineCap.hpp> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/embed/XVisualObject.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XLoadable.hpp> +#include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/frame/XModule.hpp> +#include <com/sun/star/frame/XStorable2.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> +#include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/graphic/XPrimitive2D.hpp> +#include <com/sun/star/i18n/Calendar2.hpp> +#include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp> +#include <com/sun/star/i18n/XForbiddenCharacters.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/linguistic2/XSupportedLocales.hpp> +#include <com/sun/star/mail/XAuthenticator.hpp> +#include <com/sun/star/mail/XConnectionListener.hpp> +#include <com/sun/star/mail/XMailMessage.hpp> +#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp> +#include <com/sun/star/rdf/XMetadatable.hpp> +#include <com/sun/star/script/XStarBasicAccess.hpp> +#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/table/BorderLineStyle.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/PositionLayoutDir.hpp> +#include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/text/RubyAdjust.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/XTextSection.hpp> +#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker3.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/TypeClass.hdl> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/uno/XCurrentContext.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XWeak.hpp> +#include <com/sun/star/uno/genfunc.h> +#include <com/sun/star/uno/genfunc.hxx> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/NumberFormat.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/XAccounting.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/XModifiable2.hpp> +#include <com/sun/star/view/XPrintJobBroadcaster.hpp> +#include <com/sun/star/view/XPrintable.hpp> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/lok.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> +#include <comphelper/string.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/compbase_ex.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implbase_ex.hxx> +#include <cppuhelper/implbase_ex_post.hxx> +#include <cppuhelper/implbase_ex_pre.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakagg.hxx> +#include <cppuhelper/weakref.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/primitive2d/CommonTypes.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> +#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <editeng/borderline.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/editdata.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/editstat.hxx> +#include <editeng/eedata.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/formatbreakitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/numdef.hxx> +#include <editeng/numitem.hxx> +#include <editeng/outliner.hxx> +#include <editeng/paperinf.hxx> +#include <editeng/paragraphdata.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/sizeitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/svxfont.hxx> +#include <editeng/ulspitem.hxx> +#include <i18nlangtag/i18nlangtagdllapi.h> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <i18nutil/i18nutildllapi.h> +#include <i18nutil/paper.hxx> +#include <i18nutil/transliteration.hxx> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/deleter.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/sorted_vector.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/underlyingenumvalue.hxx> +#include <officecfg/Office/Writer.hxx> +#include <ooo/vba/XHelperInterface.hpp> +#include <ooo/vba/word/XParagraphFormat.hpp> +#include <salhelper/salhelperdllapi.h> +#include <salhelper/simplereferenceobject.hxx> +#include <sfx2/Metadatable.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/chalign.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/dllapi.h> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/filedlghelper.hxx> +#include <sfx2/htmlmode.hxx> +#include <sfx2/linksrc.hxx> +#include <sfx2/lnkbase.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/request.hxx> +#include <sfx2/sfxdlg.hxx> +#include <sfx2/shell.hxx> +#include <sfx2/tabdlg.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/viewsh.hxx> +#include <sot/exchange.hxx> +#include <sot/formats.hxx> +#include <sot/sotdllapi.h> +#include <svl/SfxBroadcaster.hxx> +#include <svl/broadcast.hxx> +#include <svl/cenumitm.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> +#include <svl/eitem.hxx> +#include <svl/hint.hxx> +#include <svl/intitem.hxx> +#include <svl/itempool.hxx> +#include <svl/itemset.hxx> +#include <svl/languageoptions.hxx> +#include <svl/lstner.hxx> +#include <svl/macitem.hxx> +#include <svl/nfkeytab.hxx> +#include <svl/ondemand.hxx> +#include <svl/poolitem.hxx> +#include <svl/stritem.hxx> +#include <svl/style.hxx> +#include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> +#include <svl/undo.hxx> +#include <svl/urihelper.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> +#include <svtools/borderline.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/htmlcfg.hxx> +#include <svtools/svtdllapi.h> +#include <svtools/toolbarmenu.hxx> +#include <svtools/unitconv.hxx> +#include <svtools/valueset.hxx> +#include <svx/Palette.hxx> +#include <svx/SvxColorValueSet.hxx> +#include <svx/XPropertyEntry.hxx> +#include <svx/autoformathelper.hxx> +#include <svx/colorbox.hxx> +#include <svx/colorwindow.hxx> +#include <svx/ctredlin.hxx> +#include <svx/dialmgr.hxx> +#include <svx/flagsdef.hxx> +#include <svx/framelinkarray.hxx> +#include <svx/langbox.hxx> +#include <svx/pagectrl.hxx> +#include <svx/rotmodit.hxx> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svx/svddef.hxx> +#include <svx/svxdlg.hxx> +#include <svx/svxdllapi.h> +#include <svx/swframetypes.hxx> +#include <svx/unomod.hxx> +#include <svx/xdash.hxx> +#include <svx/xdef.hxx> +#include <svx/xgrad.hxx> +#include <svx/xhatch.hxx> +#include <tools/color.hxx> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <tools/debug.hxx> +#include <tools/fldunit.hxx> +#include <tools/fontenum.hxx> +#include <tools/fract.hxx> +#include <tools/gen.hxx> +#include <tools/globname.hxx> +#include <tools/lineend.hxx> +#include <tools/link.hxx> +#include <tools/mapunit.hxx> +#include <tools/multisel.hxx> +#include <tools/poly.hxx> +#include <tools/ref.hxx> +#include <tools/solar.h> +#include <tools/time.hxx> +#include <tools/toolsdllapi.h> +#include <tools/urlobj.hxx> +#include <tools/wintypes.hxx> +#include <typelib/typeclass.h> +#include <typelib/typedescription.h> +#include <typelib/uik.h> +#include <uno/any2.h> +#include <uno/data.h> +#include <uno/sequence2.h> +#include <unotools/calendarwrapper.hxx> +#include <unotools/charclass.hxx> +#include <unotools/configitem.hxx> +#include <unotools/fontcvt.hxx> +#include <unotools/fontdefs.hxx> +#include <unotools/localedatawrapper.hxx> +#include <unotools/nativenumberwrapper.hxx> +#include <unotools/options.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/resmgr.hxx> +#include <unotools/sharedunocomponent.hxx> +#include <unotools/syslocale.hxx> +#include <unotools/transliterationwrapper.hxx> +#include <unotools/unotoolsdllapi.h> +#include <vbahelper/vbadllapi.h> +#include <vbahelper/vbahelper.hxx> +#include <vbahelper/vbahelperinterface.hxx> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <IDocumentDeviceAccess.hxx> +#include <IDocumentRedlineAccess.hxx> +#include <IDocumentSettingAccess.hxx> +#include <IMark.hxx> +#include <SwNumberTreeTypes.hxx> +#include <SwRewriter.hxx> +#include <SwStyleNameMapper.hxx> +#include <autoformatpreview.hxx> +#include <bparr.hxx> +#include <calbck.hxx> +#include <charfmt.hxx> +#include <cmdid.h> +#include <cnttab.hxx> +#include <column.hxx> +#include <dbmgr.hxx> +#include <doc.hxx> +#include <docary.hxx> +#include <docsh.hxx> +#include <docstyle.hxx> +#include <docufld.hxx> +#include <drpcps.hxx> +#include <envlop.hxx> +#include <expfld.hxx> +#include <fchrfmt.hxx> +#include <fldbas.hxx> +#include <fldedt.hxx> +#include <fldmgr.hxx> +#include <fldtdlg.hxx> +#include <fmtautofmt.hxx> +#include <fmtclds.hxx> +#include <fmtcol.hxx> +#include <fmtflcnt.hxx> +#include <fmtfld.hxx> +#include <fmtfsize.hxx> +#include <fmtftn.hxx> +#include <fmtinfmt.hxx> +#include <fmtornt.hxx> +#include <fmtpdsc.hxx> +#include <fmtrfmrk.hxx> +#include <fmtruby.hxx> +#include <format.hxx> +#include <frmdlg.hxx> +#include <frmfmt.hxx> +#include <frmpage.hxx> +#include <glossary.hxx> +#include <hintids.hxx> +#include <index.hxx> +#include <label.hxx> +#include <labimg.hxx> +#include <macassgn.hxx> +#include <modcfg.hxx> +#include <ndarr.hxx> +#include <ndhints.hxx> +#include <ndindex.hxx> +#include <ndtyp.hxx> +#include <node.hxx> +#include <num.hxx> +#include <numberingtypelistbox.hxx> +#include <numfmtlb.hxx> +#include <numpara.hxx> +#include <numrule.hxx> +#include <optload.hxx> +#include <outline.hxx> +#include <pagedesc.hxx> +#include <pam.hxx> +#include <pardlg.hxx> +#include <poolfmt.hxx> +#include <reffld.hxx> +#include <ring.hxx> +#include <section.hxx> +#include <shellio.hxx> +#include <shellres.hxx> +#include <swabstdlg.hxx> +#include <swatrset.hxx> +#include <swdbdata.hxx> +#include <swdllapi.h> +#include <swmodule.hxx> +#include <swrect.hxx> +#include <swtblfmt.hxx> +#include <swtypes.hxx> +#include <swuicnttab.hxx> +#include <swuiexp.hxx> +#include <swuipardlg.hxx> +#include <swundo.hxx> +#include <swwait.hxx> +#include <tablemgr.hxx> +#include <tblafmt.hxx> +#include <tblenum.hxx> +#include <tgrditem.hxx> +#include <tox.hxx> +#include <toxe.hxx> +#include <uiitems.hxx> +#include <uitool.hxx> +#include <undobj.hxx> +#include <unobaseclass.hxx> +#include <unotools.hxx> +#include <usrpref.hxx> +#include <view.hxx> +#include <viewopt.hxx> +#include <wdocsh.hxx> +#include <wrap.hxx> +#include <wrtsh.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_vbaswobj.cxx b/sw/inc/pch/precompiled_vbaswobj.cxx new file mode 100644 index 000000000..8c7bf9f8d --- /dev/null +++ b/sw/inc/pch/precompiled_vbaswobj.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#include "precompiled_vbaswobj.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_vbaswobj.hxx b/sw/inc/pch/precompiled_vbaswobj.hxx new file mode 100644 index 000000000..2c7fe5b18 --- /dev/null +++ b/sw/inc/pch/precompiled_vbaswobj.hxx @@ -0,0 +1,345 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-04-25 20:56:01 using: + ./bin/update_pch sw vbaswobj --cutoff=4 --exclude:system --include:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./sw/inc/pch/precompiled_vbaswobj.hxx "make sw.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <array> +#include <assert.h> +#include <atomic> +#include <cassert> +#include <climits> +#include <cmath> +#include <cstddef> +#include <deque> +#include <exception> +#include <float.h> +#include <functional> +#include <initializer_list> +#include <iomanip> +#include <iostream> +#include <limits.h> +#include <limits> +#include <list> +#include <map> +#include <math.h> +#include <memory> +#include <new> +#include <optional> +#include <ostream> +#include <set> +#include <stack> +#include <stddef.h> +#include <string.h> +#include <string> +#include <string_view> +#include <type_traits> +#include <typeinfo> +#include <unordered_map> +#include <utility> +#include <vector> +#include <boost/property_tree/ptree_fwd.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/diagnose.h> +#include <osl/doublecheckedlocking.h> +#include <osl/endian.h> +#include <osl/file.hxx> +#include <osl/getglobalmutex.hxx> +#include <osl/interlck.h> +#include <osl/mutex.h> +#include <osl/mutex.hxx> +#include <osl/thread.h> +#include <osl/time.h> +#include <rtl/alloc.h> +#include <rtl/character.hxx> +#include <rtl/instance.hxx> +#include <rtl/locale.h> +#include <rtl/math.h> +#include <rtl/ref.hxx> +#include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <rtl/uuid.h> +#include <sal/config.h> +#include <sal/detail/log.h> +#include <sal/log.hxx> +#include <sal/macros.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <sal/typesizes.h> +#include <vcl/EnumContext.hxx> +#include <vcl/IDialogRenderable.hxx> +#include <vcl/Scanline.hxx> +#include <vcl/alpha.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/builder.hxx> +#include <vcl/cairo.hxx> +#include <vcl/checksum.hxx> +#include <vcl/cursor.hxx> +#include <vcl/devicecoordinate.hxx> +#include <vcl/dllapi.h> +#include <vcl/errcode.hxx> +#include <vcl/exceptiontypes.hxx> +#include <vcl/fntstyle.hxx> +#include <vcl/font.hxx> +#include <vcl/image.hxx> +#include <vcl/inputtypes.hxx> +#include <vcl/keycod.hxx> +#include <vcl/keycodes.hxx> +#include <vcl/lazydelete.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/menu.hxx> +#include <vcl/metaactiontypes.hxx> +#include <vcl/outdev.hxx> +#include <vcl/outdevmap.hxx> +#include <vcl/outdevstate.hxx> +#include <vcl/region.hxx> +#include <vcl/salnativewidgets.hxx> +#include <vcl/scopedbitmapaccess.hxx> +#include <vcl/svapp.hxx> +#include <vcl/task.hxx> +#include <vcl/timer.hxx> +#include <vcl/uitest/factory.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/vclreferencebase.hxx> +#include <vcl/wall.hxx> +#include <vcl/window.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/b2irange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/tuple/b2i64tuple.hxx> +#include <basegfx/tuple/b2ituple.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/utils/common.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <basic/sberrors.hxx> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> +#include <com/sun/star/awt/Key.hpp> +#include <com/sun/star/awt/KeyGroup.hpp> +#include <com/sun/star/awt/SystemPointer.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/document/EventObject.hpp> +#include <com/sun/star/drawing/LineCap.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/i18n/CollatorOptions.hpp> +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/rdf/XMetadatable.hpp> +#include <com/sun/star/security/DocumentSignatureInformation.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/PositionLayoutDir.hpp> +#include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextRangeCompare.hpp> +#include <com/sun/star/text/XTextSection.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/TypeClass.hdl> +#include <com/sun/star/uno/TypeClass.hpp> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XWeak.hpp> +#include <com/sun/star/uno/genfunc.h> +#include <com/sun/star/uno/genfunc.hxx> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> +#include <comphelper/solarmutex.hxx> +#include <comphelper/weak.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implbase_ex.hxx> +#include <cppuhelper/implbase_ex_post.hxx> +#include <cppuhelper/implbase_ex_pre.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakagg.hxx> +#include <cppuhelper/weakref.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/numdef.hxx> +#include <editeng/numitem.hxx> +#include <editeng/svxenum.hxx> +#include <i18nlangtag/lang.h> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/sorted_vector.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/underlyingenumvalue.hxx> +#include <ooo/vba/XCollection.hpp> +#include <ooo/vba/XHelperInterface.hpp> +#include <ooo/vba/word/XParagraphFormat.hpp> +#include <sfx2/Metadatable.hxx> +#include <sfx2/dllapi.h> +#include <sfx2/shell.hxx> +#include <sot/formats.hxx> +#include <sot/sotdllapi.h> +#include <svl/SfxBroadcaster.hxx> +#include <svl/broadcast.hxx> +#include <svl/cintitem.hxx> +#include <svl/hint.hxx> +#include <svl/intitem.hxx> +#include <svl/lstner.hxx> +#include <svl/poolitem.hxx> +#include <svl/style.hxx> +#include <svl/stylesheetuser.hxx> +#include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> +#include <svl/undo.hxx> +#include <svx/svxdllapi.h> +#include <svx/xdef.hxx> +#include <tools/color.hxx> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <tools/debug.hxx> +#include <tools/fldunit.hxx> +#include <tools/fontenum.hxx> +#include <tools/gen.hxx> +#include <tools/link.hxx> +#include <tools/mapunit.hxx> +#include <tools/poly.hxx> +#include <tools/ref.hxx> +#include <tools/solar.h> +#include <tools/time.hxx> +#include <tools/toolsdllapi.h> +#include <tools/urlobj.hxx> +#include <tools/wintypes.hxx> +#include <typelib/typeclass.h> +#include <typelib/typedescription.h> +#include <typelib/uik.h> +#include <uno/any2.h> +#include <uno/data.h> +#include <uno/sequence2.h> +#include <unotools/fontcvt.hxx> +#include <unotools/fontdefs.hxx> +#include <unotools/options.hxx> +#include <unotools/resmgr.hxx> +#include <unotools/syslocale.hxx> +#include <unotools/unotoolsdllapi.h> +#include <vbahelper/vbadllapi.h> +#include <vbahelper/vbahelper.hxx> +#include <vbahelper/vbahelperinterface.hxx> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <IDocumentMarkAccess.hxx> +#include <IMark.hxx> +#include <IShellCursorSupplier.hxx> +#include <SwNumberTreeTypes.hxx> +#include <SwRewriter.hxx> +#include <bparr.hxx> +#include <calbck.hxx> +#include <charfmt.hxx> +#include <crstate.hxx> +#include <cshtyp.hxx> +#include <docary.hxx> +#include <docsh.hxx> +#include <fldbas.hxx> +#include <fldupde.hxx> +#include <fmtcol.hxx> +#include <format.hxx> +#include <frmfmt.hxx> +#include <hintids.hxx> +#include <index.hxx> +#include <ndarr.hxx> +#include <ndindex.hxx> +#include <ndtyp.hxx> +#include <node.hxx> +#include <numrule.hxx> +#include <pam.hxx> +#include <ring.hxx> +#include <section.hxx> +#include <swcrsr.hxx> +#include <swdllapi.h> +#include <swrect.hxx> +#include <swregion.hxx> +#include <swtable.hxx> +#include <swtblfmt.hxx> +#include <swtypes.hxx> +#include <swundo.hxx> +#include <tblenum.hxx> +#include <tblsel.hxx> +#include <tox.hxx> +#include <toxe.hxx> +#include <undobj.hxx> +#include <unobaseclass.hxx> +#include <viewsh.hxx> +#include <viscrs.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/poolfmt.awk b/sw/inc/poolfmt.awk new file mode 100644 index 000000000..58f758c94 --- /dev/null +++ b/sw/inc/poolfmt.awk @@ -0,0 +1,75 @@ +# +# 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 . +# +# This awk-script generates a cxx-file, that dumps all PoolIDs of the template. +# It is needed for HelpPI. +# Usage: awk -f poolid.awk poolfmt.hxx > poolid.cxx +# cl poolid.cxx +# poolid.exe > ???.hrc +# + +function Header() { + print "// This is an outputfile of an awk-script: $Workfile: poolfmt.awk $" + print "#include <solar.h> " + print + print "#include <stdio.h>" + print "#include <stdlib.h>" + print + print "#pragma hdrstop" + print + print "#include <iostream.hxx> " + print "#include \"poolfmt.hxx\"" + print +} + +function Main() { + print + print "void main( int , char *[] ) {" + sStr = "#define" + print " int nSize = (sizeof(ppPoolIds) / sizeof(PoolFormatIds)) - 1;" + print " for( int n = 0; n < nSize; n++ )" + print " printf( \"" sStr " %s\\t%8d\\n\", ppPoolIds[ n ].pStr, ppPoolIds[ n ].nId );" + print "}" +} + +function TableHead() { + print + print "struct PoolFormatIds { int nId; const char* pStr; };" + print "static PoolFormatIds ppPoolIds[] = {" +} + +function TableTail() { + print " 0, \"\" };" + print +} + +BEGIN { + Header(); + TableHead(); +} + +/^[ \t]*RES_/ && !index( $1, "_BEGIN" ) && !index( $1, "_END" ) && !index( $1, "_POOL_" ) { + sStr = $1; + split( $1, sStr, "," ); + print " " sStr[1] ", \"" sStr[1] "\"," +} + +END { + TableTail(); + Main(); +} + diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx new file mode 100644 index 000000000..44d9214fe --- /dev/null +++ b/sw/inc/poolfmt.hxx @@ -0,0 +1,455 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_POOLFMT_HXX +#define INCLUDED_SW_INC_POOLFMT_HXX + +#include <limits.h> +#include <editeng/frmdir.hxx> +#include <i18nlangtag/lang.h> + +/** POOLCOLL-IDs: +// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ +// !User! Range ! 0 ! Offset ! +// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ +// +// Range: 1 - text +// 2 - lists +// 3 - special ranges +// 4 - indices +// 5 - chapter / document +// 6 - HTML-styles. + +// Other IDs: +// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ +// !User! Range ! 1 ! Offset ! +// +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ +// Range: 0 - character styles +// 1 - frame styles +// 2 - page styles +// 3 - paragraph styles (?) +// 4 - graphics styles (?) + +// For all IDs we have: +// Origin: 0 -pool +// 1 -user +// Offset: within the group */ + +/** Attention: New IDs can only be added to the ends of the groups. + These IDs are read and written by the Reader/Writer. + They are only aware of the Offset to Start. */ + +/// Mask for recognition of COLLPOOL-IDs: + +const sal_uInt16 POOLGRP_NOCOLLID = (1 << 10); + +/// POLLCOLL-groups: + +const sal_uInt16 USER_FMT = (1 << 15); +const sal_uInt16 POOL_FMT = (0 << 15); + +const sal_uInt16 COLL_TEXT_BITS = (1 << 11); +const sal_uInt16 COLL_LISTS_BITS = (2 << 11); +const sal_uInt16 COLL_EXTRA_BITS = (3 << 11); +const sal_uInt16 COLL_REGISTER_BITS = (4 << 11); +const sal_uInt16 COLL_DOC_BITS = (5 << 11); +const sal_uInt16 COLL_HTML_BITS = (6 << 11); +const sal_uInt16 COLL_GET_RANGE_BITS = (15 << 11); + +/// Other groups: + +const sal_uInt16 POOLGRP_CHARFMT = (0 << 11) + POOLGRP_NOCOLLID; +const sal_uInt16 POOLGRP_FRAMEFMT = (1 << 11) + POOLGRP_NOCOLLID; +const sal_uInt16 POOLGRP_PAGEDESC = (2 << 11) + POOLGRP_NOCOLLID; +const sal_uInt16 POOLGRP_NUMRULE = (3 << 11) + POOLGRP_NOCOLLID; +const sal_uInt16 POOLGRP_TABSTYLE = (4 << 11) + POOLGRP_NOCOLLID; +const sal_uInt16 POOLGRP_CELLSTYLE = (5 << 11) + POOLGRP_NOCOLLID; + +/// Recognize whether it's a user defined style or not: +const sal_uInt16 POOL_IDUSER_FMT = + USHRT_MAX & ~(COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID); + +inline bool IsPoolUserFormat( sal_uInt16 nId ) +{ + return POOL_IDUSER_FMT == (nId & ~(COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID)); +} + +/// IDs for the ranges. +enum RES_POOLFMT +{ +RES_POOLFMT_BEGIN = 1, +RES_POOL_CHRFMT = RES_POOLFMT_BEGIN, +RES_POOL_FRMFMT, +RES_POOL_TXTCOLL, +RES_POOL_PAGEFMT, + +RES_POOL_PARFMT, +RES_POOL_GRFFMT, +RES_POOLFMT_END +}; + +/// Ranges for the IDs of the formats. + +/// IDs for character styles. +enum RES_POOL_CHRFMT_TYPE +{ +RES_POOLCHR_BEGIN = POOLGRP_CHARFMT, +RES_POOLCHR_NORMAL_BEGIN = POOLGRP_CHARFMT, + +RES_POOLCHR_FOOTNOTE = RES_POOLCHR_NORMAL_BEGIN, ///< Footnote. +RES_POOLCHR_PAGENO, ///< Pages/field. +RES_POOLCHR_LABEL, ///< Label. +RES_POOLCHR_DROPCAPS, ///< Dropcaps. +RES_POOLCHR_NUM_LEVEL, ///< Numbering symbols +RES_POOLCHR_BULLET_LEVEL, ///< Bullets. + +RES_POOLCHR_INET_NORMAL, ///< Internet normal. +RES_POOLCHR_INET_VISIT, ///< Internet visited. +RES_POOLCHR_JUMPEDIT, ///< Placeholder. +RES_POOLCHR_TOXJUMP, ///< Jump from index. +RES_POOLCHR_ENDNOTE, ///< Endnote. +RES_POOLCHR_LINENUM, ///< Line numbering. +RES_POOLCHR_IDX_MAIN_ENTRY, ///< Main entry in indices. +RES_POOLCHR_FOOTNOTE_ANCHOR, ///< Footnote anchor. +RES_POOLCHR_ENDNOTE_ANCHOR, ///< Endnote anchor. +RES_POOLCHR_RUBYTEXT, ///< Rubytext. +RES_POOLCHR_VERT_NUM, ///< Vertical numbering symbols. + +RES_POOLCHR_NORMAL_END, + +RES_POOLCHR_HTML_BEGIN = RES_POOLCHR_BEGIN + 50, ///< HTML-styles. +RES_POOLCHR_HTML_EMPHASIS = RES_POOLCHR_HTML_BEGIN, +RES_POOLCHR_HTML_CITIATION, +RES_POOLCHR_HTML_STRONG, +RES_POOLCHR_HTML_CODE, +RES_POOLCHR_HTML_SAMPLE, +RES_POOLCHR_HTML_KEYBOARD, +RES_POOLCHR_HTML_VARIABLE, +RES_POOLCHR_HTML_DEFINSTANCE, +RES_POOLCHR_HTML_TELETYPE, +RES_POOLCHR_HTML_END, + +RES_POOLCHR_END = RES_POOLCHR_HTML_END +}; + +/// IDs for frame styles. +enum RES_POOL_FRMFMT_TYPE +{ +RES_POOLFRM_BEGIN = POOLGRP_FRAMEFMT, + +RES_POOLFRM_FRAME = RES_POOLFRM_BEGIN, ///< Frame. +RES_POOLFRM_GRAPHIC, ///< Graphics. +RES_POOLFRM_OLE, ///< OLE. +RES_POOLFRM_FORMEL, ///< Formula. +RES_POOLFRM_MARGINAL, ///< Marginalia. +RES_POOLFRM_WATERSIGN, ///< Watermark. +RES_POOLFRM_LABEL, ///< Labels. + +RES_POOLFRM_END +}; + +/// IDs for page styles. +enum RES_POOL_PAGEFMT_TYPE +{ +RES_POOLPAGE_BEGIN = POOLGRP_PAGEDESC, + +RES_POOLPAGE_STANDARD = RES_POOLPAGE_BEGIN, ///< Standard page. +RES_POOLPAGE_FIRST, ///< First page. +RES_POOLPAGE_LEFT, ///< Left page. +RES_POOLPAGE_RIGHT, ///< Right page. +RES_POOLPAGE_JAKET, ///< Envelope. +RES_POOLPAGE_REGISTER, ///< Index. +RES_POOLPAGE_HTML, ///< HTML. +RES_POOLPAGE_FOOTNOTE, ///< Footnote at end of document. +RES_POOLPAGE_ENDNOTE, ///< Endnote page. +RES_POOLPAGE_LANDSCAPE, ///< Landscape page style. + +RES_POOLPAGE_END +}; + +// IDs for list styles. +enum RES_POOL_NUMRULE_TYPE +{ +RES_POOLNUMRULE_BEGIN = POOLGRP_NUMRULE, +RES_POOLNUMRULE_NUM1 = RES_POOLNUMRULE_BEGIN, ///< NumRule Numbering 123. +RES_POOLNUMRULE_NUM2, ///< NumRule Numbering ABC. +RES_POOLNUMRULE_NUM3, ///< NumRule Numbering abc. +RES_POOLNUMRULE_NUM4, ///< NumRule Numbering IVX. +RES_POOLNUMRULE_NUM5, ///< NumRule Numbering ivx. +RES_POOLNUMRULE_BUL1, ///< NumRule Bullets 1. +RES_POOLNUMRULE_BUL2, ///< NumRule Bullets 2. +RES_POOLNUMRULE_BUL3, ///< NumRule Bullets 3. +RES_POOLNUMRULE_BUL4, ///< NumRule Bullets 4. +RES_POOLNUMRULE_BUL5, ///< NumRule Bullets 5. +RES_POOLNUMRULE_END +}; + +// IDs for table styles. +enum RES_POOL_TABLESTYLE_TYPE +{ +RES_POOLTABLESTYLE_BEGIN = POOLGRP_TABSTYLE, +RES_POOLTABLESTYLE_DEFAULT = RES_POOLTABLESTYLE_BEGIN, +// 16 old styles +RES_POOLTABLESTYLE_3D, +RES_POOLTABLESTYLE_BLACK1, +RES_POOLTABLESTYLE_BLACK2, +RES_POOLTABLESTYLE_BLUE, +RES_POOLTABLESTYLE_BROWN, +RES_POOLTABLESTYLE_CURRENCY, +RES_POOLTABLESTYLE_CURRENCY_3D, +RES_POOLTABLESTYLE_CURRENCY_GRAY, +RES_POOLTABLESTYLE_CURRENCY_LAVENDER, +RES_POOLTABLESTYLE_CURRENCY_TURQUOISE, +RES_POOLTABLESTYLE_GRAY, +RES_POOLTABLESTYLE_GREEN, +RES_POOLTABLESTYLE_LAVENDER, +RES_POOLTABLESTYLE_RED, +RES_POOLTABLESTYLE_TURQUOISE, +RES_POOLTABLESTYLE_YELLOW, +// 10 new styles since LibreOffice 6.0 +RES_POOLTABLESTYLE_LO6_ACADEMIC, +RES_POOLTABLESTYLE_LO6_BOX_LIST_BLUE, +RES_POOLTABLESTYLE_LO6_BOX_LIST_GREEN, +RES_POOLTABLESTYLE_LO6_BOX_LIST_RED, +RES_POOLTABLESTYLE_LO6_BOX_LIST_YELLOW, +RES_POOLTABLESTYLE_LO6_ELEGANT, +RES_POOLTABLESTYLE_LO6_FINANCIAL, +RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_COLUMNS, +RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_ROWS, +RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED, +RES_POOLTABLESTYLE_END +}; + +enum RES_POOL_CELLSTYLE_TYPE +{ +RES_POOLCELLSTYLE_BEGIN = POOLGRP_CELLSTYLE, +RES_POOLCELLSTYLE_END = RES_POOLCELLSTYLE_BEGIN +}; + +// IDs for paragraph styles. +enum RES_POOL_COLLFMT_TYPE +{ +// Group text. +RES_POOLCOLL_TEXT_BEGIN = COLL_TEXT_BITS, + +RES_POOLCOLL_STANDARD = RES_POOLCOLL_TEXT_BEGIN, ///< Standard. +RES_POOLCOLL_TEXT, ///< Text body. +RES_POOLCOLL_TEXT_IDENT, ///< Text body first line indent. +RES_POOLCOLL_TEXT_NEGIDENT, ///< Text body hanging indent. +RES_POOLCOLL_TEXT_MOVE, ///< Text body indent. +RES_POOLCOLL_GREETING, ///< Complimentary close. +RES_POOLCOLL_SIGNATURE, ///< Signature. +RES_POOLCOLL_CONFRONTATION, ///< List indent. +RES_POOLCOLL_MARGINAL, ///< Marginalia. + +/// Subgroup headings. +RES_POOLCOLL_HEADLINE_BASE, ///< Base heading. +RES_POOLCOLL_HEADLINE1, ///< Heading 1. +RES_POOLCOLL_HEADLINE2, ///< Heading 2. +RES_POOLCOLL_HEADLINE3, ///< Heading 3. +RES_POOLCOLL_HEADLINE4, ///< Heading 4. +RES_POOLCOLL_HEADLINE5, ///< Heading 5. +RES_POOLCOLL_HEADLINE6, ///< Heading 6. +RES_POOLCOLL_HEADLINE7, ///< Heading 7. +RES_POOLCOLL_HEADLINE8, ///< Heading 8. +RES_POOLCOLL_HEADLINE9, ///< Heading 9. +RES_POOLCOLL_HEADLINE10, ///< Heading 10. + +RES_POOLCOLL_TEXT_END, + +/// Group lists. +RES_POOLCOLL_LISTS_BEGIN = COLL_LISTS_BITS, + +RES_POOLCOLL_NUMBER_BULLET_BASE = RES_POOLCOLL_LISTS_BEGIN, ///< Base list. + +/// Subgroup numberings. +RES_POOLCOLL_NUM_LEVEL1S, ///< Start 1st level. +RES_POOLCOLL_NUM_LEVEL1, ///< 1st level. +RES_POOLCOLL_NUM_LEVEL1E, ///< End 1st level. +RES_POOLCOLL_NUM_NONUM1, ///< No numbering. +RES_POOLCOLL_NUM_LEVEL2S, ///< Start 2nd level. +RES_POOLCOLL_NUM_LEVEL2, ///< 2nd level. +RES_POOLCOLL_NUM_LEVEL2E, ///< End 2nd level. +RES_POOLCOLL_NUM_NONUM2, ///< No numbering. +RES_POOLCOLL_NUM_LEVEL3S, ///< Start 3rd level. +RES_POOLCOLL_NUM_LEVEL3, ///< 3rd level. +RES_POOLCOLL_NUM_LEVEL3E, ///< End 3rd level. +RES_POOLCOLL_NUM_NONUM3, ///< No numbering. +RES_POOLCOLL_NUM_LEVEL4S, ///< Start 4th level. +RES_POOLCOLL_NUM_LEVEL4, ///< 4th level. +RES_POOLCOLL_NUM_LEVEL4E, ///< End 4th level. +RES_POOLCOLL_NUM_NONUM4, ///< No numbering. +RES_POOLCOLL_NUM_LEVEL5S, ///< Start 5th level. +RES_POOLCOLL_NUM_LEVEL5, ///< 5th level. +RES_POOLCOLL_NUM_LEVEL5E, ///< End 5th level. +RES_POOLCOLL_NUM_NONUM5, ///< No numbering. + +///Subgroup bullets. +RES_POOLCOLL_BULLET_LEVEL1S, ///< Start 1st level. +RES_POOLCOLL_BULLET_LEVEL1, ///< 1st level. +RES_POOLCOLL_BULLET_LEVEL1E, ///< End 1st level +RES_POOLCOLL_BULLET_NONUM1, ///< No numbering. +RES_POOLCOLL_BULLET_LEVEL2S, ///< Start 2nd level. +RES_POOLCOLL_BULLET_LEVEL2, ///< 2nd level. +RES_POOLCOLL_BULLET_LEVEL2E, ///< End 2nd level. +RES_POOLCOLL_BULLET_NONUM2, ///< No numbering. +RES_POOLCOLL_BULLET_LEVEL3S, ///< Start 3rd level. +RES_POOLCOLL_BULLET_LEVEL3, ///< 3rd Level. +RES_POOLCOLL_BULLET_LEVEL3E, ///< End 3rd level. +RES_POOLCOLL_BULLET_NONUM3, ///< No numbering. +RES_POOLCOLL_BULLET_LEVEL4S, ///< Start 4th level. +RES_POOLCOLL_BULLET_LEVEL4, ///< 4th level. +RES_POOLCOLL_BULLET_LEVEL4E, ///< End 4th level. +RES_POOLCOLL_BULLET_NONUM4, ///< No numbering. +RES_POOLCOLL_BULLET_LEVEL5S, ///< Start 5th level. +RES_POOLCOLL_BULLET_LEVEL5, ///< 5th level. +RES_POOLCOLL_BULLET_LEVEL5E, ///< End 5th Level. +RES_POOLCOLL_BULLET_NONUM5, ///< No numbering. + +RES_POOLCOLL_LISTS_END, + +/// Special ranges. +RES_POOLCOLL_EXTRA_BEGIN = COLL_EXTRA_BITS, + +/// Subgroup header. +RES_POOLCOLL_HEADERFOOTER = RES_POOLCOLL_EXTRA_BEGIN, ///< Header and Footer. +RES_POOLCOLL_HEADER, ///< Header Left&Right. +RES_POOLCOLL_HEADERL, ///< Header Left. +RES_POOLCOLL_HEADERR, ///< Header Right. + +/// Subgroup footer. +RES_POOLCOLL_FOOTER, ///< Footer Left&Right. +RES_POOLCOLL_FOOTERL, ///< Footer Left. +RES_POOLCOLL_FOOTERR, ///< Footer Right. + +/// Subgroup table. +RES_POOLCOLL_TABLE, ///< Table of Contents. +RES_POOLCOLL_TABLE_HDLN, ///< Table of Contents - heading. + +/// Subgroup labels. +RES_POOLCOLL_LABEL, ///< Base labels. +RES_POOLCOLL_LABEL_ABB, ///< Label illustration. +RES_POOLCOLL_LABEL_TABLE, ///< Label table. +RES_POOLCOLL_LABEL_FRAME, ///< Label frame. +RES_POOLCOLL_LABEL_FIGURE, ///< Label figure + +/// Other stuff. +RES_POOLCOLL_FRAME, ///< Frames. +RES_POOLCOLL_FOOTNOTE, ///< Footnotes. +RES_POOLCOLL_JAKETADRESS, ///< Addressee. +RES_POOLCOLL_SENDADRESS, ///< Sender. +RES_POOLCOLL_ENDNOTE, ///< Endnotes. + +RES_POOLCOLL_LABEL_DRAWING, ///< Label drawing objects. +RES_POOLCOLL_EXTRA_END, + +/// Group indices. +RES_POOLCOLL_REGISTER_BEGIN = COLL_REGISTER_BITS, + +RES_POOLCOLL_REGISTER_BASE = RES_POOLCOLL_REGISTER_BEGIN, ///< Base index. + +/// Subgroup index tables. +RES_POOLCOLL_TOX_IDXH, ///< Header. +RES_POOLCOLL_TOX_IDX1, ///< 1st level. +RES_POOLCOLL_TOX_IDX2, ///< 2nd level. +RES_POOLCOLL_TOX_IDX3, ///< 3rd level. +RES_POOLCOLL_TOX_IDXBREAK, ///< Separator. + +/// Subgroup table of contents. +RES_POOLCOLL_TOX_CNTNTH, ///< Header. +RES_POOLCOLL_TOX_CNTNT1, ///< Content 1st level. +RES_POOLCOLL_TOX_CNTNT2, ///< Content 2nd level. +RES_POOLCOLL_TOX_CNTNT3, ///< Content 3rd level. +RES_POOLCOLL_TOX_CNTNT4, ///< Content 4th level. +RES_POOLCOLL_TOX_CNTNT5, ///< Content 5th level. + +/// Subgroup user indices. +RES_POOLCOLL_TOX_USERH, ///< Header. +RES_POOLCOLL_TOX_USER1, ///< 1st level. +RES_POOLCOLL_TOX_USER2, ///< 2nd level. +RES_POOLCOLL_TOX_USER3, ///< 3rd level. +RES_POOLCOLL_TOX_USER4, ///< 4th level. +RES_POOLCOLL_TOX_USER5, ///< 5th level. + +RES_POOLCOLL_TOX_CNTNT6, ///< Content 6th level. +RES_POOLCOLL_TOX_CNTNT7, ///< Content 7th level. +RES_POOLCOLL_TOX_CNTNT8, ///< Content 8th level. +RES_POOLCOLL_TOX_CNTNT9, ///< Content 9th level. +RES_POOLCOLL_TOX_CNTNT10, ///< Content 10th level. + +/// illustrations index. +RES_POOLCOLL_TOX_ILLUSH, ///< Illustrations header. +RES_POOLCOLL_TOX_ILLUS1, ///< Illustrations all levels. + +/// object index. +RES_POOLCOLL_TOX_OBJECTH, ///< Objects header. +RES_POOLCOLL_TOX_OBJECT1, ///< Objects all levels. + +/// tables index. +RES_POOLCOLL_TOX_TABLESH, ///< Tables header. +RES_POOLCOLL_TOX_TABLES1, ///< Tables all levels. + +/// index of authorities. +RES_POOLCOLL_TOX_AUTHORITIESH, ///< Authorities header. +RES_POOLCOLL_TOX_AUTHORITIES1, ///< Authorities all levels. + +/// user index 6..10. +RES_POOLCOLL_TOX_USER6, ///< 6th level. +RES_POOLCOLL_TOX_USER7, ///< 7th level. +RES_POOLCOLL_TOX_USER8, ///< 8th level. +RES_POOLCOLL_TOX_USER9, ///< 9th level. +RES_POOLCOLL_TOX_USER10, ///< 10th level. + +RES_POOLCOLL_REGISTER_END, + +/// Group chapter / document. +RES_POOLCOLL_DOC_BEGIN = COLL_DOC_BITS, + +RES_POOLCOLL_DOC_TITLE = RES_POOLCOLL_DOC_BEGIN, ///< Doc. title. +RES_POOLCOLL_DOC_SUBTITLE, ///< Doc. subtitle. +RES_POOLCOLL_DOC_APPENDIX, ///< Doc. appendix. + +RES_POOLCOLL_DOC_END, + +/// Group HTML-styles. +RES_POOLCOLL_HTML_BEGIN = COLL_HTML_BITS, + +RES_POOLCOLL_HTML_BLOCKQUOTE = RES_POOLCOLL_HTML_BEGIN, +RES_POOLCOLL_HTML_PRE, +RES_POOLCOLL_HTML_HR, +RES_POOLCOLL_HTML_DD, +RES_POOLCOLL_HTML_DT, + +RES_POOLCOLL_HTML_END + +/// End of text styles collection. +}; + +/** Query defined parent of a POOL-ID + Returns 0 if standard + USHRT_MAX if no parent + the parent in all other cases. */ +sal_uInt16 GetPoolParent( sal_uInt16 nId ); + +SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage); + +bool IsConditionalByPoolId(sal_uInt16 nId); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx new file mode 100644 index 000000000..c1536ef78 --- /dev/null +++ b/sw/inc/postithelper.hxx @@ -0,0 +1,163 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_POSTITHELPER_HXX +#define INCLUDED_SW_INC_POSTITHELPER_HXX + +#include "swrect.hxx" +#include "fmtfld.hxx" +#include <cstddef> +#include <vcl/vclptr.hxx> +#include <tools/solar.h> +#include "SidebarWindowsTypes.hxx" + +class SfxBroadcaster; +class SwRootFrame; +class SwPostItMgr; +class SwEditWin; +class SwFrame; +class IDocumentRedlineAccess; +namespace sw::annotation { class SwAnnotationWin; } +namespace sw::mark { class IMark; } + +struct SwPosition; + +struct SwLayoutInfo +{ + const SwFrame* mpAnchorFrame; + SwRect mPosition; + + // optional start of the annotation + sal_uLong mnStartNodeIdx; + sal_Int32 mnStartContent; + + SwRect mPageFrame; + SwRect mPagePrtArea; + unsigned long mnPageNumber; + + sw::sidebarwindows::SidebarPosition meSidebarPosition; + + std::size_t mRedlineAuthor; + + /** + * If true, the overlay arrow points to the comment anchor, otherwise it points to the commented + * frame. + */ + bool mPositionFromCommentAnchor; + + SwLayoutInfo() + : mpAnchorFrame(nullptr) + , mPosition() + , mnStartNodeIdx( 0 ) + , mnStartContent( -1 ) + , mPageFrame() + , mPagePrtArea() + , mnPageNumber(1) + , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE) + , mRedlineAuthor(0) + , mPositionFromCommentAnchor(true) + {} +}; + +namespace SwPostItHelper +{ + enum SwLayoutStatus + { + INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN + }; + + SwLayoutStatus getLayoutInfos( + SwLayoutInfo& o_rInfo, + const SwPosition& rAnchorPos, + const sw::mark::IMark* pAnnotationMark = nullptr ); + + long getLayoutHeight( const SwRootFrame* pRoot ); + void setSidebarChanged( SwRootFrame* pRoot, bool bBrowseMode ); + unsigned long getPageInfo( SwRect& rPageFrame, const SwRootFrame* , const Point& ); +} + +class SwSidebarItem +{ +public: + VclPtr<sw::annotation::SwAnnotationWin> pPostIt; + bool bShow; + bool bFocus; + bool bPendingLayout; + + SwPostItHelper::SwLayoutStatus mLayoutStatus; + SwLayoutInfo maLayoutInfo; + + SwSidebarItem( const bool aFocus) + : pPostIt(nullptr) + , bShow(true) + , bFocus(aFocus) + , bPendingLayout(false) + , mLayoutStatus( SwPostItHelper::INVISIBLE ) + , maLayoutInfo() + { + } + + virtual ~SwSidebarItem() + { + } + + SwSidebarItem(SwSidebarItem const &) = default; + SwSidebarItem(SwSidebarItem &&) = default; + SwSidebarItem & operator =(SwSidebarItem const &) = default; + SwSidebarItem & operator =(SwSidebarItem &&) = default; + + virtual SwPosition GetAnchorPosition() const = 0; + virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) = 0; + virtual const SwFormatField& GetFormatField() const = 0; + virtual const SfxBroadcaster* GetBroadcaster() const = 0; + virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow( SwEditWin& rEditWin, + SwPostItMgr& aMgr) = 0; +}; + +class SwAnnotationItem final : public SwSidebarItem +{ +public: + SwAnnotationItem( + SwFormatField& rFormatField, + const bool aFocus) + : SwSidebarItem( aFocus ) + , mrFormatField( rFormatField ) + { + } + + virtual SwPosition GetAnchorPosition() const override; + virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) override; + virtual const SwFormatField& GetFormatField() const override + { + return mrFormatField; + } + virtual const SfxBroadcaster* GetBroadcaster() const override + { + return dynamic_cast<const SfxBroadcaster *> (&mrFormatField); + } + virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow( + SwEditWin& rEditWin, + SwPostItMgr& aMgr ) override; + +private: + SwFormatField& mrFormatField; +}; + +#endif // INCLUDED_SW_INC_POSTITHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx new file mode 100644 index 000000000..1092f977f --- /dev/null +++ b/sw/inc/printdata.hxx @@ -0,0 +1,295 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PRINTDATA_HXX +#define INCLUDED_SW_INC_PRINTDATA_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <vcl/print.hxx> +#include <sfx2/objsh.hxx> + +#include <set> +#include <map> +#include <vector> +#include <utility> +#include <memory> + +class SwDoc; +class SwDocShell; +class SetGetExpFields; +class SwViewOption; +class SwViewOptionAdjust_Impl; +class SwViewShell; +class SwRenderData; + +/** this must match the definitions in css::text::NotePrintMode */ +enum class SwPostItMode +{ + NONE = 0, + Only = 1, + EndDoc = 2, + EndPage = 3, + InMargins = 4 +}; + + +class SwPrintData +{ + const SwRenderData * m_pRenderData; // not owner + +public: + + bool m_bPrintGraphic, m_bPrintTable, m_bPrintDraw, m_bPrintControl, m_bPrintPageBackground, + m_bPrintBlackFont, + //#i81434# - printing of hidden text + m_bPrintHiddenText, m_bPrintTextPlaceholder, + m_bPrintLeftPages, m_bPrintRightPages, m_bPrintReverse, m_bPrintProspect, + m_bPrintProspectRTL, + m_bPrintSingleJobs, m_bPaperFromSetup, + /// Print empty pages + m_bPrintEmptyPages; + + SwPostItMode m_nPrintPostIts; + OUString m_sFaxName; + + SwPrintData() + { + m_pRenderData = nullptr; + + m_bPrintGraphic = + m_bPrintTable = + m_bPrintDraw = + m_bPrintControl = + m_bPrintLeftPages = + m_bPrintRightPages = + m_bPrintPageBackground = + m_bPrintEmptyPages = true; + + m_bPaperFromSetup = + m_bPrintReverse = + m_bPrintProspect = + m_bPrintProspectRTL = + m_bPrintSingleJobs = + m_bPrintBlackFont = + m_bPrintHiddenText = + m_bPrintTextPlaceholder = false; + + m_nPrintPostIts = SwPostItMode::NONE; + } + + virtual ~SwPrintData() {} + + SwPrintData(SwPrintData const &) = default; + SwPrintData(SwPrintData &&) = default; + SwPrintData & operator =(SwPrintData const &) = default; + SwPrintData & operator =(SwPrintData &&) = default; + + bool operator==(const SwPrintData& rData)const + { + return + m_bPrintGraphic == rData.m_bPrintGraphic && + m_bPrintTable == rData.m_bPrintTable && + m_bPrintDraw == rData.m_bPrintDraw && + m_bPrintControl == rData.m_bPrintControl && + m_bPrintPageBackground== rData.m_bPrintPageBackground && + m_bPrintBlackFont == rData.m_bPrintBlackFont && + m_bPrintLeftPages == rData.m_bPrintLeftPages && + m_bPrintRightPages == rData.m_bPrintRightPages && + m_bPrintReverse == rData.m_bPrintReverse && + m_bPrintProspect == rData.m_bPrintProspect && + m_bPrintProspectRTL == rData.m_bPrintProspectRTL && + m_bPrintSingleJobs == rData.m_bPrintSingleJobs && + m_bPaperFromSetup == rData.m_bPaperFromSetup && + m_bPrintEmptyPages == rData.m_bPrintEmptyPages && + m_nPrintPostIts == rData.m_nPrintPostIts && + m_sFaxName == rData.m_sFaxName && + m_bPrintHiddenText == rData.m_bPrintHiddenText && + m_bPrintTextPlaceholder == rData.m_bPrintTextPlaceholder; + } + + /** Note: in the context where this class is used the pointers should always be valid + during the lifetime of this object */ + const SwRenderData & GetRenderData() const { return *m_pRenderData; } + void SetRenderData( const SwRenderData *pData ) { m_pRenderData = pData; } + + bool IsPrintGraphic() const { return m_bPrintGraphic; } + bool IsPrintTable() const { return m_bPrintTable; } + bool IsPrintDraw() const { return m_bPrintDraw; } + bool IsPrintControl() const { return m_bPrintControl; } + bool IsPrintLeftPage() const { return m_bPrintLeftPages; } + bool IsPrintRightPage() const { return m_bPrintRightPages; } + bool IsPrintReverse() const { return m_bPrintReverse; } + bool IsPaperFromSetup() const { return m_bPaperFromSetup; } + bool IsPrintEmptyPages() const { return m_bPrintEmptyPages; } + bool IsPrintProspect() const { return m_bPrintProspect; } + bool IsPrintProspectRTL() const { return m_bPrintProspectRTL; } + bool IsPrintPageBackground() const { return m_bPrintPageBackground; } + bool IsPrintBlackFont() const { return m_bPrintBlackFont; } + bool IsPrintSingleJobs() const { return m_bPrintSingleJobs; } + SwPostItMode GetPrintPostIts() const { return m_nPrintPostIts; } + const OUString& GetFaxName() const { return m_sFaxName; } + bool IsPrintHiddenText() const { return m_bPrintHiddenText; } + bool IsPrintTextPlaceholder() const { return m_bPrintTextPlaceholder; } + + void SetPrintGraphic( bool b ) { doSetModified(); m_bPrintGraphic = b; } + void SetPrintTable( bool b ) { doSetModified(); m_bPrintTable = b; } + void SetPrintDraw( bool b ) { doSetModified(); m_bPrintDraw = b; } + void SetPrintControl( bool b ) { doSetModified(); m_bPrintControl = b; } + void SetPrintLeftPage( bool b ) { doSetModified(); m_bPrintLeftPages = b; } + void SetPrintRightPage( bool b ) { doSetModified(); m_bPrintRightPages = b; } + void SetPrintReverse( bool b ) { doSetModified(); m_bPrintReverse = b; } + void SetPaperFromSetup( bool b ) { doSetModified(); m_bPaperFromSetup = b; } + void SetPrintEmptyPages( bool b ) { doSetModified(); m_bPrintEmptyPages = b; } + void SetPrintPostIts( SwPostItMode n ) { doSetModified(); m_nPrintPostIts = n; } + void SetPrintProspect( bool b ) { doSetModified(); m_bPrintProspect = b; } + void SetPrintProspect_RTL( bool b ) { doSetModified(); m_bPrintProspectRTL = b; } + void SetPrintPageBackground( bool b ) { doSetModified(); m_bPrintPageBackground = b; } + void SetPrintBlackFont( bool b ) { doSetModified(); m_bPrintBlackFont = b; } + void SetPrintSingleJobs( bool b ) { doSetModified(); m_bPrintSingleJobs = b; } + void SetFaxName( const OUString& rSet ) { m_sFaxName = rSet; } + void SetPrintHiddenText( bool b ) { doSetModified(); m_bPrintHiddenText = b; } + void SetPrintTextPlaceholder( bool b ) { doSetModified(); m_bPrintTextPlaceholder = b; } + + virtual void doSetModified () {} +}; + +class SwPrintUIOptions final : public vcl::PrinterOptionsHelper +{ + VclPtr< OutputDevice > m_pLast; + const SwPrintData & m_rDefaultPrintData; + +public: + SwPrintUIOptions( sal_uInt16 nCurrentPage, bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData ); + virtual ~SwPrintUIOptions(); + + bool processPropertiesAndCheckFormat( const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp ); + + bool IsPrintFormControls() const { return getBoolValue( "PrintControls", m_rDefaultPrintData.m_bPrintControl ); } + bool IsPrintPageBackground() const { return getBoolValue( "PrintPageBackground", m_rDefaultPrintData.m_bPrintPageBackground ); } + bool IsPrintProspect() const { return getBoolValue( "PrintProspect", m_rDefaultPrintData.m_bPrintProspect ); } + bool IsPrintProspectRTL() const { return getIntValue( "PrintProspectRTL", m_rDefaultPrintData.m_bPrintProspectRTL ? 1 : 0 ) != 0; } + bool IsPrintTextPlaceholders() const { return getBoolValue( "PrintTextPlaceholder", m_rDefaultPrintData.m_bPrintTextPlaceholder ); } + bool IsPrintHiddenText() const { return getBoolValue( "PrintHiddenText", m_rDefaultPrintData.m_bPrintHiddenText ); } + bool IsPrintWithBlackTextColor() const { return getBoolValue( "PrintBlackFonts", m_rDefaultPrintData.m_bPrintBlackFont ); } + SwPostItMode GetPrintPostItsType() const { return static_cast< SwPostItMode >(getIntValue( "PrintAnnotationMode", static_cast<sal_uInt16>(m_rDefaultPrintData.m_nPrintPostIts) )); } + bool IsPaperFromSetup() const { return getBoolValue( "PrintPaperFromSetup", m_rDefaultPrintData.m_bPaperFromSetup ); } + + bool IsPrintLeftPages() const; + bool IsPrintRightPages() const; + bool IsPrintEmptyPages( bool bIsPDFExport ) const; + bool IsPrintGraphics() const; + bool IsPrintDrawings() const; +}; + +/** A class that stores temporary data that is needed for rendering the document. + Usually this data is created when 'getRendererCount' is called and + and it is used in the 'render' function of that same interface */ +class SwRenderData +{ + /** pages valid for printing (according to the current settings) + This set of pages does NOT depend on the 'PageRange' that is used as a printing option! */ + std::set< sal_Int32 > m_aValidPages; ///< the set of possible pages (see StringRangeEnumerator::getRangesFromString ) + + /// printer paper tray to use for each of the m_aValidPages above + std::map< sal_Int32, sal_Int32 > m_aPrinterPaperTrays; + + /** vector of pages and their order to be printed (duplicates and any order allowed!) + (see 'render' in unotxdoc.cxx) + negative entry indicates the page to be printed is from the post-it doc */ + std::vector< sal_Int32 > m_aPagesToPrint; + + /** for prospect printing: the pairs of pages to be printed together on a single prospect page. + -1 indicates a half page to be left empty. */ + std::vector< std::pair< sal_Int32, sal_Int32 > > m_aPagePairs; + + OUString m_aPageRange; + + /** temp print document -- must live longer than m_pViewOptionAdjust! + also this is a Lock and not a Ref because Ref does not delete the doc */ + SfxObjectShellLock m_xTempDocShell; + + /// the view options to be applied for printing + std::unique_ptr<SwViewOptionAdjust_Impl> m_pViewOptionAdjust; + + std::unique_ptr<SwPrintData> m_pPrtOptions; + +public: + + // PostIt relevant data + /// an array of "SetGetExpField *" sorted by page and line numbers + std::unique_ptr<SetGetExpFields> m_pPostItFields; + /// this contains a SwDoc with the post-it content + std::unique_ptr<SwViewShell> m_pPostItShell; + +public: + SwRenderData(); + ~SwRenderData(); + + bool HasPostItData() const { return m_pPostItShell != nullptr; } + void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev ); + void DeletePostItData(); + + SfxObjectShellLock const& GetTempDocShell() const { return m_xTempDocShell;} + void SetTempDocShell(SfxObjectShellLock const&); + + bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != nullptr; } + bool NeedNewViewOptionAdjust( const SwViewShell& ) const; + void ViewOptionAdjustStart( SwViewShell &rSh, const SwViewOption &rViewOptions); + void ViewOptionAdjust( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF ); + void ViewOptionAdjustStop(); + void ViewOptionAdjustCrashPreventionKludge(); + + bool HasSwPrtOptions() const { return m_pPrtOptions != nullptr; } + SwPrintData const* GetSwPrtOptions() const { return m_pPrtOptions.get(); } + void MakeSwPrtOptions( SwDocShell const*const pDocShell, + SwPrintUIOptions const*const pOpt, bool const bIsPDFExport ); + + typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; + + std::set< sal_Int32 > & GetValidPagesSet() { return m_aValidPages; } + const std::set< sal_Int32 > & GetValidPagesSet() const { return m_aValidPages; } + + /** a map for printer paper tray numbers to use for each document page + a value of -1 for the tray means that there is no specific tray defined */ + std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() { return m_aPrinterPaperTrays; } + const std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() const { return m_aPrinterPaperTrays; } + + /** used for 'normal' printing + A page value of 0 as entry indicates that this page is not from the document but + from the post-it document. (See also GetPostItStartFrame below) */ + std::vector< sal_Int32 > & GetPagesToPrint() { return m_aPagesToPrint; } + const std::vector< sal_Int32 > & GetPagesToPrint() const { return m_aPagesToPrint; } + + /// used for prospect printing only + PagePairsVec_t & GetPagePairsForProspectPrinting() { return m_aPagePairs; } + const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return m_aPagePairs; } + + const OUString& GetPageRange() const { return m_aPageRange; } + void SetPageRange( const OUString &rRange ) { m_aPageRange = rRange; } +}; + +namespace sw { + +void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb); + +} ///< namespace sw + +#endif // INCLUDED_SW_INC_PRINTDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/proofreadingiterator.hxx b/sw/inc/proofreadingiterator.hxx new file mode 100644 index 000000000..a77dd9abf --- /dev/null +++ b/sw/inc/proofreadingiterator.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_INC_PROOFREADINGITERATOR_HXX +#define INCLUDED_SW_INC_PROOFREADINGITERATOR_HXX + +#include <sal/config.h> + +#include <com/sun/star/uno/Reference.h> + +namespace com::sun::star { + namespace linguistic2 { class XProofreadingIterator; } + namespace uno { class XComponentContext; } +} + +// A simple wrapper around the css.linguistic2.ProofreadingIterator +// single-instance service. The first time that service implementation gets +// instantiated it immediately starts a GrammarCheckingIterator thread that +// eventually needs to be joined (via dispose): + +namespace sw::proofreadingiterator { + +css::uno::Reference<css::linguistic2::XProofreadingIterator> get( + css::uno::Reference<css::uno::XComponentContext> const & context); + +void dispose(); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/prtopt.hxx b/sw/inc/prtopt.hxx new file mode 100644 index 000000000..41a2835eb --- /dev/null +++ b/sw/inc/prtopt.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_PRTOPT_HXX +#define INCLUDED_SW_INC_PRTOPT_HXX + +#include <unotools/configitem.hxx> +#include "printdata.hxx" + +class SwPrintOptions final : public SwPrintData, public utl::ConfigItem +{ +private: + bool m_bIsWeb; + + css::uno::Sequence<OUString> GetPropertyNames() const; + + virtual void ImplCommit() override; + +public: + SwPrintOptions(bool bWeb); + virtual ~SwPrintOptions() override; + + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual void doSetModified() override { SetModified(); } + + SwPrintOptions& operator=(const SwPrintData& rData) + { + SwPrintData::operator=( rData ); + SetModified(); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pvprtdat.hxx b/sw/inc/pvprtdat.hxx new file mode 100644 index 000000000..2a8d5fb0c --- /dev/null +++ b/sw/inc/pvprtdat.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_PVPRTDAT_HXX +#define INCLUDED_SW_INC_PVPRTDAT_HXX + +#include <sal/types.h> + +class SwPagePreviewPrtData +{ + + sal_Int32 m_nLeftSpace, m_nRightSpace, m_nTopSpace, m_nBottomSpace, + m_nHorzSpace, m_nVertSpace; + sal_uInt8 m_nRow, m_nCol; + bool m_bLandscape : 1; +public: + SwPagePreviewPrtData() + : m_nLeftSpace(0), m_nRightSpace(0), m_nTopSpace(0), m_nBottomSpace(0), + m_nHorzSpace(0), m_nVertSpace(0), m_nRow(1), m_nCol(1), + m_bLandscape(false) + {} + + sal_Int32 GetLeftSpace() const { return m_nLeftSpace; } + void SetLeftSpace( sal_Int32 n ) { m_nLeftSpace = n; } + + sal_Int32 GetRightSpace() const { return m_nRightSpace; } + void SetRightSpace( sal_Int32 n ) { m_nRightSpace = n; } + + sal_Int32 GetTopSpace() const { return m_nTopSpace; } + void SetTopSpace( sal_Int32 n ) { m_nTopSpace = n; } + + sal_Int32 GetBottomSpace() const { return m_nBottomSpace; } + void SetBottomSpace(sal_Int32 n ) { m_nBottomSpace = n; } + + sal_Int32 GetHorzSpace() const { return m_nHorzSpace; } + void SetHorzSpace( sal_Int32 n ) { m_nHorzSpace = n; } + + sal_Int32 GetVertSpace() const { return m_nVertSpace; } + void SetVertSpace( sal_Int32 n ) { m_nVertSpace = n; } + + sal_uInt8 GetRow() const { return m_nRow; } + void SetRow(sal_uInt8 n ) { m_nRow = n; } + + sal_uInt8 GetCol() const { return m_nCol; } + void SetCol( sal_uInt8 n ) { m_nCol = n; } + + bool GetLandscape() const { return m_bLandscape; } + void SetLandscape( bool b ) { m_bLandscape = b; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc new file mode 100644 index 000000000..e362a8c38 --- /dev/null +++ b/sw/inc/rcid.hrc @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_RCID_HRC +#define INCLUDED_SW_INC_RCID_HRC + +#include <svl/solar.hrc> + +// Areas for the UI-Directories + +#define RC_GLOBALS (RID_SW_START + 800) + +/*-------------------------------------------------------------------- + Description: areas unharness + --------------------------------------------------------------------*/ + +// Global Resources +#define RC_GLOBALS_BEGIN RC_GLOBALS +#define RC_GLOBALS_END (RC_GLOBALS_BEGIN + 120) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/rdfhelper.hxx b/sw/inc/rdfhelper.hxx new file mode 100644 index 000000000..ee346c499 --- /dev/null +++ b/sw/inc/rdfhelper.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_INC_RDFHELPER_HXX +#define INCLUDED_SW_INC_RDFHELPER_HXX + +#include <map> + +#include <rtl/ustring.hxx> + +#include "swdllapi.h" + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> + +class SwTextNode; + +namespace com::sun::star { + namespace frame { + class XModel; + } + namespace rdf { + class XDocumentMetadataAccess; + class XResource; + class XURI; + } +} + +/// Provides access to RDF metadata on core objects. +class SW_DLLPUBLIC SwRDFHelper +{ +public: + /// Gets all graph-names in RDF of a given type. + static css::uno::Sequence<css::uno::Reference<css::rdf::XURI>> + getGraphNames(const css::uno::Reference<css::rdf::XDocumentMetadataAccess>& xDocumentMetadataAccess, + const css::uno::Reference<css::rdf::XURI>& xType); + + /// Gets all graph-names in RDF of a given type. + static css::uno::Sequence<css::uno::Reference<css::rdf::XURI>> + getGraphNames(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rType); + + /// Gets all (XResource, key, value) statements in RDF graphs given the graph-names. + static std::map<OUString, OUString> + getStatements(const css::uno::Reference<css::frame::XModel>& xModel, + const css::uno::Sequence<css::uno::Reference<css::rdf::XURI>>& rGraphNames, + const css::uno::Reference<css::rdf::XResource>& xSubject); + + /// Gets all (XResource, key, value) statements in RDF graphs of type rType. + static std::map<OUString, OUString> + getStatements(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rType, + const css::uno::Reference<css::rdf::XResource>& xSubject); + + /// Add an (XResource, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first. + static void addStatement(const css::uno::Reference<css::frame::XModel>& xModel, + const OUString& rType, const OUString& rPath, + const css::uno::Reference<css::rdf::XResource>& xSubject, + const OUString& rKey, const OUString& rValue); + + /// Check if a graph of type rType exists. + static bool hasMetadataGraph(const css::uno::Reference<css::frame::XModel>& xModel, + const OUString& rType); + + /// Remove an (XResource, key, value) statement in the graph of type rType, if it exists. + static void removeStatement(const css::uno::Reference<css::frame::XModel>& xModel, + const OUString& rType, + const css::uno::Reference<css::rdf::XResource>& xSubject, + const OUString& rKey, const OUString& rValue); + + /// Clone all statements in the graph of type rType, if any exists, from one subject to another. + static void cloneStatements(const css::uno::Reference<css::frame::XModel>& xSrcModel, + const css::uno::Reference<css::frame::XModel>& xDstModel, + const OUString& rType, + const css::uno::Reference<css::rdf::XResource>& xSrcSubject, + const css::uno::Reference<css::rdf::XResource>& xDstSubject); + + /// Remove all statements in the graph of type rType, if any exists. + static void clearStatements(const css::uno::Reference<css::frame::XModel>& xModel, + const OUString& rType, + const css::uno::Reference<css::rdf::XResource>& xSubject); + + /// Gets all (rTextNode, key, value) statements in RDF graphs of type rType. + static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode); + + /// Add an (rTextNode, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first. + static void addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue); + + /// Remove an (rTextNode, key, value) statement in the graph of type rType. + static void removeTextNodeStatement(const OUString& rType, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue); + + /// Update an (rTextNode, key, value) statement in the graph of type rType from old value to new. Creates the graph at rPath if doesn't exist. + static void updateTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rOldValue, const OUString& rNewValue); + +}; + +#endif // INCLUDED_SW_INC_RDFHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx new file mode 100644 index 000000000..e75ad1aaa --- /dev/null +++ b/sw/inc/redline.hxx @@ -0,0 +1,333 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_REDLINE_HXX +#define INCLUDED_SW_INC_REDLINE_HXX + +#include <tools/datetime.hxx> +#include <rtl/ustring.hxx> + +#include "pam.hxx" + +#include "IDocumentRedlineAccess.hxx" + +#include <cstddef> +#include <memory> +#include <vector> +#include <optional> + + +class SfxItemSet; + +class SW_DLLPUBLIC SwRedlineExtraData +{ + SwRedlineExtraData( const SwRedlineExtraData& ) = delete; + SwRedlineExtraData& operator=( const SwRedlineExtraData& ) = delete; + +protected: + SwRedlineExtraData() {} + +public: + virtual ~SwRedlineExtraData(); + virtual SwRedlineExtraData* CreateNew() const = 0; + + virtual void Reject( SwPaM& rPam ) const; + virtual bool operator == ( const SwRedlineExtraData& ) const; +}; + +class SW_DLLPUBLIC SwRedlineExtraData_FormatColl final : public SwRedlineExtraData +{ + OUString m_sFormatNm; + std::unique_ptr<SfxItemSet> m_pSet; + sal_uInt16 m_nPoolId; + bool m_bFormatAll; // don't strip the last paragraph mark +public: + SwRedlineExtraData_FormatColl( const OUString& rColl, sal_uInt16 nPoolFormatId, + const SfxItemSet* pSet = nullptr, bool bFormatAll = true ); + virtual ~SwRedlineExtraData_FormatColl() override; + virtual SwRedlineExtraData* CreateNew() const override; + virtual void Reject( SwPaM& rPam ) const override; + virtual bool operator == ( const SwRedlineExtraData& ) const override; + + const OUString& GetFormatName() const { return m_sFormatNm; } + void SetItemSet( const SfxItemSet& rSet ); + SfxItemSet* GetItemSet( ) const { return m_pSet.get(); } + void SetFormatAll( bool bAll ) { m_bFormatAll = bAll; } +}; + +class SwRedlineExtraData_Format final : public SwRedlineExtraData +{ + std::vector<sal_uInt16> m_aWhichIds; + + SwRedlineExtraData_Format( const SwRedlineExtraData_Format& rCpy ); + +public: + SwRedlineExtraData_Format( const SfxItemSet& rSet ); + virtual ~SwRedlineExtraData_Format() override; + virtual SwRedlineExtraData* CreateNew() const override; + virtual void Reject( SwPaM& rPam ) const override; + virtual bool operator == ( const SwRedlineExtraData& ) const override; +}; + +class SW_DLLPUBLIC SwRedlineData +{ + friend class SwRangeRedline; + SwRedlineData* m_pNext; // Points to other data. + SwRedlineExtraData* m_pExtraData; + + OUString m_sComment; + DateTime m_aStamp; + RedlineType m_eType; + bool m_bAutoFormat; + std::size_t m_nAuthor; + sal_uInt16 m_nSeqNo; + +public: + SwRedlineData( RedlineType eT, std::size_t nAut ); + SwRedlineData( const SwRedlineData& rCpy, bool bCpyNext = true ); + + // For sw3io: pNext/pExtraData are taken over. + SwRedlineData( RedlineType eT, std::size_t nAut, const DateTime& rDT, + const OUString& rCmnt, SwRedlineData* pNxt ); + + ~SwRedlineData(); + + bool operator==( const SwRedlineData& rCmp ) const + { + return m_nAuthor == rCmp.m_nAuthor && + m_eType == rCmp.m_eType && + m_bAutoFormat == rCmp.m_bAutoFormat && + m_sComment == rCmp.m_sComment && + (( !m_pNext && !rCmp.m_pNext ) || + ( m_pNext && rCmp.m_pNext && *m_pNext == *rCmp.m_pNext )) && + (( !m_pExtraData && !rCmp.m_pExtraData ) || + ( m_pExtraData && rCmp.m_pExtraData && + *m_pExtraData == *rCmp.m_pExtraData )); + } + bool operator!=( const SwRedlineData& rCmp ) const + { return !operator==( rCmp ); } + + RedlineType GetType() const { return m_eType; } + + std::size_t GetAuthor() const { return m_nAuthor; } + const OUString& GetComment() const { return m_sComment; } + const DateTime& GetTimeStamp() const { return m_aStamp; } + const SwRedlineData* Next() const{ return m_pNext; } + + void SetComment( const OUString& rS ) { m_sComment = rS; } + void SetTimeStamp( const DateTime& rDT ) { m_aStamp = rDT; } + + void SetAutoFormat() { m_bAutoFormat = true; } + bool IsAutoFormat() const { return m_bAutoFormat; } + bool CanCombine( const SwRedlineData& rCmp ) const; + + // ExtraData gets copied, the pointer is therefore not taken over by + // the RedlineObject + void SetExtraData( const SwRedlineExtraData* pData ); + const SwRedlineExtraData* GetExtraData() const { return m_pExtraData; } + + // For UI-side pooling of Redline-actions. + // At the moment only used for Autoformat with Redline. + // Value != 0 means there can be others! + sal_uInt16 GetSeqNo() const { return m_nSeqNo; } + void SetSeqNo( sal_uInt16 nNo ) { m_nSeqNo = nNo; } + + OUString GetDescr() const; +}; + +class SW_DLLPUBLIC SwRangeRedline : public SwPaM +{ + SwRedlineData* m_pRedlineData; + SwNodeIndex* m_pContentSect; + bool m_bDelLastPara : 1; + bool m_bIsVisible : 1; + sal_uInt32 m_nId; + + std::optional<long> m_oLOKLastNodeTop; + + void MoveToSection(); + void CopyToSection(); + void DelCopyOfSection(size_t nMyPos); + void MoveFromSection(size_t nMyPos); + +public: + static sal_uInt32 m_nLastId; + + SwRangeRedline( RedlineType eType, const SwPaM& rPam ); + SwRangeRedline( const SwRedlineData& rData, const SwPaM& rPam ); + SwRangeRedline( const SwRedlineData& rData, const SwPosition& rPos ); + // For sw3io: pData is taken over! + SwRangeRedline(SwRedlineData* pData, const SwPosition& rPos, + bool bDelLP) : + SwPaM( rPos ), m_pRedlineData( pData ), m_pContentSect( nullptr ), + m_bDelLastPara( bDelLP ), m_bIsVisible( true ), m_nId( m_nLastId++ ) + {} + SwRangeRedline( const SwRangeRedline& ); + virtual ~SwRangeRedline() override; + + sal_uInt32 GetId() const { return m_nId; } + SwNodeIndex* GetContentIdx() const { return m_pContentSect; } + // For Undo. + void SetContentIdx( const SwNodeIndex* ); + + bool IsVisible() const { return m_bIsVisible; } + bool IsDelLastPara() const { return m_bDelLastPara; } + + void SetStart( const SwPosition& rPos, SwPosition* pSttPtr = nullptr ); + void SetEnd( const SwPosition& rPos, SwPosition* pEndPtr = nullptr ); + + /// Do we have a valid selection? + bool HasValidRange() const; + + const SwRedlineData& GetRedlineData(sal_uInt16 nPos = 0) const; + bool operator!=( const SwRedlineData& rCmp ) const + { return *m_pRedlineData != rCmp; } + void SetAutoFormat() { m_pRedlineData->SetAutoFormat(); } + bool IsAutoFormat() const { return m_pRedlineData->IsAutoFormat(); } + + sal_uInt16 GetStackCount() const; + std::size_t GetAuthor( sal_uInt16 nPos = 0) const; + OUString const & GetAuthorString( sal_uInt16 nPos = 0 ) const; + const DateTime& GetTimeStamp( sal_uInt16 nPos = 0) const; + RedlineType GetType( sal_uInt16 nPos = 0 ) const; + const OUString& GetComment( sal_uInt16 nPos = 0 ) const; + + void SetComment( const OUString& rS ) { m_pRedlineData->SetComment( rS ); } + + /** ExtraData gets copied, the pointer is therefore not taken over by + * the RedLineObject.*/ + void SetExtraData( const SwRedlineExtraData* pData ) + { m_pRedlineData->SetExtraData( pData ); } + const SwRedlineExtraData* GetExtraData() const + { return m_pRedlineData->GetExtraData(); } + + // For UI-side pooling of Redline-actions. + // At the moment only used for Autoformat with Redline. + // Value != 0 means there can be others! + sal_uInt16 GetSeqNo() const { return m_pRedlineData->GetSeqNo(); } + void SetSeqNo( sal_uInt16 nNo ) { m_pRedlineData->SetSeqNo( nNo ); } + + // At Hide/ShowOriginal the list is traversed two times in order to + // hide the Del-Redlines via Copy and Delete. + // Otherwise at Move the attribution would be handled incorrectly. + // All other callers must always give 0. + void CallDisplayFunc(size_t nMyPos); + void Show(sal_uInt16 nLoop , size_t nMyPos); + void Hide(sal_uInt16 nLoop , size_t nMyPos); + void ShowOriginal(sal_uInt16 nLoop, size_t nMyPos); + + /// Calculates the intersection with text node number nNdIdx. + void CalcStartEnd(sal_uLong nNdIdx, sal_Int32& rStart, sal_Int32& rEnd) const; + + enum class Invalidation { Add, Remove }; + /// Initiate the layout. + void InvalidateRange(Invalidation); + + bool IsOwnRedline( const SwRangeRedline& rRedl ) const + { return GetAuthor() == rRedl.GetAuthor(); } + bool CanCombine( const SwRangeRedline& rRedl ) const; + + void PushData( const SwRangeRedline& rRedl, bool bOwnAsNext = true ); + bool PopData(); + + /** + Returns textual description of a redline data element of + this redline. + + The textual description of the selected element contains the + kind of redline and the possibly shortened text of the redline. + + @return textual description of the selected redline data element + */ + OUString GetDescr(); + + bool operator<( const SwRangeRedline& ) const; + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + void MaybeNotifyRedlinePositionModification(long nTop); +}; + +void MaybeNotifyRedlineModification(SwRangeRedline* pRedline, SwDoc* pDoc); + +/// Base object for 'Redlines' that are not of 'Ranged' type (like table row insert\delete) +class SW_DLLPUBLIC SwExtraRedline +{ +private: + SwExtraRedline(SwExtraRedline const&) = delete; + SwExtraRedline& operator=(SwExtraRedline const&) = delete; +public: + SwExtraRedline() = default; + virtual ~SwExtraRedline(); +}; + +/// Redline that holds information about a table-row that had some change +class SW_DLLPUBLIC SwTableRowRedline : public SwExtraRedline +{ +private: + SwRedlineData m_aRedlineData; + const SwTableLine& m_rTableLine; + +public: + SwTableRowRedline(const SwRedlineData& rData, const SwTableLine& rTableLine); + virtual ~SwTableRowRedline() override; + + /** ExtraData gets copied, the pointer is therefore not taken over by + * the RedLineObject.*/ + void SetExtraData( const SwRedlineExtraData* pData ) + { m_aRedlineData.SetExtraData( pData ); } + const SwTableLine& GetTableLine() const + { return m_rTableLine; } + const SwRedlineData& GetRedlineData() const + { return m_aRedlineData; } +}; + +/// Redline that holds information about a table-cell that had some change +class SW_DLLPUBLIC SwTableCellRedline : public SwExtraRedline +{ +private: + SwRedlineData m_aRedlineData; + const SwTableBox& m_rTableBox; + +public: + SwTableCellRedline(const SwRedlineData& rData, const SwTableBox& rTableBox); + virtual ~SwTableCellRedline() override; + + /** ExtraData gets copied, the pointer is therefore not taken over by + * the RedLineObject.*/ + void SetExtraData( const SwRedlineExtraData* pData ) + { m_aRedlineData.SetExtraData( pData ); } + const SwTableBox& GetTableBox() const + { return m_rTableBox; } + const SwRedlineData& GetRedlineData() const + { return m_aRedlineData; } +}; + +class SW_DLLPUBLIC SwRedlineHint final : public SfxHint +{ +}; + + +namespace sw { + +std::vector<SwRangeRedline*> GetAllValidRanges(std::unique_ptr<SwRangeRedline> p); + +} // namespace sw + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx new file mode 100644 index 000000000..f59ea0d55 --- /dev/null +++ b/sw/inc/reffld.hxx @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_REFFLD_HXX +#define INCLUDED_SW_INC_REFFLD_HXX + +#include <tools/solar.h> + +#include "fldbas.hxx" + +class SfxPoolItem; +class SwDoc; +class SwTextNode; +class SwTextField; +class SwRootFrame; + +bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos, + const SwTextNode& rBehindNd, sal_Int32 nSttPos ); + +enum REFERENCESUBTYPE +{ + REF_SETREFATTR = 0, + REF_SEQUENCEFLD, + REF_BOOKMARK, + REF_OUTLINE, + REF_FOOTNOTE, + REF_ENDNOTE +}; + +enum REFERENCEMARK +{ + REF_BEGIN, + REF_PAGE = REF_BEGIN, ///< "Page" + REF_CHAPTER, ///< "Chapter" + REF_CONTENT, ///< "Reference" + REF_UPDOWN, ///< "Above/Below" + REF_PAGE_PGDESC, ///< "As Page Style" + REF_ONLYNUMBER, ///< "Category and Number" + REF_ONLYCAPTION, ///< "Caption Text" + REF_ONLYSEQNO, ///< "Numbering" + // --> #i81002# + /// new reference format types for referencing bookmarks and set references + REF_NUMBER, ///< "Number" + REF_NUMBER_NO_CONTEXT, ///< "Number (no context)" + REF_NUMBER_FULL_CONTEXT, ///< "Number (full context)" +}; + +/// Get reference. + +class SAL_DLLPUBLIC_RTTI SwGetRefFieldType final : public SwFieldType +{ + SwDoc* m_pDoc; + + /// Overlay in order to update all ref-fields. + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; +public: + SwGetRefFieldType(SwDoc* pDoc ); + virtual std::unique_ptr<SwFieldType> Copy() const override; + + SwDoc* GetDoc() const { return m_pDoc; } + + void MergeWithOtherDoc( SwDoc& rDestDoc ); + + static SwTextNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark, + sal_uInt16 nSubType, sal_uInt16 nSeqNo, + sal_Int32* pStt, sal_Int32* pEnd = nullptr, + SwRootFrame const* pLayout = nullptr); +}; + +class SW_DLLPUBLIC SwGetRefField final : public SwField +{ +private: + OUString m_sSetRefName; + OUString m_sSetReferenceLanguage; + OUString m_sText; ///< result + OUString m_sTextRLHidden; ///< result for layout with redlines hidden + sal_uInt16 m_nSubType; + /// reference to either a SwTextFootnote::m_nSeqNo or a SwSetExpField::mnSeqNo + sal_uInt16 m_nSeqNo; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwGetRefField( SwGetRefFieldType*, const OUString& rSetRef, const OUString& rReferenceLanguage, + sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat ); + + virtual ~SwGetRefField() override; + + virtual OUString GetFieldName() const override; + + const OUString& GetSetRefName() const { return m_sSetRefName; } + + // #i81002# + /** The <SwTextField> instance, which represents the text attribute for the + <SwGetRefField> instance, has to be passed to the method. + This <SwTextField> instance is needed for the reference format type REF_UPDOWN + and REF_NUMBER. + Note: This instance may be NULL (field in Undo/Redo). This will cause + no update for these reference format types. */ + void UpdateField( const SwTextField* pFieldTextAttr ); + + void SetExpand( const OUString& rStr ); + + /// Get/set sub type. + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType( sal_uInt16 n ) override; + + // --> #i81002# + bool IsRefToHeadingCrossRefBookmark() const; + bool IsRefToNumItemCrossRefBookmark() const; + const SwTextNode* GetReferencedTextNode() const; + // #i85090# + OUString GetExpandedTextOfReferencedTextNode(SwRootFrame const& rLayout) const; + + /// Get/set SequenceNo (of interest only for REF_SEQUENCEFLD). + sal_uInt16 GetSeqNo() const { return m_nSeqNo; } + void SetSeqNo( sal_uInt16 n ) { m_nSeqNo = n; } + + // Name of reference. + virtual OUString GetPar1() const override; + virtual void SetPar1(const OUString& rStr) override; + + virtual OUString GetPar2() const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ) override; + + void ConvertProgrammaticToUIName(); + + virtual OUString GetDescription() const override; +}; + +#endif /// INCLUDED_SW_INC_REFFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx new file mode 100644 index 000000000..e152899ec --- /dev/null +++ b/sw/inc/ring.hxx @@ -0,0 +1,265 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_RING_HXX +#define INCLUDED_SW_INC_RING_HXX + +#include <utility> +#include <sal/types.h> +#include <iterator> +#include <type_traits> +#include <boost/iterator/iterator_facade.hpp> +#include <boost/intrusive/circular_list_algorithms.hpp> + +namespace sw +{ + template <typename value_type> class RingContainer; + template <typename value_type> class RingIterator; + /** + * An intrusive container class double linking the contained nodes + * @example sw/qa/core/uwriter.cxx + */ + template <typename value_type> + class SAL_WARN_UNUSED Ring + { + public: + typedef typename std::add_const<value_type>::type const_value_type; + typedef RingContainer<value_type> ring_container; + typedef RingContainer<const_value_type> const_ring_container; + virtual ~Ring() COVERITY_NOEXCEPT_FALSE + { unlink(); }; + /** algo::unlink is buggy! don't call it directly! */ + void unlink() + { + algo::unlink(this); + m_pNext = this; // don't leave pointers to old list behind! + m_pPrev = this; + } + /** + * Removes this item from its current ring container and adds it to + * another ring container. If the item was not alone in the original + * ring container, the other items in the ring will stay in the old + * ring container. + * Note: the newly created item will be inserted just before item pDestRing. + * @param pDestRing the container to add this item to + */ + void MoveTo( value_type* pDestRing ); + /** @return a stl-like container with begin()/end() for iteration */ + ring_container GetRingContainer(); + /** @return a stl-like container with begin()/end() for const iteration */ + const_ring_container GetRingContainer() const; + + protected: + /** + * Creates a new item in a ring container all by itself. + * Note: Ring instances can newer be outside a container. At most, they + * are alone in one. + */ + Ring() + : m_pNext(this) + , m_pPrev(this) + { } + /** + * Creates a new item and add it to an existing ring container. + * Note: the newly created item will be inserted just before item pRing. + * @param pRing ring container to add the created item to + */ + Ring( value_type* pRing ); + /** @return the next item in the ring container */ + value_type* GetNextInRing() + { return static_cast<value_type *>(m_pNext); } + /** @return the previous item in the ring container */ + value_type* GetPrevInRing() + { return static_cast<value_type *>(m_pPrev); } + /** @return the next item in the ring container */ + const_value_type* GetNextInRing() const + { return static_cast<value_type *>(m_pNext); } + /** @return the previous item in the ring container */ + const_value_type* GetPrevInRing() const + { return static_cast<value_type *>(m_pPrev); } + /** @return true if and only if this item is alone in its ring */ + bool unique() const + { return algo::unique(static_cast< const_value_type* >(this)); } + + private: + /** internal implementation class -- not for external use */ + struct Ring_node_traits + { + typedef Ring node; + typedef Ring* node_ptr; + typedef const Ring* const_node_ptr; + static node_ptr get_next(const_node_ptr n) { return const_cast<node_ptr>(n)->m_pNext; }; + static void set_next(node_ptr n, node_ptr next) { n->m_pNext = next; }; + static node_ptr get_previous(const_node_ptr n) { return const_cast<node_ptr>(n)->m_pPrev; }; + static void set_previous(node_ptr n, node_ptr previous) { n->m_pPrev = previous; }; + }; + friend ring_container; + friend const_ring_container; + friend typename ring_container::iterator; + friend typename ring_container::const_iterator; + friend typename const_ring_container::iterator; + friend typename const_ring_container::const_iterator; + friend class boost::iterator_core_access; + typedef boost::intrusive::circular_list_algorithms<Ring_node_traits> algo; + Ring* m_pNext; + Ring* m_pPrev; + }; + + template <typename value_type> + inline Ring<value_type>::Ring( value_type* pObj ) + : m_pNext(this) + , m_pPrev(this) + { + if( pObj ) + { + algo::link_before(pObj, this); + } + } + + template <typename value_type> + inline void Ring<value_type>::MoveTo(value_type* pDestRing) + { + value_type* pThis = static_cast< value_type* >(this); + unlink(); + // insert into "new" + if (pDestRing) + { + algo::link_before(pDestRing, pThis); + } + } + + /** + * helper class that provides Svalue_typeL-style container iteration to the ring + */ + template <typename value_type> + class SAL_WARN_UNUSED RingContainer final + { + private: + /** the item in the ring where iteration starts */ + value_type* m_pStart; + typedef typename std::remove_const<value_type>::type nonconst_value_type; + + public: + RingContainer( value_type* pRing ) : m_pStart(pRing) {}; + typedef RingIterator<value_type> iterator; + typedef RingIterator<const value_type> const_iterator; + /** + * iterator access + * @code + * for(SwPaM& rCurrentPaM : pPaM->GetRingContainer()) + * do_stuff(rCurrentPaM); // this gets called on every SwPaM in the same ring as pPaM + * @endcode + */ + iterator begin(); + iterator end(); + const_iterator begin() const; + const_iterator end() const; + /** @return the number of elements in the container */ + size_t size() const + { return std::distance(begin(), end()); } + /** + * Merges two ring containers. All item from both ring containers will + * be in the same ring container in the end. + * Note: The items of this ring container will be inserted just before + * item pDestRing + * @param pDestRing the container to merge this container with + */ + void merge( RingContainer< value_type > aDestRing ) + { + // first check that we aren't merged already, swapping would + // actually un-merge in this case! + assert(m_pStart->m_pPrev != aDestRing.m_pStart); + assert(m_pStart != aDestRing.m_pStart->m_pPrev); + std::swap(m_pStart->m_pPrev->m_pNext, aDestRing.m_pStart->m_pPrev->m_pNext); + std::swap(m_pStart->m_pPrev, aDestRing.m_pStart->m_pPrev); + } + }; + + template <typename value_type> + class RingIterator final : public boost::iterator_facade< + RingIterator<value_type> + , value_type + , boost::forward_traversal_tag + > + { + private: + typedef typename std::remove_const<value_type>::type nonconst_value_type; + public: + RingIterator() + : m_pCurrent(nullptr) + , m_pStart(nullptr) + {} + explicit RingIterator(nonconst_value_type* pRing, bool bStart = true) + : m_pCurrent(nullptr) + , m_pStart(pRing) + { + if(!bStart) + m_pCurrent = m_pStart; + } + + private: + friend class boost::iterator_core_access; + void increment() + { m_pCurrent = m_pCurrent ? m_pCurrent->GetNextInRing() : m_pStart->GetNextInRing(); } + bool equal(RingIterator const& other) const + { + // we never want to compare iterators from + // different rings or starting points + assert(m_pStart == other.m_pStart); + return m_pCurrent == other.m_pCurrent; + } + value_type& dereference() const + { return m_pCurrent ? *m_pCurrent : * m_pStart; } + /** + * value_type is: + * - pointing to the current item in the iteration in general + * - nullptr if on the first item (begin()) + * - m_pStart when beyond the last item (end()) + */ + nonconst_value_type* m_pCurrent; + /** the first item of the iteration */ + nonconst_value_type* m_pStart; + }; + + template <typename value_type> + inline typename Ring<value_type>::ring_container Ring<value_type>::GetRingContainer() + { return Ring<value_type>::ring_container(static_cast< value_type* >(this)); }; + + template <typename value_type> + inline typename Ring<value_type>::const_ring_container Ring<value_type>::GetRingContainer() const + { return Ring<value_type>::const_ring_container(static_cast< const_value_type* >(this)); }; + + template <typename value_type> + inline typename RingContainer<value_type>::iterator RingContainer<value_type>::begin() + { return RingContainer<value_type>::iterator(const_cast< nonconst_value_type* >(m_pStart)); }; + + template <typename value_type> + inline typename RingContainer<value_type>::iterator RingContainer<value_type>::end() + { return RingContainer<value_type>::iterator(const_cast< nonconst_value_type* >(m_pStart), false); }; + + template <typename value_type> + inline typename RingContainer<value_type>::const_iterator RingContainer<value_type>::begin() const + { return RingContainer<value_type>::const_iterator(const_cast< nonconst_value_type* >(m_pStart)); }; + + template <typename value_type> + inline typename RingContainer<value_type>::const_iterator RingContainer<value_type>::end() const + { return RingContainer<value_type>::const_iterator(const_cast< nonconst_value_type* >(m_pStart), false); }; +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/rubylist.hxx b/sw/inc/rubylist.hxx new file mode 100644 index 000000000..b025686da --- /dev/null +++ b/sw/inc/rubylist.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_RUBYLIST_HXX +#define INCLUDED_SW_INC_RUBYLIST_HXX + +#include "fmtruby.hxx" + +class SwRubyListEntry +{ + OUString m_sText; + SwFormatRuby m_aRubyAttr; +public: + SwRubyListEntry() : m_aRubyAttr( OUString() ) {} + ~SwRubyListEntry(); + + const OUString& GetText() const { return m_sText; } + void SetText( const OUString& rStr ) { m_sText = rStr; } + + const SwFormatRuby& GetRubyAttr() const { return m_aRubyAttr; } + SwFormatRuby& GetRubyAttr() { return m_aRubyAttr; } + void SetRubyAttr( const SwFormatRuby& rAttr ) { m_aRubyAttr = rAttr; } +}; + +#endif //_ INCLUDED_SW_INC_RUBYLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx new file mode 100644 index 000000000..bbadd9927 --- /dev/null +++ b/sw/inc/section.hxx @@ -0,0 +1,376 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SECTION_HXX +#define INCLUDED_SW_INC_SECTION_HXX + +#include <com/sun/star/uno/Sequence.h> + +#include <tools/ref.hxx> +#include <svl/hint.hxx> +#include <sfx2/lnkbase.hxx> +#include <sfx2/Metadatable.hxx> + +#include "frmfmt.hxx" +#include <vector> + +namespace com::sun::star { + namespace text { class XTextSection; } +} +class SwSectionFormat; +class SwDoc; +class SwSection; +class SwSectionNode; +class SwTOXBase; +class SwServerObject; + +typedef std::vector<SwSection*> SwSections; + +enum class SectionType { Content, + ToxHeader, + ToxContent, + DdeLink = static_cast<int>(sfx2::SvBaseLinkObjectType::ClientDde), + FileLink = static_cast<int>(sfx2::SvBaseLinkObjectType::ClientFile) + }; + +enum class LinkCreateType +{ + NONE, // Do nothing. + Connect, // Connect created link. + Update // Connect created link and update it. +}; + +class SW_DLLPUBLIC SwSectionData +{ +private: + SectionType m_eType; + + OUString m_sSectionName; + OUString m_sCondition; + OUString m_sLinkFileName; + OUString m_sLinkFilePassword; // Must be changed to Sequence. + css::uno::Sequence <sal_Int8> m_Password; + + /// It seems this flag caches the current final "hidden" state. + bool m_bHiddenFlag : 1; + /// Flags that correspond to attributes in the format: + /// may have different value than format attribute: + /// format attr has value for this section, while flag is + /// effectively ORed with parent sections! + bool m_bProtectFlag : 1; + // Edit in readonly sections. + bool m_bEditInReadonlyFlag : 1; + + bool m_bHidden : 1; // All paragraphs hidden? + bool m_bCondHiddenFlag : 1; // Hiddenflag for condition. + bool m_bConnectFlag : 1; // Connected to server? + +public: + + SwSectionData(SectionType const eType, OUString const& rName); + explicit SwSectionData(SwSection const&); + SwSectionData(SwSectionData const&); + SwSectionData & operator=(SwSectionData const&); + bool operator==(SwSectionData const&) const; + + const OUString& GetSectionName() const { return m_sSectionName; } + void SetSectionName(OUString const& rName){ m_sSectionName = rName; } + SectionType GetType() const { return m_eType; } + void SetType(SectionType const eNew) { m_eType = eNew; } + + bool IsHidden() const { return m_bHidden; } + void SetHidden(bool const bFlag) { m_bHidden = bFlag; } + + bool IsHiddenFlag() const { return m_bHiddenFlag; } + SAL_DLLPRIVATE void + SetHiddenFlag(bool const bFlag) { m_bHiddenFlag = bFlag; } + bool IsProtectFlag() const { return m_bProtectFlag; } + SAL_DLLPRIVATE void + SetProtectFlag(bool const bFlag) { m_bProtectFlag = bFlag; } + bool IsEditInReadonlyFlag() const { return m_bEditInReadonlyFlag; } + void SetEditInReadonlyFlag(bool const bFlag) + { m_bEditInReadonlyFlag = bFlag; } + + void SetCondHidden(bool const bFlag) { m_bCondHiddenFlag = bFlag; } + bool IsCondHidden() const { return m_bCondHiddenFlag; } + + const OUString& GetCondition() const { return m_sCondition; } + void SetCondition(OUString const& rNew) { m_sCondition = rNew; } + + const OUString& GetLinkFileName() const { return m_sLinkFileName; } + void SetLinkFileName(OUString const& rNew) + { + m_sLinkFileName = rNew; + } + + const OUString& GetLinkFilePassword() const { return m_sLinkFilePassword; } + void SetLinkFilePassword(OUString const& rS){ m_sLinkFilePassword = rS; } + + css::uno::Sequence<sal_Int8> const& GetPassword() const + { return m_Password; } + void SetPassword(css::uno::Sequence<sal_Int8> const& rNew) + { m_Password = rNew; } + bool IsLinkType() const + { return (SectionType::DdeLink == m_eType) || (SectionType::FileLink == m_eType); } + + bool IsConnectFlag() const { return m_bConnectFlag; } + void SetConnectFlag(bool const bFlag){ m_bConnectFlag = bFlag; } + + static OUString CollapseWhiteSpaces(const OUString& sName); +}; + +class SW_DLLPUBLIC SwSection + : public SwClient +{ + // In order to correctly maintain the flag when creating/deleting frames. + friend class SwSectionNode; + // The "read CTOR" of SwSectionFrame have to change the Hiddenflag. + friend class SwSectionFrame; + +private: + mutable SwSectionData m_Data; + + tools::SvRef<SwServerObject> m_RefObj; // Set if DataServer. + tools::SvRef<sfx2::SvBaseLink> m_RefLink; + + SAL_DLLPRIVATE void ImplSetHiddenFlag( + bool const bHidden, bool const bCondition); + +protected: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override; + +public: + + SwSection(SectionType const eType, OUString const& rName, + SwSectionFormat & rFormat); + virtual ~SwSection() override; + + bool DataEquals(SwSectionData const& rCmp) const; + + void SetSectionData(SwSectionData const& rData); + + const OUString& GetSectionName() const { return m_Data.GetSectionName(); } + void SetSectionName(OUString const& rName){ m_Data.SetSectionName(rName); } + SectionType GetType() const { return m_Data.GetType(); } + void SetType(SectionType const eType) { return m_Data.SetType(eType); } + + inline SwSectionFormat* GetFormat(); + inline SwSectionFormat const * GetFormat() const; + + // Set hidden/protected -> update the whole tree! + // (Attributes/flags are set/get.) + bool IsHidden() const { return m_Data.IsHidden(); } + void SetHidden (bool const bFlag = true); + bool IsProtect() const; + void SetProtect(bool const bFlag = true); + bool IsEditInReadonly() const; + void SetEditInReadonly(bool const bFlag = true); + + // Get internal flags (state including parents, not what is + // currently set at section!). + bool IsHiddenFlag() const { return m_Data.IsHiddenFlag(); } + bool IsProtectFlag() const { return m_Data.IsProtectFlag(); } + bool IsEditInReadonlyFlag() const { return m_Data.IsEditInReadonlyFlag(); } + + void SetCondHidden(bool const bFlag); + bool IsCondHidden() const { return m_Data.IsCondHidden(); } + // Query (also for parents) if this section is to be hidden. + bool CalcHiddenFlag() const; + + inline SwSection* GetParent() const; + + OUString const & GetCondition() const { return m_Data.GetCondition(); } + void SetCondition(OUString const& rNew) { m_Data.SetCondition(rNew); } + + OUString const & GetLinkFileName() const; + void SetLinkFileName(OUString const& rNew); + // Password of linked file (only valid during runtime!) + OUString const & GetLinkFilePassword() const + { return m_Data.GetLinkFilePassword(); } + void SetLinkFilePassword(OUString const& rS) + { m_Data.SetLinkFilePassword(rS); } + + // Get / set password of this section + css::uno::Sequence<sal_Int8> const& GetPassword() const + { return m_Data.GetPassword(); } + + // Data server methods. + void SetRefObject( SwServerObject* pObj ); + const SwServerObject* GetObject() const { return m_RefObj.get(); } + SwServerObject* GetObject() { return m_RefObj.get(); } + bool IsServer() const { return m_RefObj.is(); } + + // Methods for linked ranges. + SfxLinkUpdateMode GetUpdateType() const { return m_RefLink->GetUpdateMode(); } + void SetUpdateType(SfxLinkUpdateMode nType ) + { m_RefLink->SetUpdateMode(nType); } + + bool IsConnected() const { return m_RefLink.is(); } + void UpdateNow() { m_RefLink->Update(); } + void Disconnect() { m_RefLink->Disconnect(); } + + const ::sfx2::SvBaseLink& GetBaseLink() const { return *m_RefLink; } + ::sfx2::SvBaseLink& GetBaseLink() { return *m_RefLink; } + + void CreateLink( LinkCreateType eType ); + + static void MakeChildLinksVisible( const SwSectionNode& rSectNd ); + + bool IsLinkType() const { return m_Data.IsLinkType(); } + + // Flags for UI. Did connection work? + bool IsConnectFlag() const { return m_Data.IsConnectFlag(); } + void SetConnectFlag(bool const bFlag = true) + { m_Data.SetConnectFlag(bFlag); } + + // Return the TOX base class if the section is a TOX section + const SwTOXBase* GetTOXBase() const; + + void BreakLink(); + +}; + +// #i117863# +class SwSectionFrameMoveAndDeleteHint final : public SfxHint +{ + public: + SwSectionFrameMoveAndDeleteHint( const bool bSaveContent ) + : SfxHint( SfxHintId::SwSectionFrameMoveAndDelete ) + , mbSaveContent( bSaveContent ) + {} + + bool IsSaveContent() const + { + return mbSaveContent; + } + + private: + const bool mbSaveContent; +}; + +enum class SectionSort { Not, Pos }; + +class SW_DLLPUBLIC SwSectionFormat final + : public SwFrameFormat + , public ::sfx2::Metadatable +{ + friend class SwDoc; + + /** Why does this exist in addition to the m_wXObject in SwFrameFormat? + in case of an index, both a SwXDocumentIndex and a SwXTextSection + register at this SwSectionFormat, so we need to have two refs. + */ + css::uno::WeakReference<css::text::XTextSection> m_wXTextSection; + + SAL_DLLPRIVATE void UpdateParent(); // Parent has been changed. + + SwSectionFormat( SwFrameFormat* pDrvdFrame, SwDoc *pDoc ); + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override; + +public: + virtual ~SwSectionFormat() override; + + // Deletes all Frames in aDepend (Frames are recognized via dynamic_cast). + virtual void DelFrames() override; + + // Creates views. + virtual void MakeFrames() override; + + // Get information from Format. + virtual bool GetInfo( SfxPoolItem& ) const override; + + SwSection* GetSection() const; + inline SwSectionFormat* GetParent() const; + inline SwSection* GetParentSection() const; + + // All sections that are derived from this one: + // - sorted according to name or position or unsorted + // - all of them or only those that are in the normal Nodes-array. + void GetChildSections( SwSections& rArr, + SectionSort eSort = SectionSort::Not, + bool bAllSections = true ) const; + + // Query whether section is in Nodes-array or in UndoNodes-array. + bool IsInNodesArr() const; + + SwSectionNode* GetSectionNode(); + const SwSectionNode* GetSectionNode() const + { return const_cast<SwSectionFormat *>(this) + ->GetSectionNode(); } + + // Is section a valid one for global document? + const SwSection* GetGlobalDocSection() const; + + SAL_DLLPRIVATE css::uno::WeakReference<css::text::XTextSection> const& GetXTextSection() const + { return m_wXTextSection; } + SAL_DLLPRIVATE void SetXTextSection(css::uno::Reference<css::text::XTextSection> const& xTextSection) + { m_wXTextSection = xTextSection; } + + // sfx2::Metadatable + virtual ::sfx2::IXmlIdRegistry& GetRegistry() override; + virtual bool IsInClipboard() const override; + virtual bool IsInUndo() const override; + virtual bool IsInContent() const override; + virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override; + virtual bool supportsFullDrawingLayerFillAttributeSet() const override; + void dumpAsXml(xmlTextWriterPtr pWriter) const; + +}; + +SwSectionFormat* SwSection::GetFormat() +{ + return static_cast<SwSectionFormat*>(GetRegisteredIn()); +} + +SwSectionFormat const * SwSection::GetFormat() const +{ + return static_cast<SwSectionFormat const *>(GetRegisteredIn()); +} + +inline SwSection* SwSection::GetParent() const +{ + SwSectionFormat const * pFormat = GetFormat(); + SwSection* pRet = nullptr; + if( pFormat ) + pRet = pFormat->GetParentSection(); + return pRet; +} + +inline SwSectionFormat* SwSectionFormat::GetParent() const +{ + SwSectionFormat* pRet = nullptr; + if( GetRegisteredIn() ) + pRet = const_cast<SwSectionFormat*>(dynamic_cast< const SwSectionFormat* >( GetRegisteredIn() )); + return pRet; +} + +inline SwSection* SwSectionFormat::GetParentSection() const +{ + SwSectionFormat* pParent = GetParent(); + SwSection* pRet = nullptr; + if( pParent ) + { + pRet = pParent->GetSection(); + } + return pRet; +} + +#endif /* _ INCLUDED_SW_INC_SECTION_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/shellid.hxx b/sw/inc/shellid.hxx new file mode 100644 index 000000000..d7bfe88d0 --- /dev/null +++ b/sw/inc/shellid.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SHELLID_HXX +#define INCLUDED_SW_INC_SHELLID_HXX + +#include <sfx2/shell.hxx> + +// Mapping for UI-parameters + +#define SW_BASESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(1)) +#define SW_TEXTSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(2)) +#define SW_LISTSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(3)) +#define SW_TABSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(4)) +#define SW_FRAMESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(5)) +#define SW_GRFSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(6)) +#define SW_OLESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(7)) +#define SW_DRAWSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(8)) +#define SW_DRWTXTSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(9)) + +#define SW_INTERFACE_MODULE (SFX_INTERFACE_SW_START + SfxInterfaceId(10)) +#define SW_DOCSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(11)) +#define SW_VIEWSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(12)) +#define SW_PAGEPREVIEW (SFX_INTERFACE_SW_START + SfxInterfaceId(13)) +#define SW_GLOSDOCSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(14)) +#define SW_SRC_VIEWSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(15)) + +#define SW_BEZIERSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(16)) +#define SW_DRAWBASESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(17)) +#define SW_DRAWFORMSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(18)) + +#define SW_WEBDOCSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(19)) +#define SW_WEBVIEWSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(20)) +#define SW_WEBBASESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(21)) +#define SW_WEBTEXTSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(22)) +#define SW_WEBFRAMESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(23)) +#define SW_WEBGLOSDOCSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(24)) +#define SW_WEBLISTSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(25)) +#define SW_WEBTABSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(26)) +#define SW_WEBGRFSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(27)) +#define SW_WEBOLESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(28)) +#define SW_WEBDRAWBASESHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(29)) +#define SW_WEBDRAWFORMSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(30)) + +#define SW_MEDIASHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(31)) +#define SW_ANNOTATIONSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(32)) + +#define SW_NAVIGATIONSHELL (SFX_INTERFACE_SW_START + SfxInterfaceId(33)) +#endif // _UIPARAM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx new file mode 100644 index 000000000..8d1b4776c --- /dev/null +++ b/sw/inc/shellio.hxx @@ -0,0 +1,572 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SHELLIO_HXX +#define INCLUDED_SW_INC_SHELLIO_HXX + +#include <memory> + +#include <com/sun/star/uno/Reference.h> +#include <sot/storage.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <tools/datetime.hxx> +#include <tools/ref.hxx> +#include <rtl/ref.hxx> +#include <osl/thread.h> +#include <o3tl/deleter.hxx> +#include <o3tl/typed_flags_set.hxx> +#include "swdllapi.h" +#include "docfac.hxx" +#include "unocrsr.hxx" + +class SfxItemPool; +class SfxItemSet; +class SfxMedium; +class SvStream; +class SvxFontItem; +class SvxMacroTableDtor; +class SwContentNode; +class SwCursorShell; +class SwDoc; +class SwPaM; +class SwTextBlocks; +struct SwPosition; +struct Writer_Impl; +namespace sw +{ +namespace mark +{ +class IMark; +} +} +namespace com::sun::star::embed { class XStorage; } + +// Defines the count of chars at which a paragraph read via ASCII/W4W-Reader +// is forced to wrap. It has to be always greater than 200!!! +#define MAX_ASCII_PARA 10000 + +class SW_DLLPUBLIC SwAsciiOptions +{ + OUString m_sFont; + rtl_TextEncoding m_eCharSet; + LanguageType m_nLanguage; + LineEnd m_eCRLF_Flag; + bool m_bIncludeBOM; // Whether to include a byte-order-mark in the output. + +public: + + const OUString& GetFontName() const { return m_sFont; } + void SetFontName( const OUString& rFont ) { m_sFont = rFont; } + + rtl_TextEncoding GetCharSet() const { return m_eCharSet; } + void SetCharSet( rtl_TextEncoding nVal ) { m_eCharSet = nVal; } + + LanguageType GetLanguage() const { return m_nLanguage; } + void SetLanguage( LanguageType nVal ) { m_nLanguage = nVal; } + + LineEnd GetParaFlags() const { return m_eCRLF_Flag; } + void SetParaFlags( LineEnd eVal ) { m_eCRLF_Flag = eVal; } + + bool GetIncludeBOM() const { return m_bIncludeBOM; } + void SetIncludeBOM( bool bVal ) { m_bIncludeBOM = bVal; } + + void Reset() + { + m_sFont.clear(); + m_eCRLF_Flag = GetSystemLineEnd(); + m_eCharSet = ::osl_getThreadTextEncoding(); + m_nLanguage = LANGUAGE_SYSTEM; + m_bIncludeBOM = true; + } + // for the automatic conversion (mail/news/...) + void ReadUserData( const OUString& ); + void WriteUserData( OUString& ); + + SwAsciiOptions() { Reset(); } +}; + +// Base class of possible options for a special reader. +class Reader; + +class SwgReaderOption +{ + SwAsciiOptions m_aASCIIOpts; + bool m_bFrameFormats; + bool m_bPageDescs; + bool m_bTextFormats; + bool m_bNumRules; + bool m_bMerge; + css::uno::Reference<css::io::XInputStream> m_xInputStream; +public: + void ResetAllFormatsOnly() { m_bFrameFormats = m_bPageDescs = m_bTextFormats = m_bNumRules = m_bMerge = false; } + bool IsFormatsOnly() const { return m_bFrameFormats || m_bPageDescs || m_bTextFormats || m_bNumRules || m_bMerge; } + + bool IsFrameFormats() const { return m_bFrameFormats; } + void SetFrameFormats( const bool bNew) { m_bFrameFormats = bNew; } + + bool IsPageDescs() const { return m_bPageDescs; } + void SetPageDescs( const bool bNew) { m_bPageDescs = bNew; } + + bool IsTextFormats() const { return m_bTextFormats; } + void SetTextFormats( const bool bNew) { m_bTextFormats = bNew; } + + bool IsNumRules() const { return m_bNumRules; } + void SetNumRules( const bool bNew) { m_bNumRules = bNew; } + + bool IsMerge() const { return m_bMerge; } + void SetMerge( const bool bNew ) { m_bMerge = bNew; } + + const SwAsciiOptions& GetASCIIOpts() const { return m_aASCIIOpts; } + void SetASCIIOpts( const SwAsciiOptions& rOpts ) { m_aASCIIOpts = rOpts; } + void ResetASCIIOpts() { m_aASCIIOpts.Reset(); } + + css::uno::Reference<css::io::XInputStream>& GetInputStream() { return m_xInputStream; } + void SetInputStream(css::uno::Reference<css::io::XInputStream>& xInputStream) + { + m_xInputStream = xInputStream; + } + + SwgReaderOption() + { ResetAllFormatsOnly(); m_aASCIIOpts.Reset(); } +}; + +// Calls reader with its options, document, cursor etc. +class SW_DLLPUBLIC SwReader: public SwDocFac +{ + SvStream* mpStrm; + tools::SvRef<SotStorage> mpStg; + css::uno::Reference < css::embed::XStorage > mxStg; + SfxMedium* mpMedium; // Who wants to obtain a Medium (W4W). + + SwPaM* mpCursor; + OUString maFileName; + OUString msBaseURL; + bool mbSkipImages; + +public: + + // Initial reading. Document is created only at Read(...) + // or in case it is given, into that. + // Special case for Load with Sw3Reader. + SwReader( SfxMedium&, const OUString& rFilename, SwDoc *pDoc = nullptr ); + + // Read into existing document. + // Document and position in document are taken from SwPaM. + SwReader( SvStream&, const OUString& rFilename, const OUString& rBaseURL, SwPaM& ); + SwReader( SfxMedium&, const OUString& rFilename, SwPaM& ); + SwReader( const css::uno::Reference < css::embed::XStorage >&, const OUString& rFilename, SwPaM& ); + + // The only export interface is SwReader::Read(...)!!! + ErrCode Read( const Reader& ); + + // Ask for glossaries. + bool HasGlossaries( const Reader& ); + bool ReadGlossaries( const Reader&, SwTextBlocks&, bool bSaveRelFiles ); + +protected: + void SetBaseURL( const OUString& rURL ) { msBaseURL = rURL; } + void SetSkipImages( bool bSkipImages ) { mbSkipImages = bSkipImages; } +}; + +typedef std::unique_ptr<SwReader, o3tl::default_delete<SwReader>> SwReaderPtr; + +// Special Readers can be both!! (Excel, W4W, .. ). +enum class SwReaderType { + NONE = 0x00, + Stream = 0x01, + Storage = 0x02 +}; +namespace o3tl { + template<> struct typed_flags<SwReaderType> : is_typed_flags<SwReaderType, 0x03> {}; +}; + +extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDOC(SvStream &rStream, const OUString &rFltName); +extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDOCX(SvStream &rStream); +extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportRTF(SvStream &rStream); +extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHTML(SvStream &rStream); +SAL_DLLPUBLIC_EXPORT void FlushFontCache(); + +class SW_DLLPUBLIC Reader +{ + friend class SwReader; + friend bool TestImportDOC(SvStream &rStream, const OUString &rFltName); + friend bool TestImportRTF(SvStream &rStream); + friend bool TestImportHTML(SvStream &rStream); + rtl::Reference<SwDoc> mxTemplate; + OUString m_aTemplateName; + + Date m_aDateStamp; + tools::Time m_aTimeStamp; + DateTime m_aCheckDateTime; + +protected: + SvStream* m_pStream; + tools::SvRef<SotStorage> m_pStorage; + css::uno::Reference < css::embed::XStorage > m_xStorage; + SfxMedium* m_pMedium; // Who wants to obtain a Medium (W4W). + + SwgReaderOption m_aOption; + bool m_bInsertMode : 1; + bool m_bTemplateBrowseMode : 1; + bool m_bReadUTF8: 1; // Interpret stream as UTF-8. + bool m_bBlockMode: 1; + bool m_bOrganizerMode : 1; + bool m_bHasAskTemplateName : 1; + bool m_bIgnoreHTMLComments : 1; + bool m_bSkipImages : 1; + + virtual OUString GetTemplateName(SwDoc& rDoc) const; + +public: + Reader(); + virtual ~Reader(); + + virtual SwReaderType GetReaderType(); + SwgReaderOption& GetReaderOpt() { return m_aOption; } + + virtual void SetFltName( const OUString& rFltNm ); + + // Adapt item-set of a Frame-Format to the old format. + static void ResetFrameFormatAttrs( SfxItemSet &rFrameSet ); + + // Adapt Frame-/Graphics-/OLE- styles to the old format + // (without borders etc.). + static void ResetFrameFormats( SwDoc& rDoc ); + + // Load filter template, set it and release it again. + SwDoc* GetTemplateDoc(SwDoc& rDoc); + bool SetTemplate( SwDoc& rDoc ); + void ClearTemplate(); + void SetTemplateName( const OUString& rDir ); + void MakeHTMLDummyTemplateDoc(); + + bool IsReadUTF8() const { return m_bReadUTF8; } + void SetReadUTF8( bool bSet ) { m_bReadUTF8 = bSet; } + + bool IsBlockMode() const { return m_bBlockMode; } + void SetBlockMode( bool bSet ) { m_bBlockMode = bSet; } + + bool IsOrganizerMode() const { return m_bOrganizerMode; } + void SetOrganizerMode( bool bSet ) { m_bOrganizerMode = bSet; } + + void SetIgnoreHTMLComments( bool bSet ) { m_bIgnoreHTMLComments = bSet; } + + virtual bool HasGlossaries() const; + virtual bool ReadGlossaries( SwTextBlocks&, bool bSaveRelFiles ) const; + + // Read the sections of the document, which is equal to the medium. + // Returns the count of it + virtual size_t GetSectionList( SfxMedium& rMedium, + std::vector<OUString>& rStrings) const; + + const tools::SvRef<SotStorage>& getSotStorageRef() const { return m_pStorage; }; + void setSotStorageRef(const tools::SvRef<SotStorage>& pStgRef) { m_pStorage = pStgRef; }; + +private: + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0; + + // Everyone who does not need the streams / storages open + // has to override the method (W4W!!). + virtual bool SetStrmStgPtr(); +}; + +class AsciiReader final : public Reader +{ + friend class SwReader; + virtual ErrCode Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; +public: + AsciiReader(): Reader() {} +}; + +class SW_DLLPUBLIC StgReader : public Reader +{ + OUString m_aFltName; + +public: + virtual SwReaderType GetReaderType() override; + const OUString& GetFltName() const { return m_aFltName; } + virtual void SetFltName( const OUString& r ) override; +}; + +// The given stream has to be created dynamically and must +// be requested via Stream() before the instance is deleted! + +class SwImpBlocks; + +class SW_DLLPUBLIC SwTextBlocks +{ + std::unique_ptr<SwImpBlocks> m_pImp; + ErrCode m_nErr; + +public: + SwTextBlocks( const OUString& ); + ~SwTextBlocks(); + + SwDoc* GetDoc(); + void ClearDoc(); // Delete Doc-contents. + OUString GetName() const; + void SetName( const OUString& ); + ErrCode const & GetError() const { return m_nErr; } + + OUString GetBaseURL() const; + void SetBaseURL( const OUString& rURL ); + + sal_uInt16 GetCount() const; // Get count text modules. + sal_uInt16 GetIndex( const OUString& ) const; // Get index of short names. + sal_uInt16 GetLongIndex( const OUString& ) const; // Get index of long names. + OUString GetShortName( sal_uInt16 ) const; // Get short name for index. + OUString GetLongName( sal_uInt16 ) const; // Get long name for index. + + bool Delete( sal_uInt16 ); + void Rename( sal_uInt16, const OUString*, const OUString* ); + + bool BeginGetDoc( sal_uInt16 ); // Read text modules. + void EndGetDoc(); // Release text modules. + + bool BeginPutDoc( const OUString&, const OUString& ); // Begin save. + sal_uInt16 PutDoc(); // End save. + + sal_uInt16 PutText( const OUString&, const OUString&, const OUString& ); // Save (short name, text). + + bool IsOnlyTextBlock( sal_uInt16 ) const; + bool IsOnlyTextBlock( const OUString& rShort ) const; + + OUString const & GetFileName() const; // Filename of pImp. + bool IsReadOnly() const; // ReadOnly-flag of pImp. + + bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable ); + bool SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable ); + + bool StartPutMuchBlockEntries(); + void EndPutMuchBlockEntries(); +}; + +// BEGIN source/filter/basflt/fltini.cxx + +extern Reader *ReadAscii, *ReadHTML, *ReadXML; + +SW_DLLPUBLIC Reader* SwGetReaderXML(); + +// END source/filter/basflt/fltini.cxx + +extern bool SetHTMLTemplate( SwDoc &rDoc ); //For templates from HTML before loading shellio.cxx. + +// Base-class of all writers. + +class IDocumentSettingAccess; +class IDocumentStylePoolAccess; + +class SW_DLLPUBLIC Writer + : public SvRefBase +{ + SwAsciiOptions m_aAsciiOptions; + OUString m_sBaseURL; + + void AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont ); + void AddFontItems_( SfxItemPool& rPool, sal_uInt16 nWhichId ); + + std::unique_ptr<Writer_Impl> m_pImpl; + + Writer(Writer const&) = delete; + Writer& operator=(Writer const&) = delete; + +protected: + + const OUString* m_pOrigFileName; + + void ResetWriter(); + bool CopyNextPam( SwPaM ** ); + + void PutNumFormatFontsInAttrPool(); + void PutEditEngFontsInAttrPool(); + + virtual ErrCode WriteStream() = 0; + void SetBaseURL( const OUString& rURL ) { m_sBaseURL = rURL; } + + IDocumentSettingAccess& getIDocumentSettingAccess(); + const IDocumentSettingAccess& getIDocumentSettingAccess() const; + + IDocumentStylePoolAccess& getIDocumentStylePoolAccess(); + const IDocumentStylePoolAccess& getIDocumentStylePoolAccess() const; + +public: + SwDoc* m_pDoc; + SwPaM* m_pOrigPam; // Last Pam that has to be processed. + std::shared_ptr<SwUnoCursor> m_pCurrentPam; + bool m_bWriteAll : 1; + bool m_bShowProgress : 1; + bool m_bWriteClipboardDoc : 1; + bool m_bWriteOnlyFirstTable : 1; + bool m_bASCII_ParaAsCR : 1; + bool m_bASCII_ParaAsBlank : 1; + bool m_bASCII_NoLastLineEnd : 1; + bool m_bUCS2_WithStartChar : 1; + bool m_bExportPargraphNumbering : 1; + + bool m_bBlock : 1; + bool m_bOrganizerMode : 1; + bool m_bHideDeleteRedlines : 1; + + Writer(); + virtual ~Writer() override; + + virtual ErrCode Write( SwPaM&, SfxMedium&, const OUString* ); + ErrCode Write( SwPaM&, SvStream&, const OUString* ); + virtual ErrCode Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ); + virtual ErrCode Write( SwPaM&, SotStorage&, const OUString* ); + + virtual void SetupFilterOptions(SfxMedium& rMedium); + + virtual bool IsStgWriter() const; + + void SetShowProgress( bool bFlag ) { m_bShowProgress = bFlag; } + + const OUString* GetOrigFileName() const { return m_pOrigFileName; } + + const SwAsciiOptions& GetAsciiOptions() const { return m_aAsciiOptions; } + void SetAsciiOptions( const SwAsciiOptions& rOpt ) { m_aAsciiOptions = rOpt; } + + const OUString& GetBaseURL() const { return m_sBaseURL;} + + // Look up next bookmark position from bookmark-table. + sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const; + // Build a bookmark table, which is sort by the node position. The + // OtherPos of the bookmarks also inserted. + void CreateBookmarkTable(); + // Search all Bookmarks in the range and return it in the Array. + bool GetBookmarks( const SwContentNode& rNd, + sal_Int32 nStt, sal_Int32 nEnd, + std::vector< const ::sw::mark::IMark* >& rArr ); + + // Create new PaM at position. + static std::shared_ptr<SwUnoCursor> NewUnoCursor(SwDoc & rDoc, + sal_uLong const nStartIdx, sal_uLong const nEndIdx); + + // If applicable copy a local file into internet. + bool CopyLocalFileToINet( OUString& rFileNm ); + + // Stream-specific routines. Do not use in storage-writer! + + // Optimizing output on stream. + static SvStream& OutLong( SvStream& rStrm, long nVal ); + static SvStream& OutULong( SvStream& rStrm, sal_uLong nVal ); + + void SetStream(SvStream *const pStream); + SvStream& Strm(); + + void SetOrganizerMode( bool bSet ) { m_bOrganizerMode = bSet; } +}; + +typedef tools::SvRef<Writer> WriterRef; + +// Base class for all storage writers. +class SW_DLLPUBLIC StgWriter : public Writer +{ +protected: + tools::SvRef<SotStorage> m_pStg; + css::uno::Reference < css::embed::XStorage > m_xStg; + + // Create error at call. + virtual ErrCode WriteStream() override; + virtual ErrCode WriteStorage() = 0; + virtual ErrCode WriteMedium( SfxMedium& ) = 0; + + using Writer::Write; + +public: + StgWriter() : Writer() {} + + virtual bool IsStgWriter() const override; + + virtual ErrCode Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ) override; + virtual ErrCode Write( SwPaM&, SotStorage&, const OUString* ) override; + + SotStorage& GetStorage() const { return *m_pStg; } +}; + +// Interface class for general access on special writers. + +class SW_DLLPUBLIC SwWriter +{ + SvStream* m_pStrm; + css::uno::Reference < css::embed::XStorage > m_xStg; + SfxMedium* m_pMedium; + + SwPaM* m_pOutPam; + SwCursorShell *m_pShell; + SwDoc &m_rDoc; + + bool m_bWriteAll; + +public: + ErrCode Write( WriterRef const & rxWriter, const OUString* = nullptr); + + SwWriter( SvStream&, SwCursorShell &, bool bWriteAll = false ); + SwWriter( SvStream&, SwDoc & ); + SwWriter( SvStream&, SwPaM &, bool bWriteAll = false ); + + SwWriter( const css::uno::Reference < css::embed::XStorage >&, SwDoc& ); + + SwWriter( SfxMedium&, SwCursorShell &, bool bWriteAll ); + SwWriter( SfxMedium&, SwDoc & ); +}; + +typedef Reader* (*FnGetReader)(); +typedef void (*FnGetWriter)(const OUString&, const OUString& rBaseURL, WriterRef&); +ErrCode SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, bool, const OUString& ); +ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); + +struct SwReaderWriterEntry +{ + Reader* pReader; + FnGetReader fnGetReader; + FnGetWriter fnGetWriter; + bool bDelReader; + + SwReaderWriterEntry( const FnGetReader fnReader, const FnGetWriter fnWriter, bool bDel ) + : pReader( nullptr ), fnGetReader( fnReader ), fnGetWriter( fnWriter ), bDelReader( bDel ) + {} + + /// Get access to the reader. + Reader* GetReader(); + + /// Get access to the writer. + void GetWriter( const OUString& rNm, const OUString& rBaseURL, WriterRef& xWrt ) const; +}; + +namespace SwReaderWriter +{ + SW_DLLPUBLIC Reader* GetRtfReader(); + SW_DLLPUBLIC Reader* GetDOCXReader(); + + /// Return reader based on the name. + Reader* GetReader( const OUString& rFltName ); + + /// Return writer based on the name. + SW_DLLPUBLIC void GetWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xWrt ); +} + +void GetRTFWriter( const OUString&, const OUString&, WriterRef& ); +void GetASCWriter(const OUString&, const OUString&, WriterRef&); +void GetHTMLWriter( const OUString&, const OUString&, WriterRef& ); +void GetXMLWriter( const OUString&, const OUString&, WriterRef& ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx new file mode 100644 index 000000000..ef81f1a64 --- /dev/null +++ b/sw/inc/shellres.hxx @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SHELLRES_HXX +#define INCLUDED_SW_INC_SHELLRES_HXX + +#include <memory> +#include <vector> +#include "swdllapi.h" +#include <rtl/ustring.hxx> + +struct SW_DLLPUBLIC ShellResource +{ + OUString aPostItAuthor; + OUString aPostItPage; + OUString aPostItLine; + + // Calc error-strings. + OUString aCalc_Syntax; + OUString aCalc_ZeroDiv; + OUString aCalc_Brack; + OUString aCalc_Pow; + OUString aCalc_Overflow; + OUString aCalc_Default; + OUString aCalc_Error; + + // For GetRefField - referenced item not found. + OUString aGetRefField_RefItemNotFound; + // For some list boxes - string "none" + OUString aStrNone; + // For fixed fields. + OUString aFixedStr; + // Custom fields of type css::util::Duration. + OUString sDurationFormat; + + //Names of TOXs. + OUString aTOXIndexName; + OUString aTOXUserName; + OUString aTOXContentName; + OUString aTOXIllustrationsName; + OUString aTOXObjectsName; + OUString aTOXTablesName; + OUString aTOXAuthoritiesName; + OUString aTOXCitationName; + + std::vector<OUString> aDocInfoLst; + + // The autoFormat-Redline comments. + inline const std::vector<OUString>& GetAutoFormatNameLst() const; + + enum PageNameMode + { + NORMAL_PAGE, + FIRST_PAGE, + FOLLOW_PAGE + }; + // Returns for the specific filter the new names of pagedescs + // This method is for the old code of the specific filters with + // now localized names. + OUString GetPageDescName(sal_uInt16 nNo, PageNameMode eMode); + + ShellResource(); + +private: + void GetAutoFormatNameLst_() const; + mutable std::unique_ptr<std::vector<OUString>> pAutoFormatNameLst; + OUString sPageDescFirstName; + OUString sPageDescFollowName; + OUString sPageDescName; +}; + +inline const std::vector<OUString>& ShellResource::GetAutoFormatNameLst() const +{ + if( !pAutoFormatNameLst ) + GetAutoFormatNameLst_(); + return *pAutoFormatNameLst; +} + +#endif // INCLUDED_SW_INC_SHELLRES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/sortopt.hxx b/sw/inc/sortopt.hxx new file mode 100644 index 000000000..b29460f1f --- /dev/null +++ b/sw/inc/sortopt.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SORTOPT_HXX +#define INCLUDED_SW_INC_SORTOPT_HXX + +#include <rtl/ustring.hxx> +#include <i18nlangtag/lang.h> +#include "swdllapi.h" +#include <memory> +#include <vector> + +enum class SwSortOrder { Ascending, Descending }; +enum class SwSortDirection { Columns, Rows }; + +struct SW_DLLPUBLIC SwSortKey +{ + SwSortKey(); + SwSortKey( sal_uInt16 nId, const OUString& rSrtType, SwSortOrder eOrder ); + + OUString sSortType; + SwSortOrder eSortOrder; + sal_uInt16 nColumnId; + bool bIsNumeric; +}; + +struct SW_DLLPUBLIC SwSortOptions +{ + SwSortOptions(); + ~SwSortOptions(); + SwSortOptions(const SwSortOptions& rOpt); + + SwSortOptions& operator=( SwSortOptions const & ) = delete; // MSVC2015 workaround + + std::vector<std::unique_ptr<SwSortKey>> aKeys; + SwSortDirection eDirection; + sal_Unicode cDeli; + LanguageType nLanguage; + bool bTable; + bool bIgnoreCase; +}; + +#endif // INCLUDED_SW_INC_SORTOPT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/splargs.hxx b/sw/inc/splargs.hxx new file mode 100644 index 000000000..37d7baa30 --- /dev/null +++ b/sw/inc/splargs.hxx @@ -0,0 +1,157 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SPLARGS_HXX +#define INCLUDED_SW_INC_SPLARGS_HXX + +#include <i18nlangtag/lang.h> +#include <tools/gen.hxx> + +#include <com/sun/star/linguistic2/XSpellAlternatives.hpp> +#include <com/sun/star/linguistic2/XSpellChecker1.hpp> + +#include <functional> + +class SwTextFrame; +class SwTextNode; +class SwIndex; +namespace vcl { class Font; } +namespace com::sun::star::linguistic2 { class XHyphenatedWord; } + +struct SwArgsBase // used for text conversion (Hangul/Hanja, ...) +{ + SwTextNode *pStartNode; + SwIndex *pStartIdx; + SwTextNode *pEndNode; + SwIndex *pEndIdx; + + SwArgsBase( + SwTextNode* pStart, SwIndex& rStart, + SwTextNode* pEnd, SwIndex& rEnd ) + : pStartNode( pStart ), pStartIdx( &rStart ), + pEndNode( pEnd ), pEndIdx( &rEnd ) + {} + + void SetStart(SwTextNode* pStart, SwIndex& rStart ) + { + pStartNode = pStart; pStartIdx = &rStart ; + } + + void SetEnd( SwTextNode* pEnd, SwIndex& rEnd ) + { + pEndNode = pEnd; pEndIdx = &rEnd ; + } +}; + +// used for text conversion (Hangul/Hanja, Simplified/Traditional Chinese, ...) +struct SwConversionArgs : SwArgsBase +{ + OUString aConvText; // convertible text found + LanguageType nConvSrcLang; // (source) language to look for + LanguageType nConvTextLang; // language of aConvText (if the latter one was found) + + // used for chinese translation + LanguageType nConvTargetLang; // target language of text to be changed + const vcl::Font *pTargetFont; // target font of text to be changed + // explicitly enables or disables application of the above two + bool bAllowImplicitChangesForNotConvertibleText; + + SwConversionArgs( LanguageType nLang, + SwTextNode* pStart, SwIndex& rStart, + SwTextNode* pEnd, SwIndex& rEnd ) + : SwArgsBase( pStart, rStart, pEnd, rEnd ), + nConvSrcLang( nLang ), + nConvTextLang( LANGUAGE_NONE ), + nConvTargetLang( LANGUAGE_NONE ), + pTargetFont( nullptr ), + bAllowImplicitChangesForNotConvertibleText( false ) + {} +}; + +struct SwSpellArgs : SwArgsBase +{ + css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller; + + css::uno::Reference< css::linguistic2::XSpellAlternatives > xSpellAlt; + + bool bIsGrammarCheck; + + SwSpellArgs(css::uno::Reference< + css::linguistic2::XSpellChecker1 > const &rxSplChk, + SwTextNode* pStart, SwIndex& rStart, + SwTextNode* pEnd, SwIndex& rEnd, + bool bGrammar ) + : SwArgsBase( pStart, rStart, pEnd, rEnd ), + xSpeller( rxSplChk ), + bIsGrammarCheck( bGrammar ) + {} +}; + +// Parameter-class for Hyphenate. +// docedt.cxx: SwDoc::Hyphenate() +// txtedt.cxx: SwTextNode::Hyphenate() +// txthyph.cxx: SwTextFrame::Hyphenate() + +class SwInterHyphInfo +{ + /// output: hyphenated word + css::uno::Reference<css::linguistic2::XHyphenatedWord> m_xHyphWord; + /// input: cursor point to locate the frame + const Point m_aCursorPos; +public: + /// input: requested range to hyphenate + sal_Int32 m_nStart; + sal_Int32 m_nEnd; + /// output: found word + sal_Int32 m_nWordStart; + sal_Int32 m_nWordLen; + + SwInterHyphInfo( const Point &rCursorPos ) + : m_aCursorPos(rCursorPos) + , m_nStart(0) + , m_nEnd(SAL_MAX_INT32) + , m_nWordStart(0), m_nWordLen(0) + { + } + const Point *GetCursorPos() const + { + return m_aCursorPos.X() || m_aCursorPos.Y() ? &m_aCursorPos : nullptr; + } + void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rxHW) + { + m_xHyphWord = rxHW; + } + const css::uno::Reference< css::linguistic2::XHyphenatedWord >& GetHyphWord() const + { + return m_xHyphWord; + } +}; + + +namespace sw { + +typedef std::function<SwTextFrame*()> Creator; + +SwTextFrame * +SwHyphIterCacheLastTextFrame(SwTextNode const *, const Creator& rCreator); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc new file mode 100644 index 000000000..e498db376 --- /dev/null +++ b/sw/inc/strings.hrc @@ -0,0 +1,1382 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_STRINGS_HRC +#define INCLUDED_SW_INC_STRINGS_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NNC_(Context, StringSingular, StringPlural) reinterpret_cast<char const *>(Context "\004" u8##StringSingular "\004" u8##StringPlural) + +// Format names +#define STR_POOLCHR_STANDARD NC_("STR_POOLCHR_STANDARD", "Default Character Style") +#define STR_POOLCHR_FOOTNOTE NC_("STR_POOLCHR_FOOTNOTE", "Footnote Characters") +#define STR_POOLCHR_PAGENO NC_("STR_POOLCHR_PAGENO", "Page Number") +#define STR_POOLCHR_LABEL NC_("STR_POOLCHR_LABEL", "Caption Characters") +#define STR_POOLCHR_DROPCAPS NC_("STR_POOLCHR_DROPCAPS", "Drop Caps") +#define STR_POOLCHR_NUM_LEVEL NC_("STR_POOLCHR_NUM_LEVEL", "Numbering Symbols") +#define STR_POOLCHR_BULLET_LEVEL NC_("STR_POOLCHR_BULLET_LEVEL", "Bullets") +#define STR_POOLCHR_INET_NORMAL NC_("STR_POOLCHR_INET_NORMAL", "Internet Link") +#define STR_POOLCHR_INET_VISIT NC_("STR_POOLCHR_INET_VISIT", "Visited Internet Link") +#define STR_POOLCHR_JUMPEDIT NC_("STR_POOLCHR_JUMPEDIT", "Placeholder") +#define STR_POOLCHR_TOXJUMP NC_("STR_POOLCHR_TOXJUMP", "Index Link") +#define STR_POOLCHR_ENDNOTE NC_("STR_POOLCHR_ENDNOTE", "Endnote Characters") +#define STR_POOLCHR_LINENUM NC_("STR_POOLCHR_LINENUM", "Line Numbering") +#define STR_POOLCHR_IDX_MAIN_ENTRY NC_("STR_POOLCHR_IDX_MAIN_ENTRY", "Main Index Entry") +#define STR_POOLCHR_FOOTNOTE_ANCHOR NC_("STR_POOLCHR_FOOTNOTE_ANCHOR", "Footnote Anchor") +#define STR_POOLCHR_ENDNOTE_ANCHOR NC_("STR_POOLCHR_ENDNOTE_ANCHOR", "Endnote Anchor") +#define STR_POOLCHR_RUBYTEXT NC_("STR_POOLCHR_RUBYTEXT", "Rubies") +#define STR_POOLCHR_VERT_NUM NC_("STR_POOLCHR_VERT_NUM", "Vertical Numbering Symbols") +// Drawing templates for HTML +#define STR_POOLCHR_HTML_EMPHASIS NC_("STR_POOLCHR_HTML_EMPHASIS", "Emphasis") +#define STR_POOLCHR_HTML_CITIATION NC_("STR_POOLCHR_HTML_CITIATION", "Quotation") +#define STR_POOLCHR_HTML_STRONG NC_("STR_POOLCHR_HTML_STRONG", "Strong Emphasis") +#define STR_POOLCHR_HTML_CODE NC_("STR_POOLCHR_HTML_CODE", "Source Text") +#define STR_POOLCHR_HTML_SAMPLE NC_("STR_POOLCHR_HTML_SAMPLE", "Example") +#define STR_POOLCHR_HTML_KEYBOARD NC_("STR_POOLCHR_HTML_KEYBOARD", "User Entry") +#define STR_POOLCHR_HTML_VARIABLE NC_("STR_POOLCHR_HTML_VARIABLE", "Variable") +#define STR_POOLCHR_HTML_DEFINSTANCE NC_("STR_POOLCHR_HTML_DEFINSTANCE", "Definition") +#define STR_POOLCHR_HTML_TELETYPE NC_("STR_POOLCHR_HTML_TELETYPE", "Teletype") +// Border templates +#define STR_POOLFRM_FRAME NC_("STR_POOLFRM_FRAME", "Frame") +#define STR_POOLFRM_GRAPHIC NC_("STR_POOLFRM_GRAPHIC", "Graphics") +#define STR_POOLFRM_OLE NC_("STR_POOLFRM_OLE", "OLE") +#define STR_POOLFRM_FORMEL NC_("STR_POOLFRM_FORMEL", "Formula") +#define STR_POOLFRM_MARGINAL NC_("STR_POOLFRM_MARGINAL", "Marginalia") +#define STR_POOLFRM_WATERSIGN NC_("STR_POOLFRM_WATERSIGN", "Watermark") +#define STR_POOLFRM_LABEL NC_("STR_POOLFRM_LABEL", "Labels") +// Template names +#define STR_POOLCOLL_STANDARD NC_("STR_POOLCOLL_STANDARD", "Default Paragraph Style") +#define STR_POOLCOLL_TEXT NC_("STR_POOLCOLL_TEXT", "Text Body") +#define STR_POOLCOLL_TEXT_IDENT NC_("STR_POOLCOLL_TEXT_IDENT", "First Line Indent") +#define STR_POOLCOLL_TEXT_NEGIDENT NC_("STR_POOLCOLL_TEXT_NEGIDENT", "Hanging Indent") +#define STR_POOLCOLL_TEXT_MOVE NC_("STR_POOLCOLL_TEXT_MOVE", "Text Body Indent") +#define STR_POOLCOLL_GREETING NC_("STR_POOLCOLL_GREETING", "Complimentary Close") +#define STR_POOLCOLL_SIGNATURE NC_("STR_POOLCOLL_SIGNATURE", "Signature") +#define STR_POOLCOLL_HEADLINE_BASE NC_("STR_POOLCOLL_HEADLINE_BASE", "Heading") +#define STR_POOLCOLL_NUMBER_BULLET_BASE NC_("STR_POOLCOLL_NUMBER_BULLET_BASE", "List") +#define STR_POOLCOLL_REGISTER_BASE NC_("STR_POOLCOLL_REGISTER_BASE", "Index") +#define STR_POOLCOLL_CONFRONTATION NC_("STR_POOLCOLL_CONFRONTATION", "List Indent") +#define STR_POOLCOLL_MARGINAL NC_("STR_POOLCOLL_MARGINAL", "Marginalia") +#define STR_POOLCOLL_HEADLINE1 NC_("STR_POOLCOLL_HEADLINE1", "Heading 1") +#define STR_POOLCOLL_HEADLINE2 NC_("STR_POOLCOLL_HEADLINE2", "Heading 2") +#define STR_POOLCOLL_HEADLINE3 NC_("STR_POOLCOLL_HEADLINE3", "Heading 3") +#define STR_POOLCOLL_HEADLINE4 NC_("STR_POOLCOLL_HEADLINE4", "Heading 4") +#define STR_POOLCOLL_HEADLINE5 NC_("STR_POOLCOLL_HEADLINE5", "Heading 5") +#define STR_POOLCOLL_HEADLINE6 NC_("STR_POOLCOLL_HEADLINE6", "Heading 6") +#define STR_POOLCOLL_HEADLINE7 NC_("STR_POOLCOLL_HEADLINE7", "Heading 7") +#define STR_POOLCOLL_HEADLINE8 NC_("STR_POOLCOLL_HEADLINE8", "Heading 8") +#define STR_POOLCOLL_HEADLINE9 NC_("STR_POOLCOLL_HEADLINE9", "Heading 9") +#define STR_POOLCOLL_HEADLINE10 NC_("STR_POOLCOLL_HEADLINE10", "Heading 10") +#define STR_POOLCOLL_NUM_LEVEL1S NC_("STR_POOLCOLL_NUM_LEVEL1S", "Numbering 1 Start") +#define STR_POOLCOLL_NUM_LEVEL1 NC_("STR_POOLCOLL_NUM_LEVEL1", "Numbering 1") +#define STR_POOLCOLL_NUM_LEVEL1E NC_("STR_POOLCOLL_NUM_LEVEL1E", "Numbering 1 End") +#define STR_POOLCOLL_NUM_NONUM1 NC_("STR_POOLCOLL_NUM_NONUM1", "Numbering 1 Cont.") +#define STR_POOLCOLL_NUM_LEVEL2S NC_("STR_POOLCOLL_NUM_LEVEL2S", "Numbering 2 Start") +#define STR_POOLCOLL_NUM_LEVEL2 NC_("STR_POOLCOLL_NUM_LEVEL2", "Numbering 2") +#define STR_POOLCOLL_NUM_LEVEL2E NC_("STR_POOLCOLL_NUM_LEVEL2E", "Numbering 2 End") +#define STR_POOLCOLL_NUM_NONUM2 NC_("STR_POOLCOLL_NUM_NONUM2", "Numbering 2 Cont.") +#define STR_POOLCOLL_NUM_LEVEL3S NC_("STR_POOLCOLL_NUM_LEVEL3S", "Numbering 3 Start") +#define STR_POOLCOLL_NUM_LEVEL3 NC_("STR_POOLCOLL_NUM_LEVEL3", "Numbering 3") +#define STR_POOLCOLL_NUM_LEVEL3E NC_("STR_POOLCOLL_NUM_LEVEL3E", "Numbering 3 End") +#define STR_POOLCOLL_NUM_NONUM3 NC_("STR_POOLCOLL_NUM_NONUM3", "Numbering 3 Cont.") +#define STR_POOLCOLL_NUM_LEVEL4S NC_("STR_POOLCOLL_NUM_LEVEL4S", "Numbering 4 Start") +#define STR_POOLCOLL_NUM_LEVEL4 NC_("STR_POOLCOLL_NUM_LEVEL4", "Numbering 4") +#define STR_POOLCOLL_NUM_LEVEL4E NC_("STR_POOLCOLL_NUM_LEVEL4E", "Numbering 4 End") +#define STR_POOLCOLL_NUM_NONUM4 NC_("STR_POOLCOLL_NUM_NONUM4", "Numbering 4 Cont.") +#define STR_POOLCOLL_NUM_LEVEL5S NC_("STR_POOLCOLL_NUM_LEVEL5S", "Numbering 5 Start") +#define STR_POOLCOLL_NUM_LEVEL5 NC_("STR_POOLCOLL_NUM_LEVEL5", "Numbering 5") +#define STR_POOLCOLL_NUM_LEVEL5E NC_("STR_POOLCOLL_NUM_LEVEL5E", "Numbering 5 End") +#define STR_POOLCOLL_NUM_NONUM5 NC_("STR_POOLCOLL_NUM_NONUM5", "Numbering 5 Cont.") +#define STR_POOLCOLL_BULLET_LEVEL1S NC_("STR_POOLCOLL_BULLET_LEVEL1S", "List 1 Start") +#define STR_POOLCOLL_BULLET_LEVEL1 NC_("STR_POOLCOLL_BULLET_LEVEL1", "List 1") +#define STR_POOLCOLL_BULLET_LEVEL1E NC_("STR_POOLCOLL_BULLET_LEVEL1E", "List 1 End") +#define STR_POOLCOLL_BULLET_NONUM1 NC_("STR_POOLCOLL_BULLET_NONUM1", "List 1 Cont.") +#define STR_POOLCOLL_BULLET_LEVEL2S NC_("STR_POOLCOLL_BULLET_LEVEL2S", "List 2 Start") +#define STR_POOLCOLL_BULLET_LEVEL2 NC_("STR_POOLCOLL_BULLET_LEVEL2", "List 2") +#define STR_POOLCOLL_BULLET_LEVEL2E NC_("STR_POOLCOLL_BULLET_LEVEL2E", "List 2 End") +#define STR_POOLCOLL_BULLET_NONUM2 NC_("STR_POOLCOLL_BULLET_NONUM2", "List 2 Cont.") +#define STR_POOLCOLL_BULLET_LEVEL3S NC_("STR_POOLCOLL_BULLET_LEVEL3S", "List 3 Start") +#define STR_POOLCOLL_BULLET_LEVEL3 NC_("STR_POOLCOLL_BULLET_LEVEL3", "List 3") +#define STR_POOLCOLL_BULLET_LEVEL3E NC_("STR_POOLCOLL_BULLET_LEVEL3E", "List 3 End") +#define STR_POOLCOLL_BULLET_NONUM3 NC_("STR_POOLCOLL_BULLET_NONUM3", "List 3 Cont.") +#define STR_POOLCOLL_BULLET_LEVEL4S NC_("STR_POOLCOLL_BULLET_LEVEL4S", "List 4 Start") +#define STR_POOLCOLL_BULLET_LEVEL4 NC_("STR_POOLCOLL_BULLET_LEVEL4", "List 4") +#define STR_POOLCOLL_BULLET_LEVEL4E NC_("STR_POOLCOLL_BULLET_LEVEL4E", "List 4 End") +#define STR_POOLCOLL_BULLET_NONUM4 NC_("STR_POOLCOLL_BULLET_NONUM4", "List 4 Cont.") +#define STR_POOLCOLL_BULLET_LEVEL5S NC_("STR_POOLCOLL_BULLET_LEVEL5S", "List 5 Start") +#define STR_POOLCOLL_BULLET_LEVEL5 NC_("STR_POOLCOLL_BULLET_LEVEL5", "List 5") +#define STR_POOLCOLL_BULLET_LEVEL5E NC_("STR_POOLCOLL_BULLET_LEVEL5E", "List 5 End") +#define STR_POOLCOLL_BULLET_NONUM5 NC_("STR_POOLCOLL_BULLET_NONUM5", "List 5 Cont.") +#define STR_POOLCOLL_HEADERFOOTER NC_("STR_POOLCOLL_HEADER", "Header and Footer") +#define STR_POOLCOLL_HEADER NC_("STR_POOLCOLL_HEADER", "Header") +#define STR_POOLCOLL_HEADERL NC_("STR_POOLCOLL_HEADERL", "Header Left") +#define STR_POOLCOLL_HEADERR NC_("STR_POOLCOLL_HEADERR", "Header Right") +#define STR_POOLCOLL_FOOTER NC_("STR_POOLCOLL_FOOTER", "Footer") +#define STR_POOLCOLL_FOOTERL NC_("STR_POOLCOLL_FOOTERL", "Footer Left") +#define STR_POOLCOLL_FOOTERR NC_("STR_POOLCOLL_FOOTERR", "Footer Right") +#define STR_POOLCOLL_TABLE NC_("STR_POOLCOLL_TABLE", "Table Contents") +#define STR_POOLCOLL_TABLE_HDLN NC_("STR_POOLCOLL_TABLE_HDLN", "Table Heading") +#define STR_POOLCOLL_FRAME NC_("STR_POOLCOLL_FRAME", "Frame Contents") +#define STR_POOLCOLL_FOOTNOTE NC_("STR_POOLCOLL_FOOTNOTE", "Footnote") +#define STR_POOLCOLL_ENDNOTE NC_("STR_POOLCOLL_ENDNOTE", "Endnote") +#define STR_POOLCOLL_LABEL NC_("STR_POOLCOLL_LABEL", "Caption") +#define STR_POOLCOLL_LABEL_ABB NC_("STR_POOLCOLL_LABEL_ABB", "Illustration") +#define STR_POOLCOLL_LABEL_TABLE NC_("STR_POOLCOLL_LABEL_TABLE", "Table") +#define STR_POOLCOLL_LABEL_FRAME NC_("STR_POOLCOLL_LABEL_FRAME", "Text") +#define STR_POOLCOLL_LABEL_DRAWING NC_("STR_POOLCOLL_LABEL_DRAWING", "Drawing") +#define STR_POOLCOLL_LABEL_FIGURE NC_("STR_POOLCOLL_LABEL_FIGURE", "Figure") +#define STR_POOLCOLL_JAKETADRESS NC_("STR_POOLCOLL_JAKETADRESS", "Addressee") +#define STR_POOLCOLL_SENDADRESS NC_("STR_POOLCOLL_SENDADRESS", "Sender") +#define STR_POOLCOLL_TOX_IDXH NC_("STR_POOLCOLL_TOX_IDXH", "Index Heading") +#define STR_POOLCOLL_TOX_IDX1 NC_("STR_POOLCOLL_TOX_IDX1", "Index 1") +#define STR_POOLCOLL_TOX_IDX2 NC_("STR_POOLCOLL_TOX_IDX2", "Index 2") +#define STR_POOLCOLL_TOX_IDX3 NC_("STR_POOLCOLL_TOX_IDX3", "Index 3") +#define STR_POOLCOLL_TOX_IDXBREAK NC_("STR_POOLCOLL_TOX_IDXBREAK", "Index Separator") +#define STR_POOLCOLL_TOX_CNTNTH NC_("STR_POOLCOLL_TOX_CNTNTH", "Contents Heading") +#define STR_POOLCOLL_TOX_CNTNT1 NC_("STR_POOLCOLL_TOX_CNTNT1", "Contents 1") +#define STR_POOLCOLL_TOX_CNTNT2 NC_("STR_POOLCOLL_TOX_CNTNT2", "Contents 2") +#define STR_POOLCOLL_TOX_CNTNT3 NC_("STR_POOLCOLL_TOX_CNTNT3", "Contents 3") +#define STR_POOLCOLL_TOX_CNTNT4 NC_("STR_POOLCOLL_TOX_CNTNT4", "Contents 4") +#define STR_POOLCOLL_TOX_CNTNT5 NC_("STR_POOLCOLL_TOX_CNTNT5", "Contents 5") +#define STR_POOLCOLL_TOX_CNTNT6 NC_("STR_POOLCOLL_TOX_CNTNT6", "Contents 6") +#define STR_POOLCOLL_TOX_CNTNT7 NC_("STR_POOLCOLL_TOX_CNTNT7", "Contents 7") +#define STR_POOLCOLL_TOX_CNTNT8 NC_("STR_POOLCOLL_TOX_CNTNT8", "Contents 8") +#define STR_POOLCOLL_TOX_CNTNT9 NC_("STR_POOLCOLL_TOX_CNTNT9", "Contents 9") +#define STR_POOLCOLL_TOX_CNTNT10 NC_("STR_POOLCOLL_TOX_CNTNT10", "Contents 10") +#define STR_POOLCOLL_TOX_USERH NC_("STR_POOLCOLL_TOX_USERH", "User Index Heading") +#define STR_POOLCOLL_TOX_USER1 NC_("STR_POOLCOLL_TOX_USER1", "User Index 1") +#define STR_POOLCOLL_TOX_USER2 NC_("STR_POOLCOLL_TOX_USER2", "User Index 2") +#define STR_POOLCOLL_TOX_USER3 NC_("STR_POOLCOLL_TOX_USER3", "User Index 3") +#define STR_POOLCOLL_TOX_USER4 NC_("STR_POOLCOLL_TOX_USER4", "User Index 4") +#define STR_POOLCOLL_TOX_USER5 NC_("STR_POOLCOLL_TOX_USER5", "User Index 5") +#define STR_POOLCOLL_TOX_USER6 NC_("STR_POOLCOLL_TOX_USER6", "User Index 6") +#define STR_POOLCOLL_TOX_USER7 NC_("STR_POOLCOLL_TOX_USER7", "User Index 7") +#define STR_POOLCOLL_TOX_USER8 NC_("STR_POOLCOLL_TOX_USER8", "User Index 8") +#define STR_POOLCOLL_TOX_USER9 NC_("STR_POOLCOLL_TOX_USER9", "User Index 9") +#define STR_POOLCOLL_TOX_USER10 NC_("STR_POOLCOLL_TOX_USER10", "User Index 10") +#define STR_POOLCOLL_TOX_CITATION NC_("STR_POOLCOLL_TOX_CITATION", "Citation") +#define STR_POOLCOLL_TOX_ILLUSH NC_("STR_POOLCOLL_TOX_ILLUSH", "Figure Index Heading") +#define STR_POOLCOLL_TOX_ILLUS1 NC_("STR_POOLCOLL_TOX_ILLUS1", "Figure Index 1") +#define STR_POOLCOLL_TOX_OBJECTH NC_("STR_POOLCOLL_TOX_OBJECTH", "Object Index Heading") +#define STR_POOLCOLL_TOX_OBJECT1 NC_("STR_POOLCOLL_TOX_OBJECT1", "Object Index 1") +#define STR_POOLCOLL_TOX_TABLESH NC_("STR_POOLCOLL_TOX_TABLESH", "Table Index Heading") +#define STR_POOLCOLL_TOX_TABLES1 NC_("STR_POOLCOLL_TOX_TABLES1", "Table Index 1") +#define STR_POOLCOLL_TOX_AUTHORITIESH NC_("STR_POOLCOLL_TOX_AUTHORITIESH", "Bibliography Heading") +#define STR_POOLCOLL_TOX_AUTHORITIES1 NC_("STR_POOLCOLL_TOX_AUTHORITIES1", "Bibliography 1") +// Document title style, not to be confused with Heading style +#define STR_POOLCOLL_DOC_TITLE NC_("STR_POOLCOLL_DOC_TITEL", "Title") +#define STR_POOLCOLL_DOC_SUBTITLE NC_("STR_POOLCOLL_DOC_SUBTITEL", "Subtitle") +#define STR_POOLCOLL_DOC_APPENDIX NC_("STR_POOLCOLL_DOC_APPENDIX", "Appendix") +#define STR_POOLCOLL_HTML_BLOCKQUOTE NC_("STR_POOLCOLL_HTML_BLOCKQUOTE", "Quotations") +#define STR_POOLCOLL_HTML_PRE NC_("STR_POOLCOLL_HTML_PRE", "Preformatted Text") +#define STR_POOLCOLL_HTML_HR NC_("STR_POOLCOLL_HTML_HR", "Horizontal Line") +#define STR_POOLCOLL_HTML_DD NC_("STR_POOLCOLL_HTML_DD", "List Contents") +#define STR_POOLCOLL_HTML_DT NC_("STR_POOLCOLL_HTML_DT", "List Heading") +//page style names +#define STR_POOLPAGE_STANDARD NC_("STR_POOLPAGE_STANDARD", "Default Page Style") +#define STR_POOLPAGE_FIRST NC_("STR_POOLPAGE_FIRST", "First Page") +#define STR_POOLPAGE_LEFT NC_("STR_POOLPAGE_LEFT", "Left Page") +#define STR_POOLPAGE_RIGHT NC_("STR_POOLPAGE_RIGHT", "Right Page") +#define STR_POOLPAGE_JAKET NC_("STR_POOLPAGE_JAKET", "Envelope") +#define STR_POOLPAGE_REGISTER NC_("STR_POOLPAGE_REGISTER", "Index") +#define STR_POOLPAGE_HTML NC_("STR_POOLPAGE_HTML", "HTML") +#define STR_POOLPAGE_FOOTNOTE NC_("STR_POOLPAGE_FOOTNOTE", "Footnote") +#define STR_POOLPAGE_ENDNOTE NC_("STR_POOLPAGE_ENDNOTE", "Endnote") +#define STR_POOLPAGE_LANDSCAPE NC_("STR_POOLPAGE_LANDSCAPE", "Landscape") +// Numbering rules +#define STR_POOLNUMRULE_NUM1 NC_("STR_POOLNUMRULE_NUM1", "Numbering 123") +#define STR_POOLNUMRULE_NUM2 NC_("STR_POOLNUMRULE_NUM2", "Numbering ABC") +#define STR_POOLNUMRULE_NUM3 NC_("STR_POOLNUMRULE_NUM3", "Numbering abc") +#define STR_POOLNUMRULE_NUM4 NC_("STR_POOLNUMRULE_NUM4", "Numbering IVX") +#define STR_POOLNUMRULE_NUM5 NC_("STR_POOLNUMRULE_NUM5", "Numbering ivx") +//Bullet \u2022 +#define STR_POOLNUMRULE_BUL1 NC_("STR_POOLNUMRULE_BUL1", "Bullet •") +//Bullet \u2013 +#define STR_POOLNUMRULE_BUL2 NC_("STR_POOLNUMRULE_BUL2", "Bullet –") +//Bullet \uE4C4 +#define STR_POOLNUMRULE_BUL3 NC_("STR_POOLNUMRULE_BUL3", "Bullet ") +//Bullet \uE49E +#define STR_POOLNUMRULE_BUL4 NC_("STR_POOLNUMRULE_BUL4", "Bullet ") +//Bullet \uE20B +#define STR_POOLNUMRULE_BUL5 NC_("STR_POOLNUMRULE_BUL5", "Bullet ") +#define STR_COLUMN_VALUESET_ITEM0 NC_("STR_COLUMN_VALUESET_ITEM0", "1 column") +#define STR_COLUMN_VALUESET_ITEM1 NC_("STR_COLUMN_VALUESET_ITEM1", "2 columns with equal size") +#define STR_COLUMN_VALUESET_ITEM2 NC_("STR_COLUMN_VALUESET_ITEM2", "3 columns with equal size") +#define STR_COLUMN_VALUESET_ITEM3 NC_("STR_COLUMN_VALUESET_ITEM3", "2 columns with different size (left > right)") +#define STR_COLUMN_VALUESET_ITEM4 NC_("STR_COLUMN_VALUESET_ITEM4", "2 columns with different size (left < right)") +// Table styles, Writer internal, others are taken from Svx +#define STR_TABSTYLE_DEFAULT NC_("STR_TABSTYLE_DEFAULT", "Default Table Style") + +#define STR_PARAGRAPHSTYLEFAMILY NC_("STR_PARAGRAPHSTYLEFAMILY", "Paragraph Styles") +#define STR_CHARACTERSTYLEFAMILY NC_("STR_CHARACTERSTYLEFAMILY", "Character Styles") +#define STR_FRAMESTYLEFAMILY NC_("STR_FRAMESTYLEFAMILY", "Frame Styles") +#define STR_PAGESTYLEFAMILY NC_("STR_PAGESTYLEFAMILY", "Page Styles") +#define STR_LISTSTYLEFAMILY NC_("STR_LISTSTYLEFAMILY", "List Styles") +#define STR_TABLESTYLEFAMILY NC_("STR_TABLESTYLEFAMILY", "Table Styles") +#define STR_ENV_TITLE NC_("STR_ENV_TITLE", "Envelope") +#define STR_LAB_TITLE NC_("STR_LAB_TITLE", "Labels") + +#define STR_WRITER_DOCUMENT_FULLTYPE NC_("STR_WRITER_DOCUMENT_FULLTYPE", "%PRODUCTNAME %PRODUCTVERSION Text Document") +#define STR_CANTOPEN NC_("STR_CANTOPEN", "Cannot open document.") +#define STR_CANTCREATE NC_("STR_CANTCREATE", "Can't create document.") +#define STR_DLLNOTFOUND NC_("STR_DLLNOTFOUND", "Filter not found.") +#define STR_LOAD_GLOBAL_DOC NC_("STR_LOAD_GLOBAL_DOC", "Name and Path of Master Document") +#define STR_LOAD_HTML_DOC NC_("STR_LOAD_HTML_DOC", "Name and Path of the HTML Document") +#define STR_JAVA_EDIT NC_("STR_JAVA_EDIT", "Edit Script") +#define STR_BOOKMARK_DEF_NAME NC_("STR_BOOKMARK_DEF_NAME", "Bookmark") +#define STR_BOOKMARK_YES NC_("STR_BOOKMARK_YES", "Yes") +#define STR_BOOKMARK_NO NC_("STR_BOOKMARK_NO", "No") +#define STR_BOOKMARK_FORBIDDENCHARS NC_("STR_BOOKMARK_FORBIDDENCHARS", "Forbidden characters:") +#define SW_STR_NONE NC_("SW_STR_NONE", "[None]") +#define STR_CAPTION_BEGINNING NC_("STR_CAPTION_BEGINNING", "Start") +#define STR_CAPTION_END NC_("STR_CAPTION_END", "End") +#define STR_CAPTION_ABOVE NC_("STR_CAPTION_ABOVE", "Above") +#define STR_CAPTION_BELOW NC_("STR_CAPTION_BELOW", "Below") +#define SW_STR_READONLY NC_("SW_STR_READONLY", "read-only") +#define STR_READONLY_PATH NC_("STR_READONLY_PATH", "The 'AutoText' directories are read-only. Do you want to call the path settings dialog?") +#define STR_DOC_STAT NC_("STR_DOC_STAT", "Statistics") +#define STR_OUTLINENUMBERING_DISABLED NC_("STR_OUTLINENUMBERING_DISABLED","This option is disabled when chapter numbering is assigned to a paragraph style") +// Statusbar-titles +#define STR_STATSTR_W4WREAD NC_("STR_STATSTR_W4WREAD", "Importing document...") +#define STR_STATSTR_W4WWRITE NC_("STR_STATSTR_W4WWRITE", "Exporting document...") +#define STR_STATSTR_SWGWRITE NC_("STR_STATSTR_SWGWRITE", "Saving document...") +#define STR_STATSTR_REFORMAT NC_("STR_STATSTR_REFORMAT", "Repagination...") +#define STR_STATSTR_AUTOFORMAT NC_("STR_STATSTR_AUTOFORMAT", "Formatting document automatically...") +#define STR_STATSTR_SEARCH NC_("STR_STATSTR_SEARCH", "Search...") +#define STR_STATSTR_LETTER NC_("STR_STATSTR_LETTER", "Letter") +#define STR_STATSTR_SPELL NC_("STR_STATSTR_SPELL", "Spellcheck...") +#define STR_STATSTR_HYPHEN NC_("STR_STATSTR_HYPHEN", "Hyphenation...") +#define STR_STATSTR_TOX_INSERT NC_("STR_STATSTR_TOX_INSERT", "Inserting Index...") +#define STR_STATSTR_TOX_UPDATE NC_("STR_STATSTR_TOX_UPDATE", "Updating Index...") +#define STR_STATSTR_SUMMARY NC_("STR_STATSTR_SUMMARY", "Creating abstract...") +#define STR_STATSTR_SWGPRTOLENOTIFY NC_("STR_STATSTR_SWGPRTOLENOTIFY", "Adapt Objects...") +#define STR_TABLE_DEFNAME NC_("STR_TABLE_DEFNAME", "Table") +#define STR_GRAPHIC_DEFNAME NC_("STR_GRAPHIC_DEFNAME", "Image") +#define STR_OBJECT_DEFNAME NC_("STR_OBJECT_DEFNAME", "Object") +#define STR_FRAME_DEFNAME NC_("STR_FRAME_DEFNAME", "Frame") +#define STR_SHAPE_DEFNAME NC_("STR_SHAPE_DEFNAME", "Shape") +#define STR_REGION_DEFNAME NC_("STR_REGION_DEFNAME", "Section") +#define STR_NUMRULE_DEFNAME NC_("STR_NUMRULE_DEFNAME", "Numbering") +#define STR_EMPTYPAGE NC_("STR_EMPTYPAGE", "blank page") +#define STR_ABSTRACT_TITLE NC_("STR_ABSTRACT_TITLE", "Abstract: ") +#define STR_FDLG_TEMPLATE_NAME NC_("STR_FDLG_TEMPLATE_NAME", "separated by: ") +#define STR_FDLG_OUTLINE_LEVEL NC_("STR_FDLG_OUTLINE_LEVEL", "Outline: Level ") +#define STR_FDLG_STYLE NC_("STR_FDLG_STYLE", "Style: ") +#define STR_PAGEOFFSET NC_("STR_PAGEOFFSET", "Page number: ") +#define STR_PAGEBREAK NC_("STR_PAGEBREAK", "Break before new page") +#define STR_WESTERN_FONT NC_("STR_WESTERN_FONT", "Western text: ") +#define STR_CJK_FONT NC_("STR_CJK_FONT", "Asian text: ") +#define STR_CTL_FONT NC_("STR_CTL_FONT", "CTL text: ") +#define STR_REDLINE_UNKNOWN_AUTHOR NC_("STR_REDLINE_UNKNOWN_AUTHOR", "Unknown Author") +#define STR_DELETE_NOTE_AUTHOR NC_("STR_DELETE_NOTE_AUTHOR", "Delete ~All Comments by $1") +#define STR_HIDE_NOTE_AUTHOR NC_("STR_HIDE_NOTE_AUTHOR", "H~ide All Comments by $1") +#define STR_OUTLINE_NUMBERING NC_("STR_OUTLINE_NUMBERING", "Chapter Numbering") +/* To translators: $1 == will be replaced by STR_WORDCOUNT_WORDARG, and $2 by STR_WORDCOUNT_COLARG + e.g. Selected: 1 word, 2 characters */ +#define STR_WORDCOUNT NC_("STR_WORDCOUNT", "Selected: $1, $2") +// To translators: STR_WORDCOUNT_WORDARG is $1 of STR_WORDCOUNT. $1 of STR_WORDCOUNT is number of words +#define STR_WORDCOUNT_WORDARG NNC_("STR_WORDCOUNT_WORDARG", "$1 word", "$1 words") +// To translators: STR_WORDCOUNT_CHARARG is $1 of STR_WORDCOUNT. $1 of STR_WORDCOUNT_CHARARG is number of characters +#define STR_WORDCOUNT_CHARARG NNC_("STR_WORDCOUNT_CHARARG", "$1 character", "$1 characters") +/* To translators: $1 == will be replaced by STR_WORDCOUNT_WORDARG, and $2 by STR_WORDCOUNT_COLARG + e.g. 1 word, 2 characters */ +#define STR_WORDCOUNT_NO_SELECTION NC_("STR_WORDCOUNT_NO_SELECTION", "$1, $2") +/* To translators: STR_WORDCOUNT_WORDARG_NO_SELECTION is $1 of STR_WORDCOUNT_NO_SELECTION. + $1 of STR_WORDCOUNT_NO_SELECTION is number of words */ +#define STR_WORDCOUNT_WORDARG_NO_SELECTION NNC_("STR_WORDCOUNT_WORDARG_NO_SELECTION", "$1 word", "$1 words") +/* To translators: STR_WORDCOUNT_CHARARG_NO_SELECTION is $1 of STR_WORDCOUNT_NO_SELECTION. + $1 of STR_WORDCOUNT_CHARARG_NO_SELECTION is number of characters */ +#define STR_WORDCOUNT_CHARARG_NO_SELECTION NNC_("STR_WORDCOUNT_CHARARG_NO_SELECTION", "$1 character", "$1 characters") +#define STR_CONVERT_TEXT_TABLE NC_("STR_CONVERT_TEXT_TABLE", "Convert Text to Table") +#define STR_ADD_AUTOFORMAT_TITLE NC_("STR_ADD_AUTOFORMAT_TITLE", "Add AutoFormat") +#define STR_ADD_AUTOFORMAT_LABEL NC_("STR_ADD_AUTOFORMAT_LABEL", "Name") +#define STR_DEL_AUTOFORMAT_TITLE NC_("STR_DEL_AUTOFORMAT_TITLE", "Delete AutoFormat") +#define STR_DEL_AUTOFORMAT_MSG NC_("STR_DEL_AUTOFORMAT_MSG", "The following AutoFormat entry will be deleted:") +#define STR_RENAME_AUTOFORMAT_TITLE NC_("STR_RENAME_AUTOFORMAT_TITLE", "Rename AutoFormat") +#define STR_BTN_AUTOFORMAT_CLOSE NC_("STR_BTN_AUTOFORMAT_CLOSE", "~Close") +#define STR_JAN NC_("STR_JAN", "Jan") +#define STR_FEB NC_("STR_FEB", "Feb") +#define STR_MAR NC_("STR_MAR", "Mar") +#define STR_NORTH NC_("STR_NORTH", "North") +#define STR_MID NC_("STR_MID", "Mid") +#define STR_SOUTH NC_("STR_SOUTH", "South") +#define STR_SUM NC_("STR_SUM", "Sum") +#define STR_INVALID_AUTOFORMAT_NAME NC_("STR_INVALID_AUTOFORMAT_NAME", "You have entered an invalid name.\nThe desired AutoFormat could not be created. \nTry again using a different name.") +#define STR_NUMERIC NC_("STR_NUMERIC", "Numeric") +#define STR_ROW NC_("STR_ROW", "Rows") +#define STR_COL NC_("STR_COL", "Column") +#define STR_AUTHMRK_EDIT NC_("STR_AUTHMRK_EDIT", "Edit Bibliography Entry") +#define STR_AUTHMRK_INSERT NC_("STR_AUTHMRK_INSERT", "Insert Bibliography Entry") +#define STR_ACCESS_PAGESETUP_SPACING NC_("STR_ACCESS_PAGESETUP_SPACING", "Spacing between %1 and %2") +#define STR_ACCESS_COLUMN_WIDTH NC_("STR_ACCESS_COLUMN_WIDTH", "Column %1 Width") +#define STR_CAPTION_TABLE NC_("STR_CAPTION_TABLE", "%PRODUCTNAME Writer Table") +#define STR_CAPTION_FRAME NC_("STR_CAPTION_FRAME", "%PRODUCTNAME Writer Frame") +#define STR_CAPTION_GRAPHIC NC_("STR_CAPTION_GRAPHIC", "%PRODUCTNAME Writer Image") +#define STR_CAPTION_OLE NC_("STR_CAPTION_OLE", "Other OLE Objects") +#define STR_WRONG_TABLENAME NC_("STR_WRONG_TABLENAME", "The name of the table must not contain spaces.") +#define STR_ERR_TABLE_MERGE NC_("STR_ERR_TABLE_MERGE", "Selected table cells are too complex to merge.") +#define STR_SRTERR NC_("STR_SRTERR", "Cannot sort selection") + +// Miscellaneous +#define STR_EVENT_OBJECT_SELECT NC_("STR_EVENT_OBJECT_SELECT", "Click object") +#define STR_EVENT_START_INS_GLOSSARY NC_("STR_EVENT_START_INS_GLOSSARY", "Before inserting AutoText") +#define STR_EVENT_END_INS_GLOSSARY NC_("STR_EVENT_END_INS_GLOSSARY", "After inserting AutoText") +#define STR_EVENT_MOUSEOVER_OBJECT NC_("STR_EVENT_MOUSEOVER_OBJECT", "Mouse over object") +#define STR_EVENT_MOUSECLICK_OBJECT NC_("STR_EVENT_MOUSECLICK_OBJECT", "Trigger hyperlink") +#define STR_EVENT_MOUSEOUT_OBJECT NC_("STR_EVENT_MOUSEOUT_OBJECT", "Mouse leaves object") +#define STR_EVENT_IMAGE_LOAD NC_("STR_EVENT_IMAGE_LOAD", "Image loaded successfully") +#define STR_EVENT_IMAGE_ABORT NC_("STR_EVENT_IMAGE_ABORT", "Image loading terminated") +#define STR_EVENT_IMAGE_ERROR NC_("STR_EVENT_IMAGE_ERROR", "Could not load image") +#define STR_EVENT_FRM_KEYINPUT_A NC_("STR_EVENT_FRM_KEYINPUT_A", "Input of alphanumeric characters") +#define STR_EVENT_FRM_KEYINPUT_NOA NC_("STR_EVENT_FRM_KEYINPUT_NOA", "Input of non-alphanumeric characters") +#define STR_EVENT_FRM_RESIZE NC_("STR_EVENT_FRM_RESIZE", "Resize frame") +#define STR_EVENT_FRM_MOVE NC_("STR_EVENT_FRM_MOVE", "Move frame") +#define STR_CONTENT_TYPE_OUTLINE NC_("STR_CONTENT_TYPE_OUTLINE", "Headings") +#define STR_CONTENT_TYPE_TABLE NC_("STR_CONTENT_TYPE_TABLE", "Tables") +#define STR_CONTENT_TYPE_FRAME NC_("STR_CONTENT_TYPE_FRAME", "Frames") +#define STR_CONTENT_TYPE_GRAPHIC NC_("STR_CONTENT_TYPE_GRAPHIC", "Images") +#define STR_CONTENT_TYPE_OLE NC_("STR_CONTENT_TYPE_OLE", "OLE objects") +#define STR_CONTENT_TYPE_BOOKMARK NC_("STR_CONTENT_TYPE_BOOKMARK", "Bookmarks") +#define STR_CONTENT_TYPE_REGION NC_("STR_CONTENT_TYPE_REGION", "Sections") +#define STR_CONTENT_TYPE_URLFIELD NC_("STR_CONTENT_TYPE_URLFIELD", "Hyperlinks") +#define STR_CONTENT_TYPE_REFERENCE NC_("STR_CONTENT_TYPE_REFERENCE", "References") +#define STR_CONTENT_TYPE_INDEX NC_("STR_CONTENT_TYPE_INDEX", "Indexes") +#define STR_CONTENT_TYPE_DRAWOBJECT NC_("STR_CONTENT_TYPE_DRAWOBJECT", "Drawing objects") +#define STR_CONTENT_TYPE_POSTIT NC_("STR_CONTENT_TYPE_POSTIT", "Comments") +#define STR_IDXEXAMPLE_IDXTXT_HEADING1 NC_("STR_IDXEXAMPLE_IDXTXT_HEADING1", "Heading 1") +#define STR_IDXEXAMPLE_IDXTXT_ENTRY1 NC_("STR_IDXEXAMPLE_IDXTXT_ENTRY1", "This is the content from the first chapter. This is a user directory entry.") +#define STR_IDXEXAMPLE_IDXTXT_HEADING11 NC_("STR_IDXEXAMPLE_IDXTXT_HEADING11", "Heading 1.1") +#define STR_IDXEXAMPLE_IDXTXT_ENTRY11 NC_("STR_IDXEXAMPLE_IDXTXT_ENTRY11", "This is the content from chapter 1.1. This is the entry for the table of contents.") +#define STR_IDXEXAMPLE_IDXTXT_HEADING12 NC_("STR_IDXEXAMPLE_IDXTXT_HEADING12", "Heading 1.2") +#define STR_IDXEXAMPLE_IDXTXT_ENTRY12 NC_("STR_IDXEXAMPLE_IDXTXT_ENTRY12", "This is the content from chapter 1.2. This keyword is a main entry.") +#define STR_IDXEXAMPLE_IDXTXT_TABLE1 NC_("STR_IDXEXAMPLE_IDXTXT_TABLE1", "Table 1: This is table 1") +#define STR_IDXEXAMPLE_IDXTXT_IMAGE1 NC_("STR_IDXEXAMPLE_IDXTXT_IMAGE1", "Image 1: This is image 1") +#define STR_IDXEXAMPLE_IDXMARK_CHAPTER NC_("STR_IDXEXAMPLE_IDXMARK_CHAPTER", "Chapter") +#define STR_IDXEXAMPLE_IDXMARK_KEYWORD NC_("STR_IDXEXAMPLE_IDXMARK_KEYWORD", "Keyword") +#define STR_IDXEXAMPLE_IDXMARK_USER_DIR_ENTRY NC_("STR_IDXEXAMPLE_IDXMARK_USER_DIR_ENTRY", "User Directory Entry") +#define STR_IDXEXAMPLE_IDXMARK_ENTRY NC_("STR_IDXEXAMPLE_IDXMARK_ENTRY", "Entry") +#define STR_IDXEXAMPLE_IDXMARK_THIS NC_("STR_IDXEXAMPLE_IDXMARK_THIS", "this") +#define STR_IDXEXAMPLE_IDXMARK_PRIMARY_KEY NC_("STR_IDXEXAMPLE_IDXMARK_PRIMARY_KEY", "Primary key") +#define STR_IDXEXAMPLE_IDXMARK_SECONDARY_KEY NC_("STR_IDXEXAMPLE_IDXMARK_SECONDARY_KEY", "Secondary key") +#define STR_CONTENT_TYPE_SINGLE_OUTLINE NC_("STR_CONTENT_TYPE_SINGLE_OUTLINE", "Heading") +#define STR_CONTENT_TYPE_SINGLE_TABLE NC_("STR_CONTENT_TYPE_SINGLE_TABLE", "Table") +#define STR_CONTENT_TYPE_SINGLE_FRAME NC_("STR_CONTENT_TYPE_SINGLE_FRAME", "Text frame") +#define STR_CONTENT_TYPE_SINGLE_GRAPHIC NC_("STR_CONTENT_TYPE_SINGLE_GRAPHIC", "Image") +#define STR_CONTENT_TYPE_SINGLE_OLE NC_("STR_CONTENT_TYPE_SINGLE_OLE", "OLE object") +#define STR_CONTENT_TYPE_SINGLE_BOOKMARK NC_("STR_CONTENT_TYPE_SINGLE_BOOKMARK", "Bookmark") +#define STR_CONTENT_TYPE_SINGLE_REGION NC_("STR_CONTENT_TYPE_SINGLE_REGION", "Section") +#define STR_CONTENT_TYPE_SINGLE_URLFIELD NC_("STR_CONTENT_TYPE_SINGLE_URLFIELD", "Hyperlink") +#define STR_CONTENT_TYPE_SINGLE_REFERENCE NC_("STR_CONTENT_TYPE_SINGLE_REFERENCE", "Reference") +#define STR_CONTENT_TYPE_SINGLE_INDEX NC_("STR_CONTENT_TYPE_SINGLE_INDEX", "Index") +#define STR_CONTENT_TYPE_SINGLE_POSTIT NC_("STR_CONTENT_TYPE_SINGLE_POSTIT", "Comment") +#define STR_CONTENT_TYPE_SINGLE_DRAWOBJECT NC_("STR_CONTENT_TYPE_SINGLE_DRAWOBJECT", "Draw object") +#define STR_DEFINE_NUMBERFORMAT NC_("STR_DEFINE_NUMBERFORMAT", "Additional formats...") +#define RID_STR_SYSTEM NC_("RID_STR_SYSTEM", "[System]") +#define STR_MULT_INTERACT_HYPH_WARN NC_("STR_MULT_INTERACT_HYPH_WARN", "The interactive hyphenation is already active\nin a different document") +#define STR_HYPH_TITLE NC_("STR_HYPH_TITLE", "Hyphenation") +#define STR_HYPH_MISSING NC_("STR_HYPH_MISSING", "Missing hyphenation data") +#define STR_HYPH_MISSING_DETAIL NC_("STR_HYPH_MISSING", "Please install the hyphenation package for locale “%1”.") + +// Undo +#define STR_CANT_UNDO NC_("STR_CANT_UNDO", "not possible") +#define STR_DELETE_UNDO NC_("STR_DELETE_UNDO", "Delete $1") +#define STR_INSERT_UNDO NC_("STR_INSERT_UNDO", "Insert $1") +#define STR_OVR_UNDO NC_("STR_OVR_UNDO", "Overwrite: $1") +#define STR_SPLITNODE_UNDO NC_("STR_SPLITNODE_UNDO", "New Paragraph") +#define STR_MOVE_UNDO NC_("STR_MOVE_UNDO", "Move") +#define STR_INSATTR_UNDO NC_("STR_INSATTR_UNDO", "Apply attributes") +#define STR_SETFMTCOLL_UNDO NC_("STR_SETFMTCOLL_UNDO", "Apply Styles: $1") +#define STR_RESET_ATTR_UNDO NC_("STR_RESET_ATTR_UNDO", "Reset attributes") +#define STR_INSFMT_ATTR_UNDO NC_("STR_INSFMT_ATTR_UNDO", "Change style: $1") +#define STR_INSERT_DOC_UNDO NC_("STR_INSERT_DOC_UNDO", "Insert file") +#define STR_INSERT_GLOSSARY NC_("STR_INSERT_GLOSSARY", "Insert AutoText") +#define STR_DELBOOKMARK NC_("STR_DELBOOKMARK", "Delete bookmark: $1") +#define STR_INSBOOKMARK NC_("STR_INSBOOKMARK", "Insert bookmark: $1") +#define STR_SORT_TBL NC_("STR_SORT_TBL", "Sort table") +#define STR_SORT_TXT NC_("STR_SORT_TXT", "Sort text") +#define STR_INSTABLE_UNDO NC_("STR_INSTABLE_UNDO", "Insert table: $1$2$3") +#define STR_TEXTTOTABLE_UNDO NC_("STR_TEXTTOTABLE_UNDO", "Convert text -> table") +#define STR_TABLETOTEXT_UNDO NC_("STR_TABLETOTEXT_UNDO", "Convert table -> text") +#define STR_COPY_UNDO NC_("STR_COPY_UNDO", "Copy: $1") +#define STR_REPLACE_UNDO NC_("STR_REPLACE_UNDO", "Replace $1 $2 $3") +#define STR_INSERT_PAGE_BREAK_UNDO NC_("STR_INSERT_PAGE_BREAK_UNDO", "Insert page break") +#define STR_INSERT_COLUMN_BREAK_UNDO NC_("STR_INSERT_COLUMN_BREAK_UNDO", "Insert column break") +#define STR_INSERT_ENV_UNDO NC_("STR_INSERT_ENV_UNDO", "Insert Envelope") +#define STR_DRAG_AND_COPY NC_("STR_DRAG_AND_COPY", "Copy: $1") +#define STR_DRAG_AND_MOVE NC_("STR_DRAG_AND_MOVE", "Move: $1") +#define STR_INSERT_CHART NC_("STR_INSERT_CHART", "Insert %PRODUCTNAME Chart") +#define STR_INSERTFLY NC_("STR_INSERTFLY", "Insert frame") +#define STR_DELETEFLY NC_("STR_DELETEFLY", "Delete frame") +#define STR_AUTOFORMAT NC_("STR_AUTOFORMAT", "AutoFormat") +#define STR_TABLEHEADLINE NC_("STR_TABLEHEADLINE", "Table heading") +#define STR_REPLACE NC_("STR_REPLACE", "Replace: $1 $2 $3") +#define STR_INSERTSECTION NC_("STR_INSERTSECTION", "Insert section") +#define STR_DELETESECTION NC_("STR_DELETESECTION", "Delete section") +#define STR_CHANGESECTION NC_("STR_CHANGESECTION", "Modify section") +#define STR_CHANGEDEFATTR NC_("STR_CHANGEDEFATTR", "Modify default values") +#define STR_REPLACE_STYLE NC_("STR_REPLACE_STYLE", "Replace style: $1 $2 $3") +#define STR_DELETE_PAGE_BREAK NC_("STR_DELETE_PAGE_BREAK", "Delete page break") +#define STR_TEXT_CORRECTION NC_("STR_TEXT_CORRECTION", "Text Correction") +#define STR_OUTLINE_LR NC_("STR_OUTLINE_LR", "Promote/demote outline") +#define STR_OUTLINE_UD NC_("STR_OUTLINE_UD", "Move outline") +#define STR_INSNUM NC_("STR_INSNUM", "Insert numbering") +#define STR_NUMUP NC_("STR_NUMUP", "Promote level") +#define STR_NUMDOWN NC_("STR_NUMDOWN", "Demote level") +#define STR_MOVENUM NC_("STR_MOVENUM", "Move paragraphs") +#define STR_INSERTDRAW NC_("STR_INSERTDRAW", "Insert drawing object: $1") +#define STR_NUMORNONUM NC_("STR_NUMORNONUM", "Number On/Off") +#define STR_INC_LEFTMARGIN NC_("STR_INC_LEFTMARGIN", "Increase Indent") +#define STR_DEC_LEFTMARGIN NC_("STR_DEC_LEFTMARGIN", "Decrease indent") +#define STR_INSERTLABEL NC_("STR_INSERTLABEL", "Insert caption: $1") +#define STR_SETNUMRULESTART NC_("STR_SETNUMRULESTART", "Restart numbering") +#define STR_CHANGEFTN NC_("STR_CHANGEFTN", "Modify footnote") +#define STR_ACCEPT_REDLINE NC_("STR_ACCEPT_REDLINE", "Accept change: $1") +#define STR_REJECT_REDLINE NC_("STR_REJECT_REDLINE", "Reject change: $1") +#define STR_SPLIT_TABLE NC_("STR_SPLIT_TABLE", "Split Table") +#define STR_DONTEXPAND NC_("STR_DONTEXPAND", "Stop attribute") +#define STR_AUTOCORRECT NC_("STR_AUTOCORRECT", "AutoCorrect") +#define STR_MERGE_TABLE NC_("STR_MERGE_TABLE", "Merge table") +#define STR_TRANSLITERATE NC_("STR_TRANSLITERATE", "Change Case") +#define STR_DELNUM NC_("STR_DELNUM", "Delete numbering") +#define STR_DRAWUNDO NC_("STR_DRAWUNDO", "Drawing objects: $1") +#define STR_DRAWGROUP NC_("STR_DRAWGROUP", "Group draw objects") +#define STR_DRAWUNGROUP NC_("STR_DRAWUNGROUP", "Ungroup drawing objects") +#define STR_DRAWDELETE NC_("STR_DRAWDELETE", "Delete drawing objects") +#define STR_REREAD NC_("STR_REREAD", "Replace Image") +#define STR_DELGRF NC_("STR_DELGRF", "Delete Image") +#define STR_TABLE_ATTR NC_("STR_TABLE_ATTR", "Apply table attributes") +#define STR_UNDO_TABLE_AUTOFMT NC_("STR_UNDO_TABLE_AUTOFMT", "AutoFormat Table") +#define STR_UNDO_TABLE_INSCOL NC_("STR_UNDO_TABLE_INSCOL", "Insert Column") +#define STR_UNDO_TABLE_INSROW NC_("STR_UNDO_TABLE_INSROW", "Insert Row") +#define STR_UNDO_TABLE_DELBOX NC_("STR_UNDO_TABLE_DELBOX", "Delete row/column") +#define STR_UNDO_COL_DELETE NC_("STR_UNDO_COL_DELETE", "Delete column") +#define STR_UNDO_ROW_DELETE NC_("STR_UNDO_ROW_DELETE", "Delete row") +#define STR_UNDO_TABLE_SPLIT NC_("STR_UNDO_TABLE_SPLIT", "Split Cells") +#define STR_UNDO_TABLE_MERGE NC_("STR_UNDO_TABLE_MERGE", "Merge Cells") +#define STR_TABLE_NUMFORMAT NC_("STR_TABLE_NUMFORMAT", "Format cell") +#define STR_INSERT_TOX NC_("STR_INSERT_TOX", "Insert index/table") +#define STR_CLEAR_TOX_RANGE NC_("STR_CLEAR_TOX_RANGE", "Remove index/table") +#define STR_TABLE_TBLCPYTBL NC_("STR_TABLE_TBLCPYTBL", "Copy table") +#define STR_TABLE_CPYTBL NC_("STR_TABLE_CPYTBL", "Copy table") +#define STR_INS_FROM_SHADOWCRSR NC_("STR_INS_FROM_SHADOWCRSR", "Set cursor") +#define STR_UNDO_CHAIN NC_("STR_UNDO_CHAIN", "Link text frames") +#define STR_UNDO_UNCHAIN NC_("STR_UNDO_UNCHAIN", "Unlink text frames") +#define STR_UNDO_FTNINFO NC_("STR_UNDO_FTNINFO", "Modify footnote options") +#define STR_UNDO_COMPAREDOC NC_("STR_UNDO_COMPAREDOC", "Compare Document") +#define STR_UNDO_SETFLYFRMFMT NC_("STR_UNDO_SETFLYFRMFMT", "Apply frame style: $1") +#define STR_UNDO_SETRUBYATTR NC_("STR_UNDO_SETRUBYATTR", "Ruby Setting") +#define STR_INSERT_FOOTNOTE NC_("STR_INSERT_FOOTNOTE", "Insert footnote") +#define STR_INSERT_URLBTN NC_("STR_INSERT_URLBTN", "insert URL button") +#define STR_INSERT_URLTXT NC_("STR_INSERT_URLTXT", "Insert Hyperlink") +#define STR_DELETE_INVISIBLECNTNT NC_("STR_DELETE_INVISIBLECNTNT", "remove invisible content") +#define STR_TOXCHANGE NC_("STR_TOXCHANGE", "Table/index changed") +#define STR_START_QUOTE NC_("STR_START_QUOTE", "“") +#define STR_END_QUOTE NC_("STR_END_QUOTE", "”") +#define STR_LDOTS NC_("STR_LDOTS", "...") +#define STR_MULTISEL NC_("STR_MULTISEL", "multiple selection") +#define STR_TYPING_UNDO NC_("STR_TYPING_UNDO", "Typing: $1") +#define STR_PASTE_CLIPBOARD_UNDO NC_("STR_PASTE_CLIPBOARD_UNDO", "Paste clipboard") +#define STR_YIELDS NC_("STR_YIELDS", "→") +#define STR_OCCURRENCES_OF NC_("STR_OCCURRENCES_OF", "occurrences of") +#define STR_UNDO_TABS NNC_("STR_UNDO_TABS", "One tab", "$1 tabs") +#define STR_UNDO_NLS NNC_("STR_UNDO_NLS", "One line break","$1 line breaks") +#define STR_UNDO_PAGEBREAKS NC_("STR_UNDO_PAGEBREAKS", "page break") +#define STR_UNDO_COLBRKS NC_("STR_UNDO_COLBRKS", "column break") +#define STR_UNDO_REDLINE_INSERT NC_("STR_UNDO_REDLINE_INSERT", "Insert $1") +#define STR_UNDO_REDLINE_DELETE NC_("STR_UNDO_REDLINE_DELETE", "Delete $1") +#define STR_UNDO_REDLINE_FORMAT NC_("STR_UNDO_REDLINE_FORMAT", "Attributes changed") +#define STR_UNDO_REDLINE_TABLE NC_("STR_UNDO_REDLINE_TABLE", "Table changed") +#define STR_UNDO_REDLINE_FMTCOLL NC_("STR_UNDO_REDLINE_FMTCOLL", "Style changed") +#define STR_UNDO_REDLINE_PARAGRAPH_FORMAT NC_("STR_UNDO_REDLINE_PARAGRAPH_FORMAT", "Paragraph formatting changed") +#define STR_UNDO_REDLINE_TABLE_ROW_INSERT NC_("STR_UNDO_REDLINE_TABLE_ROW_INSERT", "Insert Row") +#define STR_UNDO_REDLINE_TABLE_ROW_DELETE NC_("STR_UNDO_REDLINE_TABLE_ROW_DELETE", "Delete Row") +#define STR_UNDO_REDLINE_TABLE_CELL_INSERT NC_("STR_UNDO_REDLINE_TABLE_CELL_INSERT", "Insert Cell") +#define STR_UNDO_REDLINE_TABLE_CELL_DELETE NC_("STR_UNDO_REDLINE_TABLE_CELL_DELETE", "Delete Cell") +#define STR_N_REDLINES NC_("STR_N_REDLINES", "$1 changes") +#define STR_UNDO_PAGEDESC NC_("STR_UNDO_PAGEDESC", "Change page style: $1") +#define STR_UNDO_PAGEDESC_CREATE NC_("STR_UNDO_PAGEDESC_CREATE", "Create page style: $1") +#define STR_UNDO_PAGEDESC_DELETE NC_("STR_UNDO_PAGEDESC_DELETE", "Delete page style: $1") +#define STR_UNDO_PAGEDESC_RENAME NC_("STR_UNDO_PAGEDESC_RENAME", "Rename page style: $1 $2 $3") +#define STR_UNDO_HEADER_FOOTER NC_("STR_UNDO_HEADER_FOOTER", "Header/footer changed") +#define STR_UNDO_FIELD NC_("STR_UNDO_FIELD", "Field changed") +#define STR_UNDO_TXTFMTCOL_CREATE NC_("STR_UNDO_TXTFMTCOL_CREATE", "Create paragraph style: $1") +#define STR_UNDO_TXTFMTCOL_DELETE NC_("STR_UNDO_TXTFMTCOL_DELETE", "Delete paragraph style: $1") +#define STR_UNDO_TXTFMTCOL_RENAME NC_("STR_UNDO_TXTFMTCOL_RENAME", "Rename paragraph style: $1 $2 $3") +#define STR_UNDO_CHARFMT_CREATE NC_("STR_UNDO_CHARFMT_CREATE", "Create character style: $1") +#define STR_UNDO_CHARFMT_DELETE NC_("STR_UNDO_CHARFMT_DELETE", "Delete character style: $1") +#define STR_UNDO_CHARFMT_RENAME NC_("STR_UNDO_CHARFMT_RENAME", "Rename character style: $1 $2 $3") +#define STR_UNDO_FRMFMT_CREATE NC_("STR_UNDO_FRMFMT_CREATE", "Create frame style: $1") +#define STR_UNDO_FRMFMT_DELETE NC_("STR_UNDO_FRMFMT_DELETE", "Delete frame style: $1") +#define STR_UNDO_FRMFMT_RENAME NC_("STR_UNDO_FRMFMT_RENAME", "Rename frame style: $1 $2 $3") +#define STR_UNDO_NUMRULE_CREATE NC_("STR_UNDO_NUMRULE_CREATE", "Create numbering style: $1") +#define STR_UNDO_NUMRULE_DELETE NC_("STR_UNDO_NUMRULE_DELETE", "Delete numbering style: $1") +#define STR_UNDO_NUMRULE_RENAME NC_("STR_UNDO_NUMRULE_RENAME", "Rename numbering style: $1 $2 $3") +#define STR_UNDO_BOOKMARK_RENAME NC_("STR_UNDO_BOOKMARK_RENAME", "Rename bookmark: $1 $2 $3") +#define STR_UNDO_INDEX_ENTRY_INSERT NC_("STR_UNDO_INDEX_ENTRY_INSERT", "Insert index entry") +#define STR_UNDO_INDEX_ENTRY_DELETE NC_("STR_UNDO_INDEX_ENTRY_DELETE", "Delete index entry") +#define STR_FIELD NC_("STR_FIELD", "field") +#define STR_UNDO_INSERT_TEXTBOX NC_("STR_UNDO_INSERT_TEXTBOX", "text box") +/*undo: STR_PARAGRAPHS, string.text*/ +#define STR_PARAGRAPHS NC_("STR_PARAGRAPHS", "Paragraphs") +#define STR_FRAME NC_("STR_FRAME", "frame") +#define STR_OLE NC_("STR_OLE", "OLE-object") +#define STR_MATH_FORMULA NC_("STR_MATH_FORMULA", "formula") +#define STR_CHART NC_("STR_CHART", "chart") +#define STR_NOTE NC_("STR_NOTE", "comment") +#define STR_REFERENCE NC_("STR_REFERENCE", "cross-reference") +#define STR_SCRIPT NC_("STR_SCRIPT", "script") +#define STR_AUTHORITY_ENTRY NC_("STR_AUTHORITY_ENTRY", "bibliography entry") +#define STR_SPECIALCHAR NC_("STR_SPECIALCHAR", "special character") +#define STR_FOOTNOTE NC_("STR_FOOTNOTE", "footnote") +#define STR_GRAPHIC NC_("STR_GRAPHIC", "image") +#define STR_DRAWING_OBJECTS NC_("STR_DRAWING_OBJECTS", "drawing object(s)") +#define STR_TABLE_NAME NC_("STR_TABLE_NAME", "table: $1$2$3") +#define STR_CHAPTERS NNC_("STR_CHAPTERS", "chapter", "chapters") +#define STR_PARAGRAPH_UNDO NC_("STR_PARAGRAPH_UNDO", "paragraph") +#define STR_PARAGRAPH_SIGN_UNDO NC_("STR_PARAGRAPH_SIGN_UNDO", "Paragraph sign") +#define STR_UNDO_FLYFRMFMT_TITLE NC_("STR_UNDO_FLYFRMFMT_TITLE", "Change object title of $1") +#define STR_UNDO_FLYFRMFMT_DESCRIPTION NC_("STR_UNDO_FLYFRMFMT_DESCRIPTION", "Change object description of $1") +#define STR_UNDO_TBLSTYLE_CREATE NC_("STR_UNDO_TBLSTYLE_CREATE", "Create table style: $1") +#define STR_UNDO_TBLSTYLE_DELETE NC_("STR_UNDO_TBLSTYLE_DELETE", "Delete table style: $1") +#define STR_UNDO_TBLSTYLE_UPDATE NC_("STR_UNDO_TBLSTYLE_UPDATE", "Update table style: $1") +#define STR_UNDO_TABLE_DELETE NC_("STR_UNDO_TABLE_DELETE", "Delete table") +#define STR_UNDO_INSERT_FORM_FIELD NC_("STR_UNDO_INSERT_FORM_FIELD", "Insert form field") +#define STR_DROP_DOWN_FIELD_ITEM_LIMIT NC_("STR_DROP_DOWN_FIELD_ITEM_LIMIT", "You can specify maximum of 25 items for a drop-down form field.") + +#define STR_ACCESS_DOC_NAME NC_("STR_ACCESS_DOC_NAME", "Document view") +#define STR_ACCESS_DOC_DESC NC_("STR_ACCESS_DOC_DESC", "Document view") +#define STR_ACCESS_HEADER_NAME NC_("STR_ACCESS_HEADER_NAME", "Header $(ARG1)") +#define STR_ACCESS_HEADER_DESC NC_("STR_ACCESS_HEADER_DESC", "Header page $(ARG1)") +#define STR_ACCESS_FOOTER_NAME NC_("STR_ACCESS_FOOTER_NAME", "Footer $(ARG1)") +#define STR_ACCESS_FOOTER_DESC NC_("STR_ACCESS_FOOTER_DESC", "Footer page $(ARG1)") +#define STR_ACCESS_FOOTNOTE_NAME NC_("STR_ACCESS_FOOTNOTE_NAME", "Footnote $(ARG1)") +#define STR_ACCESS_FOOTNOTE_DESC NC_("STR_ACCESS_FOOTNOTE_DESC", "Footnote $(ARG1)") +#define STR_ACCESS_ENDNOTE_NAME NC_("STR_ACCESS_ENDNOTE_NAME", "Endnote $(ARG1)") +#define STR_ACCESS_ENDNOTE_DESC NC_("STR_ACCESS_ENDNOTE_DESC", "Endnote $(ARG1)") +#define STR_ACCESS_TABLE_DESC NC_("STR_ACCESS_TABLE_DESC", "$(ARG1) on page $(ARG2)") +#define STR_ACCESS_PAGE_NAME NC_("STR_ACCESS_PAGE_NAME", "Page $(ARG1)") +#define STR_ACCESS_PAGE_DESC NC_("STR_ACCESS_PAGE_DESC", "Page: $(ARG1)") +#define STR_ACCESS_ANNOTATION_AUTHOR_NAME NC_("STR_ACCESS_ANNOTATION_AUTHOR_NAME", "Author") +#define STR_ACCESS_ANNOTATION_DATE_NAME NC_("STR_ACCESS_ANNOTATION_DATE_NAME", "Date") +#define STR_ACCESS_ANNOTATION_RESOLVED_NAME NC_("STR_ACCESS_ANNOTATION_RESOLVED_NAME", "Resolved") +#define STR_ACCESS_ANNOTATION_BUTTON_NAME NC_("STR_ACCESS_ANNOTATION_BUTTON_NAME", "Actions") +#define STR_ACCESS_ANNOTATION_BUTTON_DESC NC_("STR_ACCESS_ANNOTATION_BUTTON_DESC", "Activate this button to open a list of actions which can be performed on this comment and other comments") +#define STR_ACCESS_PREVIEW_DOC_NAME NC_("STR_ACCESS_PREVIEW_DOC_NAME", "Document preview") +#define STR_ACCESS_PREVIEW_DOC_SUFFIX NC_("STR_ACCESS_PREVIEW_DOC_SUFFIX", "(Preview mode)") +#define STR_ACCESS_DOC_WORDPROCESSING NC_("STR_ACCESS_DOC_WORDPROCESSING", "%PRODUCTNAME Document") + +#define STR_COMCORE_READERROR NC_("STR_COMCORE_READERROR", "Read Error") +#define STR_COMCORE_CANT_SHOW NC_("STR_COMCORE_CANT_SHOW", "Image cannot be displayed.") +#define STR_ERROR_CLPBRD_READ NC_("STR_ERROR_CLPBRD_READ", "Error reading from the clipboard.") + +#define STR_COLUMN_BREAK NC_("STR_COLUMN_BREAK", "Manual Column Break") + +#define STR_CHART2_ROW_LABEL_TEXT NC_("STR_CHART2_ROW_LABEL_TEXT", "Row %ROWNUMBER") +#define STR_CHART2_COL_LABEL_TEXT NC_("STR_CHART2_COL_LABEL_TEXT", "Column %COLUMNLETTER") +#define STR_STYLE_FAMILY_CHARACTER NC_("STR_STYLE_FAMILY_CHARACTER", "Character") +#define STR_STYLE_FAMILY_PARAGRAPH NC_("STR_STYLE_FAMILY_PARAGRAPH", "Paragraph") +#define STR_STYLE_FAMILY_FRAME NC_("STR_STYLE_FAMILY_FRAME", "Frame") +#define STR_STYLE_FAMILY_PAGE NC_("STR_STYLE_FAMILY_PAGE", "Pages") +#define STR_STYLE_FAMILY_NUMBERING NC_("STR_STYLE_FAMILY_NUMBERING", "Numbering") +#define STR_STYLE_FAMILY_TABLE NC_("STR_STYLE_FAMILY_TABLE", "Table") +#define STR_STYLE_FAMILY_CELL NC_("STR_STYLE_FAMILY_CELL", "Cell") + +#define ST_SCRIPT_ASIAN NC_("ST_SCRIPT_ASIAN", "Asian") +#define ST_SCRIPT_CTL NC_("ST_SCRIPT_CTL", "CTL") +#define ST_SCRIPT_WESTERN NC_("ST_SCRIPT_WESTERN", "Western") +#define STR_PRINTOPTUI_PRODUCTNAME NC_("STR_PRINTOPTUI_PRODUCTNAME", "%PRODUCTNAME %s") +#define STR_PRINTOPTUI_CONTENTS NC_("STR_PRINTOPTUI_CONTENTS", "Contents") +#define STR_PRINTOPTUI_PAGE_BACKGROUND NC_("STR_PRINTOPTUI_PAGE_BACKGROUND", "Page ba~ckground") +#define STR_PRINTOPTUI_PICTURES NC_("STR_PRINTOPTUI_PICTURES", "~Images and other graphic objects") +#define STR_PRINTOPTUI_HIDDEN NC_("STR_PRINTOPTUI_HIDDEN", "Hidden te~xt") +#define STR_PRINTOPTUI_TEXT_PLACEHOLDERS NC_("STR_PRINTOPTUI_TEXT_PLACEHOLDERS", "~Text placeholders") +#define STR_PRINTOPTUI_FORM_CONTROLS NC_("STR_PRINTOPTUI_FORM_CONTROLS", "Form control~s") +#define STR_PRINTOPTUI_COLOR NC_("STR_PRINTOPTUI_COLOR", "Color") +#define STR_PRINTOPTUI_PRINT_BLACK NC_("STR_PRINTOPTUI_PRINT_BLACK", "Print text in blac~k") +#define STR_PRINTOPTUI_PAGES_TEXT NC_("STR_PRINTOPTUI_PAGES_TEXT", "Pages:") +#define STR_PRINTOPTUI_PRINT_BLANK NC_("STR_PRINTOPTUI_PRINT_BLANK", "Print ~automatically inserted blank pages") +#define STR_PRINTOPTUI_ONLY_PAPER NC_("STR_PRINTOPTUI_ONLY_PAPER", "~Use only paper tray from printer preferences") +#define STR_PRINTOPTUI_NONE NC_("STR_PRINTOPTUI_NONE", "None (document only)") +#define STR_PRINTOPTUI_COMMENTS_ONLY NC_("STR_PRINTOPTUI_COMMENTS_ONLY", "Comments only") +#define STR_PRINTOPTUI_PLACE_END NC_("STR_PRINTOPTUI_PLACE_END", "Place at end of document") +#define STR_PRINTOPTUI_PLACE_PAGE NC_("STR_PRINTOPTUI_PLACE_PAGE", "Place at end of page") +#define STR_PRINTOPTUI_COMMENTS NC_("STR_PRINTOPTUI_COMMENTS", "~Comments") +#define STR_PRINTOPTUI_BROCHURE NC_("STR_PRINTOPTUI_BROCHURE", "Broch~ure") +#define STR_PRINTOPTUI_LEFT_SCRIPT NC_("STR_PRINTOPTUI_LEFT_SCRIPT", "Left-to-right script") +#define STR_PRINTOPTUI_RIGHT_SCRIPT NC_("STR_PRINTOPTUI_RIGHT_SCRIPT", "Right-to-left script") +#define STR_PRINTOPTUI_PRINTALLPAGES NC_("STR_PRINTOPTUI_PRINTALLPAGES", "~All Pages") +#define STR_PRINTOPTUI_PRINTPAGES NC_("STR_PRINTOPTUI_PRINTPAGES", "Pa~ges:") +#define STR_PRINTOPTUI_PRINTEVENPAGES NC_("STR_PRINTOPTUI_PRINTEVENPAGES", "~Even pages") +#define STR_PRINTOPTUI_PRINTODDPAGES NC_("STR_PRINTOPTUI_PRINTODDPAGES", "~Odd pages") +#define STR_PRINTOPTUI_PRINTSELECTION NC_("STR_PRINTOPTUI_PRINTSELECTION", "~Selection") +#define STR_PRINTOPTUI_PLACE_MARGINS NC_("STR_PRINTOPTUI_PLACE_MARGINS", "Place in margins") + +#define STR_FORMULA_CALC NC_("STR_FORMULA_CALC", "Functions") +#define STR_FORMULA_CANCEL NC_("STR_FORMULA_CANCEL", "Cancel") +#define STR_FORMULA_APPLY NC_("STR_FORMULA_APPLY", "Apply") +#define STR_ACCESS_FORMULA_TOOLBAR NC_("STR_ACCESS_FORMULA_TOOLBAR", "Formula Tool Bar") +#define STR_ACCESS_FORMULA_TYPE NC_("STR_ACCESS_FORMULA_TYPE", "Formula Type") +#define STR_ACCESS_FORMULA_TEXT NC_("STR_ACCESS_FORMULA_TEXT", "Formula Text") + +#define STR_ACCESS_TL_GLOBAL NC_("STR_ACCESS_TL_GLOBAL", "Global View") +#define STR_ACCESS_TL_CONTENT NC_("STR_ACCESS_TL_CONTENT", "Content Navigation View") +#define STR_OUTLINE_LEVEL NC_("STR_OUTLINE_LEVEL", "Outline Level") +#define STR_DRAGMODE NC_("STR_DRAGMODE", "Drag Mode") +#define STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY NC_("STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY", "Send Outline to Clipboard") +#define STR_OUTLINE_TRACKING NC_("STR_OUTLINE_TRACKING", "Outline Tracking") +#define STR_OUTLINE_TRACKING_DEFAULT NC_("STR_OUTLINE_TRACKING_DEFAULT", "Default") +#define STR_OUTLINE_TRACKING_FOCUS NC_("STR_OUTLINE_TRACKING_FOCUS", "Focus") +#define STR_OUTLINE_TRACKING_OFF NC_("STR_OUTLINE_TRACKING_OFF", "Off") + +#define STR_EXPANDALL NC_("STR_EXPANDALL", "Expand All") +#define STR_COLLAPSEALL NC_("STR_COLLAPSEALL", "Collapse All") +#define STR_HYPERLINK NC_("STR_HYPERLINK", "Insert as Hyperlink") +#define STR_LINK_REGION NC_("STR_LINK_REGION", "Insert as Link") +#define STR_COPY_REGION NC_("STR_COPY_REGION", "Insert as Copy") +#define STR_DISPLAY NC_("STR_DISPLAY", "Display") +#define STR_ACTIVE_VIEW NC_("STR_ACTIVE_VIEW", "Active Window") +#define STR_HIDDEN NC_("STR_HIDDEN", "hidden") +#define STR_ACTIVE NC_("STR_ACTIVE", "active") +#define STR_INACTIVE NC_("STR_INACTIVE", "inactive") +#define STR_EDIT_ENTRY NC_("STR_EDIT_ENTRY", "Edit...") +#define STR_UPDATE NC_("STR_UPDATE", "~Update") +#define STR_EDIT_CONTENT NC_("STR_EDIT_CONTENT", "Edit") +#define STR_EDIT_LINK NC_("STR_EDIT_LINK", "Edit link") +#define STR_EDIT_INSERT NC_("STR_EDIT_INSERT", "Insert") +#define STR_INDEX NC_("STR_INDEX", "~Index") +#define STR_FILE NC_("STR_FILE", "File") +#define STR_NEW_FILE NC_("STR_NEW_FILE", "New Document") +#define STR_INSERT_TEXT NC_("STR_INSERT_TEXT", "Text") +#define STR_DELETE NC_("STR_DELETE", "Delete") +#define STR_DELETE_ENTRY NC_("STR_DELETE_ENTRY", "~Delete") +#define STR_UPDATE_SEL NC_("STR_UPDATE_SEL", "Selection") +#define STR_UPDATE_INDEX NC_("STR_UPDATE_INDEX", "Indexes") +#define STR_UPDATE_LINK NC_("STR_UPDATE_LINK", "Links") +#define STR_UPDATE_ALL NC_("STR_UPDATE_ALL", "All") + +#define STR_INVISIBLE NC_("STR_INVISIBLE", "hidden") +#define STR_BROKEN_LINK NC_("STR_BROKEN_LINK", "File not found: ") + +#define STR_RESOLVED NC_("STR_RESOLVED", "RESOLVED") + +#define STR_MARGIN_TOOLTIP_LEFT NC_("STR_MARGIN_TOOLTIP_LEFT", "Left: ") +#define STR_MARGIN_TOOLTIP_RIGHT NC_("STR_MARGIN_TOOLTIP_RIGHT", ". Right: ") +#define STR_MARGIN_TOOLTIP_INNER NC_("STR_MARGIN_TOOLTIP_INNER", "Inner: ") +#define STR_MARGIN_TOOLTIP_OUTER NC_("STR_MARGIN_TOOLTIP_OUTER", ". Outer: ") +#define STR_MARGIN_TOOLTIP_TOP NC_("STR_MARGIN_TOOLTIP_TOP", ". Top: ") +#define STR_MARGIN_TOOLTIP_BOT NC_("STR_MARGIN_TOOLTIP_BOT", ". Bottom: ") + +// Error calculator +#define STR_POSTIT_PAGE NC_("STR_POSTIT_PAGE", "Page") +#define STR_POSTIT_LINE NC_("STR_POSTIT_LINE", "Line") +#define STR_POSTIT_AUTHOR NC_("STR_POSTIT_AUTHOR", "Author") +#define STR_CALC_SYNTAX NC_("STR_CALC_SYNTAX", "** Syntax Error **") +#define STR_CALC_ZERODIV NC_("STR_CALC_ZERODIV", "** Division by zero **") +#define STR_CALC_BRACK NC_("STR_CALC_BRACK", "** Wrong use of brackets **") +#define STR_CALC_POW NC_("STR_CALC_POW", "** Square function overflow **") +#define STR_CALC_OVERFLOW NC_("STR_CALC_OVERFLOW", "** Overflow **") +#define STR_CALC_DEFAULT NC_("STR_CALC_DEFAULT", "** Error **") +#define STR_CALC_ERROR NC_("STR_CALC_ERROR", "** Expression is faulty **") +#define STR_GETREFFLD_REFITEMNOTFOUND NC_("STR_GETREFFLD_REFITEMNOTFOUND", "Error: Reference source not found") +#define STR_TEMPLATE_NONE NC_("STR_TEMPLATE_NONE", "None") +#define STR_FIELD_FIXED NC_("STR_FIELD_FIXED", "(fixed)") +#define STR_DURATION_FORMAT NC_("STR_DURATION_FORMAT", " Y: %1 M: %2 D: %3 H: %4 M: %5 S: %6") +#define STR_TOI NC_("STR_TOI", "Alphabetical Index") +#define STR_TOU NC_("STR_TOU", "User-Defined") +#define STR_TOC NC_("STR_TOC", "Table of Contents") +#define STR_TOX_AUTH NC_("STR_TOX_AUTH", "Bibliography") +#define STR_TOX_CITATION NC_("STR_TOX_CITATION", "Citation") +#define STR_TOX_TBL NC_("STR_TOX_TBL", "Index of Tables") +#define STR_TOX_OBJ NC_("STR_TOX_OBJ", "Table of Objects") +#define STR_TOX_ILL NC_("STR_TOX_ILL", "Table of Figures") +// SubType DocInfo +#define FLD_DOCINFO_TITLE NC_("FLD_DOCINFO_TITEL", "Title") +#define FLD_DOCINFO_SUBJECT NC_("FLD_DOCINFO_THEMA", "Subject") +#define FLD_DOCINFO_KEYS NC_("FLD_DOCINFO_KEYS", "Keywords") +#define FLD_DOCINFO_COMMENT NC_("FLD_DOCINFO_COMMENT", "Comments") +#define FLD_DOCINFO_CREATE NC_("FLD_DOCINFO_CREATE", "Created") +#define FLD_DOCINFO_CHANGE NC_("FLD_DOCINFO_CHANGE", "Modified") +#define FLD_DOCINFO_PRINT NC_("FLD_DOCINFO_PRINT", "Last printed") +#define FLD_DOCINFO_DOCNO NC_("FLD_DOCINFO_DOCNO", "Revision number") +#define FLD_DOCINFO_EDIT NC_("FLD_DOCINFO_EDIT", "Total editing time") +#define STR_PAGEDESC_NAME NC_("STR_PAGEDESC_NAME", "Convert $(ARG1)") +#define STR_PAGEDESC_FIRSTNAME NC_("STR_PAGEDESC_FIRSTNAME", "First convert $(ARG1)") +#define STR_PAGEDESC_FOLLOWNAME NC_("STR_PAGEDESC_FOLLOWNAME", "Next convert $(ARG1)") +#define STR_AUTH_TYPE_ARTICLE NC_("STR_AUTH_TYPE_ARTICLE", "Article") +#define STR_AUTH_TYPE_BOOK NC_("STR_AUTH_TYPE_BOOK", "Book") +#define STR_AUTH_TYPE_BOOKLET NC_("STR_AUTH_TYPE_BOOKLET", "Brochures") +#define STR_AUTH_TYPE_CONFERENCE NC_("STR_AUTH_TYPE_CONFERENCE", "Conference proceedings") +#define STR_AUTH_TYPE_INBOOK NC_("STR_AUTH_TYPE_INBOOK", "Book excerpt") +#define STR_AUTH_TYPE_INCOLLECTION NC_("STR_AUTH_TYPE_INCOLLECTION", "Book excerpt with title") +#define STR_AUTH_TYPE_INPROCEEDINGS NC_("STR_AUTH_TYPE_INPROCEEDINGS", "Conference proceedings") +#define STR_AUTH_TYPE_JOURNAL NC_("STR_AUTH_TYPE_JOURNAL", "Journal") +#define STR_AUTH_TYPE_MANUAL NC_("STR_AUTH_TYPE_MANUAL", "Techn. documentation") +#define STR_AUTH_TYPE_MASTERSTHESIS NC_("STR_AUTH_TYPE_MASTERSTHESIS", "Thesis") +#define STR_AUTH_TYPE_MISC NC_("STR_AUTH_TYPE_MISC", "Miscellaneous") +#define STR_AUTH_TYPE_PHDTHESIS NC_("STR_AUTH_TYPE_PHDTHESIS", "Dissertation") +#define STR_AUTH_TYPE_PROCEEDINGS NC_("STR_AUTH_TYPE_PROCEEDINGS", "Conference proceedings") +#define STR_AUTH_TYPE_TECHREPORT NC_("STR_AUTH_TYPE_TECHREPORT", "Research report") +#define STR_AUTH_TYPE_UNPUBLISHED NC_("STR_AUTH_TYPE_UNPUBLISHED", "Unpublished") +#define STR_AUTH_TYPE_EMAIL NC_("STR_AUTH_TYPE_EMAIL", "Email") +#define STR_AUTH_TYPE_WWW NC_("STR_AUTH_TYPE_WWW", "WWW document") +#define STR_AUTH_TYPE_CUSTOM1 NC_("STR_AUTH_TYPE_CUSTOM1", "User-defined1") +#define STR_AUTH_TYPE_CUSTOM2 NC_("STR_AUTH_TYPE_CUSTOM2", "User-defined2") +#define STR_AUTH_TYPE_CUSTOM3 NC_("STR_AUTH_TYPE_CUSTOM3", "User-defined3") +#define STR_AUTH_TYPE_CUSTOM4 NC_("STR_AUTH_TYPE_CUSTOM4", "User-defined4") +#define STR_AUTH_TYPE_CUSTOM5 NC_("STR_AUTH_TYPE_CUSTOM5", "User-defined5") +#define STR_AUTH_FIELD_IDENTIFIER NC_("STR_AUTH_FIELD_IDENTIFIER", "Short name") +#define STR_AUTH_FIELD_AUTHORITY_TYPE NC_("STR_AUTH_FIELD_AUTHORITY_TYPE", "Type") +#define STR_AUTH_FIELD_ADDRESS NC_("STR_AUTH_FIELD_ADDRESS", "Address") +#define STR_AUTH_FIELD_ANNOTE NC_("STR_AUTH_FIELD_ANNOTE", "Annotation") +#define STR_AUTH_FIELD_AUTHOR NC_("STR_AUTH_FIELD_AUTHOR", "Author(s)") +#define STR_AUTH_FIELD_BOOKTITLE NC_("STR_AUTH_FIELD_BOOKTITLE", "Book title") +#define STR_AUTH_FIELD_CHAPTER NC_("STR_AUTH_FIELD_CHAPTER", "Chapter") +#define STR_AUTH_FIELD_EDITION NC_("STR_AUTH_FIELD_EDITION", "Edition") +#define STR_AUTH_FIELD_EDITOR NC_("STR_AUTH_FIELD_EDITOR", "Editor") +#define STR_AUTH_FIELD_HOWPUBLISHED NC_("STR_AUTH_FIELD_HOWPUBLISHED", "Publication type") +#define STR_AUTH_FIELD_INSTITUTION NC_("STR_AUTH_FIELD_INSTITUTION", "Institution") +#define STR_AUTH_FIELD_JOURNAL NC_("STR_AUTH_FIELD_JOURNAL", "Journal") +#define STR_AUTH_FIELD_MONTH NC_("STR_AUTH_FIELD_MONTH", "Month") +#define STR_AUTH_FIELD_NOTE NC_("STR_AUTH_FIELD_NOTE", "Note") +#define STR_AUTH_FIELD_NUMBER NC_("STR_AUTH_FIELD_NUMBER", "Number") +#define STR_AUTH_FIELD_ORGANIZATIONS NC_("STR_AUTH_FIELD_ORGANIZATIONS", "Organization") +#define STR_AUTH_FIELD_PAGES NC_("STR_AUTH_FIELD_PAGES", "Page(s)") +#define STR_AUTH_FIELD_PUBLISHER NC_("STR_AUTH_FIELD_PUBLISHER", "Publisher") +#define STR_AUTH_FIELD_SCHOOL NC_("STR_AUTH_FIELD_SCHOOL", "University") +#define STR_AUTH_FIELD_SERIES NC_("STR_AUTH_FIELD_SERIES", "Series") +#define STR_AUTH_FIELD_TITLE NC_("STR_AUTH_FIELD_TITLE", "Title") +#define STR_AUTH_FIELD_TYPE NC_("STR_AUTH_FIELD_TYPE", "Type of report") +#define STR_AUTH_FIELD_VOLUME NC_("STR_AUTH_FIELD_VOLUME", "Volume") +#define STR_AUTH_FIELD_YEAR NC_("STR_AUTH_FIELD_YEAR", "Year") +#define STR_AUTH_FIELD_URL NC_("STR_AUTH_FIELD_URL", "URL") +#define STR_AUTH_FIELD_CUSTOM1 NC_("STR_AUTH_FIELD_CUSTOM1", "User-defined1") +#define STR_AUTH_FIELD_CUSTOM2 NC_("STR_AUTH_FIELD_CUSTOM2", "User-defined2") +#define STR_AUTH_FIELD_CUSTOM3 NC_("STR_AUTH_FIELD_CUSTOM3", "User-defined3") +#define STR_AUTH_FIELD_CUSTOM4 NC_("STR_AUTH_FIELD_CUSTOM4", "User-defined4") +#define STR_AUTH_FIELD_CUSTOM5 NC_("STR_AUTH_FIELD_CUSTOM5", "User-defined5") +#define STR_AUTH_FIELD_ISBN NC_("STR_AUTH_FIELD_ISBN", "ISBN") + +#define STR_IDXMRK_EDIT NC_("STR_IDXMRK_EDIT", "Edit Index Entry") +#define STR_IDXMRK_INSERT NC_("STR_IDXMRK_INSERT", "Insert Index Entry") +#define STR_QUERY_CHANGE_AUTH_ENTRY NC_("STR_QUERY_CHANGE_AUTH_ENTRY", "The document already contains the bibliography entry but with different data. Do you want to adjust the existing entries?") + +#define STR_COMMENTS_LABEL NC_("STR_COMMENTS_LABEL", "Comments") +#define STR_SHOW_COMMENTS NC_("STR_SHOW_COMMENTS", "Show comments") +#define STR_HIDE_COMMENTS NC_("STR_HIDE_COMMENTS", "Hide comments") + +#define STR_DOUBLE_SHORTNAME NC_("STR_DOUBLE_SHORTNAME", "Shortcut name already exists. Please choose another name.") +#define STR_QUERY_DELETE NC_("STR_QUERY_DELETE", "Delete AutoText?") +#define STR_QUERY_DELETE_GROUP1 NC_("STR_QUERY_DELETE_GROUP1", "Delete the category ") +#define STR_QUERY_DELETE_GROUP2 NC_("STR_QUERY_DELETE_GROUP2", "?") +#define STR_GLOSSARY NC_("STR_GLOSSARY", "AutoText :") +#define STR_SAVE_GLOSSARY NC_("STR_SAVE_GLOSSARY", "Save AutoText") +#define STR_NO_GLOSSARIES NC_("STR_NO_GLOSSARIES", "There is no AutoText in this file.") +#define STR_MY_AUTOTEXT NC_("STR_MY_AUTOTEXT", "My AutoText") + +#define STR_NOGLOS NC_("STR_NOGLOS", "AutoText for Shortcut '%1' not found.") +#define STR_NO_TABLE NC_("STR_NO_TABLE", "A table with no rows or no cells cannot be inserted") +#define STR_TABLE_TOO_LARGE NC_("STR_TABLE_TOO_LARGE", "The table cannot be inserted because it is too large") +#define STR_ERR_INSERT_GLOS NC_("STR_ERR_INSERT_GLOS", "AutoText could not be created.") +#define STR_CLPBRD_FORMAT_ERROR NC_("STR_CLPBRD_FORMAT_ERROR", "Requested clipboard format is not available.") +#define STR_PRIVATETEXT NC_("STR_PRIVATETEXT", "%PRODUCTNAME %PRODUCTVERSION Text Document") +#define STR_PRIVATEGRAPHIC NC_("STR_PRIVATEGRAPHIC", "Image (%PRODUCTNAME %PRODUCTVERSION Text Document)") +#define STR_PRIVATEOLE NC_("STR_PRIVATEOLE", "Object (%PRODUCTNAME %PRODUCTVERSION Text Document)") +#define STR_DDEFORMAT NC_("STR_DDEFORMAT", "Dynamic Data Exchange (DDE link)") + +#define STR_DELETE_ALL_NOTES NC_("STR_DELETE_ALL_NOTES", "All Comments") +#define STR_FORMAT_ALL_NOTES NC_("STR_FORMAT_ALL_NOTES", "All Comments") +#define STR_DELETE_AUTHOR_NOTES NC_("STR_DELETE_AUTHOR_NOTES", "Comments by ") +#define STR_NODATE NC_("STR_NODATE", "(no date)") +#define STR_NOAUTHOR NC_("STR_NOAUTHOR", "(no author)") +#define STR_REPLY NC_("STR_REPLY", "Reply to $1") + +#define ST_TITLE_EDIT NC_("ST_TITLE_EDIT", "Edit Address Block") +#define ST_TITLE_MALE NC_("ST_TITLE_MALE", "Custom Salutation (Male Recipients)") +#define ST_TITLE_FEMALE NC_("ST_TITLE_FEMALE", "Custom Salutation (Female Recipients)") +#define ST_SALUTATIONELEMENTS NC_("ST_SALUTATIONELEMENTS", "Salutation e~lements") +#define ST_INSERTSALUTATIONFIELD NC_("ST_INSERTSALUTATIONFIELD", "Add to salutation") +#define ST_REMOVESALUTATIONFIELD NC_("ST_REMOVESALUTATIONFIELD", "Remove from salutation") +#define ST_DRAGSALUTATION NC_("ST_DRAGSALUTATION", "1. ~Drag salutation elements into the box below") +#define ST_SALUTATION NC_("ST_SALUTATION", "Salutation") +#define ST_PUNCTUATION NC_("ST_PUNCTUATION", "Punctuation Mark") +#define ST_TEXT NC_("ST_TEXT", "Text") +#define ST_SALUTATIONMATCHING NC_("ST_SALUTATIONMATCHING", "Assign the fields from your data source to match the salutation elements.") +#define ST_SALUTATIONPREVIEW NC_("ST_SALUTATIONPREVIEW", "Salutation preview") +#define ST_ADDRESSELEMENT NC_("ST_ADDRESSELEMENT", "Address elements") +#define ST_SALUTATIONELEMENT NC_("ST_SALUTATIONELEMENT", "Salutation elements") +#define ST_MATCHESTO NC_("ST_MATCHESTO", "Matches to field:") +#define ST_PREVIEW NC_("ST_PREVIEW", "Preview") +#define ST_DELETE_CONFIRM NC_("ST_DELETE_CONFIRM", "Do you want to delete this registered data source?") + +#define STR_NOTASSIGNED NC_("STR_NOTASSIGNED", " not yet matched ") +#define STR_FILTER_ALL NC_("STR_FILTER_ALL", "All files") +#define STR_FILTER_ALL_DATA NC_("STR_FILTER_ALL_DATA", "Address lists(*.*)") +#define STR_FILTER_SXB NC_("STR_FILTER_SXB", "%PRODUCTNAME Base (*.odb)") +#define STR_FILTER_SXC NC_("STR_FILTER_SXC", "%PRODUCTNAME Calc (*.ods;*.sxc)") +#define STR_FILTER_SXW NC_("STR_FILTER_SXW", "%PRODUCTNAME Writer (*.odt;*.sxw)") +#define STR_FILTER_DBF NC_("STR_FILTER_DBF", "dBase (*.dbf)") +#define STR_FILTER_XLS NC_("STR_FILTER_XLS", "Microsoft Excel (*.xls;*.xlsx)") +#define STR_FILTER_DOC NC_("STR_FILTER_DOC", "Microsoft Word (*.doc;*.docx)") +#define STR_FILTER_TXT NC_("STR_FILTER_TXT", "Plain text (*.txt)") +#define STR_FILTER_CSV NC_("STR_FILTER_CSV", "Text Comma Separated (*.csv)") +#define STR_FILTER_MDB NC_("STR_FILTER_MDB", "Microsoft Access (*.mdb;*.mde)") +#define STR_FILTER_ACCDB NC_("STR_FILTER_ACCDB", "Microsoft Access 2007 (*.accdb,*.accde)") +#define ST_CONFIGUREMAIL NC_("ST_CONFIGUREMAIL", "In order to be able to send mail merge documents by email, %PRODUCTNAME requires information about the email account to be used.\n\nDo you want to enter email account information now?") +#define ST_FILTERNAME NC_("ST_FILTERNAME", "%PRODUCTNAME Address List (.csv)") + +#define ST_STARTING NC_("ST_STARTING", "Select Starting Document") +#define ST_DOCUMENTTYPE NC_("ST_DOCUMENTTYPE", "Select Document Type") +#define ST_ADDRESSBLOCK NC_("ST_ADDRESSBLOCK", "Insert Address Block") +#define ST_ADDRESSLIST NC_("ST_ADDRESSLIST", "Select Address List") +#define ST_GREETINGSLINE NC_("ST_GREETINGSLINE", "Create Salutation") +#define ST_LAYOUT NC_("ST_LAYOUT", "Adjust Layout") +#define ST_EXCLUDE NC_("ST_EXCLUDE", "Exclude recipient") +#define ST_FINISH NC_("ST_FINISH", "~Finish") +#define ST_MMWTITLE NC_("ST_MMWTITLE", "Mail Merge Wizard") + +#define ST_TABLE NC_("ST_TABLE", "Table") +#define ST_QUERY NC_("ST_QUERY", "Query") + +#define STR_QUERY_SPELL_CONTINUE NC_("STR_QUERY_SPELL_CONTINUE", "Continue checking at beginning of document?") +#define STR_SPELLING_COMPLETED NC_("STR_SPELLING_COMPLETED", "The spellcheck is complete.") +#define STR_DICTIONARY_UNAVAILABLE NC_("STR_DICTIONARY_UNAVAILABLE", "No dictionary available") + +/*-------------------------------------------------------------------- + Description: strings for the types + --------------------------------------------------------------------*/ +// range document +#define STR_DATEFLD NC_("STR_DATEFLD", "Date") +#define STR_TIMEFLD NC_("STR_TIMEFLD", "Time") +#define STR_FILENAMEFLD NC_("STR_FILENAMEFLD", "File name") +#define STR_DBNAMEFLD NC_("STR_DBNAMEFLD", "Database Name") +#define STR_CHAPTERFLD NC_("STR_CHAPTERFLD", "Chapter") +#define STR_PAGENUMBERFLD NC_("STR_PAGENUMBERFLD", "Page number") +#define STR_DOCSTATFLD NC_("STR_DOCSTATFLD", "Statistics") +#define STR_AUTHORFLD NC_("STR_AUTHORFLD", "Author") +#define STR_TEMPLNAMEFLD NC_("STR_TEMPLNAMEFLD", "Templates") +#define STR_EXTUSERFLD NC_("STR_EXTUSERFLD", "Sender") +// range functions +#define STR_SETFLD NC_("STR_SETFLD", "Set variable") +#define STR_GETFLD NC_("STR_GETFLD", "Show variable") +#define STR_FORMELFLD NC_("STR_FORMELFLD", "Insert Formula") +#define STR_INPUTFLD NC_("STR_INPUTFLD", "Input field") +#define STR_SETINPUTFLD NC_("STR_SETINPUTFLD", "Input field (variable)") +#define STR_USRINPUTFLD NC_("STR_USRINPUTFLD", "Input field (user)") +#define STR_CONDTXTFLD NC_("STR_CONDTXTFLD", "Conditional text") +#define STR_DDEFLD NC_("STR_DDEFLD", "DDE field") +#define STR_MACROFLD NC_("STR_MACROFLD", "Execute macro") +#define STR_SEQFLD NC_("STR_SEQFLD", "Number range") +#define STR_SETREFPAGEFLD NC_("STR_SETREFPAGEFLD", "Set page variable") +#define STR_GETREFPAGEFLD NC_("STR_GETREFPAGEFLD", "Show page variable") +#define STR_INTERNETFLD NC_("STR_INTERNETFLD", "Load URL") +#define STR_JUMPEDITFLD NC_("STR_JUMPEDITFLD", "Placeholder") +#define STR_COMBINED_CHARS NC_("STR_COMBINED_CHARS", "Combine characters") +#define STR_DROPDOWN NC_("STR_DROPDOWN", "Input list") +// range references +#define STR_SETREFFLD NC_("STR_SETREFFLD", "Set Reference") +#define STR_GETREFFLD NC_("STR_GETREFFLD", "Insert Reference") +// range database +#define STR_DBFLD NC_("STR_DBFLD", "Mail merge fields") +#define STR_DBNEXTSETFLD NC_("STR_DBNEXTSETFLD", "Next record") +#define STR_DBNUMSETFLD NC_("STR_DBNUMSETFLD", "Any record") +#define STR_DBSETNUMBERFLD NC_("STR_DBSETNUMBERFLD", "Record number") +#define STR_PREVPAGEFLD NC_("STR_PREVPAGEFLD", "Previous page") +#define STR_NEXTPAGEFLD NC_("STR_NEXTPAGEFLD", "Next page") +#define STR_HIDDENTXTFLD NC_("STR_HIDDENTXTFLD", "Hidden text") +// range user fields +#define STR_USERFLD NC_("STR_USERFLD", "User Field") +#define STR_POSTITFLD NC_("STR_POSTITFLD", "Note") +#define STR_SCRIPTFLD NC_("STR_SCRIPTFLD", "Script") +#define STR_AUTHORITY NC_("STR_AUTHORITY", "Bibliography entry") +#define STR_HIDDENPARAFLD NC_("STR_HIDDENPARAFLD", "Hidden Paragraph") +// range DocumentInfo +#define STR_DOCINFOFLD NC_("STR_DOCINFOFLD", "DocInformation") +/*-------------------------------------------------------------------- + Description: SubCmd-Strings + --------------------------------------------------------------------*/ +#define FLD_DATE_STD NC_("FLD_DATE_STD", "Date") +#define FLD_DATE_FIX NC_("FLD_DATE_FIX", "Date (fixed)") +#define FLD_TIME_STD NC_("FLD_TIME_STD", "Time") +#define FLD_TIME_FIX NC_("FLD_TIME_FIX", "Time (fixed)") +// SubCmd Statistic +#define FLD_STAT_TABLE NC_("FLD_STAT_TABLE", "Tables") +#define FLD_STAT_CHAR NC_("FLD_STAT_CHAR", "Characters") +#define FLD_STAT_WORD NC_("FLD_STAT_WORD", "Words") +#define FLD_STAT_PARA NC_("FLD_STAT_PARA", "Paragraphs") +#define FLD_STAT_GRF NC_("FLD_STAT_GRF", "Image") +#define FLD_STAT_OBJ NC_("FLD_STAT_OBJ", "Objects") +#define FLD_STAT_PAGE NC_("FLD_STAT_PAGE", "Pages") +// SubCmd DDETypes +#define FMT_DDE_HOT NC_("FMT_DDE_HOT", "DDE automatic") +#define FMT_DDE_NORMAL NC_("FMT_DDE_NORMAL", "DDE manual") +#define FLD_INPUT_TEXT NC_("FLD_INPUT_TEXT", "[Text]") + +/*-------------------------------------------------------------------- + Description: SubType Extuser + --------------------------------------------------------------------*/ +#define FLD_EU_COMPANY NC_("FLD_EU_FIRMA", "Company") +#define FLD_EU_GIVENNAME NC_("FLD_EU_VORNAME", "First Name") +#define FLD_EU_SURNAME NC_("FLD_EU_NAME", "Last Name") +#define FLD_EU_INITIALS NC_("FLD_EU_ABK", "Initials") +#define FLD_EU_STREET NC_("FLD_EU_STRASSE", "Street") +#define FLD_EU_COUNTRY NC_("FLD_EU_LAND", "Country") +#define FLD_EU_POSTCODE NC_("FLD_EU_PLZ", "Zip code") +#define FLD_EU_TOWN NC_("FLD_EU_ORT", "City") +#define FLD_EU_TITLE NC_("FLD_EU_TITEL", "Title") +#define FLD_EU_POS NC_("FLD_EU_POS", "Position") +#define FLD_EU_TELPERSONAL NC_("FLD_EU_TELPRIV", "Tel. (Home)") +#define FLD_EU_TELWORK NC_("FLD_EU_TELFIRMA", "Tel. (Work)") +#define FLD_EU_FAX NC_("FLD_EU_FAX", "Fax") +#define FLD_EU_EMAIL NC_("FLD_EU_EMAIL", "Email") +#define FLD_EU_REGION NC_("FLD_EU_STATE", "State") +#define FLD_PAGEREF_OFF NC_("FLD_PAGEREF_OFF", "off") +#define FLD_PAGEREF_ON NC_("FLD_PAGEREF_ON", "on") +/*-------------------------------------------------------------------- + Description: path name + --------------------------------------------------------------------*/ +// Format FileName +#define FMT_FF_NAME NC_("FMT_FF_NAME", "File name") +#define FMT_FF_NAME_NOEXT NC_("FMT_FF_NAME_NOEXT", "File name without extension") +#define FMT_FF_PATHNAME NC_("FMT_FF_PATHNAME", "Path/File name") +#define FMT_FF_PATH NC_("FMT_FF_PATH", "Path") +#define FMT_FF_UI_NAME NC_("FMT_FF_UI_NAME", "Style") +#define FMT_FF_UI_RANGE NC_("FMT_FF_UI_RANGE", "Category") +/*-------------------------------------------------------------------- + Description: format chapter + --------------------------------------------------------------------*/ +#define FMT_CHAPTER_NAME NC_("FMT_CHAPTER_NAME", "Chapter name") +#define FMT_CHAPTER_NO NC_("FMT_CHAPTER_NO", "Chapter number") +#define FMT_CHAPTER_NO_NOSEPARATOR NC_("FMT_CHAPTER_NO_NOSEPARATOR", "Chapter number without separator") +#define FMT_CHAPTER_NAMENO NC_("FMT_CHAPTER_NAMENO", "Chapter number and name") +/*-------------------------------------------------------------------- + Description: formats + --------------------------------------------------------------------*/ +#define FMT_NUM_ABC NC_("FMT_NUM_ABC", "A B C") +#define FMT_NUM_SABC NC_("FMT_NUM_SABC", "a b c") +#define FMT_NUM_ABC_N NC_("FMT_NUM_ABC_N", "A .. AA .. AAA") +#define FMT_NUM_SABC_N NC_("FMT_NUM_SABC_N", "a .. aa .. aaa") +#define FMT_NUM_ROMAN NC_("FMT_NUM_ROMAN", "Roman (I II III)") +#define FMT_NUM_SROMAN NC_("FMT_NUM_SROMAN", "Roman (i ii iii)") +#define FMT_NUM_ARABIC NC_("FMT_NUM_ARABIC", "Arabic (1 2 3)") +#define FMT_NUM_PAGEDESC NC_("FMT_NUM_PAGEDESC", "As Page Style") +#define FMT_NUM_PAGESPECIAL NC_("FMT_NUM_PAGESPECIAL", "Text") +/*-------------------------------------------------------------------- + Description: Author + --------------------------------------------------------------------*/ +#define FMT_AUTHOR_NAME NC_("FMT_AUTHOR_NAME", "Name") +#define FMT_AUTHOR_SCUT NC_("FMT_AUTHOR_SCUT", "Initials") +/*-------------------------------------------------------------------- + Description: set variable + --------------------------------------------------------------------*/ +#define FMT_SETVAR_SYS NC_("FMT_SETVAR_SYS", "System") +#define FMT_SETVAR_TEXT NC_("FMT_SETVAR_TEXT", "Text") +#define FMT_GETVAR_NAME NC_("FMT_GETVAR_NAME", "Name") +#define FMT_GETVAR_TEXT NC_("FMT_GETVAR_TEXT", "Text") +#define FMT_USERVAR_CMD NC_("FMT_USERVAR_CMD", "Formula") +#define FMT_USERVAR_TEXT NC_("FMT_USERVAR_TEXT", "Text") +#define FMT_DBFLD_DB NC_("FMT_DBFLD_DB", "Database") +#define FMT_DBFLD_SYS NC_("FMT_DBFLD_SYS", "System") +/*-------------------------------------------------------------------- + Description: storage fields + --------------------------------------------------------------------*/ +#define FMT_REG_AUTHOR NC_("FMT_REG_AUTHOR", "Author") +#define FMT_REG_TIME NC_("FMT_REG_TIME", "Time") +#define FMT_REG_DATE NC_("FMT_REG_DATE", "Date") +/*-------------------------------------------------------------------- + Description: formats references + --------------------------------------------------------------------*/ +#define FMT_REF_TEXT NC_("FMT_REF_TEXT", "Reference") +#define FMT_REF_PAGE NC_("FMT_REF_PAGE", "Page") +#define FMT_REF_CHAPTER NC_("FMT_REF_CHAPTER", "Chapter") +#define FMT_REF_UPDOWN NC_("FMT_REF_UPDOWN", "Above/Below") +#define FMT_REF_PAGE_PGDSC NC_("FMT_REF_PAGE_PGDSC", "As Page Style") +#define FMT_REF_ONLYNUMBER NC_("FMT_REF_ONLYNUMBER", "Category and Number") +#define FMT_REF_ONLYCAPTION NC_("FMT_REF_ONLYCAPTION", "Caption Text") +#define FMT_REF_ONLYSEQNO NC_("FMT_REF_ONLYSEQNO", "Numbering") +#define FMT_REF_NUMBER NC_("FMT_REF_NUMBER", "Number") +#define FMT_REF_NUMBER_NO_CONTEXT NC_("FMT_REF_NUMBER_NO_CONTEXT", "Number (no context)") +#define FMT_REF_NUMBER_FULL_CONTEXT NC_("FMT_REF_NUMBER_FULL_CONTEXT", "Number (full context)") + +#define FMT_REF_WITH_LOWERCASE_HU_ARTICLE NC_("FMT_REF_WITH_LOWERCASE_HU_ARTICLE", "Article a/az + ") +#define FMT_REF_WITH_UPPERCASE_HU_ARTICLE NC_("FMT_REF_WITH_UPPERCASE_HU_ARTICLE", "Article A/Az + ") +/*-------------------------------------------------------------------- + Description: placeholder + --------------------------------------------------------------------*/ +#define FMT_MARK_TEXT NC_("FMT_MARK_TEXT", "Text") +#define FMT_MARK_TABLE NC_("FMT_MARK_TABLE", "Table") +#define FMT_MARK_FRAME NC_("FMT_MARK_FRAME", "Frame") +#define FMT_MARK_GRAFIC NC_("FMT_MARK_GRAFIC", "Image") +#define FMT_MARK_OLE NC_("FMT_MARK_OLE", "Object") +/*-------------------------------------------------------------------- + Description: ExchangeStrings for Edit/NameFT + --------------------------------------------------------------------*/ +#define STR_COND NC_("STR_COND", "~Condition") +#define STR_TEXT NC_("STR_TEXT", "Then, Else") +#define STR_DDE_CMD NC_("STR_DDE_CMD", "DDE Statement") +#define STR_INSTEXT NC_("STR_INSTEXT", "Hidden t~ext") +#define STR_MACNAME NC_("STR_MACNAME", "~Macro name") +#define STR_PROMPT NC_("STR_PROMPT", "~Reference") +#define STR_COMBCHRS_FT NC_("STR_COMBCHRS_FT", "Ch~aracters") +#define STR_OFFSET NC_("STR_OFFSET", "O~ffset") +#define STR_VALUE NC_("STR_VALUE", "Value") +#define STR_FORMULA NC_("STR_FORMULA", "Formula") +#define STR_CUSTOM_FIELD NC_("STR_CUSTOM_FIELD", "Custom") + +#define STR_CUSTOM_LABEL NC_("STR_CUSTOM_LABEL", "[User]") + +#define STR_HDIST NC_("STR_HDIST", "H. Pitch") +#define STR_VDIST NC_("STR_VDIST", "V. Pitch") +#define STR_WIDTH NC_("STR_WIDTH", "Width") +#define STR_HEIGHT NC_("STR_HEIGHT", "Height") +#define STR_LEFT NC_("STR_LEFT", "Left margin") +#define STR_UPPER NC_("STR_UPPER", "Top margin") +#define STR_COLS NC_("STR_COLS", "Columns") +#define STR_ROWS NC_("STR_ROWS", "Rows") + +#define STR_WORDCOUNT_HINT NC_("STR_WORDCOUNT_HINT", "Word and character count. Click to open Word Count dialog.") +#define STR_VIEWLAYOUT_ONE NC_("STR_VIEWLAYOUT_ONE", "Single-page view") +#define STR_VIEWLAYOUT_MULTI NC_("STR_VIEWLAYOUT_MULTI", "Multiple-page view") +#define STR_VIEWLAYOUT_BOOK NC_("STR_VIEWLAYOUT_BOOK", "Book view") +#define STR_BOOKCTRL_HINT NC_("STR_BOOKCTRL_HINT", "Page number in document. Click to open Go to Page dialog or right-click for bookmark list.") +#define STR_BOOKCTRL_HINT_EXTENDED NC_("STR_BOOKCTRL_HINT_EXTENDED", "Page number in document (Page number on printed document). Click to open Go to Page dialog.") +#define STR_TMPLCTRL_HINT NC_("STR_TMPLCTRL_HINT", "Page Style. Right-click to change style or click to open Style dialog.") + +// Strings for textual attributes. +#define STR_DROP_OVER NC_("STR_DROP_OVER", "Drop Caps over") +#define STR_DROP_LINES NC_("STR_DROP_LINES", "rows") +#define STR_NO_DROP_LINES NC_("STR_NO_DROP_LINES", "No Drop Caps") +#define STR_NO_PAGEDESC NC_("STR_NO_PAGEDESC", "No page break") +#define STR_NO_MIRROR NC_("STR_NO_MIRROR", "Don't mirror") +#define STR_VERT_MIRROR NC_("STR_VERT_MIRROR", "Flip vertically") +#define STR_HORI_MIRROR NC_("STR_HORI_MIRROR", "Flip horizontal") +#define STR_BOTH_MIRROR NC_("STR_BOTH_MIRROR", "Horizontal and Vertical Flip") +#define STR_MIRROR_TOGGLE NC_("STR_MIRROR_TOGGLE", "+ mirror horizontal on even pages") +#define STR_CHARFMT NC_("STR_CHARFMT", "Character Style") +#define STR_NO_CHARFMT NC_("STR_NO_CHARFMT", "No Character Style") +#define STR_FOOTER NC_("STR_FOOTER", "Footer") +#define STR_NO_FOOTER NC_("STR_NO_FOOTER", "No footer") +#define STR_HEADER NC_("STR_HEADER", "Header") +#define STR_NO_HEADER NC_("STR_NO_HEADER", "No header") +#define STR_SURROUND_IDEAL NC_("STR_SURROUND_IDEAL", "Optimal wrap") +#define STR_SURROUND_NONE NC_("STR_SURROUND_NONE", "No wrap") +#define STR_SURROUND_THROUGH NC_("STR_SURROUND_THROUGH", "Through") +#define STR_SURROUND_PARALLEL NC_("STR_SURROUND_PARALLEL", "Parallel wrap") +#define STR_SURROUND_LEFT NC_("STR_SURROUND_LEFT", "Left wrap") +#define STR_SURROUND_RIGHT NC_("STR_SURROUND_RIGHT", "Right wrap") +#define STR_SURROUND_ANCHORONLY NC_("STR_SURROUND_ANCHORONLY", "(Anchor only)") +#define STR_FRM_WIDTH NC_("STR_FRM_WIDTH", "Width:") +#define STR_FRM_FIXEDHEIGHT NC_("STR_FRM_FIXEDHEIGHT", "Fixed height:") +#define STR_FRM_MINHEIGHT NC_("STR_FRM_MINHEIGHT", "Min. height:") +#define STR_FLY_AT_PARA NC_("STR_FLY_AT_PARA", "to paragraph") +#define STR_FLY_AS_CHAR NC_("STR_FLY_AS_CHAR", "to character") +#define STR_FLY_AT_PAGE NC_("STR_FLY_AT_PAGE", "to page") +#define STR_POS_X NC_("STR_POS_X", "X Coordinate:") +#define STR_POS_Y NC_("STR_POS_Y", "Y Coordinate:") +#define STR_VERT_TOP NC_("STR_VERT_TOP", "at top") +#define STR_VERT_CENTER NC_("STR_VERT_CENTER", "Centered vertically") +#define STR_VERT_BOTTOM NC_("STR_VERT_BOTTOM", "at bottom") +#define STR_LINE_TOP NC_("STR_LINE_TOP", "Top of line") +#define STR_LINE_CENTER NC_("STR_LINE_CENTER", "Line centered") +#define STR_LINE_BOTTOM NC_("STR_LINE_BOTTOM", "Bottom of line") +#define STR_REGISTER_ON NC_("STR_REGISTER_ON", "Register-true") +#define STR_REGISTER_OFF NC_("STR_REGISTER_OFF", "Not register-true") +#define STR_HORI_RIGHT NC_("STR_HORI_RIGHT", "at the right") +#define STR_HORI_CENTER NC_("STR_HORI_CENTER", "Centered horizontally") +#define STR_HORI_LEFT NC_("STR_HORI_LEFT", "at the left") +#define STR_HORI_INSIDE NC_("STR_HORI_INSIDE", "inside") +#define STR_HORI_OUTSIDE NC_("STR_HORI_OUTSIDE", "outside") +#define STR_HORI_FULL NC_("STR_HORI_FULL", "Full width") +#define STR_COLUMNS NC_("STR_COLUMNS", "Columns") +#define STR_LINE_WIDTH NC_("STR_LINE_WIDTH", "Separator Width:") +#define STR_MAX_FTN_HEIGHT NC_("STR_MAX_FTN_HEIGHT", "Max. footnote area:") +#define STR_EDIT_IN_READONLY NC_("STR_EDIT_IN_READONLY", "Editable in read-only document") +#define STR_LAYOUT_SPLIT NC_("STR_LAYOUT_SPLIT", "Split") +#define STR_NUMRULE_ON NC_("STR_NUMRULE_ON", "Numbering") +#define STR_NUMRULE_OFF NC_("STR_NUMRULE_OFF", "no numbering") +#define STR_CONNECT1 NC_("STR_CONNECT1", "linked to ") +#define STR_CONNECT2 NC_("STR_CONNECT2", "and ") +#define STR_LINECOUNT NC_("STR_LINECOUNT", "Count lines") +#define STR_DONTLINECOUNT NC_("STR_DONTLINECOUNT", "don't count lines") +#define STR_LINCOUNT_START NC_("STR_LINCOUNT_START", "restart line count with: ") +#define STR_LUMINANCE NC_("STR_LUMINANCE", "Brightness: ") +#define STR_CHANNELR NC_("STR_CHANNELR", "Red: ") +#define STR_CHANNELG NC_("STR_CHANNELG", "Green: ") +#define STR_CHANNELB NC_("STR_CHANNELB", "Blue: ") +#define STR_CONTRAST NC_("STR_CONTRAST", "Contrast: ") +#define STR_GAMMA NC_("STR_GAMMA", "Gamma: ") +#define STR_TRANSPARENCY NC_("STR_TRANSPARENCY", "Transparency: ") +#define STR_INVERT NC_("STR_INVERT", "Invert") +#define STR_INVERT_NOT NC_("STR_INVERT_NOT", "do not invert") +#define STR_DRAWMODE NC_("STR_DRAWMODE", "Graphics mode: ") +#define STR_DRAWMODE_STD NC_("STR_DRAWMODE_STD", "Standard") +#define STR_DRAWMODE_GREY NC_("STR_DRAWMODE_GREY", "Grayscales") +#define STR_DRAWMODE_BLACKWHITE NC_("STR_DRAWMODE_BLACKWHITE", "Black & White") +#define STR_DRAWMODE_WATERMARK NC_("STR_DRAWMODE_WATERMARK", "Watermark") +#define STR_ROTATION NC_("STR_ROTATION", "Rotation") +#define STR_GRID_NONE NC_("STR_GRID_NONE", "No grid") +#define STR_GRID_LINES_ONLY NC_("STR_GRID_LINES_ONLY", "Grid (lines only)") +#define STR_GRID_LINES_CHARS NC_("STR_GRID_LINES_CHARS", "Grid (lines and characters)") +#define STR_FOLLOW_TEXT_FLOW NC_("STR_FOLLOW_TEXT_FLOW", "Follow text flow") +#define STR_DONT_FOLLOW_TEXT_FLOW NC_("STR_DONT_FOLLOW_TEXT_FLOW", "Do not follow text flow") +#define STR_CONNECT_BORDER_ON NC_("STR_CONNECT_BORDER_ON", "Merge borders") +#define STR_CONNECT_BORDER_OFF NC_("STR_CONNECT_BORDER_OFF", "Do not merge borders") + +#define ST_TBL NC_("ST_TBL", "Table") +#define ST_FRM NC_("ST_FRM", "Text Frame") +#define ST_PGE NC_("ST_PGE", "Page") +#define ST_DRW NC_("ST_DRW", "Drawing") +#define ST_CTRL NC_("ST_CTRL", "Control") +#define ST_REG NC_("ST_REG", "Section") +#define ST_BKM NC_("ST_BKM", "Bookmark") +#define ST_GRF NC_("ST_GRF", "Graphics") +#define ST_OLE NC_("ST_OLE", "OLE object") +#define ST_OUTL NC_("ST_OUTL", "Headings") +#define ST_SEL NC_("ST_SEL", "Selection") +#define ST_FTN NC_("ST_FTN", "Footnote") +#define ST_MARK NC_("ST_MARK", "Reminder") +#define ST_POSTIT NC_("ST_POSTIT", "Comment") +#define ST_SRCH_REP NC_("ST_SRCH_REP", "Repeat search") +#define ST_INDEX_ENTRY NC_("ST_INDEX_ENTRY", "Index entry") +#define ST_TABLE_FORMULA NC_("ST_TABLE_FORMULA", "Table formula") +#define ST_TABLE_FORMULA_ERROR NC_("ST_TABLE_FORMULA_ERROR", "Wrong table formula") +// Strings for the quickhelp of the View-PgUp/Down-Buttons +#define STR_IMGBTN_TBL_DOWN NC_("STR_IMGBTN_TBL_DOWN", "Next table") +#define STR_IMGBTN_FRM_DOWN NC_("STR_IMGBTN_FRM_DOWN", "Next text frame") +#define STR_IMGBTN_PGE_DOWN NC_("STR_IMGBTN_PGE_DOWN", "Next page") +#define STR_IMGBTN_DRW_DOWN NC_("STR_IMGBTN_DRW_DOWN", "Next drawing") +#define STR_IMGBTN_CTRL_DOWN NC_("STR_IMGBTN_CTRL_DOWN", "Next control") +#define STR_IMGBTN_REG_DOWN NC_("STR_IMGBTN_REG_DOWN", "Next section") +#define STR_IMGBTN_BKM_DOWN NC_("STR_IMGBTN_BKM_DOWN", "Next bookmark") +#define STR_IMGBTN_GRF_DOWN NC_("STR_IMGBTN_GRF_DOWN", "Next graphic") +#define STR_IMGBTN_OLE_DOWN NC_("STR_IMGBTN_OLE_DOWN", "Next OLE object") +#define STR_IMGBTN_OUTL_DOWN NC_("STR_IMGBTN_OUTL_DOWN", "Next heading") +#define STR_IMGBTN_SEL_DOWN NC_("STR_IMGBTN_SEL_DOWN", "Next selection") +#define STR_IMGBTN_FTN_DOWN NC_("STR_IMGBTN_FTN_DOWN", "Next footnote") +#define STR_IMGBTN_MARK_DOWN NC_("STR_IMGBTN_MARK_DOWN", "Next Reminder") +#define STR_IMGBTN_POSTIT_DOWN NC_("STR_IMGBTN_POSTIT_DOWN", "Next Comment") +#define STR_IMGBTN_SRCH_REP_DOWN NC_("STR_IMGBTN_SRCH_REP_DOWN", "Continue search forward") +#define STR_IMGBTN_INDEX_ENTRY_DOWN NC_("STR_IMGBTN_INDEX_ENTRY_DOWN", "Next index entry") +#define STR_IMGBTN_TBL_UP NC_("STR_IMGBTN_TBL_UP", "Previous table") +#define STR_IMGBTN_FRM_UP NC_("STR_IMGBTN_FRM_UP", "Previous text frame") +#define STR_IMGBTN_PGE_UP NC_("STR_IMGBTN_PGE_UP", "Previous page") +#define STR_IMGBTN_DRW_UP NC_("STR_IMGBTN_DRW_UP", "Previous drawing") +#define STR_IMGBTN_CTRL_UP NC_("STR_IMGBTN_CTRL_UP", "Previous control") +#define STR_IMGBTN_REG_UP NC_("STR_IMGBTN_REG_UP", "Previous section") +#define STR_IMGBTN_BKM_UP NC_("STR_IMGBTN_BKM_UP", "Previous bookmark") +#define STR_IMGBTN_GRF_UP NC_("STR_IMGBTN_GRF_UP", "Previous graphic") +#define STR_IMGBTN_OLE_UP NC_("STR_IMGBTN_OLE_UP", "Previous OLE object") +#define STR_IMGBTN_OUTL_UP NC_("STR_IMGBTN_OUTL_UP", "Previous heading") +#define STR_IMGBTN_SEL_UP NC_("STR_IMGBTN_SEL_UP", "Previous selection") +#define STR_IMGBTN_FTN_UP NC_("STR_IMGBTN_FTN_UP", "Previous footnote") +#define STR_IMGBTN_MARK_UP NC_("STR_IMGBTN_MARK_UP", "Previous Reminder") +#define STR_IMGBTN_POSTIT_UP NC_("STR_IMGBTN_POSTIT_UP", "Previous Comment") +#define STR_IMGBTN_SRCH_REP_UP NC_("STR_IMGBTN_SRCH_REP_UP", "Continue search backwards") +#define STR_IMGBTN_INDEX_ENTRY_UP NC_("STR_IMGBTN_INDEX_ENTRY_UP", "Previous index entry") +#define STR_IMGBTN_TBLFML_UP NC_("STR_IMGBTN_TBLFML_UP", "Previous table formula") +#define STR_IMGBTN_TBLFML_DOWN NC_("STR_IMGBTN_TBLFML_DOWN", "Next table formula") +#define STR_IMGBTN_TBLFML_ERR_UP NC_("STR_IMGBTN_TBLFML_ERR_UP", "Previous faulty table formula") +#define STR_IMGBTN_TBLFML_ERR_DOWN NC_("STR_IMGBTN_TBLFML_ERR_DOWN", "Next faulty table formula") + +#define STR_REDLINE_INSERT NC_("STR_REDLINE_INSERT", "Inserted") +#define STR_REDLINE_DELETE NC_("STR_REDLINE_DELETE", "Deleted") +#define STR_REDLINE_FORMAT NC_("STR_REDLINE_FORMAT", "Formatted") +#define STR_REDLINE_TABLE NC_("STR_REDLINE_TABLE", "Table changed") +#define STR_REDLINE_FMTCOLL NC_("STR_REDLINE_FMTCOLL", "Applied Paragraph Styles") +#define STR_REDLINE_PARAGRAPH_FORMAT NC_("STR_REDLINE_PARAGRAPH_FORMAT", "Paragraph formatting changed") +#define STR_REDLINE_TABLE_ROW_INSERT NC_("STR_REDLINE_TABLE_ROW_INSERT", "Row Inserted") +#define STR_REDLINE_TABLE_ROW_DELETE NC_("STR_REDLINE_TABLE_ROW_DELETE", "Row Deleted") +#define STR_REDLINE_TABLE_CELL_INSERT NC_("STR_REDLINE_TABLE_CELL_INSERT", "Cell Inserted") +#define STR_REDLINE_TABLE_CELL_DELETE NC_("STR_REDLINE_TABLE_CELL_DELETE", "Cell Deleted") +#define STR_ENDNOTE NC_("STR_ENDNOTE", "Endnote: ") +#define STR_FTNNOTE NC_("STR_FTNNOTE", "Footnote: ") +#define STR_SMARTTAG_CLICK NC_("STR_SMARTTAG_CLICK", "%s-click to open Smart Tag menu") +#define STR_HEADER_TITLE NC_("STR_HEADER_TITLE", "Header (%1)") +#define STR_FIRST_HEADER_TITLE NC_("STR_FIRST_HEADER_TITLE", "First Page Header (%1)") +#define STR_LEFT_HEADER_TITLE NC_("STR_LEFT_HEADER_TITLE", "Left Page Header (%1)") +#define STR_RIGHT_HEADER_TITLE NC_("STR_RIGHT_HEADER_TITLE", "Right Page Header (%1)") +#define STR_FOOTER_TITLE NC_("STR_FOOTER_TITLE", "Footer (%1)") +#define STR_FIRST_FOOTER_TITLE NC_("STR_FIRST_FOOTER_TITLE", "First Page Footer (%1)") +#define STR_LEFT_FOOTER_TITLE NC_("STR_LEFT_FOOTER_TITLE", "Left Page Footer (%1)") +#define STR_RIGHT_FOOTER_TITLE NC_("STR_RIGHT_FOOTER_TITLE", "Right Page Footer (%1)") +#define STR_DELETE_HEADER NC_("STR_DELETE_HEADER", "Delete Header...") +#define STR_FORMAT_HEADER NC_("STR_FORMAT_HEADER", "Format Header...") +#define STR_DELETE_FOOTER NC_("STR_DELETE_FOOTER", "Delete Footer...") +#define STR_FORMAT_FOOTER NC_("STR_FORMAT_FOOTER", "Format Footer...") + +#define STR_UNFLOAT_TABLE NC_("STR_UNFLOAT_TABLE", "Un-float Table") + +#define STR_GRFILTER_OPENERROR NC_("STR_GRFILTER_OPENERROR", "Image file cannot be opened") +#define STR_GRFILTER_IOERROR NC_("STR_GRFILTER_IOERROR", "Image file cannot be read") +#define STR_GRFILTER_FORMATERROR NC_("STR_GRFILTER_FORMATERROR", "Unknown image format") +#define STR_GRFILTER_VERSIONERROR NC_("STR_GRFILTER_VERSIONERROR", "This image file version is not supported") +#define STR_GRFILTER_FILTERERROR NC_("STR_GRFILTER_FILTERERROR", "Image filter not found") +#define STR_GRFILTER_TOOBIG NC_("STR_GRFILTER_TOOBIG", "Not enough memory to insert the image.") +#define STR_INSERT_GRAPHIC NC_("STR_INSERT_GRAPHIC", "Insert Image") +#define STR_REDLINE_COMMENT NC_("STR_REDLINE_COMMENT", "Comment: ") +#define STR_REDLINE_INSERTED NC_("STR_REDLINE_INSERTED", "Insertion") +#define STR_REDLINE_DELETED NC_("STR_REDLINE_DELETED", "Deletion") +#define STR_REDLINE_AUTOFMT NC_("STR_REDLINE_AUTOFMT", "AutoCorrect") +#define STR_REDLINE_FORMATTED NC_("STR_REDLINE_FORMATTED", "Formats") +#define STR_REDLINE_TABLECHG NC_("STR_REDLINE_TABLECHG", "Table Changes") +#define STR_REDLINE_FMTCOLLSET NC_("STR_REDLINE_FMTCOLLSET", "Applied Paragraph Styles") +#define STR_PAGE NC_("STR_PAGE", "Page ") +#define STR_PAGE_COUNT NC_("STR_PAGE_COUNT", "Page %1 of %2") +#define STR_PAGE_COUNT_CUSTOM NC_("STR_PAGE_COUNT_CUSTOM", "Page %1 of %2 (Page %3)") +#define STR_PAGE_COUNT_PRINTED NC_("STR_PAGE_COUNT_PRINTED", "Page %1 of %2 (Page %3 of %4 to print)") +//Strings for gallery/background +#define STR_SWBG_PARAGRAPH NC_("STR_SWBG_PARAGRAPH", "Paragraph") +#define STR_SWBG_GRAPHIC NC_("STR_SWBG_GRAPHIC", "Image") +#define STR_SWBG_OLE NC_("STR_SWBG_OLE", "OLE object") +#define STR_SWBG_FRAME NC_("STR_SWBG_FRAME", "Frame") +#define STR_SWBG_TABLE NC_("STR_SWBG_TABLE", "Table") +#define STR_SWBG_TABLE_ROW NC_("STR_SWBG_TABLE_ROW", "Table row") +#define STR_SWBG_TABLE_CELL NC_("STR_SWBG_TABLE_CELL", "Table cell") +#define STR_SWBG_PAGE NC_("STR_SWBG_PAGE", "Page") +#define STR_SWBG_HEADER NC_("STR_SWBG_HEADER", "Header") +#define STR_SWBG_FOOTER NC_("STR_SWBG_FOOTER", "Footer") +//End: strings for gallery/background + +#define STR_WRITER_WEBDOC_FULLTYPE NC_("STR_WRITER_WEBDOC_FULLTYPE", "%PRODUCTNAME %PRODUCTVERSION HTML Document") + +#define STR_TITLE NC_("STR_TITLE", "Title") +#define STR_ALPHA NC_("STR_ALPHA", "Separator") +#define STR_LEVEL NC_("STR_LEVEL", "Level ") +#define STR_FILE_NOT_FOUND NC_("STR_FILE_NOT_FOUND", "The file, \"%1\" in the \"%2\" path could not be found.") +#define STR_USER_DEFINED_INDEX NC_("STR_USER_DEFINED_INDEX", "User-Defined Index") +#define STR_NOSORTKEY NC_("STR_NOSORTKEY", "<None>") +#define STR_NO_CHAR_STYLE NC_("STR_NO_CHAR_STYLE", "<None>") +#define STR_DELIM NC_("STR_DELIM", "S") +#define STR_TOKEN_ENTRY_NO NC_("STR_TOKEN_ENTRY_NO", "E#") +#define STR_TOKEN_ENTRY NC_("STR_TOKEN_ENTRY", "E") +#define STR_TOKEN_TAB_STOP NC_("STR_TOKEN_TAB_STOP", "T") +#define STR_TOKEN_PAGE_NUMS NC_("STR_TOKEN_PAGE_NUMS", "#") +#define STR_TOKEN_CHAPTER_INFO NC_("STR_TOKEN_CHAPTER_INFO", "CI") +#define STR_TOKEN_LINK_START NC_("STR_TOKEN_LINK_START", "LS") +#define STR_TOKEN_LINK_END NC_("STR_TOKEN_LINK_END", "LE") +#define STR_TOKEN_AUTHORITY NC_("STR_TOKEN_AUTHORITY", "A") +#define STR_TOKEN_HELP_ENTRY_NO NC_("STR_TOKEN_HELP_ENTRY_NO", "Chapter number") +#define STR_TOKEN_HELP_ENTRY NC_("STR_TOKEN_HELP_ENTRY", "Entry") +#define STR_TOKEN_HELP_TAB_STOP NC_("STR_TOKEN_HELP_TAB_STOP", "Tab stop") +#define STR_TOKEN_HELP_TEXT NC_("STR_TOKEN_HELP_TEXT", "Text") +#define STR_TOKEN_HELP_PAGE_NUMS NC_("STR_TOKEN_HELP_PAGE_NUMS", "Page number") +#define STR_TOKEN_HELP_CHAPTER_INFO NC_("STR_TOKEN_HELP_CHAPTER_INFO", "Chapter info") +#define STR_TOKEN_HELP_LINK_START NC_("STR_TOKEN_HELP_LINK_START", "Hyperlink start") +#define STR_TOKEN_HELP_LINK_END NC_("STR_TOKEN_HELP_LINK_END", "Hyperlink end") +#define STR_TOKEN_HELP_AUTHORITY NC_("STR_TOKEN_HELP_AUTHORITY", "Bibliography entry: ") +#define STR_CHARSTYLE NC_("STR_CHARSTYLE", "Character Style: ") +#define STR_STRUCTURE NC_("STR_STRUCTURE", "Structure text") +#define STR_ADDITIONAL_ACCNAME_STRING1 NC_("STR_ADDITIONAL_ACCNAME_STRING1", "Press Ctrl+Alt+A to move focus for more operations") +#define STR_ADDITIONAL_ACCNAME_STRING2 NC_("STR_ADDITIONAL_ACCNAME_STRING2", "Press left or right arrow to choose the structure controls") +#define STR_ADDITIONAL_ACCNAME_STRING3 NC_("STR_ADDITIONAL_ACCNAME_STRING3", "Press Ctrl+Alt+B to move focus back to the current structure control") +#define STR_AUTOMARK_TYPE NC_("STR_AUTOMARK_TYPE", "Selection file for the alphabetical index (*.sdi)") + +/*----------------------------------------------------------------------- + Description: character alignment for frmsh.cxx - context menu + -----------------------------------------------------------------------*/ +#define STR_FRMUI_TOP_BASE NC_("STR_FRMUI_TOP_BASE", "Base line at ~top") +#define STR_FRMUI_BOTTOM_BASE NC_("STR_FRMUI_BOTTOM_BASE", "~Base line at bottom") +#define STR_FRMUI_CENTER_BASE NC_("STR_FRMUI_CENTER_BASE", "Base line ~centered") +#define STR_FRMUI_OLE_INSERT NC_("STR_FRMUI_OLE_INSERT", "Insert object") +#define STR_FRMUI_OLE_EDIT NC_("STR_FRMUI_OLE_EDIT", "Edit object") +#define STR_FRMUI_COLL_HEADER NC_("STR_FRMUI_COLL_HEADER", " (Template: ") +#define STR_FRMUI_BORDER NC_("STR_FRMUI_BORDER", "Borders") +#define STR_FRMUI_PATTERN NC_("STR_FRMUI_PATTERN", "Background") + +#define STR_TEXTCOLL_HEADER NC_("STR_TEXTCOLL_HEADER", "(Paragraph Style: ") +#define STR_ILLEGAL_PAGENUM NC_("STR_ILLEGAL_PAGENUM", "Page numbers cannot be applied to the current page. Even numbers can be used on left pages, odd numbers on right pages.") + +#define STR_WRITER_GLOBALDOC_FULLTYPE NC_("STR_WRITER_GLOBALDOC_FULLTYPE", "%PRODUCTNAME %PRODUCTVERSION Master Document") + +#define STR_QUERY_CONNECT NC_("STR_QUERY_CONNECT", "A file connection will delete the contents of the current section. Connect anyway?") +#define STR_WRONG_PASSWORD NC_("STR_WRONG_PASSWORD", "The password entered is invalid.") +#define STR_WRONG_PASSWD_REPEAT NC_("STR_WRONG_PASSWD_REPEAT", "The password has not been set.") + +#define STR_HYP_OK NC_("STR_HYP_OK", "Hyphenation completed") +#define STR_LANGSTATUS_NONE NC_("STR_LANGSTATUS_NONE", "None (Do not check spelling)") +#define STR_RESET_TO_DEFAULT_LANGUAGE NC_("STR_RESET_TO_DEFAULT_LANGUAGE", "Reset to Default Language") +#define STR_LANGSTATUS_MORE NC_("STR_LANGSTATUS_MORE", "More...") +#define STR_IGNORE_SELECTION NC_("STR_IGNORE_SELECTION", "~Ignore") +#define STR_EXPLANATION_LINK NC_("STR_EXPLANATION_LINK", "Explanations...") + +#define STR_QUERY_SPECIAL_FORCED NC_("STR_QUERY_SPECIAL_FORCED", "Check special regions is deactivated. Check anyway?") +#define STR_NO_MERGE_ENTRY NC_("STR_NO_MERGE_ENTRY", "Could not merge documents.") +#define STR_NO_BASE_FOR_MERGE NC_("STR_NO_BASE_FOR_MERGE", "%PRODUCTNAME Base component is absent, and it is required to use Mail Merge.") +#define STR_ERR_SRCSTREAM NC_("STR_ERR_SRCSTREAM", "The source cannot be loaded.") +#define STR_ERR_NO_FAX NC_("STR_ERR_NO_FAX", "No fax printer has been set under Tools/Options/%1/Print.") +#define STR_WEBOPTIONS NC_("STR_WEBOPTIONS", "HTML document") +#define STR_TEXTOPTIONS NC_("STR_TEXTOPTIONS", "Text document") +#define STR_SCAN_NOSOURCE NC_("STR_SCAN_NOSOURCE", "Source not specified.") +#define STR_NUM_LEVEL NC_("STR_NUM_LEVEL", "Level ") +#define STR_NUM_OUTLINE NC_("STR_NUM_OUTLINE", "Outline ") +#define STR_EDIT_FOOTNOTE NC_("STR_EDIT_FOOTNOTE", "Edit Footnote/Endnote") +#define STR_NB_REPLACED NC_("STR_NB_REPLACED", "Search key replaced XX times.") +#define STR_SRCVIEW_ROW NC_("STR_SRCVIEW_ROW", "Row ") +#define STR_SRCVIEW_COL NC_("STR_SRCVIEW_COL", "Column ") +#define STR_SAVEAS_SRC NC_("STR_SAVEAS_SRC", "~Export source...") +#define STR_SAVEACOPY_SRC NC_("STR_SAVEACOPY_SRC", "~Export copy of source...") + +#define ST_CONTINUE NC_("ST_CONTINUE", "~Continue") +#define ST_SENDINGTO NC_("ST_SENDINGTO", "Sending to: %1") +#define ST_COMPLETED NC_("ST_COMPLETED", "Successfully sent") +#define ST_FAILED NC_("ST_FAILED", "Sending failed") + +#define STR_SENDER_TOKENS NC_("STR_SENDER_TOKENS", "COMPANY;CR;FIRSTNAME; ;LASTNAME;CR;ADDRESS;CR;CITY; ;STATEPROV; ;POSTALCODE;CR;COUNTRY;CR;") + +#define STR_TBL_FORMULA NC_("STR_TBL_FORMULA", "Text formula") + +#define STR_DROP_DOWN_EMPTY_LIST NC_("STR_DROP_DOWN_EMPTY_LIST", "No Item specified") + +/*-------------------------------------------------------------------- + Description: Classification strings + --------------------------------------------------------------------*/ + +#define STR_CLASSIFICATION_LEVEL_CHANGED NC_("STR_CLASSIFICATION_LEVEL_CHANGED", "Document classification has changed because a paragraph classification level is higher") + +/*-------------------------------------------------------------------- + Description: Paragraph Signature + --------------------------------------------------------------------*/ +#define STR_VALID NC_("STR_VALID", " Valid ") +#define STR_INVALID NC_("STR_INVALID", "Invalid") +#define STR_INVALID_SIGNATURE NC_("STR_INVALID_SIGNATURE", "Invalid Signature") +#define STR_SIGNED_BY NC_("STR_SIGNED_BY", "Signed-by") +#define STR_PARAGRAPH_SIGNATURE NC_("STR_PARAGRAPH_SIGNATURE", "Paragraph Signature") + +#define STR_BUSINESS_CARDS NC_("labeldialog|cards", "Business Cards") + +#define STR_MAILCONFIG_DLG_TITLE NC_("STR_MAILCONFIG_DLG_TITLE", "Email settings") + +#define STR_OPT_PREVIEW_INSERTED NC_("optredlinepage|insertedpreview", "Insert") +#define STR_OPT_PREVIEW_DELETED NC_("optredlinepage|deletedpreview", "Delete") +#define STR_OPT_PREVIEW_CHANGED NC_("optredlinepage|changedpreview", "Attributes") + +#define STR_AUTOMARK_SEARCHTERM NC_("createautomarkdialog|searchterm", "Search term") +#define STR_AUTOMARK_ALTERNATIVE NC_("createautomarkdialog|alternative", "Alternative entry") +#define STR_AUTOMARK_KEY1 NC_("createautomarkdialog|key1", "1st key") +#define STR_AUTOMARK_KEY2 NC_("createautomarkdialog|key2", "2nd key") +#define STR_AUTOMARK_COMMENT NC_("createautomarkdialog|comment", "Comment") +#define STR_AUTOMARK_CASESENSITIVE NC_("createautomarkdialog|casesensitive", "Match case") +#define STR_AUTOMARK_WORDONLY NC_("createautomarkdialog|wordonly", "Word only") +#define STR_AUTOMARK_YES NC_("createautomarkdialog|yes", "Yes") +#define STR_AUTOMARK_NO NC_("createautomarkdialog|no", "No") + +#define STR_WRAP_PANEL_CUSTOM_STR NC_("sidebarwrap|customlabel", "Custom") + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/sw_primitivetypes2d.hxx b/sw/inc/sw_primitivetypes2d.hxx new file mode 100644 index 000000000..44509820f --- /dev/null +++ b/sw/inc/sw_primitivetypes2d.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SW_PRIMITIVETYPES2D_HXX +#define INCLUDED_SW_INC_SW_PRIMITIVETYPES2D_HXX + +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> + +#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SW| 0) +#define PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 1) +#define PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 2) +#define PRIMITIVE2D_ID_SWBORDERRECTANGLERIMITIVE (PRIMITIVE2D_ID_RANGE_SW| 3) + +#endif // INCLUDED_SW_INC_SW_PRIMITIVETYPES2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx new file mode 100644 index 000000000..1533d816e --- /dev/null +++ b/sw/inc/swabstdlg.hxx @@ -0,0 +1,521 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWABSTDLG_HXX +#define INCLUDED_SW_INC_SWABSTDLG_HXX + +#include <rtl/ustring.hxx> +#include <sfx2/sfxdlg.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <optional> +#include "dbmgr.hxx" +#include <cnttab.hxx> +#include "tblenum.hxx" + +class SfxViewFrame; +class SfxBindings; +class SfxItemSet; +namespace vcl { class Window; } +class SfxStyleSheetBase; +class SwGlossaryHdl; +class SwField; + +class SwAsciiOptions; +class SwDoc; +class SwDocShell; +class SvStream; +class SwWrtShell; +class SfxRequest; +class SwView; +class SwTableAutoFormat; +class SwTOXMgr; +class SwTOXDescription; +class SwTOXBase; +class SwSectionData; +struct SwDBData; +class Printer; +class SwLabItem; +class SwTableFUNC; +class SwChildWinWrapper; +struct SfxChildWinInfo; +class SwTOXMark; +struct SwDocStat; +struct SwInsertTableOptions; +class SwInsTableDlg; +enum class SwBorderModes; +enum class SwCharDlgMode; +enum class SfxStyleFamily; + +namespace com::sun::star{ + namespace frame{ + class XModel; + } + namespace sdbcx{ + class XColumnsSupplier; + } + namespace sdbc{ + class XDataSource; + class XConnection; + class XResultSet; + } + namespace container { class XNameAccess; } + namespace container { class XNamed; } +} + + +namespace sw::mark { class IFieldmark; class IDateFieldmark; } + +typedef void (*SwLabDlgMethod) (css::uno::Reference< css::frame::XModel> const & xModel, const SwLabItem& rItem); + +typedef OUString (*GlossaryGetCurrGroup)(); +typedef void (*GlossarySetActGroup)(const OUString& rNewGroup); + +class AbstractGlossaryDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractGlossaryDlg() override = default; +public: + virtual OUString GetCurrGrpName() const = 0; + virtual OUString GetCurrShortName() const = 0; +}; + +class AbstractFieldInputDlg : public VclAbstractTerminatedDialog +{ +protected: + virtual ~AbstractFieldInputDlg() override = default; +public: + virtual void EndDialog(sal_Int32 nResult) override = 0; + virtual bool PrevButtonPressed() const = 0; + virtual bool NextButtonPressed() const = 0; +}; + +class AbstractInsFootNoteDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractInsFootNoteDlg() override = default; +public: + virtual OUString GetFontName() = 0; + virtual bool IsEndNote() = 0; + virtual OUString GetStr() = 0; + //from class Window + virtual void SetHelpId( const OString& sHelpId ) = 0; + virtual void SetText( const OUString& rStr ) = 0; +}; + +class AbstractInsTableDlg +{ +protected: + virtual ~AbstractInsTableDlg() = default; +public: + virtual void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, + SwInsertTableOptions& rInsTableFlags, OUString& rTableAutoFormatName, + std::unique_ptr<SwTableAutoFormat>& prTAFormat ) = 0; + virtual std::shared_ptr<weld::DialogController> getDialogController() = 0; +}; + +class AbstractJavaEditDialog : public VclAbstractDialog +{ +protected: + virtual ~AbstractJavaEditDialog() override = default; +public: + virtual OUString GetScriptText() const = 0; + virtual OUString GetScriptType() const = 0; + virtual bool IsUrl() const = 0; + virtual bool IsNew() const = 0; + virtual bool IsUpdate() const = 0; +}; + +class AbstractMailMergeDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractMailMergeDlg() override = default; +public: + virtual DBManagerOptions GetMergeType() = 0; + virtual const OUString& GetSaveFilter() const = 0; + virtual css::uno::Sequence< css::uno::Any > GetSelection() const = 0; + virtual css::uno::Reference< css::sdbc::XResultSet> GetResultSet() const = 0; + virtual bool IsSaveSingleDoc() const = 0; + virtual bool IsGenerateFromDataBase() const = 0; + virtual bool IsFileEncryptedFromDataBase() const = 0; + virtual OUString GetColumnName() const = 0; + virtual OUString GetPasswordColumnName() const = 0; + virtual OUString GetTargetURL() const = 0; +}; + +class AbstractMailMergeCreateFromDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractMailMergeCreateFromDlg() override = default; +public: + virtual bool IsThisDocument() const = 0; +}; + +class AbstractMailMergeFieldConnectionsDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractMailMergeFieldConnectionsDlg() override = default; +public: + virtual bool IsUseExistingConnections() const = 0; +}; + +class AbstractMultiTOXTabDialog : public VclAbstractDialog +{ +protected: + virtual ~AbstractMultiTOXTabDialog() override = default; +public: + virtual CurTOXType GetCurrentTOXType() const = 0; + virtual SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes) = 0; + //from SfxTabDialog + virtual const SfxItemSet* GetOutputItemSet() const = 0; +}; + +class AbstractEditRegionDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractEditRegionDlg() override = default; +public: + virtual void SelectSection(const OUString& rSectionName) = 0; +}; + +class AbstractInsertSectionTabDialog : public VclAbstractDialog +{ +protected: + virtual ~AbstractInsertSectionTabDialog() override = default; +public: + virtual void SetSectionData(SwSectionData const& rSect) = 0; +}; + +class AbstractSwWordCountFloatDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwWordCountFloatDlg() override = default; +public: + virtual void UpdateCounts() = 0; + virtual void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) = 0; + virtual std::shared_ptr<SfxDialogController> GetController() = 0; +}; + +class AbstractSwInsertAbstractDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwInsertAbstractDlg() override = default; +public: + virtual sal_uInt8 GetLevel() const = 0; + virtual sal_uInt8 GetPara() const = 0; +}; + +class AbstractSwAsciiFilterDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwAsciiFilterDlg() override = default; +public: + virtual void FillOptions( SwAsciiOptions& rOptions ) = 0; + +}; + +class AbstractSwBreakDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwBreakDlg() override = default; +public: + virtual OUString GetTemplateName() = 0; + virtual sal_uInt16 GetKind() = 0; + virtual ::std::optional<sal_uInt16> GetPageNumber() = 0; + +}; + +class AbstractSplitTableDialog : public VclAbstractDialog // add for +{ +protected: + virtual ~AbstractSplitTableDialog() override = default; +public: + virtual SplitTable_HeadlineOption GetSplitMode() = 0; +}; + +class AbstractSwConvertTableDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwConvertTableDlg() override = default; +public: + virtual void GetValues( sal_Unicode& rDelim, + SwInsertTableOptions& rInsTableFlags, + SwTableAutoFormat const*& prTAFormat ) = 0; +}; + +class AbstractSwInsertDBColAutoPilot : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwInsertDBColAutoPilot() override = default; +public: + virtual void DataToDoc( const css::uno::Sequence< css::uno::Any >& rSelection, + css::uno::Reference< css::sdbc::XDataSource> rxSource, + css::uno::Reference< css::sdbc::XConnection> xConnection, + css::uno::Reference< css::sdbc::XResultSet > xResultSet) = 0; +}; + +class AbstractDropDownFieldDialog : public VclAbstractDialog +{ +protected: + virtual ~AbstractDropDownFieldDialog() override = default; +public: + virtual bool PrevButtonPressed() const = 0; + virtual bool NextButtonPressed() const = 0; +}; + +class AbstractSwLabDlg : public SfxAbstractTabDialog +{ +protected: + virtual ~AbstractSwLabDlg() override = default; +public: + virtual const OUString& GetBusinessCardStr() const = 0; + virtual Printer *GetPrt() =0; +}; + +class AbstractSwSelGlossaryDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwSelGlossaryDlg() override = default; +public: + virtual void InsertGlos(const OUString &rRegion, const OUString &rGlosName) = 0; // inline + virtual sal_Int32 GetSelectedIdx() const = 0; // inline + virtual void SelectEntryPos(sal_Int32 nIdx) = 0; // inline +}; + +class AbstractSwAutoFormatDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwAutoFormatDlg() override = default; +public: + virtual std::unique_ptr<SwTableAutoFormat> FillAutoFormatOfIndex() const = 0; +}; + +class AbstractSwFieldDlg : public SfxAbstractTabDialog +{ +protected: + virtual ~AbstractSwFieldDlg() override = default; +public: + virtual void Initialize(SfxChildWinInfo *pInfo) = 0; + virtual void ReInitDlg() = 0; + virtual void ActivateDatabasePage() = 0; + virtual void ShowReferencePage() = 0; + virtual std::shared_ptr<SfxDialogController> GetController() = 0; +}; + +class AbstractSwRenameXNamedDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwRenameXNamedDlg() override = default; +public: + virtual void SetForbiddenChars( const OUString& rSet ) = 0; + virtual void SetAlternativeAccess( + css::uno::Reference< css::container::XNameAccess > & xSecond, + css::uno::Reference< css::container::XNameAccess > & xThird ) = 0; +}; + +class AbstractSwModalRedlineAcceptDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwModalRedlineAcceptDlg() override = default; +public: + virtual void AcceptAll( bool bAccept ) = 0; +}; + +class AbstractMarkFloatDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractMarkFloatDlg() override = default; +public: + virtual void ReInitDlg(SwWrtShell& rWrtShell) = 0; + virtual std::shared_ptr<SfxDialogController> GetController() = 0; +}; + +#define RET_LOAD_DOC 100 +#define RET_TARGET_CREATED 103 +#define RET_REMOVE_TARGET 104 + +class SwMailMergeConfigItem; + +class AbstractMailMergeWizard : public VclAbstractDialog +{ +protected: + virtual ~AbstractMailMergeWizard() override = default; +public: + virtual OUString GetReloadDocument() const = 0; + virtual void ShowPage( sal_uInt16 nLevel ) = 0; + virtual sal_uInt16 GetRestartPage() const = 0; +}; + +class SwAbstractDialogFactory +{ +public: + static SwAbstractDialogFactory* Create(); + + virtual VclPtr<SfxAbstractDialog> CreateNumFormatDialog(weld::Widget* pParent, const SfxItemSet& rAttr) = 0; + virtual VclPtr<SfxAbstractDialog> CreateSwDropCapsDialog(weld::Window* pParent, const SfxItemSet& rSet) = 0; + virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) = 0; + + virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings, + SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) = 0; + + virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg(weld::Window* pParent) = 0; + virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(weld::Window* pParent, const SfxItemSet& rSet) = 0; + virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, + SvStream* pStream) = 0; + virtual VclPtr<VclAbstractDialog> CreateSwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh, SfxRequest& rReq) = 0; + + virtual VclPtr<AbstractSwBreakDlg> CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh) = 0; + virtual VclPtr<VclAbstractDialog> CreateSwChangeDBDlg(SwView& rVw) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateSwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, + SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) = 0; + virtual VclPtr<AbstractSwConvertTableDlg> CreateSwConvertTableDlg(SwView& rView, bool bToTable) = 0; + virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog(weld::Window *pParent, SwView &rV) = 0; + + virtual VclPtr<AbstractSwInsertDBColAutoPilot> CreateSwInsertDBColAutoPilot(SwView& rView, + css::uno::Reference< css::sdbc::XDataSource> rxSource, + css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp, + const SwDBData& rData) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh) = 0; + + virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Widget* pParent, SwWrtShell &rSh, + SwField* pField, bool bPrevButton, bool bNextButton) = 0; + virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Widget* pParent, sw::mark::IFieldmark* pDropDownField) = 0; + + virtual VclPtr<VclAbstractDialog> CreateDateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc* pDoc) = 0; + + virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) = 0; + + virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet, + SwDBManager* pDBManager, bool bLabel) = 0; + + virtual SwLabDlgMethod GetSwLabDlgStaticMethod () =0; + + virtual VclPtr<SfxAbstractTabDialog> CreateSwParaDlg(weld::Window *pParent, + SwView& rVw, + const SfxItemSet& rCoreSet, + bool bDraw, + const OString& sDefPage = OString() ) = 0; + + virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; + + virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) = 0; + + virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; + virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; + virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; + virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) = 0; + + virtual VclPtr<AbstractSwAutoFormatDlg> CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell, + bool bSetAutoFormat = true, + const SwTableAutoFormat* pSelFormat = nullptr ) = 0; + virtual VclPtr<SfxAbstractDialog> CreateSwBorderDlg(weld::Window* pParent, SfxItemSet& rSet, SwBorderModes nType) = 0; + virtual VclPtr<SfxAbstractDialog> CreateSwWrapDlg(weld::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh) = 0; + + virtual VclPtr<VclAbstractDialog> CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateSwTableTabDlg(weld::Window* pParent, + const SfxItemSet* pItemSet, SwWrtShell* pSh) = 0; + + virtual VclPtr<AbstractSwFieldDlg> CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent) = 0; + virtual VclPtr<SfxAbstractDialog> CreateSwFieldEditDlg ( SwView& rVw ) = 0; + virtual VclPtr<AbstractSwRenameXNamedDlg> CreateSwRenameXNamedDlg(weld::Window* pParent, + css::uno::Reference< css::container::XNamed > & xNamed, + css::uno::Reference< css::container::XNameAccess > & xNameAccess) = 0; + virtual VclPtr<AbstractSwModalRedlineAcceptDlg> CreateSwModalRedlineAcceptDlg(weld::Window *pParent) = 0; + + virtual VclPtr<VclAbstractDialog> CreateTableMergeDialog(weld::Window* pParent, bool& rWithPrev) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateFrameTabDialog(const OUString &rDialogType, + SfxViewFrame *pFrame, weld::Window *pParent, + const SfxItemSet& rCoreSet, + bool bNewFrame = true, + const OString& sDefPage = OString()) = 0; + /// @param nSlot + /// Identifies optional Slot by which the creation of the Template (Style) dialog is triggered. + /// Currently used, if nRegion == SfxStyleFamily::Page in order to activate certain dialog pane + virtual VclPtr<SfxAbstractApplyTabDialog> CreateTemplateDialog(weld::Window* pParent, + SfxStyleSheetBase& rBase, + SfxStyleFamily nRegion, + const OString& sPage, + SwWrtShell* pActShell, + bool bNew) = 0; + virtual VclPtr<AbstractGlossaryDlg> CreateGlossaryDlg(SfxViewFrame* pViewFrame, + SwGlossaryHdl* pGlosHdl, + SwWrtShell *pWrtShell) = 0; + virtual VclPtr<AbstractFieldInputDlg> CreateFieldInputDlg(weld::Widget *pParent, + SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) = 0; + virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg(weld::Window * pParent, + SwWrtShell &rSh, bool bEd = false) = 0; + virtual VclPtr<VclAbstractDialog> CreateTitlePageDlg(weld::Window* pParent) = 0; + virtual VclPtr<VclAbstractDialog> CreateVclSwViewDialog(SwView& rView) = 0; + virtual std::shared_ptr<AbstractInsTableDlg> CreateInsTableDlg(SwView& rView) = 0; + virtual VclPtr<AbstractJavaEditDialog> CreateJavaEditDialog(weld::Window* pParent, + SwWrtShell* pWrtSh) = 0; + virtual VclPtr<AbstractMailMergeDlg> CreateMailMergeDlg( + weld::Window* pParent, SwWrtShell& rSh, + const OUString& rSourceName, + const OUString& rTableName, + sal_Int32 nCommandType, + const css::uno::Reference< css::sdbc::XConnection>& xConnection ) = 0; + virtual VclPtr<AbstractMailMergeCreateFromDlg> CreateMailMergeCreateFromDlg(weld::Window* pParent) = 0; + virtual VclPtr<AbstractMailMergeFieldConnectionsDlg> CreateMailMergeFieldConnectionsDlg(weld::Window* pParent) = 0; + virtual VclPtr<VclAbstractDialog> CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateOutlineTabDialog(weld::Window* pParent, + const SfxItemSet* pSwItemSet, + SwWrtShell &) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateSvxNumBulletTabDialog(weld::Window* pParent, + const SfxItemSet* pSwItemSet, + SwWrtShell &) = 0; + virtual VclPtr<AbstractMultiTOXTabDialog> CreateMultiTOXTabDialog( + weld::Window* pParent, const SfxItemSet& rSet, + SwWrtShell &rShell, + SwTOXBase* pCurTOX, + bool bGlobal) = 0; + virtual VclPtr<AbstractEditRegionDlg> CreateEditRegionDlg(weld::Window* pParent, SwWrtShell& rWrtSh) = 0; + virtual VclPtr<AbstractInsertSectionTabDialog> CreateInsertSectionTabDialog(weld::Window* pParent, + const SfxItemSet& rSet, SwWrtShell& rSh) = 0; + virtual VclPtr<AbstractMarkFloatDlg> CreateIndexMarkFloatDlg( + SfxBindings* pBindings, + SfxChildWindow* pChild, + weld::Window *pParent, + SfxChildWinInfo* pInfo) = 0; + virtual VclPtr<AbstractMarkFloatDlg> CreateAuthMarkFloatDlg( + SfxBindings* pBindings, + SfxChildWindow* pChild, + weld::Window *pParent, + SfxChildWinInfo* pInfo) = 0; + virtual VclPtr<VclAbstractDialog> CreateIndexMarkModalDlg( + weld::Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark) = 0; + + virtual VclPtr<AbstractMailMergeWizard> CreateMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeConfigItem>& rConfigItem) = 0; + + virtual GlossaryGetCurrGroup GetGlossaryCurrGroupFunc() = 0; + virtual GlossarySetActGroup SetGlossaryActGroupFunc() = 0; + + // for tabpage + virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0; + + virtual void ExecuteMMResultSaveDialog(weld::Window* pParent) = 0; + virtual void ExecuteMMResultPrintDialog(weld::Window* pParent) = 0; + virtual void ExecuteMMResultEmailDialog(weld::Window* pParent) = 0; + +protected: + ~SwAbstractDialogFactory() {} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swacorr.hxx b/sw/inc/swacorr.hxx new file mode 100644 index 000000000..db08c09c5 --- /dev/null +++ b/sw/inc/swacorr.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWACORR_HXX +#define INCLUDED_SW_INC_SWACORR_HXX + +#include <memory> +#include <editeng/svxacorr.hxx> + +#include <com/sun/star/uno/Reference.h> + +#include "swdllapi.h" + +class SwXMLTextBlocks; +namespace com::sun::star::embed { class XStorage; } + +class SW_DLLPUBLIC SwAutoCorrect final : public SvxAutoCorrect +{ + using SvxAutoCorrect::PutText; + + std::unique_ptr<SwXMLTextBlocks> m_pTextBlocks; + + // Return replacement text (only for SWG-format, all others can be obtained from wordlist!). + // rShort is stream-name - encrypted! + virtual bool GetLongText( const OUString& rShort, OUString& rLong ) override; + + virtual void refreshBlockList( const css::uno::Reference < css::embed::XStorage >& ) override; + + // Text with attributes (only SWG-format!). + // rShort is stream-name - encrypted! + virtual bool PutText( const css::uno::Reference < css::embed::XStorage >&, + const OUString& rFileName, const OUString& rShort, SfxObjectShell&, OUString& ) override; + +public: + SwAutoCorrect( const SvxAutoCorrect& rACorr ); + virtual ~SwAutoCorrect() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx new file mode 100644 index 000000000..fc9f034bc --- /dev/null +++ b/sw/inc/swatrset.hxx @@ -0,0 +1,327 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWATRSET_HXX +#define INCLUDED_SW_INC_SWATRSET_HXX + +#include <svl/itemset.hxx> +#include <svl/itempool.hxx> +#include "swdllapi.h" + +class SwModify; +class SwDoc; +class OutputDevice; +class IDocumentSettingAccess; +class SvxPostureItem; +class SvxWeightItem; +class SvxShadowedItem; +class SvxAutoKernItem; +class SvxWordLineModeItem; +class SvxContourItem; +class SvxKerningItem; +class SvxUnderlineItem; +class SvxOverlineItem; +class SvxCrossedOutItem; +class SvxFontHeightItem; +class SvxFontItem; +class SvxColorItem; +class SvxLanguageItem; +class SvxEscapementItem; +class SvxCaseMapItem; +class SvxNoHyphenItem; +class SvxBlinkItem; +class SvxEmphasisMarkItem; +class SvxTwoLinesItem; +class SvxCharScaleWidthItem; +class SvxCharRotateItem; +class SvxCharReliefItem; +class SvxCharHiddenItem; + +// Frame attributes +class SwFormatFillOrder; +class SwFormatFrameSize; +class SvxPaperBinItem; +class SvxLRSpaceItem; +class SvxULSpaceItem; +class SwFormatContent; +class SwFormatHeader; +class SwFormatFooter; +class SvxPrintItem; +class SvxOpaqueItem; +class SvxProtectItem; +class SwFormatSurround; +class SwFormatVertOrient; +class SwFormatHoriOrient; +class SwFormatAnchor; +class SvxBoxItem; +class SvxBrushItem; +class SvxShadowItem; +class SwFormatPageDesc; +class SvxFormatBreakItem; +class SwFormatCol; +class SvxMacroItem; +class SvxFormatKeepItem; +class SwFormatURL; +class SwFormatLineNumber; +class SwFormatEditInReadonly; +class SwFormatLayoutSplit; +class SwFormatRowSplit; +class SwFormatChain; +class SwFormatFootnoteAtTextEnd; +class SwFormatEndAtTextEnd; +class SwFormatNoBalancedColumns; +class SvxFrameDirectionItem; +class SwHeaderAndFooterEatSpacingItem; +class SwFormatFollowTextFlow; +class SwFormatWrapInfluenceOnObjPos; +class SdrTextVertAdjustItem; + +// Graphic attributes +class SwMirrorGrf; +class SwCropGrf; +class SwRotationGrf; +class SwLuminanceGrf; +class SwContrastGrf; +class SwChannelRGrf; +class SwChannelGGrf; +class SwChannelBGrf; +class SwGammaGrf; +class SwInvertGrf; +class SwTransparencyGrf; +class SwDrawModeGrf; + +// Paragraph attributes +class SvxLineSpacingItem; +class SvxAdjustItem; +class SvxFormatSplitItem; +class SwRegisterItem; +class SwNumRuleItem; +class SvxWidowsItem; +class SvxOrphansItem; +class SvxTabStopItem; +class SvxHyphenZoneItem; +class SwFormatDrop; +class SvxScriptSpaceItem; +class SvxHangingPunctuationItem; +class SvxForbiddenRuleItem; +class SvxParaVertAlignItem; +class SvxParaGridItem; +class SwParaConnectBorderItem; + +// TableBox attributes +class SwTableBoxNumFormat; +class SwTableBoxFormula; +class SwTableBoxValue; + +namespace vcl { + typedef OutputDevice RenderContext; +}; + +class SAL_DLLPUBLIC_RTTI SwAttrPool final : public SfxItemPool +{ +private: + // helpers to add/remove DrawingLayer ItemPool, used in constructor + // and destructor; still isolated to evtl. allow other use later, but + // used bz default now to have it instantly as needed for DrawingLayer + // FillStyle support + void createAndAddSecondaryPools(); + void removeAndDeleteSecondaryPools(); + + friend void InitCore(); // For creating/deleting of version maps. + friend void FinitCore(); + + SwDoc* m_pDoc; + +public: + SwAttrPool( SwDoc* pDoc ); +private: + virtual ~SwAttrPool() override; +public: + + SwDoc* GetDoc() { return m_pDoc; } + const SwDoc* GetDoc() const { return m_pDoc; } + +}; + +class SW_DLLPUBLIC SwAttrSet final : public SfxItemSet +{ + // Pointer for Modify-System + SwAttrSet *m_pOldSet, *m_pNewSet; + + // Notification-Callback + virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew ) override; + + void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); } +public: + SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 ); + SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable ); + SwAttrSet( const SwAttrSet& ); + + virtual std::unique_ptr<SfxItemSet> Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const override; + + bool Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew ); + bool Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew ); + + // Delete an item or a range. + sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew ); + sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2, + SwAttrSet* pOld = nullptr, SwAttrSet* pNew = nullptr ); + + int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew ); + + void GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const; + + SwAttrPool* GetPool() const { return static_cast<SwAttrPool*>(SfxItemSet::GetPool()); } + + // Copy attributes, if necessary across documents. + void CopyToModify( SwModify& rMod ) const; + + // Special treatment for some attributes. + // Set Modify-pointer (the old pDefinedIn) at the following attributes: + // - SwFormatDropCaps + // - SwFormatPageDesc + // (Is called at insert in formats/nodes.) + // Second version is for the SwAttrSet handles of SwContentNode. + bool SetModifyAtAttr( const SwModify* pModify ); + + // Document is set at SwAttrPool. Therefore it is always accessible. + const SwDoc *GetDoc() const { return GetPool()->GetDoc(); } + SwDoc *GetDoc() { return GetPool()->GetDoc(); } + + // Get methods: bool indicates whether to search only in Set (when false) + // or also in parents. If nothing is found then default attribute is returned. + // Character attributes. Implementation in charatr.hxx. + inline const SvxPostureItem &GetPosture( bool = true ) const; + inline const SvxWeightItem &GetWeight( bool = true ) const; + inline const SvxShadowedItem &GetShadowed( bool = true ) const; + inline const SvxAutoKernItem &GetAutoKern( bool = true ) const; + inline const SvxWordLineModeItem &GetWordLineMode( bool = true ) const; + inline const SvxContourItem &GetContour( bool = true ) const; + inline const SvxKerningItem &GetKerning( bool = true ) const; + inline const SvxUnderlineItem &GetUnderline( bool = true ) const; + inline const SvxOverlineItem &GetOverline( bool = true ) const; + inline const SvxCrossedOutItem &GetCrossedOut( bool = true ) const; + inline const SvxFontHeightItem &GetSize( bool = true ) const; + inline const SvxFontItem &GetFont( bool = true ) const; + inline const SvxColorItem &GetColor( bool = true ) const; + inline const SvxLanguageItem &GetLanguage( bool = true ) const; + inline const SvxEscapementItem &GetEscapement( bool = true ) const; + inline const SvxCaseMapItem &GetCaseMap( bool = true ) const; + inline const SvxNoHyphenItem &GetNoHyphenHere( bool = true ) const; + inline const SvxFontItem &GetCJKFont( bool = true ) const; + inline const SvxFontHeightItem &GetCJKSize( bool = true ) const; + inline const SvxLanguageItem &GetCJKLanguage( bool = true ) const; + inline const SvxPostureItem &GetCJKPosture( bool = true ) const; + inline const SvxWeightItem &GetCJKWeight( bool = true ) const; + inline const SvxFontItem &GetCTLFont( bool = true ) const; + inline const SvxFontHeightItem &GetCTLSize( bool = true ) const; + inline const SvxLanguageItem &GetCTLLanguage( bool = true ) const; + inline const SvxPostureItem &GetCTLPosture( bool = true ) const; + inline const SvxWeightItem &GetCTLWeight( bool = true ) const; + inline const SvxEmphasisMarkItem &GetEmphasisMark( bool = true ) const; + inline const SvxTwoLinesItem &Get2Lines( bool = true ) const; + inline const SvxCharScaleWidthItem &GetCharScaleW( bool = true ) const; + inline const SvxCharRotateItem &GetCharRotate( bool = true ) const; + inline const SvxCharReliefItem &GetCharRelief( bool = true ) const; + inline const SvxCharHiddenItem &GetCharHidden( bool = true ) const; + + // Frame attributes. Implementation in frmatr.hxx. + inline const SwFormatFillOrder &GetFillOrder( bool = true ) const; + inline const SwFormatFrameSize &GetFrameSize( bool = true ) const; + inline const SvxPaperBinItem &GetPaperBin( bool = true ) const; + inline const SvxLRSpaceItem &GetLRSpace( bool = true ) const; + inline const SvxULSpaceItem &GetULSpace( bool = true ) const; + inline const SwFormatContent &GetContent( bool = true ) const; + inline const SwFormatHeader &GetHeader( bool = true ) const; + inline const SwFormatFooter &GetFooter( bool = true ) const; + inline const SvxPrintItem &GetPrint( bool = true ) const; + inline const SvxOpaqueItem &GetOpaque( bool = true ) const; + inline const SvxProtectItem &GetProtect( bool = true ) const; + inline const SwFormatSurround &GetSurround( bool = true ) const; + inline const SwFormatVertOrient &GetVertOrient( bool = true ) const; + inline const SwFormatHoriOrient &GetHoriOrient( bool = true ) const; + inline const SwFormatAnchor &GetAnchor( bool = true ) const; + inline const SvxBoxItem &GetBox( bool = true ) const; + inline const SvxFormatKeepItem &GetKeep( bool = true ) const; + inline const SvxBrushItem &GetBackground( bool = true ) const; + inline const SvxShadowItem &GetShadow( bool = true ) const; + inline const SwFormatPageDesc &GetPageDesc( bool = true ) const; + inline const SvxFormatBreakItem &GetBreak( bool = true ) const; + inline const SwFormatCol &GetCol( bool = true ) const; + inline const SvxMacroItem &GetMacro( bool = true ) const; + inline const SwFormatURL &GetURL( bool = true ) const; + inline const SwFormatEditInReadonly &GetEditInReadonly( bool = true ) const; + inline const SwFormatLayoutSplit &GetLayoutSplit( bool = true ) const; + inline const SwFormatRowSplit &GetRowSplit( bool = true ) const; + inline const SwFormatChain &GetChain( bool = true ) const; + inline const SwFormatLineNumber &GetLineNumber( bool = true ) const; + inline const SwFormatFootnoteAtTextEnd &GetFootnoteAtTextEnd( bool = true ) const; + inline const SwFormatEndAtTextEnd &GetEndAtTextEnd( bool = true ) const; + inline const SwFormatNoBalancedColumns &GetBalancedColumns( bool = true ) const; + inline const SvxFrameDirectionItem &GetFrameDir( bool = true ) const; + inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( bool = true ) const; + inline const SwFormatFollowTextFlow &GetFollowTextFlow(bool = true) const; + inline const SwFormatWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(bool = true) const; + inline const SdrTextVertAdjustItem& GetTextVertAdjust(bool = true) const; + + // Graphic attributes - implementation in grfatr.hxx + inline const SwMirrorGrf &GetMirrorGrf( bool = true ) const; + inline const SwCropGrf &GetCropGrf( bool = true ) const; + inline const SwRotationGrf &GetRotationGrf(bool = true ) const; + inline const SwLuminanceGrf &GetLuminanceGrf(bool = true ) const; + inline const SwContrastGrf &GetContrastGrf(bool = true ) const; + inline const SwChannelRGrf &GetChannelRGrf(bool = true ) const; + inline const SwChannelGGrf &GetChannelGGrf(bool = true ) const; + inline const SwChannelBGrf &GetChannelBGrf(bool = true ) const; + inline const SwGammaGrf &GetGammaGrf(bool = true ) const; + inline const SwInvertGrf &GetInvertGrf(bool = true ) const; + inline const SwTransparencyGrf &GetTransparencyGrf(bool = true ) const; + inline const SwDrawModeGrf &GetDrawModeGrf(bool = true ) const; + + // Paragraph attributes - implementation in paratr.hxx + inline const SvxLineSpacingItem &GetLineSpacing( bool = true ) const; + inline const SvxAdjustItem &GetAdjust( bool = true ) const; + inline const SvxFormatSplitItem &GetSplit( bool = true ) const; + inline const SwRegisterItem &GetRegister( bool = true ) const; + inline const SwNumRuleItem &GetNumRule( bool = true ) const; + inline const SvxWidowsItem &GetWidows( bool = true ) const; + inline const SvxOrphansItem &GetOrphans( bool = true ) const; + inline const SvxTabStopItem &GetTabStops( bool = true ) const; + inline const SvxHyphenZoneItem &GetHyphenZone( bool = true ) const; + inline const SwFormatDrop &GetDrop( bool = true ) const; + inline const SvxScriptSpaceItem &GetScriptSpace(bool = true) const; + inline const SvxHangingPunctuationItem &GetHangingPunctuation(bool = true) const; + inline const SvxForbiddenRuleItem &GetForbiddenRule(bool = true) const; + inline const SvxParaVertAlignItem &GetParaVertAlign(bool = true) const; + inline const SvxParaGridItem &GetParaGrid(bool = true) const; + inline const SwParaConnectBorderItem &GetParaConnectBorder(bool = true ) const; + + // Tablebox attributes - implementation in cellatr.hxx + inline const SwTableBoxNumFormat &GetTableBoxNumFormat( bool = true ) const; + inline const SwTableBoxFormula &GetTableBoxFormula( bool = true ) const; + inline const SwTableBoxValue &GetTableBoxValue( bool = true ) const; +}; + +//Helper for filters to find true lineheight of a font +SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess, + const SwAttrSet &rSet, + const vcl::RenderContext &rOut, sal_Int16 nScript); +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swbaslnk.hxx b/sw/inc/swbaslnk.hxx new file mode 100644 index 000000000..3604c1511 --- /dev/null +++ b/sw/inc/swbaslnk.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWBASLNK_HXX +#define INCLUDED_SW_INC_SWBASLNK_HXX + +#include <sfx2/lnkbase.hxx> +#include <tools/solar.h> + +class SwNode; +class SwContentNode; + +class SwBaseLink : public ::sfx2::SvBaseLink +{ + SwContentNode* m_pContentNode; + bool m_bNoDataFlag : 1; + +public: + + SwBaseLink( SfxLinkUpdateMode nMode, SotClipboardFormatId nFormat, SwContentNode* pNode = nullptr ) + : ::sfx2::SvBaseLink( nMode, nFormat ), m_pContentNode( pNode ), + m_bNoDataFlag( false ) + {} + virtual ~SwBaseLink() override; + + virtual ::sfx2::SvBaseLink::UpdateResult DataChanged( + const OUString& rMimeType, const css::uno::Any & rValue ) override; + + virtual void Closed() override; + + virtual const SwNode* GetAnchor() const; + + // For graphics only. + bool SwapIn( bool bWaitForData = false, bool bNativFormat = false ); + + void Connect() { SvBaseLink::GetRealObject(); } + + // Only for graphics-links (for switching between DDE / Grf-link). + using SvBaseLink::SetObjType; + + bool IsRecursion( const SwBaseLink* pChkLnk ) const; + virtual bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const; + + void SetNoDataFlag() { m_bNoDataFlag = true; } + bool ChkNoDataFlag() { const bool bRet = m_bNoDataFlag; m_bNoDataFlag = false; return bRet; } + bool IsNoDataFlag() const { return m_bNoDataFlag; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swcalwrp.hxx b/sw/inc/swcalwrp.hxx new file mode 100644 index 000000000..c4e6b0d63 --- /dev/null +++ b/sw/inc/swcalwrp.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWCALWRP_HXX +#define INCLUDED_SW_INC_SWCALWRP_HXX + +#include <i18nlangtag/lang.h> +#include <unotools/calendarwrapper.hxx> +#include <comphelper/processfactory.hxx> + +namespace salhelper +{ +template <typename> class SingletonRef; +} + +class SwCalendarWrapper : public CalendarWrapper +{ + LanguageType m_nLang; + +public: + SwCalendarWrapper( const css::uno::Reference< css::uno::XComponentContext > & rxContext = ::comphelper::getProcessComponentContext() ) + : CalendarWrapper( rxContext ), m_nLang( LANGUAGE_SYSTEM ) + {} + + void LoadDefaultCalendar( LanguageType nLang ); +}; + +salhelper::SingletonRef<SwCalendarWrapper>* s_getCalendarWrapper(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swcli.hxx b/sw/inc/swcli.hxx new file mode 100644 index 000000000..0a6b65a33 --- /dev/null +++ b/sw/inc/swcli.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWCLI_HXX +#define INCLUDED_SW_INC_SWCLI_HXX +#include <sfx2/ipclient.hxx> + +class SwView; +class SwEditWin; +namespace svt +{ +class EmbeddedObjectRef; +} + +class SwOleClient final : public SfxInPlaceClient +{ + bool m_IsInDoVerb; + bool m_IsOldCheckForOLEInCaption; + + virtual void ObjectAreaChanged() override; + virtual void RequestNewObjectArea( tools::Rectangle& ) override; + virtual void ViewChanged() override; + +public: + SwOleClient( SwView *pView, SwEditWin *pWin, const svt::EmbeddedObjectRef& ); + + void SetInDoVerb(bool const bFlag) { m_IsInDoVerb = bFlag; } + + bool IsCheckForOLEInCaption() const { return m_IsOldCheckForOLEInCaption; } + + virtual void FormatChanged() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h new file mode 100644 index 000000000..ac50f3e38 --- /dev/null +++ b/sw/inc/swcommands.h @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWCOMMANDS_H +#define INCLUDED_SW_INC_SWCOMMANDS_H + +#define CMD_FN_READONLY_SELECTION_MODE ".uno:SelectTextMode" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx new file mode 100644 index 000000000..a6e634ac3 --- /dev/null +++ b/sw/inc/swcrsr.hxx @@ -0,0 +1,315 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWCRSR_HXX +#define INCLUDED_SW_INC_SWCRSR_HXX + +#include "pam.hxx" +#include "tblsel.hxx" +#include "cshtyp.hxx" + +class SfxItemSet; +struct SwCursor_SavePos; +class SvxSearchItem; +namespace i18nutil { + struct SearchOptions2; +} + +// Base structure for parameters of the find-methods. +// Returns values of found-call. +const int FIND_NOT_FOUND = 0; +const int FIND_FOUND = 1; +const int FIND_NO_RING = 2; + +struct SwFindParas +{ + // @param xSearchItem allocate in parent so we can do so outside the calling loop + virtual int DoFind(SwPaM &, SwMoveFnCollection const &, const SwPaM&, bool, std::unique_ptr<SvxSearchItem>& xSearchItem) = 0; + virtual bool IsReplaceMode() const = 0; + +protected: + ~SwFindParas() {} +}; + +enum class SwCursorSelOverFlags : sal_uInt16 +{ + NONE = 0x00, + CheckNodeSection = 0x01, + Toggle = 0x02, + EnableRevDirection = 0x04, + ChangePos = 0x08 +}; +namespace o3tl { + template<> struct typed_flags<SwCursorSelOverFlags> : is_typed_flags<SwCursorSelOverFlags, 0x0f> {}; +} + +// define for cursor travelling normally in western text cells and chars do +// the same, but in complex text cell skip over ligatures and char skip +// into it. +// These defines exist only to cut off the dependencies to I18N project. +const sal_uInt16 CRSR_SKIP_CHARS = 0; +const sal_uInt16 CRSR_SKIP_CELLS = 1; +const sal_uInt16 CRSR_SKIP_HIDDEN = 2; + + +class SW_DLLPUBLIC SwCursor : public SwPaM +{ + friend class SwCursorSaveState; + + std::vector<SwCursor_SavePos> m_vSavePos; // the current entry is the last element + long m_nRowSpanOffset; // required for travelling in tabs with rowspans + sal_uInt8 m_nCursorBidiLevel; // bidi level of the cursor + bool m_bColumnSelection; // true: cursor is aprt of a column selection + + sal_uLong FindAll( SwFindParas& , SwDocPositions, SwDocPositions, FindRanges, bool& bCancel ); + + SwCursor(SwCursor const& rPaM) = delete; + +protected: + void SaveState(); + void RestoreState(); + + const SwCursor_SavePos* GetSavePos() const { return m_vSavePos.empty() ? nullptr : &m_vSavePos.back(); } + + virtual const SwContentFrame* DoSetBidiLevelLeftRight( + bool & io_rbLeft, bool bVisualAllowed, bool bInsertCursor); + virtual void DoSetBidiLevelUpDown(); + virtual bool IsSelOvrCheck(SwCursorSelOverFlags eFlags); + +public: + // single argument ctors shall be explicit. + SwCursor( const SwPosition &rPos, SwPaM* pRing ); + virtual ~SwCursor() override; + + SwCursor & operator =(SwCursor const &) = default; + + /// this takes a second parameter, which indicates the Ring that + /// the new cursor should be part of (may be null) + SwCursor(SwCursor const& rCursor, SwPaM* pRing); + +public: + + virtual SwCursor* Create( SwPaM* pRing = nullptr ) const; + + virtual short MaxReplaceArived(); //returns RET_YES/RET_CANCEL/RET_NO + virtual void SaveTableBoxContent( const SwPosition* pPos ); + + void FillFindPos( SwDocPositions ePos, SwPosition& rPos ) const; + SwMoveFnCollection const & MakeFindRange( SwDocPositions, SwDocPositions, + SwPaM* ) const; + + // note: DO NOT call it FindText because windows.h + sal_uLong Find_Text( const i18nutil::SearchOptions2& rSearchOpt, + bool bSearchInNotes, + SwDocPositions nStart, SwDocPositions nEnd, + bool& bCancel, + FindRanges, + bool bReplace = false, + SwRootFrame const*const pLayout = nullptr); + sal_uLong FindFormat( const SwTextFormatColl& rFormatColl, + SwDocPositions nStart, SwDocPositions nEnd, + bool& bCancel, + FindRanges, + const SwTextFormatColl* pReplFormat, + SwRootFrame const*const pLayout = nullptr); + sal_uLong FindAttrs( const SfxItemSet& rSet, bool bNoCollections, + SwDocPositions nStart, SwDocPositions nEnd, + bool& bCancel, + FindRanges, + const i18nutil::SearchOptions2* pSearchOpt, + const SfxItemSet* rReplSet = nullptr, + SwRootFrame const*const pLayout = nullptr); + + // UI versions + bool IsStartEndSentence(bool bEnd, SwRootFrame const* pLayout) const; + bool SelectWord( SwViewShell const * pViewShell, const Point* pPt ); + + // API versions of above functions (will be used with a different + // WordType for the break iterator) + bool IsStartWordWT(sal_Int16 nWordType, SwRootFrame const* pLayout = nullptr) const; + bool IsEndWordWT(sal_Int16 nWordType, SwRootFrame const* pLayout = nullptr) const; + bool IsInWordWT(sal_Int16 nWordType, SwRootFrame const* pLayout = nullptr) const; + bool GoStartWordWT(sal_Int16 nWordType, SwRootFrame const* pLayout = nullptr); + bool GoEndWordWT(sal_Int16 nWordType, SwRootFrame const* pLayout = nullptr); + bool GoNextWordWT(sal_Int16 nWordType, SwRootFrame const* pLayout = nullptr); + bool GoPrevWordWT(sal_Int16 nWordType, SwRootFrame const* pLayout = nullptr); + bool SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType, const Point* pPt ); + + enum SentenceMoveType + { + NEXT_SENT, + PREV_SENT, + START_SENT, + END_SENT + }; + bool GoSentence(SentenceMoveType eMoveType, SwRootFrame const*pLayout = nullptr); + bool ExpandToSentenceBorders(SwRootFrame const* pLayout); + + virtual bool LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, + bool bAllowVisual, bool bSkipHidden, bool bInsertCursor, + SwRootFrame const* pLayout); + bool UpDown(bool bUp, sal_uInt16 nCnt, Point const * pPt, long nUpDownX, SwRootFrame & rLayout); + bool LeftRightMargin(SwRootFrame const& rLayout, bool bLeftMargin, bool bAPI); + bool IsAtLeftRightMargin(SwRootFrame const& rLayout, bool bLeftMargin, bool bAPI) const; + bool SttEndDoc( bool bSttDoc ); + bool GoPrevNextCell( bool bNext, sal_uInt16 nCnt ); + + bool Left( sal_uInt16 nCnt ) { return LeftRight( true, nCnt, CRSR_SKIP_CHARS, false/*bAllowVisual*/, false/*bSkipHidden*/, false, nullptr ); } + bool Right( sal_uInt16 nCnt ) { return LeftRight( false, nCnt, CRSR_SKIP_CHARS, false/*bAllowVisual*/, false/*bSkipHidden*/, false, nullptr ); } + bool GoNextCell( sal_uInt16 nCnt = 1 ) { return GoPrevNextCell( true, nCnt ); } + bool GoPrevCell( sal_uInt16 nCnt = 1 ) { return GoPrevNextCell( false, nCnt ); } + virtual bool GotoTable( const OUString& rName ); + bool GotoTableBox( const OUString& rName ); + bool GotoRegion( const OUString& rName ); + bool GotoFootnoteAnchor(); + bool GotoFootnoteText(); + bool GotoNextFootnoteAnchor(); + bool GotoPrevFootnoteAnchor(); + + bool MovePara( SwWhichPara, SwMoveFnCollection const & ); + bool MoveSection( SwWhichSection, SwMoveFnCollection const & ); + bool MoveTable( SwWhichTable, SwMoveFnCollection const & ); + bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & ); + + // Is there a selection of content in table? + // Return value indicates if cursor remains at its old position. + virtual bool IsSelOvr( SwCursorSelOverFlags eFlags = + SwCursorSelOverFlags::CheckNodeSection | + SwCursorSelOverFlags::Toggle | + SwCursorSelOverFlags::ChangePos ); + bool IsInProtectTable( bool bMove = false, + bool bChgCursor = true ); + bool IsNoContent() const; + + /** Restore cursor state to the one saved by SwCursorSaveState **/ + void RestoreSavePos(); + + // true: cursor can be set at this position. + virtual bool IsAtValidPos( bool bPoint = true ) const; + + // Is cursor allowed in ready only ranges? + virtual bool IsReadOnlyAvailable() const; + + virtual bool IsSkipOverProtectSections() const; + virtual bool IsSkipOverHiddenSections() const; + + sal_uInt8 GetCursorBidiLevel() const { return m_nCursorBidiLevel; } + void SetCursorBidiLevel( sal_uInt8 nNewLevel ) { m_nCursorBidiLevel = nNewLevel; } + + bool IsColumnSelection() const { return m_bColumnSelection; } + void SetColumnSelection( bool bNew ) { m_bColumnSelection = bNew; } + + long GetCursorRowSpanOffset() const { return m_nRowSpanOffset; } + + SwCursor* GetNext() { return dynamic_cast<SwCursor *>(GetNextInRing()); } + const SwCursor* GetNext() const { return dynamic_cast<SwCursor const *>(GetNextInRing()); } + SwCursor* GetPrev() { return dynamic_cast<SwCursor *>(GetPrevInRing()); } + const SwCursor* GetPrev() const { return dynamic_cast<SwCursor const *>(GetPrevInRing()); } +}; + +/** + A helper class to save cursor state (position). Create SwCursorSaveState + object to save current state, use SwCursor::RestoreSavePos() to actually + restore cursor state to the saved state (SwCursorSaveState destructor only + removes the saved state from an internal stack). It is possible to stack + several SwCursorSaveState objects. +**/ +class SwCursorSaveState +{ +private: + SwCursor& m_rCursor; +public: + SwCursorSaveState( SwCursor& rC ) : m_rCursor( rC ) { rC.SaveState(); } + ~SwCursorSaveState() { m_rCursor.RestoreState(); } +}; + +// internal, used by SwCursor::SaveState() etc. +struct SwCursor_SavePos final +{ + sal_uLong nNode; + sal_Int32 nContent; + + SwCursor_SavePos( const SwCursor& rCursor ) + : nNode( rCursor.GetPoint()->nNode.GetIndex() ), + nContent( rCursor.GetPoint()->nContent.GetIndex() ) + {} +}; + +class SwTableCursor : public virtual SwCursor +{ + +protected: + sal_uLong m_nTablePtNd; + sal_uLong m_nTableMkNd; + sal_Int32 m_nTablePtCnt; + sal_Int32 m_nTableMkCnt; + SwSelBoxes m_SelectedBoxes; + bool m_bChanged : 1; + bool m_bParked : 1; // Table-cursor was parked. + + virtual bool IsSelOvrCheck(SwCursorSelOverFlags eFlags) override; + +public: + SwTableCursor( const SwPosition &rPos ); + SwTableCursor( SwTableCursor& ); + virtual ~SwTableCursor() override; + + virtual bool LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, + bool bAllowVisual, bool bSkipHidden, bool bInsertCursor, + SwRootFrame const*) override; + virtual bool GotoTable( const OUString& rName ) override; + + void InsertBox( const SwTableBox& rTableBox ); + void DeleteBox(size_t nPos); + size_t GetSelectedBoxesCount() const { return m_SelectedBoxes.size(); } + const SwSelBoxes& GetSelectedBoxes() const { return m_SelectedBoxes; } + + // Creates cursor for all boxes. + SwCursor* MakeBoxSels( SwCursor* pCurrentCursor ); + // Any boxes protected? + bool HasReadOnlyBoxSel() const; + + // Has table cursor been changed? If so, save new values immediately. + bool IsCursorMovedUpdate(); + // Has table cursor been changed? + bool IsCursorMoved() const + { + return m_nTableMkNd != GetMark()->nNode.GetIndex() || + m_nTablePtNd != GetPoint()->nNode.GetIndex() || + m_nTableMkCnt != GetMark()->nContent.GetIndex() || + m_nTablePtCnt != GetPoint()->nContent.GetIndex(); + } + + bool IsChgd() const { return m_bChanged; } + void SetChgd() { m_bChanged = true; } + + // Park table cursor at start node of boxes. + void ParkCursor(); + + bool NewTableSelection(); + void ActualizeSelection( const SwSelBoxes &rBoxes ); + + SwTableCursor* GetNext() { return dynamic_cast<SwTableCursor *>(GetNextInRing()); } + const SwTableCursor* GetNext() const { return dynamic_cast<SwTableCursor const *>(GetNextInRing()); } + SwTableCursor* GetPrev() { return dynamic_cast<SwTableCursor *>(GetPrevInRing()); } + const SwTableCursor* GetPrev() const { return dynamic_cast<SwTableCursor const *>(GetPrevInRing()); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swdbdata.hxx b/sw/inc/swdbdata.hxx new file mode 100644 index 000000000..d691336f6 --- /dev/null +++ b/sw/inc/swdbdata.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWDBDATA_HXX +#define INCLUDED_SW_INC_SWDBDATA_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> + +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +// contains the description of a data source +struct SwDBData +{ + OUString sDataSource; + OUString sCommand; //table, query or statement + sal_Int32 nCommandType; //css::sdb::CommandType + SwDBData() : + nCommandType(0){} + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + bool operator !=(const SwDBData& rCmp) const + {return rCmp.sDataSource != sDataSource || rCmp.sCommand != sCommand || rCmp.nCommandType != nCommandType;} + bool operator ==(const SwDBData& rCmp) const + {return rCmp.sDataSource == sDataSource && rCmp.sCommand == sCommand && rCmp.nCommandType == nCommandType;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swddetbl.hxx b/sw/inc/swddetbl.hxx new file mode 100644 index 000000000..80b759337 --- /dev/null +++ b/sw/inc/swddetbl.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWDDETBL_HXX +#define INCLUDED_SW_INC_SWDDETBL_HXX + +#include "swtable.hxx" + +class SwDDEFieldType; + +class SwDDETable final : public SwTable +{ + sw::WriterMultiListener m_aDepends; + SwDDEFieldType* m_pDDEType; +public: + + // Ctor moves all lines/boxes from SwTable to it. + // After that SwTable is empty and has to be deleted. + SwDDETable( SwTable& rTable, SwDDEFieldType* pDDEType, + bool bUpdate = true ); + virtual ~SwDDETable() override; + + void ChangeContent(); + bool NoDDETable(); + + SwDDEFieldType* GetDDEFieldType(); + inline const SwDDEFieldType* GetDDEFieldType() const; +private: + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override; + virtual void SwClientNotify( const SwModify&, const SfxHint& ) override; +}; + +inline const SwDDEFieldType* SwDDETable::GetDDEFieldType() const +{ + return const_cast<SwDDETable*>(this)->GetDDEFieldType(); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swdll.hxx b/sw/inc/swdll.hxx new file mode 100644 index 000000000..9cc9b3c8b --- /dev/null +++ b/sw/inc/swdll.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWDLL_HXX +#define INCLUDED_SW_INC_SWDLL_HXX + +#include "swdllapi.h" + +namespace sw { class Filters; } + +/** + * This class is a wrapper for a Load-On-Demand-DLL. One instance + * per SfxApplication will be created for the runtime of + * SfxApplication-subclass::Main(). +*/ +namespace SwGlobals +{ + void SW_DLLPUBLIC ensure(); + + sw::Filters & getFilters(); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swdllapi.h b/sw/inc/swdllapi.h new file mode 100644 index 000000000..ceca351ee --- /dev/null +++ b/sw/inc/swdllapi.h @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWDLLAPI_H +#define INCLUDED_SW_INC_SWDLLAPI_H + +#include <sal/types.h> + +#if defined(SW_DLLIMPLEMENTATION) +#define SW_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define SW_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#endif // INCLUDED_SW_INC_SWDLLAPI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swerror.h b/sw/inc/swerror.h new file mode 100644 index 000000000..87505ff00 --- /dev/null +++ b/sw/inc/swerror.h @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWERROR_H +#define INCLUDED_SW_INC_SWERROR_H + +// Import & Export +#define ERR_SWG_FILE_FORMAT_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 1 ) +#define ERR_SWG_READ_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 2 ) +#define ERR_WW6_NO_WW6_FILE_ERR ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 8 ) +#define ERR_FORMAT_ROWCOL ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 12) +#define ERR_WW8_NO_WW8_FILE_ERR ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 14) +#define ERR_FORMAT_FILE_ROWCOL ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 15) +#define ERR_SWG_WRITE_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::Write, 30 ) +#define ERR_SWG_OLD_GLOSSARY ErrCode(ErrCodeArea::Sw, ErrCodeClass::Write, 31 ) +#define ERR_WRITE_ERROR_FILE ErrCode(ErrCodeArea::Sw, ErrCodeClass::Write, 35 ) +#define ERR_SWG_INTERNAL_ERROR ErrCode(ErrCodeArea::Sw, 50 ) +#define ERR_TXTBLOCK_NEWFILE_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::Locking, 55 ) +#define ERR_AUTOPATH_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::Path, 55 ) +#define ERR_TBLSPLIT_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::NONE, 56 ) +#define ERR_TBLINSCOL_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::NONE, 57 ) +#define ERR_TBLDDECHG_ERROR ErrCode(ErrCodeArea::Sw, ErrCodeClass::NONE, 58 ) +#define WARN_SWG_FEATURES_LOST ErrCode(WarningFlag::Yes, ErrCodeArea::Sw, ErrCodeClass::NONE, 72 ) +#define WARN_SWG_POOR_LOAD ErrCode(WarningFlag::Yes, ErrCodeArea::Sw, ErrCodeClass::Write, 74 ) +#define WARN_SWG_HTML_NO_MACROS ErrCode(WarningFlag::Yes, ErrCodeArea::Sw, ErrCodeClass::Write, 75) +#define WARN_WRITE_ERROR_FILE ErrCode(WarningFlag::Yes, ErrCodeArea::Sw, ErrCodeClass::Write, 76) +#define WARN_FORMAT_FILE_ROWCOL ErrCode(WarningFlag::Yes, ErrCodeArea::Sw, ErrCodeClass::Read, 77) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx new file mode 100644 index 000000000..558f834a9 --- /dev/null +++ b/sw/inc/swevent.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWEVENT_HXX +#define INCLUDED_SW_INC_SWEVENT_HXX + +#include "calbck.hxx" +#include "frmfmt.hxx" +#include "hints.hxx" + +#define STR_SW_EVENT_PAGE_COUNT 0 +#define STR_SW_EVENT_MAIL_MERGE 1 +#define STR_SW_EVENT_MAIL_MERGE_END 2 +#define STR_SW_EVENT_FIELD_MERGE 3 +#define STR_SW_EVENT_FIELD_MERGE_FINISHED 4 +#define STR_SW_EVENT_LAYOUT_FINISHED 5 +#define STR_SW_EVENT_OBJECT_SELECT 6 +#define STR_SW_EVENT_START_INS_GLOSSARY 7 +#define STR_SW_EVENT_END_INS_GLOSSARY 8 +#define STR_SW_EVENT_FRM_KEYINPUT_ALPHA 9 +#define STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10 +#define STR_SW_EVENT_FRM_RESIZE 11 +#define STR_SW_EVENT_FRM_MOVE 12 + +class SwFormatINetFormat; +class IMapObject; + +// Enum for objects that call events into Basic or JavaScript. +enum SwCallEventObjectType +{ + EVENT_OBJECT_NONE = 0, // Null is nothing at all. + EVENT_OBJECT_IMAGE, + EVENT_OBJECT_INETATTR, + EVENT_OBJECT_URLITEM, + EVENT_OBJECT_IMAGEMAP +}; + +// Structure for the exchange between UI/CORE. + +struct SwCallMouseEvent final + : public SwClient +{ + SwCallEventObjectType eType; + union + { + // EVENT_OBJECT_IMAGE/EVENT_OBJECT_URLITEM + const SwFrameFormat* pFormat; + + // EVENT_OBJECT_INETATTR + const SwFormatINetFormat* pINetAttr; + + // EVENT_OBJECT_IMAGEMAP + struct + { + const SwFrameFormat* pFormat; + const IMapObject* pIMapObj; + } IMAP; + } PTR; + + SwCallMouseEvent() + : eType( EVENT_OBJECT_NONE ) + { PTR.pFormat = nullptr; PTR.IMAP.pIMapObj = nullptr; } + + SwCallMouseEvent(SwCallMouseEvent const& rOther) + : SwClient(rOther.GetRegisteredInNonConst()) + , eType(rOther.eType) + { + memcpy(&PTR, &rOther.PTR, sizeof(PTR)); + } + + void Set( SwCallEventObjectType eTyp, const SwFrameFormat* pFormat ) + { Clear(); eType = eTyp; PTR.pFormat = pFormat; PTR.IMAP.pIMapObj = nullptr; assert(pFormat); const_cast<SwFrameFormat*>(pFormat)->Add(this); } + + void Set( const SwFrameFormat* pFormat, const IMapObject* pIMapObj ) + { Clear(); eType = EVENT_OBJECT_IMAGEMAP; PTR.pFormat = pFormat; PTR.IMAP.pIMapObj = pIMapObj; assert(pFormat); const_cast<SwFrameFormat*>(pFormat)->Add(this); } + + void Set( const SwFormatINetFormat* pINetAttr ) + { Clear(); eType = EVENT_OBJECT_INETATTR; PTR.pINetAttr = pINetAttr; PTR.IMAP.pIMapObj = nullptr; } + + bool operator==( const SwCallMouseEvent& rEvent ) const + { + return eType == rEvent.eType && + PTR.pFormat == rEvent.PTR.pFormat && + PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj; + } + bool operator!=( const SwCallMouseEvent& rEvent ) const + { return !( *this == rEvent ); } + + void Clear() + { + if (EVENT_OBJECT_IMAGE == eType || EVENT_OBJECT_URLITEM == eType || EVENT_OBJECT_IMAGEMAP == eType) + { + // note: pFormat is not necessarily the same as + // GetRegisteredIn() here; see ~SwFormat() + assert(PTR.pFormat); + EndListeningAll(); + } + eType = EVENT_OBJECT_NONE; PTR.pFormat = nullptr; PTR.IMAP.pIMapObj = nullptr; + } + + bool HasEvent() const { return EVENT_OBJECT_NONE != eType; } + + virtual void Modify(SfxPoolItem const*const pOldValue, SfxPoolItem const*const pNewValue) override + { + assert(EVENT_OBJECT_IMAGE == eType || EVENT_OBJECT_URLITEM == eType || EVENT_OBJECT_IMAGEMAP == eType); + SwClient::Modify(pOldValue, pNewValue); + if (!GetRegisteredIn() + || (RES_FMT_CHG == pOldValue->Which() + && static_cast<SwFormatChg const*>(pOldValue)->pChangedFormat == PTR.pFormat) + || (RES_REMOVE_UNO_OBJECT == pOldValue->Which() + && static_cast<SwPtrMsgPoolItem const*>(pOldValue)->pObject == PTR.pFormat)) + { + Clear(); + } + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swfltopt.hxx b/sw/inc/swfltopt.hxx new file mode 100644 index 000000000..8fca62493 --- /dev/null +++ b/sw/inc/swfltopt.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWFLTOPT_HXX +#define INCLUDED_SW_INC_SWFLTOPT_HXX + +#include "swdllapi.h" +#include <unotools/configitem.hxx> + +class SW_DLLPUBLIC SwFilterOptions final : public utl::ConfigItem +{ +private: + virtual void ImplCommit() override; + +public: + SwFilterOptions( sal_uInt16 nCnt, const char** ppNames, + sal_uInt64* pValues ); + + void GetValues( sal_uInt16 nCnt, const char** ppNames, + sal_uInt64* pValues ); + virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx new file mode 100644 index 000000000..a8c07038b --- /dev/null +++ b/sw/inc/swmodule.hxx @@ -0,0 +1,268 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWMODULE_HXX +#define INCLUDED_SW_INC_SWMODULE_HXX + +#include <sal/config.h> + +#include <cstddef> + +#include <o3tl/deleter.hxx> +#include <tools/fldunit.hxx> +#include <svl/lstner.hxx> +#include <unotools/options.hxx> +#include <sfx2/module.hxx> +#include <sfx2/app.hxx> + +#include "swdllapi.h" +#include "shellid.hxx" +#include "fldupde.hxx" + +class Color; +class SfxItemSet; +class SfxRequest; +class SfxErrorHandler; +class SwDBConfig; +class SwModuleOptions; +class SwMasterUsrPref; +class SwViewOption; +class SwView; +class SwWrtShell; +class SwPrintOptions; +class SwChapterNumRules; +class SwStdFontConfig; +class SwNavigationConfig; +class SwTransferable; +class SwToolbarConfigItem; +class SwAttrPool; +namespace svtools{ class ColorConfig;} +class SvtAccessibilityOptions; +class SvtCTLOptions; +class SvtUserOptions; +enum class SwCompareMode; +struct SwDBData; + +enum class SvViewOpt { + DestView, + DestText, + DestWeb, + DestViewOnly //ViewOptions are set only at View, not at the appl. +}; + +namespace com::sun::star::scanner { class XScannerManager2; } +namespace com::sun::star::linguistic2 { class XLanguageGuessing; } +namespace com::sun::star::linguistic2 { class XLinguServiceEventListener; } +namespace ooo::vba { class XSinkCaller; } + +class SW_DLLPUBLIC SwModule final : public SfxModule, public SfxListener, public utl::ConfigurationListener +{ + OUString m_sActAuthor; + + // ConfigItems + std::unique_ptr<SwModuleOptions, o3tl::default_delete<SwModuleOptions>> m_pModuleConfig; + std::unique_ptr<SwMasterUsrPref, o3tl::default_delete<SwMasterUsrPref>> m_pUsrPref; + std::unique_ptr<SwMasterUsrPref, o3tl::default_delete<SwMasterUsrPref>> m_pWebUsrPref; + std::unique_ptr<SwPrintOptions> m_pPrintOptions; + std::unique_ptr<SwPrintOptions> m_pWebPrintOptions; + std::unique_ptr<SwChapterNumRules> m_pChapterNumRules; + std::unique_ptr<SwStdFontConfig> m_pStdFontConfig; + std::unique_ptr<SwNavigationConfig> m_pNavigationConfig; + std::unique_ptr<SwToolbarConfigItem> m_pToolbarConfig; //For stacked toolbars. Which one was visible? + std::unique_ptr<SwToolbarConfigItem> m_pWebToolbarConfig; + std::unique_ptr<SwDBConfig> m_pDBConfig; + std::unique_ptr<svtools::ColorConfig> m_pColorConfig; + std::unique_ptr<SvtAccessibilityOptions> m_pAccessibilityOptions; + std::unique_ptr<SvtCTLOptions> m_pCTLOptions; + std::unique_ptr<SvtUserOptions> m_pUserOptions; + + std::unique_ptr<SfxErrorHandler> m_pErrorHandler; + + SwAttrPool *m_pAttrPool; + + // Current view is held here in order to avoid one's being forced + // to work via GetActiveView. + // View is valid until destroyed in Activate or exchanged. + SwView* m_pView; + + // List of all Redline-authors. + std::vector<OUString> m_pAuthorNames; + + // DictionaryList listener to trigger spellchecking or hyphenation + css::uno::Reference< css::linguistic2::XLinguServiceEventListener > m_xLinguServiceEventListener; + css::uno::Reference< css::scanner::XScannerManager2 > m_xScannerManager; + css::uno::Reference< css::linguistic2::XLanguageGuessing > m_xLanguageGuesser; + + bool m_bAuthorInitialised : 1; + bool m_bEmbeddedLoadSave : 1; + + // Catch hint for DocInfo. + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override; + + // Envelopes, labels. + void InsertEnv(SfxRequest&); + void InsertLab(SfxRequest&, bool bLabel); + + css::uno::Reference< ooo::vba::XSinkCaller > mxAutomationApplicationEventsCaller; + +public: + // public Data - used for internal Clipboard / Drag & Drop / XSelection + SwTransferable *m_pDragDrop, *m_pXSelection; + + SFX_DECL_INTERFACE(SW_INTERFACE_MODULE) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + // This Ctor only for SW-Dll. + SwModule( SfxObjectFactory* pFact, + SfxObjectFactory* pWebFact, + SfxObjectFactory* pGlobalFact ); + + virtual ~SwModule() override; + + // Set view for internal use only. It is public only for technical reasons. + void SetView(SwView* pVw) { m_pView = pVw; } + SwView* GetView() { return m_pView; } + + // Handler for slots. + void StateOther(SfxItemSet &); + + void ExecOther(SfxRequest &); // Fields, formula... + + // Modify user settings. + const SwMasterUsrPref *GetUsrPref(bool bWeb) const; + const SwViewOption* GetViewOption(bool bWeb); + void ApplyUsrPref(const SwViewOption &, SwView*, + SvViewOpt nDest = SvViewOpt::DestView ); + void ApplyUserMetric( FieldUnit eMetric, bool bWeb ); + void ApplyRulerMetric( FieldUnit eMetric, bool bHorizontal, bool bWeb ); + void ApplyFieldUpdateFlags(SwFieldUpdateFlags eFieldFlags); + void ApplyLinkMode(sal_Int32 nNewLinkMode); + + // Default page mode for text grid. + void ApplyDefaultPageMode(bool bIsSquaredPageMode); + + void ApplyUserCharUnit(bool bApplyChar, bool bWeb); // apply_char_unit + + // Create ConfigItems. + SwModuleOptions* GetModuleConfig() { return m_pModuleConfig.get();} + SwPrintOptions* GetPrtOptions(bool bWeb); + SwChapterNumRules* GetChapterNumRules(); + SwStdFontConfig* GetStdFontConfig() { return m_pStdFontConfig.get(); } + SwNavigationConfig* GetNavigationConfig(); + SwToolbarConfigItem*GetToolbarConfig() { return m_pToolbarConfig.get(); } + SwToolbarConfigItem*GetWebToolbarConfig() { return m_pWebToolbarConfig.get(); } + SwDBConfig* GetDBConfig(); + svtools::ColorConfig& GetColorConfig(); + SvtAccessibilityOptions& GetAccessibilityOptions(); + SvtCTLOptions& GetCTLOptions(); + SvtUserOptions& GetUserOptions(); + + // Iterate over views. + static SwView* GetFirstView(); + static SwView* GetNextView(SwView const *); + + bool IsEmbeddedLoadSave() const { return m_bEmbeddedLoadSave; } + void SetEmbeddedLoadSave( bool bFlag ) { m_bEmbeddedLoadSave = bFlag; } + + static void ShowDBObj( SwView const & rView, const SwDBData& rData); + + // Table modi. + bool IsInsTableFormatNum(bool bHTML) const; + bool IsInsTableChangeNumFormat(bool bHTML) const; + bool IsInsTableAlignNum(bool bHTML) const; + bool IsSplitVerticalByDefault(bool bHTML) const; + void SetSplitVerticalByDefault(bool bHTML, bool value); + + // Redlining. + std::size_t GetRedlineAuthor(); + OUString const & GetRedlineAuthor(std::size_t nPos); + /// See SwXTextDocument::getTrackedChangeAuthors(). + OUString GetRedlineAuthorInfo(); + std::size_t InsertRedlineAuthor(const OUString& rAuthor); + void SetRedlineAuthor(const OUString& rAuthor); // for unit tests + + void GetInsertAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet); + void GetDeletedAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet); + void GetFormatAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet); + + sal_uInt16 GetRedlineMarkPos() const; + const Color& GetRedlineMarkColor() const; + + SwCompareMode GetCompareMode() const; + bool IsUseRsid() const; + bool IsIgnorePieces() const; + sal_uInt16 GetPieceLen() const; + + // Return defined DocStat - WordDelimiter. + OUString const & GetDocStatWordDelim() const; + + // Pass metric of ModuleConfig (for HTML-export). + FieldUnit GetMetric( bool bWeb ) const; + + // Pass update-statuses. + sal_uInt16 GetLinkUpdMode() const; + SwFieldUpdateFlags GetFieldUpdateFlags() const; + + // Virtual methods for options dialog. + virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; + virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; + virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) override; + virtual std::unique_ptr<SfxStyleFamilies> CreateStyleFamilies() override; + + // Pool is created here and set at SfxShell. + void InitAttrPool(); + // Delete pool before it is too late. + void RemoveAttrPool(); + + // Invalidates online spell-wrong-lists if necessary. + static void CheckSpellChanges( bool bOnlineSpelling, + bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags ); + + css::uno::Reference< css::scanner::XScannerManager2 > const & + GetScannerManager(); + + css::uno::Reference< css::linguistic2::XLanguageGuessing > const & + GetLanguageGuesser(); + + void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller); + void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments); +}; + +// Access to SwModule, the View and the shell. + +#define SW_MOD() ( static_cast<SwModule*>(SfxApplication::GetModule(SfxToolsModule::Writer))) + +SW_DLLPUBLIC SwView* GetActiveView(); +SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell(); + +namespace sw +{ +SW_DLLPUBLIC Color* GetActiveRetoucheColor(); +} + +extern bool g_bNoInterrupt; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx new file mode 100644 index 000000000..b2c5279dc --- /dev/null +++ b/sw/inc/swrect.hxx @@ -0,0 +1,343 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWRECT_HXX +#define INCLUDED_SW_INC_SWRECT_HXX + +#include <ostream> + +#include <sal/log.hxx> +#include <tools/gen.hxx> +#include "swdllapi.h" + +class SvStream; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +/// *Of course* Writer needs its own rectangles. +/// This is half-open so m_Point.X() + m_Size.getWidth() is *not* included. +/// Note the tools Rectangle is (usually? sometimes?) closed so there's a +/// SVRect() to subtract 1 for the conversion. +class SAL_WARN_UNUSED SW_DLLPUBLIC SwRect +{ + Point m_Point; + Size m_Size; + +public: + inline SwRect(); + inline SwRect( const SwRect &rRect ); + inline SwRect( const Point& rLT, const Size& rSize ); + inline SwRect( const Point& rLT, const Point& rRB ); + inline SwRect( long X, long Y, long Width, long Height ); + + //SV-SS e.g. SwRect( pWin->GetClipRect() ); + SwRect( const tools::Rectangle &rRect ); + + //Set-Methods + inline void Chg( const Point& rNP, const Size &rNS ); + inline void Pos( const Point& rNew ); + inline void Pos( const long nNewX, const long nNewY ); + inline void SSize( const Size& rNew ); + inline void SSize( const long nHeight, const long nWidth ); + inline void Width( long nNew ); + inline void Height( long nNew ); + inline void Left( const long nLeft ); + inline void Right( const long nRight ); + inline void Top( const long nTop ); + inline void Bottom( const long nBottom ); + + //Get-Methods + inline const Point &Pos() const; + inline const Size &SSize() const; + inline long Width() const; + inline long Height() const; + inline long Left() const; + inline long Right() const; + inline long Top() const; + inline long Bottom() const; + + // In order to be able to access the members of Pos and SSize from the layout side. + inline Point &Pos(); + + Point Center() const; + + void Justify(); + + SwRect &Union( const SwRect& rRect ); + SwRect &Intersection( const SwRect& rRect ); + + // Same as Intersection, only assume that Rects are overlapping! + SwRect &Intersection_( const SwRect &rRect ); + + bool IsInside( const Point& rPOINT ) const; + bool IsNear(const Point& rPoint, long nTolerance ) const; + bool IsInside( const SwRect& rRect ) const; + bool IsOver( const SwRect& rRect ) const; + inline bool HasArea() const; + inline bool IsEmpty() const; + inline void Clear(); + + inline SwRect &operator = ( const SwRect &rRect ); + + inline bool operator == ( const SwRect& rRect ) const; + inline bool operator != ( const SwRect& rRect ) const; + + inline SwRect &operator+=( const Point &rPt ); + inline SwRect &operator-=( const Point &rPt ); + + //SV-SS e.g. pWin->DrawRect( aSwRect.SVRect() ); + inline tools::Rectangle SVRect() const; + + // Output operator for debugging. + friend SvStream& WriteSwRect( SvStream &rStream, const SwRect &rRect ); + void dumpAsXmlAttributes(xmlTextWriterPtr writer) const; + + void Top_( const long nTop ); + void Bottom_( const long nBottom ); + void Left_( const long nLeft ); + void Right_( const long nRight ); + void Width_( const long nNew ); + void Height_( const long nNew ); + long Top_() const; + long Bottom_() const; + long Left_() const; + long Right_() const; + long Width_() const; + long Height_() const; + void SubTop( const long nSub ); + void AddTop( const long nAdd ); + void AddBottom( const long nAdd ); + void AddLeft( const long nAdd ); + void SubLeft( const long nSub ); + void AddRight( const long nAdd ); + void AddWidth( const long nAdd ); + void AddHeight( const long nAdd ); + void SetPosX( const long nNew ); + void SetPosY( const long nNew ); + void SetLeftAndWidth( long nLeft, long nNew ); + void SetTopAndHeight( long nTop, long nNew ); + void SetRightAndWidth( long nRight, long nNew ); + void SetBottomAndHeight( long nBottom, long nNew ); + void SetUpperLeftCorner( const Point& rNew ); + void SetUpperRightCorner( const Point& rNew ); + void SetLowerLeftCorner( const Point& rNew ); + Size Size_() const; + Point TopLeft() const; + Point TopRight() const; + Point BottomLeft() const; + Point BottomRight() const; + Size SwappedSize() const; + long GetLeftDistance( long ) const; + long GetBottomDistance( long ) const; + long GetRightDistance( long ) const; + long GetTopDistance( long ) const; + bool OverStepLeft( long ) const; + bool OverStepBottom( long ) const; + bool OverStepTop( long ) const; + bool OverStepRight( long ) const; +}; + +typedef void (SwRect:: *SwRectSet)( const long nNew ); +typedef long (SwRect:: *SwRectGet)() const; +typedef Point (SwRect:: *SwRectPoint)() const; +typedef Size (SwRect:: *SwRectSize)() const; +typedef bool (SwRect:: *SwRectMax)( long ) const; +typedef long (SwRect:: *SwRectDist)( long ) const; +typedef void (SwRect:: *SwRectSetTwice)( long, long ); +typedef void (SwRect:: *SwRectSetPos)( const Point& ); + +// Set-Methods +inline void SwRect::Chg( const Point& rNP, const Size &rNS ) +{ + m_Point = rNP; + m_Size = rNS; +} +inline void SwRect::Pos( const Point& rNew ) +{ + m_Point = rNew; +} +inline void SwRect::Pos( const long nNewX, const long nNewY ) +{ + m_Point.setX(nNewX); + m_Point.setY(nNewY); +} +inline void SwRect::SSize( const Size& rNew ) +{ + m_Size = rNew; +} +inline void SwRect::SSize( const long nNewHeight, const long nNewWidth ) +{ + m_Size.setWidth(nNewWidth); + m_Size.setHeight(nNewHeight); +} +inline void SwRect::Width( long nNew ) +{ + m_Size.setWidth(nNew); +} +inline void SwRect::Height( long nNew ) +{ + m_Size.setHeight(nNew); +} +inline void SwRect::Left( const long nLeft ) +{ + m_Size.AdjustWidth( m_Point.getX() - nLeft ); + m_Point.setX(nLeft); +} +inline void SwRect::Right( const long nRight ) +{ + m_Size.setWidth(nRight - m_Point.getX() + 1); +} +inline void SwRect::Top( const long nTop ) +{ + m_Size.AdjustHeight( m_Point.getY() - nTop ); + m_Point.setY(nTop); +} +inline void SwRect::Bottom( const long nBottom ) +{ + m_Size.setHeight(nBottom - m_Point.getY() + 1); +} + +// Get-Methods +inline const Point &SwRect::Pos() const +{ + return m_Point; +} +inline Point &SwRect::Pos() +{ + return m_Point; +} +inline const Size &SwRect::SSize() const +{ + return m_Size; +} +inline long SwRect::Width() const +{ + return m_Size.Width(); +} +inline long SwRect::Height() const +{ + return m_Size.Height(); +} +inline long SwRect::Left() const +{ + return m_Point.X(); +} +inline long SwRect::Right() const +{ + return m_Size.getWidth() ? m_Point.getX() + m_Size.getWidth() - 1 : m_Point.getX(); +} +inline long SwRect::Top() const +{ + return m_Point.Y(); +} +inline long SwRect::Bottom() const +{ + return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : m_Point.getY(); +} + +// operators +inline SwRect &SwRect::operator = ( const SwRect &rRect ) +{ + m_Point = rRect.m_Point; + m_Size = rRect.m_Size; + return *this; +} +inline bool SwRect::operator == ( const SwRect& rRect ) const +{ + return (m_Point == rRect.m_Point && m_Size == rRect.m_Size); +} +inline bool SwRect::operator != ( const SwRect& rRect ) const +{ + return (m_Point != rRect.m_Point || m_Size != rRect.m_Size); +} + +inline SwRect &SwRect::operator+=( const Point &rPt ) +{ + m_Point += rPt; + return *this; +} +inline SwRect &SwRect::operator-=( const Point &rPt ) +{ + m_Point -= rPt; + return *this; +} + +// other +inline tools::Rectangle SwRect::SVRect() const +{ + SAL_WARN_IF( IsEmpty(), "sw", "SVRect() without Width or Height" ); + return tools::Rectangle( m_Point.getX(), m_Point.getY(), + m_Point.getX() + m_Size.getWidth() - 1, //Right() + m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom() +} + +inline bool SwRect::HasArea() const +{ + return !IsEmpty(); +} +inline bool SwRect::IsEmpty() const +{ + return !(m_Size.getHeight() && m_Size.getWidth()); +} +inline void SwRect::Clear() +{ + m_Point.setX(0); + m_Point.setY(0); + m_Size.setWidth(0); + m_Size.setHeight(0); +} + +// constructors +inline SwRect::SwRect() : + m_Point( 0, 0 ), + m_Size( 0, 0 ) +{ +} +inline SwRect::SwRect( const SwRect &rRect ) : + m_Point( rRect.m_Point ), + m_Size( rRect.m_Size ) +{ +} +inline SwRect::SwRect( const Point& rLT, const Size& rSize ) : + m_Point( rLT ), + m_Size( rSize ) +{ +} +inline SwRect::SwRect( const Point& rLT, const Point& rRB ) : + m_Point( rLT ), + m_Size( rRB.X() - rLT.X() + 1, rRB.Y() - rLT.Y() + 1 ) +{ +} +inline SwRect::SwRect( long X, long Y, long W, long H ) : + m_Point( X, Y ), + m_Size( W, H ) +{ +} + +template< typename charT, typename traits > +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, const SwRect& rectangle ) +{ + if (rectangle.IsEmpty()) + stream << "EMPTY:"; + return stream << rectangle.SSize() + << "@(" << rectangle.Pos() << ")"; +} + +#endif // INCLUDED_SW_INC_SWRECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swregion.hxx b/sw/inc/swregion.hxx new file mode 100644 index 000000000..7ba3ffdee --- /dev/null +++ b/sw/inc/swregion.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWREGION_HXX +#define INCLUDED_SW_INC_SWREGION_HXX + +#include <vector> + +#include "swrect.hxx" + +typedef std::vector<SwRect> SwRects; + +class SwRegionRects : public SwRects +{ + SwRect m_aOrigin; // Copy of StartRect. + + inline void InsertRect( const SwRect &rRect, const sal_uInt16 nPos, bool &rDel); + +public: + SwRegionRects( const SwRect& rStartRect, sal_uInt16 nInit = 20 ); + + // For punching from aOrigin. + void operator-=( const SwRect& rRect ); + void operator+=( const SwRect& rRect ); + + // From holes to areas, from areas to holes. + void Invert(); + + // Combine adjacent rectangles. + void Compress(); + + const SwRect &GetOrigin() const { return m_aOrigin; } + void ChangeOrigin( const SwRect &rRect ) { m_aOrigin = rRect; } +}; + +#endif // INCLUDED_SW_INC_SWREGION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swscanner.hxx b/sw/inc/swscanner.hxx new file mode 100644 index 000000000..a59d006b2 --- /dev/null +++ b/sw/inc/swscanner.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_SWSCANNER_HXX +#define INCLUDED_SW_INC_SWSCANNER_HXX + +#include <i18nlangtag/lang.h> +#include "modeltoviewhelper.hxx" + +#include <functional> + +class SwTextNode; + +// Helper class that provides consecutively the words of a selected area +// during spell check +class SwScanner +{ + std::function<LanguageType (sal_Int32, sal_Int32, bool)> m_pGetLangOfChar; + OUString m_aWord; + const OUString m_aPreDashReplacementText; + OUString m_aText; + const LanguageType* m_pLanguage; + const ModelToViewHelper m_ModelToView; + sal_Int32 m_nStartPos; + sal_Int32 m_nEndPos; + sal_Int32 m_nBegin; + sal_Int32 m_nLength; + sal_Int32 m_nOverriddenDashCount; + LanguageType m_aCurrentLang; + sal_uInt16 m_nWordType; + bool m_bClip; + +public: + SwScanner(const std::function<LanguageType(sal_Int32, sal_Int32, bool)>& pGetLangOfChar, + const OUString& rText, const LanguageType* pLang, const ModelToViewHelper& rConvMap, + sal_uInt16 nWordType, sal_Int32 nStart, sal_Int32 nEnd, bool bClip = false); + SwScanner( const SwTextNode& rNd, const OUString& rText, + const LanguageType* pLang, + const ModelToViewHelper& rConvMap, + sal_uInt16 nWordType, + sal_Int32 nStart, sal_Int32 nEnd, bool bClip = false ); + + // This next word function tries to find the language for the next word + // It should currently _not_ be used for spell checking, and works only for + // ! bReverse + bool NextWord(); + + const OUString& GetWord() const { return m_aWord; } + + sal_Int32 GetBegin() const { return m_nBegin; } + sal_Int32 GetEnd() const { return m_nBegin + m_nLength; } + sal_Int32 GetLen() const { return m_nLength; } + + LanguageType GetCurrentLanguage() const {return m_aCurrentLang;} + + sal_Int32 getOverriddenDashCount() const {return m_nOverriddenDashCount; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swserv.hxx b/sw/inc/swserv.hxx new file mode 100644 index 000000000..c80c0e7de --- /dev/null +++ b/sw/inc/swserv.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWSERV_HXX +#define INCLUDED_SW_INC_SWSERV_HXX + +#include <sfx2/linksrc.hxx> + +class SwSectionNode; +class SwBaseLink; +class SwTableNode; +struct SwPosition; +class SwPaM; +namespace sw::mark { class IMark; } + +class SwServerObject final : public ::sfx2::SvLinkSource +{ + using sfx2::SvLinkSource::SendDataChanged; + + enum ServerModes { BOOKMARK_SERVER, TABLE_SERVER, SECTION_SERVER, NONE_SERVER } m_eType; + union { + ::sw::mark::IMark* pBkmk; + SwTableNode* pTableNd; + SwSectionNode* pSectNd; + } m_CNTNT_TYPE; + +public: + SwServerObject( ::sw::mark::IMark& rBookmark ) + : m_eType( BOOKMARK_SERVER ) + { + m_CNTNT_TYPE.pBkmk = &rBookmark; + } + SwServerObject( SwTableNode& rTableNd ) + : m_eType( TABLE_SERVER ) + { + m_CNTNT_TYPE.pTableNd = &rTableNd; + } + SwServerObject( SwSectionNode& rSectNd ) + : m_eType( SECTION_SERVER ) + { + m_CNTNT_TYPE.pSectNd = &rSectNd; + } + virtual ~SwServerObject() override; + + virtual bool GetData( css::uno::Any & rData, + const OUString & rMimeType, + bool bSynchron = false ) override; + + void SendDataChanged( const SwPosition& rPos ); + void SendDataChanged( const SwPaM& rRange ); + + bool IsLinkInServer( const SwBaseLink* ) const; + + void SetNoServer(); + void SetDdeBookmark( ::sw::mark::IMark& rBookmark); +}; + +#endif // INCLUDED_SW_INC_SWSERV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx new file mode 100644 index 000000000..a0deaf01e --- /dev/null +++ b/sw/inc/swtable.hxx @@ -0,0 +1,519 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWTABLE_HXX +#define INCLUDED_SW_INC_SWTABLE_HXX + +#include <tools/solar.h> +#include <tools/ref.hxx> +#include "tblenum.hxx" +#include "swtypes.hxx" +#include "calbck.hxx" +#include "swrect.hxx" +#include "swtblfmt.hxx" + +#include <memory> +#include <vector> +#include <algorithm> +#include <o3tl/sorted_vector.hxx> + +class SwStartNode; +class SwFormat; +class Color; +class SwHTMLTableLayout; +class SwTableLine; +class SwTableBox; +class SwTableNode; +class SwTabCols; +class SwDoc; +class SwSelBoxes; +class SwTableCalcPara; +struct SwPosition; +class SwNodeIndex; +class SwNode; +class SfxPoolItem; +class SwUndoTableMerge; +class SwUndo; +class SwPaM; +class SwUndoTableCpyTable; +class SwBoxSelection; +struct SwSaveRowSpan; +struct Parm; +class SwServerObject; + +void sw_GetTableBoxColStr( sal_uInt16 nCol, OUString& rNm ); + +class SwTableLines +{ + std::vector<SwTableLine*> m_vLines; + +public: + typedef std::vector<SwTableLine*>::size_type size_type; + typedef std::vector<SwTableLine*>::iterator iterator; + typedef std::vector<SwTableLine*>::const_iterator const_iterator; + + // free's any remaining child objects + ~SwTableLines(); + + bool empty() const { return m_vLines.empty(); } + size_type size() const { return m_vLines.size(); } + iterator begin() { return m_vLines.begin(); } + const_iterator begin() const { return m_vLines.begin(); } + iterator end() { return m_vLines.end(); } + const_iterator end() const { return m_vLines.end(); } + SwTableLine* front() const { return m_vLines.front(); } + SwTableLine* back() const { return m_vLines.back(); } + void clear() { m_vLines.clear(); } + iterator erase( iterator aIt ) { return m_vLines.erase( aIt ); } + iterator erase( iterator aFirst, iterator aLast ) { return m_vLines.erase( aFirst, aLast ); } + iterator insert( iterator aIt, SwTableLine* pLine ) { return m_vLines.insert( aIt, pLine ); } + template<typename TInputIterator> + void insert( iterator aIt, TInputIterator aFirst, TInputIterator aLast ) + { + m_vLines.insert( aIt, aFirst, aLast ); + } + void push_back( SwTableLine* pLine ) { m_vLines.push_back( pLine ); } + void reserve( size_type nSize ) { m_vLines.reserve( nSize ); } + SwTableLine*& operator[]( size_type nPos ) { return m_vLines[ nPos ]; } + SwTableLine* operator[]( size_type nPos ) const { return m_vLines[ nPos ]; } + + // return USHRT_MAX if not found, else index of position + sal_uInt16 GetPos(const SwTableLine* pBox) const + { + const_iterator it = std::find(begin(), end(), pBox); + return it == end() ? USHRT_MAX : it - begin(); + } +}; + +using SwTableBoxes = std::vector<SwTableBox*>; + +// Save content-bearing box-pointers additionally in a sorted array +// (for calculation in table). +class SwTableSortBoxes : public o3tl::sorted_vector<SwTableBox*> {}; + +/// SwTable is one table in the document model, containing rows (which contain cells). +class SW_DLLPUBLIC SwTable: public SwClient //Client of FrameFormat. +{ + +protected: + SwTableLines m_aLines; + SwTableSortBoxes m_TabSortContentBoxes; + tools::SvRef<SwServerObject> m_xRefObj; // In case DataServer -> pointer is set. + + std::shared_ptr<SwHTMLTableLayout> m_xHTMLLayout; + + // Usually, the table node of a SwTable can be accessed by getting a box + // out of m_TabSortContentBoxes, which know their SwStartNode. But in some rare + // cases, we need to know the table node of a SwTable, before the table + // boxes have been build (SwTableNode::MakeCopy with tables in tables). + SwTableNode* m_pTableNode; + + // Should that be adjustable for every table? + TableChgMode m_eTableChgMode; + + sal_uInt16 m_nGraphicsThatResize; // Count of Grfs that initiate a resize of table + // at HTML-import. + sal_uInt16 m_nRowsToRepeat; // Number of rows to repeat on every page. + + /// Name of the table style to be applied on this table. + OUString maTableStyleName; + + bool m_bModifyLocked :1; + bool m_bNewModel :1; // false: old SubTableModel; true: new RowSpanModel + + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override; + +public: + enum SearchType + { + SEARCH_NONE, // Default: expand to rectangle + SEARCH_ROW, // row selection + SEARCH_COL // column selection + }; + + + explicit SwTable(); + virtual ~SwTable() override; + + // @@@ public copy ctor, but no copy assignment? + SwTable( const SwTable& rTable ); // no copy of the lines !! +private: + // @@@ public copy ctor, but no copy assignment? + SwTable & operator= (const SwTable &) = delete; + bool OldMerge( SwDoc*, const SwSelBoxes&, SwTableBox*, SwUndoTableMerge* ); + bool OldSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, bool ); + bool NewMerge( SwDoc*, const SwSelBoxes&, const SwSelBoxes& rMerged, + SwUndoTableMerge* ); + bool NewSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, bool ); + std::unique_ptr<SwBoxSelection> CollectBoxSelection( const SwPaM& rPam ) const; + void InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nIdx, sal_uInt16 nCnt ); + bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind ); + bool NewInsertCol( SwDoc*, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool ); + void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* ); + void AdjustWidths( const long nOld, const long nNew ); + void NewSetTabCols( Parm &rP, const SwTabCols &rNew, const SwTabCols &rOld, + const SwTableBox *pStart, bool bCurRowOnly ); + +public: + + SwHTMLTableLayout *GetHTMLTableLayout() { return m_xHTMLLayout.get(); } + const SwHTMLTableLayout *GetHTMLTableLayout() const { return m_xHTMLLayout.get(); } + void SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout> const& r); //Change of property! + + sal_uInt16 IncGrfsThatResize() { return ++m_nGraphicsThatResize; } + sal_uInt16 DecGrfsThatResize() { return m_nGraphicsThatResize ? --m_nGraphicsThatResize : 0; } + + void LockModify() { m_bModifyLocked = true; } // Must be used always + void UnlockModify() { m_bModifyLocked = false;} // in pairs! + + void SetTableModel( bool bNew ){ m_bNewModel = bNew; } + bool IsNewModel() const { return m_bNewModel; } + + /// Return the table style name of this table. + const OUString& GetTableStyleName() const { return maTableStyleName; } + + /// Set the new table style name for this table. + void SetTableStyleName(const OUString& rName) { maTableStyleName = rName; } + + sal_uInt16 GetRowsToRepeat() const { return std::min( static_cast<sal_uInt16>(GetTabLines().size()), m_nRowsToRepeat ); } + void SetRowsToRepeat( sal_uInt16 nNumOfRows ) { m_nRowsToRepeat = nNumOfRows; } + + bool IsHeadline( const SwTableLine& rLine ) const; + + SwTableLines &GetTabLines() { return m_aLines; } + const SwTableLines &GetTabLines() const { return m_aLines; } + + SwTableFormat* GetFrameFormat() { return static_cast<SwTableFormat*>(GetRegisteredIn()); } + SwTableFormat* GetFrameFormat() const { return const_cast<SwTableFormat*>(static_cast<const SwTableFormat*>(GetRegisteredIn())); } + + void GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, + bool bHidden = false, bool bCurRowOnly = false ) const; + void SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, + const SwTableBox *pStart, bool bCurRowOnly ); + +// The following functions are for new table model only... + void CreateSelection( const SwPaM& rPam, SwSelBoxes& rBoxes, + const SearchType eSearchType, bool bProtect ) const; + void CreateSelection( const SwNode* pStart, const SwNode* pEnd, + SwSelBoxes& rBoxes, const SearchType eSearchType, bool bProtect ) const; + void ExpandSelection( SwSelBoxes& rBoxes ) const; + // When a table is split into two tables, the row spans which overlaps + // the split have to be corrected and stored for undo + // SwSavRowSpan is the structure needed by Undo to undo the split operation + // CleanUpRowSpan corrects the (top of the) second table and delivers the structure + // for Undo + std::unique_ptr<SwSaveRowSpan> CleanUpTopRowSpan( sal_uInt16 nSplitLine ); + // RestoreRowSpan is called by Undo to restore the old row span values + void RestoreRowSpan( const SwSaveRowSpan& ); + // CleanUpBottomRowSpan corrects the overhanging row spans at the end of the first table + void CleanUpBottomRowSpan( sal_uInt16 nDelLines ); + +// The following functions are "pseudo-virtual", i.e. they are different for old and new table model +// It's not allowed to change the table model after the first call of one of these functions. + + bool Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged, + SwTableBox* pMergeBox, SwUndoTableMerge* pUndo ) + { + return m_bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pUndo ) : + OldMerge( pDoc, rBoxes, pMergeBox, pUndo ); + } + bool SplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, + bool bSameHeight ) + { + return m_bNewModel ? NewSplitRow( pDoc, rBoxes, nCnt, bSameHeight ) : + OldSplitRow( pDoc, rBoxes, nCnt, bSameHeight ); + } + bool PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes, + SwSelBoxes& rMerged, SwTableBox** ppMergeBox, SwUndoTableMerge* pUndo ); + void ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax ) const; + void PrepareDeleteCol( long nMin, long nMax ); + + bool InsertCol( SwDoc*, const SwSelBoxes& rBoxes, + sal_uInt16 nCnt, bool bBehind ); + bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes, + sal_uInt16 nCnt, bool bBehind ); + void PrepareDelBoxes( const SwSelBoxes& rBoxes ); + bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged, + SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder ); + bool SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ); + + void FindSuperfluousRows( SwSelBoxes& rBoxes ) + { FindSuperfluousRows_( rBoxes, nullptr, nullptr ); } + void CheckRowSpan( SwTableLine* &rpLine, bool bUp ) const; + + SwTableSortBoxes& GetTabSortBoxes() { return m_TabSortContentBoxes; } + const SwTableSortBoxes& GetTabSortBoxes() const { return m_TabSortContentBoxes; } + + // Read 1st number and delete it from string (used by GetTableBox and SwTableField). + + // #i80314# + // add 3rd parameter in order to control validation check on <rStr> + static sal_uInt16 GetBoxNum( OUString& rStr, + bool bFirst = false, + const bool bPerformValidCheck = false ); + + // Search content-bearing box with that name. + + // #i80314# + // add 2nd parameter in order to control validation check in called method + // <GetBoxNum(..)> + const SwTableBox* GetTableBox( const OUString& rName, + const bool bPerformValidCheck = false ) const; + // Copy selected boxes to another document. + bool MakeCopy( SwDoc*, const SwPosition&, const SwSelBoxes&, + bool bCpyName = false ) const; + // Copy table in this + bool InsTable( const SwTable& rCpyTable, const SwNodeIndex&, + SwUndoTableCpyTable* pUndo ); + bool InsTable( const SwTable& rCpyTable, const SwSelBoxes&, + SwUndoTableCpyTable* pUndo ); + bool InsNewTable( const SwTable& rCpyTable, const SwSelBoxes&, + SwUndoTableCpyTable* pUndo ); + // Copy headline of table (with content!) into another one. + void CopyHeadlineIntoTable( SwTableNode& rTableNd ); + + // Get box, whose start index is set on nBoxStt. + SwTableBox* GetTableBox( sal_uLong nSttIdx ); + const SwTableBox* GetTableBox( sal_uLong nSttIdx ) const + { return const_cast<SwTable*>(this)->GetTableBox( nSttIdx ); } + + // Returns true if table contains nestings. + bool IsTableComplex() const; + + // Returns true if table or selection is balanced. + bool IsTableComplexForChart( const OUString& rSel ) const; + + // Search all content-bearing boxes of the base line on which this box stands. + // rBoxes as a return value for immediate use. + // bToTop = true -> up to base line, false-> else only line of box. + static SwSelBoxes& SelLineFromBox( const SwTableBox* pBox, + SwSelBoxes& rBoxes, bool bToTop = true ); + + // Get information from client. + virtual bool GetInfo( SfxPoolItem& ) const override; + + // Search in format for registered table. + static SwTable * FindTable( SwFrameFormat const*const pFormat ); + + // Clean up structure a bit. + void GCLines(); + + // Returns the table node via m_TabSortContentBoxes or pTableNode. + SwTableNode* GetTableNode() const; + void SetTableNode( SwTableNode* pNode ) { m_pTableNode = pNode; } + + // Data server methods. + void SetRefObject( SwServerObject* ); + const SwServerObject* GetObject() const { return m_xRefObj.get(); } + SwServerObject* GetObject() { return m_xRefObj.get(); } + + // Fill data for chart. + void UpdateCharts() const; + + TableChgMode GetTableChgMode() const { return m_eTableChgMode; } + void SetTableChgMode( TableChgMode eMode ) { m_eTableChgMode = eMode; } + + bool SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eType, + SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo ); + bool SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType, + SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo ); + void RegisterToFormat( SwFormat& rFormat ); +#ifdef DBG_UTIL + void CheckConsistency() const; +#endif + + bool HasLayout() const; +}; + +/// SwTableLine is one table row in the document model. +class SW_DLLPUBLIC SwTableLine: public SwClient // Client of FrameFormat. +{ + SwTableBoxes m_aBoxes; + SwTableBox *m_pUpper; + +public: + + SwTableLine( SwTableLineFormat*, sal_uInt16 nBoxes, SwTableBox *pUp ); + virtual ~SwTableLine() override; + + SwTableBoxes &GetTabBoxes() { return m_aBoxes; } + const SwTableBoxes &GetTabBoxes() const { return m_aBoxes; } + sal_uInt16 GetBoxPos(const SwTableBox* pBox) const + { + SwTableBoxes::const_iterator it = std::find(m_aBoxes.begin(), m_aBoxes.end(), pBox); + return it == m_aBoxes.end() ? USHRT_MAX : it - m_aBoxes.begin(); + } + + SwTableBox *GetUpper() { return m_pUpper; } + const SwTableBox *GetUpper() const { return m_pUpper; } + void SetUpper( SwTableBox *pNew ) { m_pUpper = pNew; } + + SwFrameFormat* GetFrameFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } + SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); } + + // Creates an own FrameFormat if more lines depend on it. + SwFrameFormat* ClaimFrameFormat(); + void ChgFrameFormat( SwTableLineFormat* pNewFormat ); + + // Search next/previous box with content. + SwTableBox* FindNextBox( const SwTable&, const SwTableBox* =nullptr, + bool bOvrTableLns=true ) const; + SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* =nullptr, + bool bOvrTableLns=true ) const; + + SwTwips GetTableLineHeight( bool& bLayoutAvailable ) const; + + bool hasSoftPageBreak() const; + void RegisterToFormat( SwFormat& rFormat ); +}; + +/// SwTableBox is one table cell in the document model. +class SW_DLLPUBLIC SwTableBox: public SwClient //Client of FrameFormat. +{ + friend class SwNodes; // Transpose index. + friend void DelBoxNode(SwTableSortBoxes const &); // Delete StartNode* ! + friend class SwXMLTableContext; + + SwTableBox( const SwTableBox & ) = delete; + SwTableBox &operator=( const SwTableBox &) = delete; + + SwTableLines m_aLines; + const SwStartNode * m_pStartNode; + SwTableLine *m_pUpper; + + std::unique_ptr<Color> mpUserColor; + std::unique_ptr<Color> mpNumFormatColor; + long mnRowSpan; + bool mbDummyFlag; + + /// Do we contain any direct formatting? + bool mbDirectFormatting; + + // In case Format contains formulas/values already, + // a new one must be created for the new box. + static SwTableBoxFormat* CheckBoxFormat( SwTableBoxFormat* ); + +public: + + SwTableBox( SwTableBoxFormat*, sal_uInt16 nLines, SwTableLine *pUp ); + SwTableBox( SwTableBoxFormat*, const SwStartNode&, SwTableLine *pUp ); + SwTableBox( SwTableBoxFormat*, const SwNodeIndex&, SwTableLine *pUp ); + virtual ~SwTableBox() override; + + SwTableLines &GetTabLines() { return m_aLines; } + const SwTableLines &GetTabLines() const { return m_aLines; } + + SwTableLine *GetUpper() { return m_pUpper; } + const SwTableLine *GetUpper() const { return m_pUpper; } + void SetUpper( SwTableLine *pNew ) { m_pUpper = pNew; } + + SwFrameFormat* GetFrameFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } + SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); } + + /// Set that this table box contains formatting that is not set by the table style. + void SetDirectFormatting(bool bDirect) { mbDirectFormatting = bDirect; } + + /// Do we contain any direct formatting (ie. something not affected by the table style)? + bool HasDirectFormatting() const { return mbDirectFormatting; } + + // Creates its own FrameFormat if more boxes depend on it. + SwFrameFormat* ClaimFrameFormat(); + void ChgFrameFormat( SwTableBoxFormat *pNewFormat, bool bNeedToReregister = true ); + + void RemoveFromTable(); + const SwStartNode *GetSttNd() const { return m_pStartNode; } + sal_uLong GetSttIdx() const; + + // Search next/previous box with content. + SwTableBox* FindNextBox( const SwTable&, const SwTableBox*, + bool bOvrTableLns=true ) const; + SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* ) const; + // Return name of this box. It is determined dynamically and + // is calculated from the position in the lines/boxes/table. + OUString GetName() const; + // Return "value" of box (for calculating in table). + double GetValue( SwTableCalcPara& rPara ) const; + + // Computes "coordinates" of a box, used to computed selection + // width or height when inserting cols or rows + Point GetCoordinates() const; + + bool IsInHeadline( const SwTable* pTable ) const; + + // Contains box contents, that can be formatted as a number? + bool HasNumContent( double& rNum, sal_uInt32& rFormatIndex, + bool& rIsEmptyTextNd ) const; + sal_uLong IsValidNumTextNd( bool bCheckAttr = true ) const; + // If a table formula is set, test if box contents is congruent with number. + // (For Redo of change of NumFormat!). + bool IsNumberChanged() const; + + // Is that a formula box or a box with numeric contents (AutoSum)? + // What it is indicated by the return value - the WhichId of the attribute. + // Empty boxes have the return value USHRT_MAX !! + sal_uInt16 IsFormulaOrValueBox() const; + + // Loading of a document requires an actualization of cells with values + void ActualiseValueBox(); + + // Access on internal data - currently used for the NumFormatter. + inline const Color* GetSaveUserColor() const; + inline const Color* GetSaveNumFormatColor() const; + inline void SetSaveUserColor(const Color* p ); + inline void SetSaveNumFormatColor( const Color* p ); + + long getRowSpan() const; + void setRowSpan( long nNewRowSpan ); + bool getDummyFlag() const; + void setDummyFlag( bool bDummy ); + + SwTableBox& FindStartOfRowSpan( const SwTable&, sal_uInt16 nMaxStep = USHRT_MAX ); + const SwTableBox& FindStartOfRowSpan( const SwTable& rTable, + sal_uInt16 nMaxStep = USHRT_MAX ) const + { return const_cast<SwTableBox*>(this)->FindStartOfRowSpan( rTable, nMaxStep ); } + + SwTableBox& FindEndOfRowSpan( const SwTable&, sal_uInt16 nMaxStep ); + const SwTableBox& FindEndOfRowSpan( const SwTable& rTable, + sal_uInt16 nMaxStep ) const + { return const_cast<SwTableBox*>(this)->FindEndOfRowSpan( rTable, nMaxStep ); } + void RegisterToFormat( SwFormat& rFormat ) ; +}; + +class SwCellFrame; +class SW_DLLPUBLIC SwTableCellInfo +{ + struct Impl; + std::unique_ptr<Impl> m_pImpl; + + const SwCellFrame * getCellFrame() const; + + SwTableCellInfo(SwTableCellInfo const&) = delete; + SwTableCellInfo& operator=(SwTableCellInfo const&) = delete; + +public: + SwTableCellInfo(const SwTable * pTable); + ~SwTableCellInfo(); + + bool getNext(); + SwRect getRect() const; + const SwTableBox * getTableBox() const; +}; + +#endif // INCLUDED_SW_INC_SWTABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx new file mode 100644 index 000000000..c1a114ea4 --- /dev/null +++ b/sw/inc/swtblfmt.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWTBLFMT_HXX +#define INCLUDED_SW_INC_SWTBLFMT_HXX + +#include "frmfmt.hxx" + +class SAL_DLLPUBLIC_RTTI SwTableFormat final : public SwFrameFormat +{ + friend class SwDoc; + + SwTableFormat( SwAttrPool& rPool, const OUString &rFormatNm, + SwFrameFormat *pDrvdFrame ) + : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FRMFMT, aTableSetRange ) + {} + +public: + virtual bool supportsFullDrawingLayerFillAttributeSet() const override; +}; + +class SwTableLineFormat final : public SwFrameFormat +{ + friend class SwDoc; + + SwTableLineFormat( SwAttrPool& rPool, SwFrameFormat *pDrvdFrame ) + : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, aTableLineSetRange ) + {} + +public: + virtual bool supportsFullDrawingLayerFillAttributeSet() const override; +}; + +class SAL_DLLPUBLIC_RTTI SwTableBoxFormat final : public SwFrameFormat +{ + friend class SwDoc; + + SwTableBoxFormat( SwAttrPool& rPool, SwFrameFormat *pDrvdFrame ) + : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, aTableBoxSetRange ) + {} + + // For recognition of changes (especially TableBoxAttribute). + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue ) override; + +public: + virtual bool supportsFullDrawingLayerFillAttributeSet() const override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx new file mode 100644 index 000000000..fbf9165ab --- /dev/null +++ b/sw/inc/swtypes.hxx @@ -0,0 +1,254 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWTYPES_HXX +#define INCLUDED_SW_INC_SWTYPES_HXX +#include <rtl/ustring.hxx> + +#include <limits.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/CollatorOptions.hpp> +#include "swdllapi.h" +#include <o3tl/typed_flags_set.hxx> +#include <i18nlangtag/lang.h> +#include <vcl/outdev.hxx> + +namespace com::sun::star { + namespace linguistic2{ + class XLinguProperties; + class XSpellChecker1; + class XHyphenator; + class XThesaurus; + } +} +namespace utl{ + class TransliterationWrapper; +} + +class Size; +class SwPathFinder; +class Graphic; +class OutputDevice; +class CharClass; +class CollatorWrapper; +class LanguageTag; + +typedef long SwTwips; +#define INVALID_TWIPS LONG_MAX +#define TWIPS_MAX (LONG_MAX - 1) + +// Converts Millimeters to Twips (1 mm == 56.905479 twips). +template <typename T = SwTwips> +constexpr T MmToTwips(const double mm) { return static_cast<T>(mm / 0.017573); } + +#define MM50 283 // 1/2 cm in TWIPS. + +const sal_Int32 COMPLETE_STRING = SAL_MAX_INT32; + +const SwTwips cMinHdFtHeight = 56; + +#define MINFLY 23 // Minimal size for FlyFrames. +#define MINLAY 23 // Minimal size for other Frames. + +// Default column distance of two text columns corresponds to 0.3 cm. +#define DEF_GUTTER_WIDTH (MM50 / 5 * 3) + +// Minimal distance (distance to text) for border attribute +// in order not to crock up aligned lines. +// 28 Twips == 0,4mm +#define MIN_BORDER_DIST 28 + +// Minimal document border: 20mm. +const SwTwips lMinBorder = 1134; + +// Margin left and above document. +// Half of it is gap between the pages. +//TODO: Replace with SwViewOption::defDocumentBorder +#define DOCUMENTBORDER 284 + +// For inserting of captions (what and where to insert). +// It's here because it is not big enough to justify its own hxx +// and does not seem to fit somewhere else. +enum class SwLabelType +{ + Table, // Caption for a table. + Object, // Caption for a graphic or OLE. + Fly, // Caption for a text frame. + Draw // Caption for a draw object. +}; + +const sal_uInt8 MAXLEVEL = 10; + +const sal_uInt8 NO_NUMLEVEL = 0x20; // "or" with the levels. + +// Some helper functions as macros or inlines. + +#define SET_CURR_SHELL( shell ) CurrShell aCurr( shell ) + +// pPathFinder is initialized by the UI. +// The class delivers all paths needed. +extern SwPathFinder *pPathFinder; + +// Values for indents at numbering and bullet lists. +// (For more levels the values have to be multiplied with the levels+1; +// levels 0 ..4!) + +const short lBulletIndent = 1440/4; +const short lBulletFirstLineOffset = -lBulletIndent; +const sal_uInt16 lNumberIndent = 1440/4; +const short lNumberFirstLineOffset = -lNumberIndent; +const short lOutlineMinTextDistance = 216; // 0.15 inch = 0.38 cm + +// Count of SystemField-types of SwDoc. +#define INIT_FLDTYPES 33 + +// Count of predefined Seq-field types. It is always the last +// fields before INIT_FLDTYPES. +#define INIT_SEQ_FLDTYPES 5 + +// defined in sw/source/uibase/app/swmodule.cxx +SW_DLLPUBLIC OUString SwResId(const char* pId); +OUString SwResId(const char* pId, int nCardinality); + +css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker(); +css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator(); +css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus(); +css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet(); + +// Returns the twip size of this graphic. +SW_DLLPUBLIC Size GetGraphicSizeTwip( const Graphic&, vcl::RenderContext* pOutDev ); + +// Separator for jumps to different content types in document. +const sal_Unicode cMarkSeparator = '|'; +// Sequences names for jumps are <name of sequence>!<no> +const char cSequenceMarkSeparator = '!'; + +#define DB_DELIM u'\x00ff' // Database <-> table separator. + +enum class SetAttrMode +{ + DEFAULT = 0x0000, // Default. + /// @attention: DONTEXPAND does not work very well for CHARATR + /// because it can expand only the whole AUTOFMT or nothing + DONTEXPAND = 0x0001, // Don't expand text attribute any further. + DONTREPLACE = 0x0002, // Don't replace another text attribute. + + NOTXTATRCHR = 0x0004, // Don't insert 0xFF at attributes with no end. + /// attention: NOHINTADJUST prevents MergePortions! + /// when using this need to pay attention to ignore start/end flags of hint + NOHINTADJUST = 0x0008, // No merging of ranges. + NOFORMATATTR = 0x0010, // Do not change into format attribute. + APICALL = 0x0020, // Called from API (all UI related + // functionality will be disabled). + /// Force hint expand (only matters for hints with CH_TXTATR). + FORCEHINTEXPAND = 0x0040, + /// The inserted item is a copy -- intended for use in ndtxt.cxx. + IS_COPY = 0x0080, + /// for Undo, translated to SwInsertFlags::NOHINTEXPAND + NOHINTEXPAND = 0x0100, +}; +namespace o3tl +{ + template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x1ff> {}; +} + +constexpr bool SW_ISPRINTABLE(sal_Unicode c) { return c >= ' ' && 127 != c; } + +#define CHAR_HARDBLANK u'\x00A0' +#define CHAR_HARDHYPHEN u'\x2011' +#define CHAR_SOFTHYPHEN u'\x00AD' +#define CHAR_RLM u'\x200F' +#define CHAR_LRM u'\x200E' +#define CHAR_ZWSP u'\x200B' +#define CHAR_ZWNBSP u'\x2060' +#define CHAR_NNBSP u'\x202F' //NARROW NO-BREAK SPACE + +// Returns the APP - CharClass instance - used for all ToUpper/ToLower/... +SW_DLLPUBLIC CharClass& GetAppCharClass(); +SW_DLLPUBLIC LanguageType GetAppLanguage(); +SW_DLLPUBLIC const LanguageTag& GetAppLanguageTag(); + +#if 0 +// I18N doesn't get this right, can't specify more than one to ignore +#define SW_COLLATOR_IGNORES ( \ + css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \ + css::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \ + css::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH ) +#else +#define SW_COLLATOR_IGNORES ( \ + css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ) +#endif + +SW_DLLPUBLIC CollatorWrapper& GetAppCollator(); +CollatorWrapper& GetAppCaseCollator(); + +SW_DLLPUBLIC const ::utl::TransliterationWrapper& GetAppCmpStrIgnore(); + +// Official shortcut for Prepare() regarding notification of Content by the Layout. +// Content provides for calculation of minimal requirements at the next call of ::Format(). +enum class PrepareHint +{ + Clear, // Reformat completely. + WidowsOrphans, // Only check for widows and orphans and split in case of need. + FixSizeChanged, // FixSize has changed. + FollowFollows, // Follow is now possibly adjacent. + AdjustSizeWithoutFormatting, // Adjust size via grow/shrink without formatting. + FlyFrameSizeChanged, // A FlyFrame has changed its size. + FlyFrameAttributesChanged, // A FlyFrame has changed its attributes (e. g. wrap). + FlyFrameArrive, // A FlyFrame now overlaps range. + FlyFrameLeave, // A FlyFrame has left range. + FootnoteInvalidation, // Invalidation of footnotes. + FramePositionChanged, // Position of Frame has changed. + // (Check for Fly-break). In void* of Prepare() + // a sal_Bool& is passed. If this is sal_True, + // it indicates that a format has been executed. + ULSpaceChanged, // UL-Space has changed, TextFrames have to + // re-calculate line space. + MustFit, // Make frm fit (split) even if the attributes do + // not allow that (e.g. "keep together"). + Widows, // A follow realizes that the orphan rule will be applied + // for it and sends a Widows to its predecessor + // (Master/Follow). + QuoVadis, // If a footnote has to be split between two paragraphs + // the last on the page has to receive a QUOVADIS in + // order to format the text into it. + BossChanged, // If a Frame changes its column/page this additional + // Prepare is sent to POS_CHGD in MoveFwd/Bwd + // (join Footnote-numbers etc.) + // Direction is communicated via pVoid: + // MoveFwd: pVoid == 0 + // MoveBwd: pVoid == pOldPage + Register, // Invalidate frames with registers. + FootnoteInvalidationGone, // A Follow loses its footnote, possibly its first line can move up. + FootnoteMove, // A footnote changes its page. Its contents receives at first a + // height of zero in order to avoid too much noise. At formatting + // it checks whether it fits and if necessary changes its page again. + ErgoSum, // Needed because of movement in FootnoteFrames. Check QuoVadis/ErgoSum. +}; + +enum class FrameControlType +{ + PageBreak, + Header, + Footer, + FloatingTable +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx new file mode 100644 index 000000000..90fa6c51d --- /dev/null +++ b/sw/inc/swundo.hxx @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWHXX +#define INCLUDED_SW_INC_SWHXX + +#include <vector> + +#include <rtl/ustring.hxx> + +typedef std::vector< OUString > SwUndoComments_t; + +// The IDs for StdActions. +enum class SwUndoId +{ + EMPTY = 0, + STD_BEGIN = 1, + START = STD_BEGIN, // 1 + END, // 2 + + REPEAT_START, // All UndoIDs between REPEAT_START and + // REPEAT_END are Repeat-enabled !! + DELETE = REPEAT_START, // 3 + INSERT, // 4 + OVERWRITE, // 5 + SPLITNODE, // 6 + INSATTR, // 7 + SETFMTCOLL, // 8 + RESETATTR, // 9 + INSFMTATTR, // 10 + INSDOKUMENT, // 11 + COPY, // 12 + INSTABLE, // 13 + TABLETOTEXT, // 14 + TEXTTOTABLE, // 15 + SORT_TXT, // 16 + INSLAYFMT, // 17 + TABLEHEADLINE, // 18 + INSSECTION, // 19 + OUTLINE_LR, // 20 + OUTLINE_UD, // 21 + INSNUM, // 22 + NUMUP, // 23 + MOVENUM, // 24 + INSDRAWFMT, // 25 + NUMORNONUM, // 26 + INC_LEFTMARGIN, // 27 + DEC_LEFTMARGIN, // 28 + INSERTLABEL, // 29 + SETNUMRULESTART, // 30 + CHGFTN, // 31 + REDLINE, // 32 + ACCEPT_REDLINE, // 33 + REJECT_REDLINE, // 34 + SPLIT_TABLE, // 35 + DONTEXPAND, // 36 + AUTOCORRECT, // 37 + MERGE_TABLE, // 38 + TRANSLITERATE, // 39 + PASTE_CLIPBOARD, // 40 + TYPING, // 41 + REPEAT_END = 46, + + MOVE = REPEAT_END, // 46 + INSGLOSSARY, // 47 + DELBOOKMARK, // 48 + INSBOOKMARK, // 49 + SORT_TBL, // 50 + DELLAYFMT, // 51 + AUTOFORMAT, // 52 + REPLACE, // 53 + DELSECTION, // 54 + CHGSECTION, // 55 + SETDEFTATTR = 57, // 57 + DELNUM, // 58 + DRAWUNDO, // 59 + DRAWGROUP, // 60 + DRAWUNGROUP, // 61 + DRAWDELETE, // 62 + REREAD, // 63 + DELGRF, // 64 + TABLE_ATTR = 66, // 66 + TABLE_AUTOFMT, // 67 + TABLE_INSCOL, // 68 + TABLE_INSROW, // 69 + TABLE_DELBOX, // 70 + TABLE_SPLIT, // 71 + TABLE_MERGE, // 72 + TBLNUMFMT, // 73 + INSTOX, // 74 + CLEARTOXRANGE, // 75 + TBLCPYTBL, // 76 + CPYTBL, // 77 + INS_FROM_SHADOWCRSR, // 78 + CHAINE, // 79 + UNCHAIN, // 80 + FTNINFO, // 81 + COMPAREDOC = 83, // 83 + SETFLYFRMFMT, // 84 + SETRUBYATTR, // 85 + TOXCHANGE = 87, // 87 + CREATE_PAGEDESC, // 88 + CHANGE_PAGEDESC, // 89 + DELETE_PAGEDESC, // 90 + HEADER_FOOTER, // 91 #i7983# + FIELD, // 92 + TXTFMTCOL_CREATE, // 93 + TXTFMTCOL_DELETE, // 94 + TXTFMTCOL_RENAME, // 95 + CHARFMT_CREATE, // 96 + CHARFMT_DELETE, // 97 + CHARFMT_RENAME, // 98 + FRMFMT_CREATE, // 99 + FRMFMT_DELETE, // 100 + FRMFMT_RENAME, // 101 + NUMRULE_CREATE, // 102 + NUMRULE_DELETE, // 103 + NUMRULE_RENAME, // 104 + BOOKMARK_RENAME, // 105 + INDEX_ENTRY_INSERT, // 106 + INDEX_ENTRY_DELETE, // 107 + COL_DELETE, // 108 + ROW_DELETE, // 109 + RENAME_PAGEDESC, // 110 + NUMDOWN, // 111 + // --> #i73249# + FLYFRMFMT_TITLE, // 112 + FLYFRMFMT_DESCRIPTION, // 113 + TBLSTYLE_CREATE, // 114 + TBLSTYLE_DELETE, // 115 + TBLSTYLE_UPDATE, // 116 + PARA_SIGN_ADD, // 117 + + // UI undo ID's... + UI_REPLACE, // 118 + UI_INSERT_PAGE_BREAK, // 119 + UI_INSERT_COLUMN_BREAK, // 120 + UI_INSERT_ENVELOPE = 122, // 122 + UI_DRAG_AND_COPY, // 123 + UI_DRAG_AND_MOVE, // 124 + UI_INSERT_CHART, // 125 + UI_INSERT_FOOTNOTE, // 126 + UI_INSERT_URLBTN, // 127 + UI_INSERT_URLTXT, // 128 + UI_DELETE_INVISIBLECNTNT, // 129 + UI_REPLACE_STYLE, // 130 + UI_DELETE_PAGE_BREAK, // 131 + UI_TEXT_CORRECTION, // 132 + UI_TABLE_DELETE, // 133 + CONFLICT, // 134 + + INSERT_FORM_FIELD // 135 +}; + +OUString GetUndoComment(SwUndoId eId); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx new file mode 100644 index 000000000..66743d90e --- /dev/null +++ b/sw/inc/swunohelper.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWUNOHELPER_HXX +#define INCLUDED_SW_INC_SWUNOHELPER_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include "swdllapi.h" + +#include <vector> + +namespace com::sun::star::uno { class Any; } +class DateTime; +class SfxItemSet; + +namespace SWUnoHelper { + +// calls over the compherl the getEnumAsInt32 function and handle the +// exceptions. +sal_Int32 GetEnumAsInt32( const css::uno::Any& rVal ); + +// methods for UCB actions: + // delete the file under this URL +SW_DLLPUBLIC bool UCB_DeleteFile( const OUString& rURL ); + + // move the file to a new location +bool UCB_MoveFile( const OUString& rURL, const OUString& rNewURL ); + + // is the URL on the current system case sensitive? +SW_DLLPUBLIC bool UCB_IsCaseSensitiveFileName( const OUString& rURL ); + + // is the URL readonly? +SW_DLLPUBLIC bool UCB_IsReadOnlyFileName( const OUString& rURL ); + + // get a list of files from the folder of the URL + // options: pExtension = 0 -> all, else this specific extension + // pDateTime != 0 -> returns also the modified date/time of + // the files in a vector --> +bool UCB_GetFileListOfFolder( const OUString& rURL, + std::vector<OUString>& rList, + const OUString* pExtension, + std::vector<DateTime>* pDateTimeList = nullptr ); + + // is the URL an existing file? +SW_DLLPUBLIC bool UCB_IsFile( const OUString& rURL ); + + // is the URL an existing directory? +bool UCB_IsDirectory( const OUString& rURL ); + +/// helper to check if fill style is set to color or bitmap +/// and thus formerly used SvxBrushItem parts need to be mapped +/// for backwards compatibility +bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet, sal_uInt16 const nMemberId); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx new file mode 100644 index 000000000..87375f30c --- /dev/null +++ b/sw/inc/swurl.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWURL_HXX +#define INCLUDED_SW_INC_SWURL_HXX + +#include <rtl/ustring.hxx> +#include <o3tl/typed_flags_set.hxx> + +class SwViewShell; + +enum class LoadUrlFlags { + NONE = 0x00, + NewView = 0x01 +}; +namespace o3tl { + template<> struct typed_flags<LoadUrlFlags> : is_typed_flags<LoadUrlFlags, 0x01> {}; +} + +void LoadURL( SwViewShell& rSh, const OUString& rName, + LoadUrlFlags nFilter, const OUString& rTargetFrameName ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swwait.hxx b/sw/inc/swwait.hxx new file mode 100644 index 000000000..ff9a4ad77 --- /dev/null +++ b/sw/inc/swwait.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_SWWAIT_HXX +#define INCLUDED_SW_INC_SWWAIT_HXX + +#include "swdllapi.h" + +#include <o3tl/sorted_vector.hxx> + +class SwDocShell; +class SfxDispatcher; + +class SW_DLLPUBLIC SwWait +{ +public: + // Activate wait cursor for all windows of given document <rDocShell> + // Optional all dispatcher could be Locked + SwWait( + SwDocShell &rDocShell, + const bool bLockUnlockDispatcher ); + ~SwWait(); + +private: + void EnterWaitAndLockDispatcher(); + void LeaveWaitAndUnlockDispatcher(); + + SwDocShell& mrDoc; + const bool mbLockUnlockDispatcher; + o3tl::sorted_vector< SfxDispatcher* > mpLockedDispatchers; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/tabcol.hxx b/sw/inc/tabcol.hxx new file mode 100644 index 000000000..0a4a990c3 --- /dev/null +++ b/sw/inc/tabcol.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TABCOL_HXX +#define INCLUDED_SW_INC_TABCOL_HXX + +#include <vector> +#include <memory> + +#include "swdllapi.h" + +struct SwTabColsEntry +{ + long nPos; + long nMin; + long nMax; + bool bHidden; // For each entry a flag, hidden or not. + // If the flag bHidden is true column separator + // is not in current line. It must maintained + // but it may not be displayed. +}; + +typedef std::vector< SwTabColsEntry > SwTabColsEntries; + +class SW_DLLPUBLIC SwTabCols +{ + long m_nLeftMin; // Leftmost border (reference point) for + // document coordinates. + // All other values are relative to this point! + long m_nLeft; // Left border of table. + long m_nRight; // Right border of table. + long m_nRightMax; // Maximum right border of table. + + bool m_bLastRowAllowedToChange; // If the last row of the table frame + // is split across pages, it may not + // change its size. + + SwTabColsEntries m_aData; + + //For the CopyCTor. + const SwTabColsEntries& GetData() const { return m_aData; } + +public: + SwTabCols( sal_uInt16 nSize = 0 ); + SwTabCols( const SwTabCols& ); + SwTabCols &operator=( const SwTabCols& ); + long& operator[]( size_t nPos ) { return m_aData[nPos].nPos; } + long operator[]( size_t nPos ) const { return m_aData[nPos].nPos; } + size_t Count() const { return m_aData.size(); } + + bool IsHidden( size_t nPos ) const { return m_aData[nPos].bHidden; } + void SetHidden( size_t nPos, bool bValue ) { m_aData[nPos].bHidden = bValue; } + + void Insert( long nValue, bool bValue, size_t nPos ); + void Insert( long nValue, long nMin, long nMax, bool bValue, size_t nPos ); + void Remove( size_t nPos, size_t nCount = 1 ); + + const SwTabColsEntry& GetEntry( size_t nPos ) const { return m_aData[nPos]; } + SwTabColsEntry& GetEntry( size_t nPos ) { return m_aData[nPos]; } + + long GetLeftMin() const { return m_nLeftMin; } + long GetLeft() const { return m_nLeft; } + long GetRight() const { return m_nRight; } + long GetRightMax()const { return m_nRightMax;} + + void SetLeftMin ( long nNew ) { m_nLeftMin = nNew; } + void SetLeft ( long nNew ) { m_nLeft = nNew; } + void SetRight ( long nNew ) { m_nRight = nNew; } + void SetRightMax( long nNew ) { m_nRightMax = nNew;} + + bool IsLastRowAllowedToChange() const { return m_bLastRowAllowedToChange; } + void SetLastRowAllowedToChange( bool bNew ) { m_bLastRowAllowedToChange = bNew; } +}; + +class SwTable; +class SwTabFrame; +class SwFrame; + +struct SwColCache { + std::unique_ptr<SwTabCols> pLastCols; + SwTable const* pLastTable = nullptr; + SwTabFrame const* pLastTabFrame = nullptr; + SwFrame const* pLastCellFrame = nullptr; +}; + +#endif // INCLUDED_SW_INC_TABCOL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx new file mode 100644 index 000000000..f9073edff --- /dev/null +++ b/sw/inc/tblafmt.hxx @@ -0,0 +1,333 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TBLAFMT_HXX +#define INCLUDED_SW_INC_TBLAFMT_HXX +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * The structure of table auto formatting should not be changed. It is used + * by different code of Writer and Calc. If a change is necessary, the + * source code of both applications must be changed! + * + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#include <memory> + +#include <editeng/formatbreakitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <editeng/shaditem.hxx> +#include <svx/autoformathelper.hxx> +#include "fmtpdsc.hxx" +#include "fmtornt.hxx" +#include "swdllapi.h" + +struct SwAfVersions; + +class SvNumberFormatter; +class SwTable; + +class SwBoxAutoFormat : public AutoFormatBase +{ +private: + // Writer specific + std::unique_ptr<SvxFrameDirectionItem> m_aTextOrientation; + std::unique_ptr<SwFormatVertOrient> m_aVerticalAlignment; + + // number format + OUString m_sNumFormatString; + LanguageType m_eSysLanguage; + LanguageType m_eNumFormatLanguage; + + css::uno::WeakReference<css::uno::XInterface> m_wXObject; + +public: + SwBoxAutoFormat(); + SwBoxAutoFormat( const SwBoxAutoFormat& rNew ); + ~SwBoxAutoFormat(); + + /// assignment-op (still used) + SwBoxAutoFormat& operator=(const SwBoxAutoFormat& rRef); + + /// Comparing based of boxes backgrounds. + bool operator==(const SwBoxAutoFormat& rRight) const; + + // The get-methods. + const SvxFrameDirectionItem& GetTextOrientation() const { return *m_aTextOrientation; } + const SwFormatVertOrient& GetVerticalAlignment() const { return *m_aVerticalAlignment; } + + void GetValueFormat( OUString& rFormat, LanguageType& rLng, LanguageType& rSys ) const + { rFormat = m_sNumFormatString; rLng = m_eNumFormatLanguage; rSys = m_eSysLanguage; } + + const OUString& GetNumFormatString() const { return m_sNumFormatString; } + const LanguageType& GetSysLanguage() const { return m_eSysLanguage; } + const LanguageType& GetNumFormatLanguage() const { return m_eNumFormatLanguage; } + + // The set-methods. + void SetTextOrientation( const SvxFrameDirectionItem& rNew ) { m_aTextOrientation.reset(rNew.Clone()); } + void SetVerticalAlignment( const SwFormatVertOrient& rNew ) { m_aVerticalAlignment.reset(rNew.Clone()); } + + void SetValueFormat( const OUString& rFormat, LanguageType eLng, LanguageType eSys ) + { m_sNumFormatString = rFormat; m_eNumFormatLanguage = eLng; m_eSysLanguage = eSys; } + + void SetNumFormatString(const OUString& rNew) { m_sNumFormatString = rNew; } + void SetSysLanguage(const LanguageType& rNew) { m_eSysLanguage = rNew; } + void SetNumFormatLanguage(const LanguageType& rNew) { m_eNumFormatLanguage = rNew; } + + css::uno::WeakReference<css::uno::XInterface> const& GetXObject() const + { return m_wXObject; } + void SetXObject(css::uno::Reference<css::uno::XInterface> const& xObject) + { m_wXObject = xObject; } + + bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ); + bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; +}; + +enum class SwTableAutoFormatUpdateFlags { Char = 1, Box = 2 }; +namespace o3tl { + template<> struct typed_flags<SwTableAutoFormatUpdateFlags> : is_typed_flags<SwTableAutoFormatUpdateFlags, 0x03> {}; +}; + +/* +@remarks +A table has a number of lines. These lines seem to correspond with rows, except in the case of +rows spanning more than one line. Each line contains a number of boxes/cells. + +AutoFormat properties are retrieved and stored in a grid of 16 table boxes. A sampling approach +is used to read the data. 4 lines are picked, and 4 boxes are picked from each. + +The line picking and box picking algorithms are similar. We start at the first line/box, and pick +lines/boxes one by one for a maximum of 3. The 4th line/box is the last line/box in the current +table/line. If we hit the end of lines/boxes, the last line/box encountered is picked several times. + +For example, in a 2x3 table, the 4 lines will be [0, 1, 1, 1]. In each line, the boxes will be +[0, 1, 2, 2]. In a 6x5 table, the 4 lines will be [0, 1, 2, 4] and the boxes per line will be +[0, 1, 2, 5]. + +As you can see, property extraction/application is lossless for tables that are 4x4 or smaller +(and in fact has a bit of redundancy). For larger tables, we lose any individual cell formatting +for the range [(3,rows - 1) -> (3, cols - 1)]. That formatting is replaced by formatting from +the saved cells: + + 0 1 2 3 4 5 + +-----------------------------------------------------------------------+ + 0 | Saved | Saved | Saved | | | Saved | + +-----------------------------------------------------------------------+ + 1 | Saved | Saved | Saved | | | Saved | + +-----------------------------------------------------------------------+ + 2 | Saved | Saved | Saved | | | Saved | + +-----------------------------------------------------------------------+ + 3 | | | | | | | + +-----------------------------------------------------------------------+ + 4 | | | | | | | + +-----------------------------------------------------------------------+ + 5 | Saved | Saved | Saved | | | Saved | + +-----------+-----------+-----------+-----------+-----------+-----------+ + +The properties saved are divided into three categories: + 1. Character properties: Font, font size, weight, etc. + 2. Box properties: Box, cell background + 3. Table properties: Properties that are set in the Table->Table Properties dialog. + +Character and box properties are stored per cell (and are lossy for tables larger than 4x4). Table +properties are stored per-table, and are lossless. +*/ +class SW_DLLPUBLIC SwTableAutoFormat +{ + friend class SwDocTest; + friend void FinitCore(); // To destroy default pointer. + static SwBoxAutoFormat* pDfltBoxAutoFormat; + + css::uno::WeakReference<css::uno::XInterface> m_wXObject; + + OUString m_aName; + sal_uInt16 m_nStrResId; + + // Common flags of Calc and Writer. + bool m_bInclFont : 1; + bool m_bInclJustify : 1; + bool m_bInclFrame : 1; + bool m_bInclBackground : 1; + bool m_bInclValueFormat : 1; + + // Calc specific flags. + bool m_bInclWidthHeight : 1; + + SwBoxAutoFormat* m_aBoxAutoFormat[ 16 ] = {}; + + // Writer-specific options + std::shared_ptr<SvxFormatBreakItem> m_aBreak; + SwFormatPageDesc m_aPageDesc; + std::shared_ptr<SvxFormatKeepItem> m_aKeepWithNextPara; + sal_uInt16 m_aRepeatHeading; + bool m_bLayoutSplit; + bool m_bRowSplit; + bool m_bCollapsingBorders; + std::shared_ptr<SvxShadowItem> m_aShadow; + + bool m_bHidden; + bool m_bUserDefined; +public: + SwTableAutoFormat( const OUString& rName ); + SwTableAutoFormat( const SwTableAutoFormat& rNew ); + ~SwTableAutoFormat(); + + SwTableAutoFormat& operator=( const SwTableAutoFormat& rNew ); + + const SvxFormatBreakItem& GetBreak() const { return *m_aBreak; } + const SvxFormatKeepItem& GetKeepWithNextPara() const { return *m_aKeepWithNextPara; } + const SvxShadowItem& GetShadow() const { return *m_aShadow; } + + void SetBreak(const SvxFormatBreakItem& rNew) { m_aBreak.reset(rNew.Clone()); } + void SetKeepWithNextPara(const SvxFormatKeepItem& rNew) { m_aKeepWithNextPara.reset(rNew.Clone()); } + void SetShadow(const SvxShadowItem& rNew) { m_aShadow.reset(rNew.Clone()); } + + void SetBoxFormat( const SwBoxAutoFormat& rNew, sal_uInt8 nPos ); + const SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ) const; + SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ); + static const SwBoxAutoFormat& GetDefaultBoxFormat(); + + void SetName( const OUString& rNew ) { m_aName = rNew; m_nStrResId = USHRT_MAX; } + const OUString& GetName() const { return m_aName; } + + void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet, + SwTableAutoFormatUpdateFlags eFlags, SvNumberFormatter const * ); + void UpdateToSet( const sal_uInt8 nPos, const bool bSingleRowTable, const bool bSingleColTable, + SfxItemSet& rSet, SwTableAutoFormatUpdateFlags eFlags, + SvNumberFormatter* ) const ; + + void RestoreTableProperties(SwTable &table) const; + void StoreTableProperties(const SwTable &table); + + bool IsFont() const { return m_bInclFont; } + bool IsJustify() const { return m_bInclJustify; } + bool IsFrame() const { return m_bInclFrame; } + bool IsBackground() const { return m_bInclBackground; } + bool IsValueFormat() const { return m_bInclValueFormat; } + + /// Check if style is hidden. + bool IsHidden() const { return m_bHidden; } + /// Check if style is defined by user. + bool IsUserDefined() const { return m_bUserDefined; } + + void SetFont( const bool bNew ) { m_bInclFont = bNew; } + void SetJustify( const bool bNew ) { m_bInclJustify = bNew; } + void SetFrame( const bool bNew ) { m_bInclFrame = bNew; } + void SetBackground( const bool bNew ) { m_bInclBackground = bNew; } + void SetValueFormat( const bool bNew ) { m_bInclValueFormat = bNew; } + void SetWidthHeight( const bool bNew ) { m_bInclWidthHeight = bNew; } + + /// Set if style is hidden. + void SetHidden(bool bHidden) { m_bHidden = bHidden; } + /// Set if style is user defined. + void SetUserDefined(bool bUserDefined) { m_bUserDefined = bUserDefined; } + + /// These methods returns what style (row or column) is applied first on given Cell + bool FirstRowEndColumnIsRow(); + bool FirstRowStartColumnIsRow(); + bool LastRowEndColumnIsRow(); + bool LastRowStartColumnIsRow(); + + bool Load( SvStream& rStream, const SwAfVersions& ); + bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; + + css::uno::WeakReference<css::uno::XInterface> const& GetXObject() const + { return m_wXObject; } + void SetXObject(css::uno::Reference<css::uno::XInterface> const& xObject) + { m_wXObject = xObject; } + + /// Returns the cell's name postfix. eg. ".1" + OUString GetTableTemplateCellSubName(const SwBoxAutoFormat& rBoxFormat) const; + /// Returns a vector of indexes in aBoxAutoFormat array. Returned indexes points to cells which are mapped to a table-template. + static const std::vector<sal_Int32>& GetTableTemplateMap(); + + /** + * Calculates the relevant position in the table autoformat for a given + * cell in a given table. + */ + static sal_uInt8 CountPos(sal_uInt32 nCol, sal_uInt32 nCols, sal_uInt32 nRow, sal_uInt32 nRows); +}; + +class SW_DLLPUBLIC SwTableAutoFormatTable +{ + struct Impl; + std::unique_ptr<Impl> m_pImpl; + + SAL_DLLPRIVATE bool Load( SvStream& rStream ); + SAL_DLLPRIVATE bool Save( SvStream& rStream ) const; + +public: + explicit SwTableAutoFormatTable(); + ~SwTableAutoFormatTable(); + + size_t size() const; + SwTableAutoFormat const& operator[](size_t i) const; + SwTableAutoFormat & operator[](size_t i); + + /// Append table style to the existing styles. + void AddAutoFormat(const SwTableAutoFormat& rFormat); + + void InsertAutoFormat(size_t i, std::unique_ptr<SwTableAutoFormat> pFormat); + void EraseAutoFormat(size_t i); + void EraseAutoFormat(const OUString& rName); + std::unique_ptr<SwTableAutoFormat> ReleaseAutoFormat(size_t i); + /// Removes an autoformat. Returns pointer to the removed autoformat or nullptr. + std::unique_ptr<SwTableAutoFormat> ReleaseAutoFormat(const OUString& rName); + + /// Find table style with the provided name, return nullptr when not found. + SwTableAutoFormat* FindAutoFormat(const OUString& rName) const; + + void Load(); + bool Save() const; +}; + +class SwCellStyleDescriptor +{ + const std::pair<OUString, std::unique_ptr<SwBoxAutoFormat>>& m_rCellStyleDesc; +public: + SwCellStyleDescriptor(const std::pair<OUString, std::unique_ptr<SwBoxAutoFormat>>& rCellStyleDesc) : m_rCellStyleDesc(rCellStyleDesc) { } + + const OUString& GetName() const { return m_rCellStyleDesc.first; } +}; + +class SwCellStyleTable +{ + std::vector<std::pair<OUString, std::unique_ptr<SwBoxAutoFormat>>> m_aCellStyles; +public: + SwCellStyleTable(); + ~SwCellStyleTable(); + + size_t size() const; + SwCellStyleDescriptor operator[](size_t i) const; + void clear(); + + /// Add a copy of rBoxFormat + void AddBoxFormat(const SwBoxAutoFormat& rBoxFormat, const OUString& sName); + void RemoveBoxFormat(const OUString& sName); + void ChangeBoxFormatName(const OUString& sFromName, const OUString& sToName); + /// If found returns its name. If not found returns an empty OUString + OUString GetBoxFormatName(const SwBoxAutoFormat& rBoxFormat) const; + /// If found returns a ptr to a BoxFormat. If not found returns nullptr + SwBoxAutoFormat* GetBoxFormat(const OUString& sName) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/tblenum.hxx b/sw/inc/tblenum.hxx new file mode 100644 index 000000000..fd9ea7237 --- /dev/null +++ b/sw/inc/tblenum.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TBLENUM_HXX +#define INCLUDED_SW_INC_TBLENUM_HXX + +#include <o3tl/typed_flags_set.hxx> + +// For changing table columns/rows widths/heights. +enum class TableChgWidthHeightType : sal_uInt16 +{ + ColLeft = 0, + ColRight = 1, + RowBottom = 3, + CellLeft = 4, + CellRight = 5, + CellTop = 6, + CellBottom = 7, + InvalidPos = 0x0f, + + // The following can be "or"ed in. + BiggerMode = 0x8000, // Box becomes larger -> else smaller. +}; +namespace o3tl { + template<> struct typed_flags<TableChgWidthHeightType> : is_typed_flags<TableChgWidthHeightType, 0x800f> {}; +} +constexpr TableChgWidthHeightType extractPosition(TableChgWidthHeightType e) { + return static_cast<TableChgWidthHeightType>(static_cast<sal_uInt16>(e) & 0xf); +} + +enum class TableChgMode +{ + FixedWidthChangeAbs, // Table fixed width, change neighbour. + FixedWidthChangeProp, // Table fixed width, change all neighbours. + VarWidthChangeAbs // Table variable, change all neighbours. +}; + +enum class SplitTable_HeadlineOption +{ + NONE = 0, // Leave everything in place. + BorderCopy, // Copy border of the previous line. + ContentCopy, // Copy 1st line with all contents. + BoxAttrCopy, // Copy box attributes of 1st line. + BoxAttrAllCopy // Copy box attributes and paragraph styles of 1st line. +}; + +enum class TableMergeErr +{ + Ok, + NoSelection, + TooComplex +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx new file mode 100644 index 000000000..4d929ba22 --- /dev/null +++ b/sw/inc/tblsel.hxx @@ -0,0 +1,231 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TBLSEL_HXX +#define INCLUDED_SW_INC_TBLSEL_HXX + +#include "swtable.hxx" +#include "swrect.hxx" +#include "swdllapi.h" + +#include <o3tl/sorted_vector.hxx> + +#include <memory> +#include <deque> +#include <vector> + +class SwCursorShell; +class SwCursor; +class SwTableCursor; +class SwFrame; +class SwTabFrame; +class SwLayoutFrame; +class SwPaM; +class SwNode; +class SwUndoTableMerge; +class SwCellFrame; + +typedef std::deque< SwCellFrame* > SwCellFrames; + +struct CompareSwSelBoxes +{ + bool operator()(SwTableBox* const& lhs, SwTableBox* const& rhs) const + { + return lhs->GetSttIdx() < rhs->GetSttIdx(); + } +}; +class SwSelBoxes : public o3tl::sorted_vector<SwTableBox*, CompareSwSelBoxes> {}; + +// Collects all boxes in table that are selected. +// Selection gets extended in given direction according to enum-parameter. +// Boxes are collected via the Layout; works correctly if tables are split. +// (Cf. MakeSelUnions().) +enum class SwTableSearchType : sal_uInt16 +{ + NONE = 0x01, // No extension. + Row = 0x02, // Extend to rows. + Col = 0x03, // Extend to columns. + + // As flags to the other values! + Protect = 0x08, // Collect protected boxes too. + NoUnionCorrect = 0x10, // Do not correct collected Union. +}; +namespace o3tl { + template<> struct typed_flags<SwTableSearchType> : is_typed_flags<SwTableSearchType, 0x1b> {}; +} + +SW_DLLPUBLIC void GetTableSel( const SwCursorShell& rShell, SwSelBoxes& rBoxes, + const SwTableSearchType = SwTableSearchType::NONE ); + +void GetTableSel( const SwCursor& rCursor, SwSelBoxes& rBoxes, + const SwTableSearchType = SwTableSearchType::NONE ); + +// As before, but don't start from selection but from Start- EndFrames. +void GetTableSel( const SwLayoutFrame* pStart, const SwLayoutFrame* pEnd, + SwSelBoxes& rBoxes, SwCellFrames* pCells, + const SwTableSearchType = SwTableSearchType::NONE ); + +// As before but directly via PaMs. +void GetTableSelCrs( const SwCursorShell& rShell, SwSelBoxes& rBoxes ); +void GetTableSelCrs( const SwTableCursor& rTableCursor, SwSelBoxes& rBoxes ); + +// Collect boxes relevant for auto sum. +bool GetAutoSumSel( const SwCursorShell&, SwCellFrames& ); + +// Check if the SelBoxes contains protected Boxes. +bool HasProtectedCells( const SwSelBoxes& rBoxes ); + +// Check if selection is balanced. +bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd); + +// Check if cell is part of SSelection. +// (Became a function, in order to make sure that GetTableSel() and MakeTableCursor() +// have always the same concept of the selection. +bool IsFrameInTableSel( const SwRect& rUnion, const SwFrame* pCell ); + +// Determine boxes to be merged. +// In this process the rectangle gets "adapted" on the base of the layout, +// i.e. boxes are added if some overlap at the sides. +// Additionally a new box is created and filled with the relevant content. +void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, + SwTableBox** ppMergeBox, SwUndoTableMerge* pUndo ); + +// Check if selected boxes allow for a valid merge. +TableMergeErr CheckMergeSel( const SwPaM& rPam ); +TableMergeErr CheckMergeSel( const SwSelBoxes& rBoxes ); + +bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ); + +// Check if Split or InsertCol lead to a box becoming smaller than MINLAY. +bool CheckSplitCells( const SwCursorShell& rShell, sal_uInt16 nDiv, + const SwTableSearchType ); +bool CheckSplitCells( const SwCursor& rCursor, sal_uInt16 nDiv, + const SwTableSearchType ); + +// For working on tab selection also for split tables. +class SwSelUnion +{ + SwRect m_aUnion; // The rectangle enclosing the selection. + SwTabFrame *m_pTable; // The (Follow-)Table for the Union. + +public: + SwSelUnion( const SwRect &rRect, SwTabFrame *pTab ) : + m_aUnion( rRect ), m_pTable( pTab ) {} + + const SwRect& GetUnion() const { return m_aUnion; } + SwRect& GetUnion() { return m_aUnion; } + const SwTabFrame *GetTable() const { return m_pTable; } + SwTabFrame *GetTable() { return m_pTable; } +}; + +// Determines tables affected by a table selection and union rectangles +// of the selection (also for split tables) +typedef std::vector<SwSelUnion> SwSelUnions; + +// Gets the tables involved in a table selection and the union-rectangles of the selections +// - also for split tables. +// If a parameter is passed that != SwTableSearchType::NONE +// the selection is extended in the given direction. +void MakeSelUnions( SwSelUnions&, const SwLayoutFrame *pStart, + const SwLayoutFrame *pEnd, + const SwTableSearchType = SwTableSearchType::NONE ); + +// These classes copy the current table selections (rBoxes) into a +// separate structure while keeping the table structure. + +class FndBox_; +class FndLine_; + +typedef std::vector<std::unique_ptr<FndBox_>> FndBoxes_t; +typedef std::vector<std::unique_ptr<FndLine_>> FndLines_t; + +class FndBox_ +{ + SwTableBox* m_pBox; + FndLines_t m_Lines; + FndLine_* m_pUpper; + + SwTableLine *m_pLineBefore; // For deleting/restoring the layout. + SwTableLine *m_pLineBehind; + + FndBox_(FndBox_ const&) = delete; + FndBox_& operator=(FndBox_ const&) = delete; + +public: + FndBox_( SwTableBox* pB, FndLine_* pFL ) : + m_pBox(pB), m_pUpper(pFL), m_pLineBefore( nullptr ), m_pLineBehind( nullptr ) {} + + const FndLines_t& GetLines() const { return m_Lines; } + FndLines_t& GetLines() { return m_Lines; } + const SwTableBox* GetBox() const { return m_pBox; } + SwTableBox* GetBox() { return m_pBox; } + const FndLine_* GetUpper() const { return m_pUpper; } + FndLine_* GetUpper() { return m_pUpper; } + + void SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable ); + void SetTableLines( const SwTable &rTable ); + //Add an input param to identify if acc table should be disposed + void DelFrames ( SwTable &rTable ); + void MakeFrames( SwTable &rTable ); + void MakeNewFrames( SwTable &rTable, const sal_uInt16 nNumber, + const bool bBehind ); + bool AreLinesToRestore( const SwTable &rTable ) const; + + void ClearLineBehind() { m_pLineBehind = nullptr; } +}; + +class FndLine_ +{ + SwTableLine* m_pLine; + FndBoxes_t m_Boxes; + FndBox_* m_pUpper; + + FndLine_(FndLine_ const&) = delete; + FndLine_& operator=(FndLine_ const&) = delete; + +public: + FndLine_(SwTableLine* pL, FndBox_* pFB) : m_pLine(pL), m_pUpper(pFB) {} + const FndBoxes_t& GetBoxes() const { return m_Boxes; } + FndBoxes_t& GetBoxes() { return m_Boxes; } + const SwTableLine* GetLine() const { return m_pLine; } + SwTableLine* GetLine() { return m_pLine; } + const FndBox_* GetUpper() const { return m_pUpper; } + FndBox_* GetUpper() { return m_pUpper; } + + void SetUpper( FndBox_* pUp ) { m_pUpper = pUp; } +}; + +struct FndPara +{ + const SwSelBoxes& rBoxes; + FndLine_* pFndLine; + FndBox_* pFndBox; + + FndPara( const SwSelBoxes& rBxs, FndBox_* pFB ) + : rBoxes(rBxs), pFndLine(nullptr), pFndBox(pFB) {} + FndPara( const FndPara& rPara, FndBox_* pFB ) + : rBoxes(rPara.rBoxes), pFndLine(rPara.pFndLine), pFndBox(pFB) {} + FndPara( const FndPara& rPara, FndLine_* pFL ) + : rBoxes(rPara.rBoxes), pFndLine(pFL), pFndBox(rPara.pFndBox) {} +}; + +SW_DLLPUBLIC void ForEach_FndLineCopyCol(SwTableLines& rLines, FndPara* pFndPara ); + +#endif // INCLUDED_SW_INC_TBLSEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx new file mode 100644 index 000000000..746a5e90b --- /dev/null +++ b/sw/inc/textboxhelper.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_SW_INC_TEXTBOXHELPER_HXX +#define INCLUDED_SW_INC_TEXTBOXHELPER_HXX + +#include <map> +#include <set> +#include <vector> + +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Type.h> + +#include "swdllapi.h" + +class SdrPage; +class SdrObject; +class SfxItemSet; +class SwFrameFormat; +class SwFrameFormats; +class SwFormatContent; +class SwDoc; +namespace tools +{ +class Rectangle; +} +class ZSortFly; +namespace com +{ +namespace sun +{ +namespace star +{ +namespace drawing +{ +class XShape; +} +} +} +} + +/** + * A TextBox is a TextFrame, that is tied to a drawinglayer shape. + * + * This class provides helper methods to create, query and maintain such + * TextBoxes. + */ +class SW_DLLPUBLIC SwTextBoxHelper +{ +public: + /// Maps a draw format to a fly format. + using SavedLink = std::map<const SwFrameFormat*, const SwFrameFormat*>; + /// Maps a draw format to content. + using SavedContent = std::map<const SwFrameFormat*, SwFormatContent>; + /// Create a TextBox for a shape. + static void create(SwFrameFormat* pShape); + /// Destroy a TextBox for a shape. + static void destroy(SwFrameFormat* pShape); + /// Get interface of a shape's TextBox, if there is any. + static css::uno::Any queryInterface(const SwFrameFormat* pShape, const css::uno::Type& rType); + + /// Sync property of TextBox with the one of the shape. + static void syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, + const css::uno::Any& rValue); + /// Does the same, but works on properties which lack an sw-specific WID / MemberID. + static void syncProperty(SwFrameFormat* pShape, const OUString& rPropertyName, + const css::uno::Any& rValue); + /// Get a property of the underlying TextFrame. + static void getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, + css::uno::Any& rValue); + + /// Similar to syncProperty(), but used by the internal API (e.g. for UI purposes). + static void syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& rSet); + + /** + * If we have an associated TextFrame, then return that. + * + * @param nType Expected frame format type. + * Valid types are RES_DRAWFRMFMT and RES_FLYFRMFMT. + * + * @see isTextBox + */ + static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType); + /// If we have an associated TextFrame, then return that. + static SwFrameFormat* + getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& xShape); + /// Return the textbox rectangle of a draw shape (in twips). + static tools::Rectangle getTextRectangle(SwFrameFormat* pShape, bool bAbsolute = true); + + /** + * Is the frame format a text box? + * + * A text box consists of a coupled fly and draw format. Most times you + * just want to check for a single type, otherwise you get duplicate results. + * + * @param nType Expected frame format input type. + * Valid types are RES_DRAWFRMFMT and RES_FLYFRMFMT. + */ + static bool isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType); + + /// Count number of shapes in the document, excluding TextBoxes. + static sal_Int32 getCount(const SwDoc* pDoc); + /// Count number of shapes on the page, excluding TextBoxes. + static sal_Int32 getCount(SdrPage const* pPage); + /// Get a shape by index, excluding TextBoxes. + /// + /// @throws css::lang::IndexOutOfBoundsException + static css::uno::Any getByIndex(SdrPage const* pPage, sal_Int32 nIndex); + /// Get the order of the shape, excluding TextBoxes. + static sal_Int32 getOrdNum(const SdrObject* pObject); + /// If pTextBox is a textbox, then set rWrapThrough to the surround of its shape. + static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough); + + /// Saves the current shape -> textbox links in a map, so they can be restored later. + static void saveLinks(const SwFrameFormats& rFormats, + std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks); + /// Undo the effect of saveLinks() + individual resetLink() calls. + static void restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew, + SavedLink& rSavedLinks); +}; + +#endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/tgrditem.hxx b/sw/inc/tgrditem.hxx new file mode 100644 index 000000000..8e4977344 --- /dev/null +++ b/sw/inc/tgrditem.hxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TGRDITEM_HXX +#define INCLUDED_SW_INC_TGRDITEM_HXX + +#include <tools/color.hxx> +#include <svl/poolitem.hxx> +#include "swdllapi.h" +#include "hintids.hxx" +#include "format.hxx" + +class IntlWrapper; + +enum SwTextGrid { GRID_NONE, GRID_LINES_ONLY, GRID_LINES_CHARS }; + +class SW_DLLPUBLIC SwTextGridItem : public SfxPoolItem +{ +private: + Color m_aColor; + sal_uInt16 m_nLines; + sal_uInt16 m_nBaseHeight; + sal_uInt16 m_nRubyHeight; + SwTextGrid m_eGridType; + bool m_bRubyTextBelow; + bool m_bPrintGrid; + bool m_bDisplayGrid; + + //for textgrid enhancement + sal_uInt16 m_nBaseWidth; + bool m_bSnapToChars; + bool m_bSquaredMode; + +public: + SwTextGridItem(); + virtual ~SwTextGridItem() override; + + SwTextGridItem(SwTextGridItem const &) = default; + SwTextGridItem(SwTextGridItem &&) = default; + SwTextGridItem & operator =(SwTextGridItem const &) = delete; // due to SfxPoolItem + SwTextGridItem & operator =(SwTextGridItem &&) = delete; // due to SfxPoolItem + + // "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwTextGridItem* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + const Color& GetColor() const { return m_aColor; } + void SetColor( const Color& rCol ) { m_aColor = rCol; } + + sal_uInt16 GetLines() const { return m_nLines; } + void SetLines( sal_uInt16 nNew ) { m_nLines = nNew; } + + sal_uInt16 GetBaseHeight() const { return m_nBaseHeight; } + void SetBaseHeight( sal_uInt16 nNew ) { m_nBaseHeight = nNew; } + + sal_uInt16 GetRubyHeight() const { return m_nRubyHeight; } + void SetRubyHeight( sal_uInt16 nNew ) { m_nRubyHeight = nNew; } + + SwTextGrid GetGridType() const { return m_eGridType; } + void SetGridType( SwTextGrid eNew ) { m_eGridType = eNew; } + + bool IsRubyTextBelow() const { return m_bRubyTextBelow; } + bool GetRubyTextBelow() const { return m_bRubyTextBelow; } + void SetRubyTextBelow( bool bNew ) { m_bRubyTextBelow = bNew; } + + bool IsPrintGrid() const { return m_bPrintGrid; } + bool GetPrintGrid() const { return m_bPrintGrid; } + void SetPrintGrid( bool bNew ) { m_bPrintGrid = bNew; } + + bool IsDisplayGrid() const { return m_bDisplayGrid; } + bool GetDisplayGrid() const { return m_bDisplayGrid; } + void SetDisplayGrid( bool bNew ) { m_bDisplayGrid = bNew; } + + //for textgrid enhancement + sal_uInt16 GetBaseWidth() const { return m_nBaseWidth;} + void SetBaseWidth( sal_uInt16 nNew ) { m_nBaseWidth = nNew; } + + bool IsSnapToChars() const { return m_bSnapToChars; } + bool GetSnapToChars() const { return m_bSnapToChars; } + void SetSnapToChars( bool bNew ) { m_bSnapToChars = bNew; } + + bool IsSquaredMode() const { return m_bSquaredMode; } + bool GetSquaredMode() const { return m_bSquaredMode; } + void SetSquaredMode( bool bNew ) { m_bSquaredMode = bNew; } + void SwitchPaperMode(bool bNew ); + + void Init(); +}; + +inline const SwTextGridItem &SwFormat::GetTextGrid(bool bInP) const + { return m_aSet.Get( RES_TEXTGRID, bInP ); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx new file mode 100644 index 000000000..24bee485f --- /dev/null +++ b/sw/inc/tox.hxx @@ -0,0 +1,725 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TOX_HXX +#define INCLUDED_SW_INC_TOX_HXX + +#include <cppuhelper/weakref.hxx> +#include <sal/log.hxx> + +#include <i18nlangtag/lang.h> +#include <svl/poolitem.hxx> + +#include <editeng/svxenum.hxx> +#include "swtypes.hxx" +#include "toxe.hxx" +#include "calbck.hxx" +#include <o3tl/typed_flags_set.hxx> + +#include <vector> + +namespace com::sun::star { + namespace text { class XDocumentIndexMark; } +} +class SwTOXType; +class SwTOXMark; +class SwTextTOXMark; +class SwDoc; +class SwRootFrame; + +typedef std::vector<SwTOXMark*> SwTOXMarks; + +// Entry of content index, alphabetical index or user defined index + +extern const sal_Unicode C_NUM_REPL; +extern const sal_Unicode C_END_PAGE_NUM; +extern const OUString S_PAGE_DELI; + +class SW_DLLPUBLIC SwTOXMark + : public SfxPoolItem + , public sw::BroadcastingModify +{ + friend void InitCore(); + friend class SwTextTOXMark; + + OUString m_aAltText; // Text of caption is different. + OUString m_aPrimaryKey; + OUString m_aSecondaryKey; + + // three more strings for phonetic sorting + OUString m_aTextReading; + OUString m_aPrimaryKeyReading; + OUString m_aSecondaryKeyReading; + + SwTextTOXMark* m_pTextAttr; + + sal_uInt16 m_nLevel; + OUString m_aBookmarkName; + OUString m_aEntryTypeName; // stored specific entry type name for INDEX field \f + bool m_bAutoGenerated : 1; // generated using a concordance file + bool m_bMainEntry : 1; // main entry emphasized by character style + + css::uno::WeakReference<css::text::XDocumentIndexMark> m_wXDocumentIndexMark; + + SwTOXMark(); // to create the default attribute in InitCore + +protected: + // SwClient + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override; + +public: + + // single argument ctors shall be explicit. + explicit SwTOXMark( const SwTOXType* pTyp ); + virtual ~SwTOXMark() override; + + SwTOXMark( const SwTOXMark& rCopy ); + SwTOXMark& operator=( const SwTOXMark& rCopy ); + + // "pure virtual methods" of SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SwTOXMark* Clone( SfxItemPool* pPool = nullptr ) const override; + + void InvalidateTOXMark(); + + OUString GetText(SwRootFrame const* pLayout) const; + + inline bool IsAlternativeText() const; + inline const OUString& GetAlternativeText() const; + + inline void SetAlternativeText( const OUString& rAlt ); + + // content or user defined index + inline void SetLevel(sal_uInt16 nLevel); + inline sal_uInt16 GetLevel() const; + inline void SetBookmarkName( const OUString& bName); + inline const OUString& GetBookmarkName() const; + inline void SetEntryTypeName( const OUString& sName); + inline const OUString& GetEntryTypeName() const; + + // for alphabetical index only + inline void SetPrimaryKey(const OUString& rStr ); + inline void SetSecondaryKey(const OUString& rStr); + inline void SetTextReading(const OUString& rStr); + inline void SetPrimaryKeyReading(const OUString& rStr ); + inline void SetSecondaryKeyReading(const OUString& rStr); + + inline OUString const & GetPrimaryKey() const; + inline OUString const & GetSecondaryKey() const; + inline OUString const & GetTextReading() const; + inline OUString const & GetPrimaryKeyReading() const; + inline OUString const & GetSecondaryKeyReading() const; + + bool IsAutoGenerated() const {return m_bAutoGenerated;} + void SetAutoGenerated(bool bSet) {m_bAutoGenerated = bSet;} + + bool IsMainEntry() const {return m_bMainEntry;} + void SetMainEntry(bool bSet) { m_bMainEntry = bSet;} + + inline const SwTOXType* GetTOXType() const; + + const SwTextTOXMark* GetTextTOXMark() const { return m_pTextAttr; } + SwTextTOXMark* GetTextTOXMark() { return m_pTextAttr; } + + SAL_DLLPRIVATE css::uno::WeakReference<css::text::XDocumentIndexMark> const& GetXTOXMark() const + { return m_wXDocumentIndexMark; } + SAL_DLLPRIVATE void SetXTOXMark(css::uno::Reference<css::text::XDocumentIndexMark> const& xMark) + { m_wXDocumentIndexMark = xMark; } + void RegisterToTOXType( SwTOXType& rMark ); + static void InsertTOXMarks( SwTOXMarks& aMarks, const SwTOXType& rType ); +}; + +// index types +class SwTOXType final: public sw::BroadcastingModify +{ +public: + SwTOXType(SwDoc& rDoc, TOXTypes eTyp, const OUString& rName); + + // @@@ public copy ctor, but no copy assignment? + SwTOXType(const SwTOXType& rCopy); + + inline const OUString& GetTypeName() const; + inline TOXTypes GetType() const; + SwDoc& GetDoc() const { return m_rDoc; } + +private: + SwDoc& m_rDoc; + OUString m_aName; + TOXTypes m_eType; + + // @@@ public copy ctor, but no copy assignment? + SwTOXType & operator= (const SwTOXType &) = delete; +}; + +// Structure of the index lines +#define FORM_TITLE 0 +#define FORM_ALPHA_DELIMITER 1 +#define FORM_PRIMARY_KEY 2 +#define FORM_SECONDARY_KEY 3 +#define FORM_ENTRY 4 + +/* + Pattern structure + + <E#> - entry number <E# CharStyleName,PoolId> + <ET> - entry text <ET CharStyleName,PoolId> + <E> - entry text and number <E CharStyleName,PoolId> + <T> - tab stop <T,,Position,Adjust> + <C> - chapter info n = {0, 1, 2, 3, 4 } values of SwChapterFormat <C CharStyleName,PoolId> + <TX> - text token <X CharStyleName,PoolId, TOX_STYLE_DELIMITERTextContentTOX_STYLE_DELIMITER> + <#> - Page number <# CharStyleName,PoolId> + <LS> - Link start <LS> + <LE> - Link end <LE> + <A00> - Authority entry field <A02 CharStyleName, PoolId> + */ + +// These enum values are stored and must not be changed! +enum FormTokenType +{ + TOKEN_ENTRY_NO, + TOKEN_ENTRY_TEXT, + TOKEN_ENTRY, + TOKEN_TAB_STOP, + TOKEN_TEXT, + TOKEN_PAGE_NUMS, + TOKEN_CHAPTER_INFO, + TOKEN_LINK_START, + TOKEN_LINK_END, + TOKEN_AUTHORITY, + TOKEN_END +}; + +struct SW_DLLPUBLIC SwFormToken +{ + OUString sText; + OUString sCharStyleName; + SwTwips nTabStopPosition; + FormTokenType eTokenType; + sal_uInt16 nPoolId; + SvxTabAdjust eTabAlign; + sal_uInt16 nChapterFormat; //SwChapterFormat; + sal_uInt16 nOutlineLevel;//the maximum permitted outline level in numbering + sal_uInt16 nAuthorityField; //enum ToxAuthorityField + sal_Unicode cTabFillChar; + bool bWithTab; // true: do generate tab + // character only the tab stop + // #i21237# + + SwFormToken(FormTokenType eType ) : + nTabStopPosition(0), + eTokenType(eType), + nPoolId(USHRT_MAX), + eTabAlign( SvxTabAdjust::Left ), + nChapterFormat(0 /*CF_NUMBER*/), + nOutlineLevel(MAXLEVEL), //default to maximum outline level + nAuthorityField(0 /*AUTH_FIELD_IDENTIFIER*/), + cTabFillChar(' '), + bWithTab(true) // #i21237# + {} + + OUString GetString() const; +}; + +struct SwFormTokenEqualToFormTokenType +{ + FormTokenType eType; + + SwFormTokenEqualToFormTokenType(FormTokenType _eType) : eType(_eType) {} + bool operator()(const SwFormToken & rToken) + { + return rToken.eTokenType == eType; + } +}; + +/// Vector of tokens. +typedef std::vector<SwFormToken> SwFormTokens; + +/** + Helper class that converts vectors of tokens to strings and vice + versa. + */ +class SwFormTokensHelper +{ + /// the tokens + SwFormTokens m_Tokens; + +public: + /** + constructor + + @param rStr string representation of the tokens + */ + SwFormTokensHelper(const OUString & rStr); + + /** + Returns vector of tokens. + + @return vector of tokens + */ + const SwFormTokens & GetTokens() const { return m_Tokens; } +}; + +class SW_DLLPUBLIC SwForm +{ + SwFormTokens m_aPattern[ AUTH_TYPE_END + 1 ]; // #i21237# + OUString m_aTemplate[ AUTH_TYPE_END + 1 ]; + + TOXTypes m_eType; + sal_uInt16 m_nFormMaxLevel; + + bool m_bIsRelTabPos : 1; + bool m_bCommaSeparated : 1; + +public: + SwForm( TOXTypes eTOXType = TOX_CONTENT ); + SwForm( const SwForm& rForm ); + + SwForm& operator=( const SwForm& rForm ); + + inline void SetTemplate(sal_uInt16 nLevel, const OUString& rName); + inline OUString const & GetTemplate(sal_uInt16 nLevel) const; + + // #i21237# + void SetPattern(sal_uInt16 nLevel, const SwFormTokens& rName); + void SetPattern(sal_uInt16 nLevel, const OUString& rStr); + const SwFormTokens& GetPattern(sal_uInt16 nLevel) const; + + // fill tab stop positions from template to pattern- #i21237# + void AdjustTabStops( SwDoc const & rDoc ); + + inline TOXTypes GetTOXType() const; + inline sal_uInt16 GetFormMax() const; + + bool IsRelTabPos() const { return m_bIsRelTabPos; } + void SetRelTabPos( bool b ) { m_bIsRelTabPos = b; } + + bool IsCommaSeparated() const { return m_bCommaSeparated;} + void SetCommaSeparated( bool b) { m_bCommaSeparated = b;} + + static sal_uInt16 GetFormMaxLevel( TOXTypes eType ); + + static OUString GetFormEntry(); + static OUString GetFormTab(); + static OUString GetFormPageNums(); + static OUString GetFormLinkStt(); + static OUString GetFormLinkEnd(); + static OUString GetFormEntryNum(); + static OUString GetFormEntryText(); + static OUString GetFormChapterMark(); + static OUString GetFormText(); + static OUString GetFormAuth(); +}; + +// Content to create indexes of +enum class SwTOXElement : sal_uInt16 +{ + NONE = 0x0000, + Mark = 0x0001, + OutlineLevel = 0x0002, + Template = 0x0004, + Ole = 0x0008, + Table = 0x0010, + Graphic = 0x0020, + Frame = 0x0040, + Sequence = 0x0080, + TableLeader = 0x0100, + TableInToc = 0x0200, + Bookmark = 0x0400, + Newline = 0x0800, + ParagraphOutlineLevel = 0x1000, + IndexEntryType = 0x2000, +}; +namespace o3tl { + template<> struct typed_flags<SwTOXElement> : is_typed_flags<SwTOXElement, 0x3fff> {}; +} + +enum class SwTOIOptions : sal_uInt16 +{ + NONE = 0x00, + SameEntry = 0x01, + FF = 0x02, + CaseSensitive = 0x04, + KeyAsEntry = 0x08, + AlphaDelimiter = 0x10, + Dash = 0x20, + InitialCaps = 0x40, +}; +namespace o3tl { + template<> struct typed_flags<SwTOIOptions> : is_typed_flags<SwTOIOptions, 0x7f> {}; +} + +//which part of the caption is to be displayed +enum SwCaptionDisplay +{ + CAPTION_COMPLETE, + CAPTION_NUMBER, + CAPTION_TEXT +}; + +enum class SwTOOElements : sal_uInt16 +{ + NONE = 0x00, + Math = 0x01, + Chart = 0x02, + Calc = 0x08, + DrawImpress = 0x10, + Other = 0x80, +}; +namespace o3tl { + template<> struct typed_flags<SwTOOElements> : is_typed_flags<SwTOOElements, 0x9b> {}; +} + +#define TOX_STYLE_DELIMITER u'\x0001' + +// Class for all indexes +class SW_DLLPUBLIC SwTOXBase : public SwClient +{ + SwForm m_aForm; // description of the lines + OUString m_aName; // unique name + OUString m_aTitle; // title + OUString m_aBookmarkName; //Bookmark Name + OUString m_aEntryTypeName; // Type name + + OUString m_sMainEntryCharStyle; // name of the character style applied to main index entries + + OUString m_aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER + OUString m_sSequenceName; // FieldTypeName of a caption sequence + + LanguageType m_eLanguage; + OUString m_sSortAlgorithm; + + union { + sal_uInt16 nLevel; // consider outline levels + SwTOIOptions nOptions; // options of alphabetical index + } m_aData; + + SwTOXElement m_nCreateType; // sources to create the index from + SwTOOElements m_nOLEOptions; // OLE sources + SwCaptionDisplay m_eCaptionDisplay; + bool m_bProtected : 1; // index protected ? + bool m_bFromChapter : 1; // create from chapter or document + bool m_bFromObjectNames : 1; // create a table or object index + // from the names rather than the caption + bool m_bLevelFromChapter : 1; // User index: get the level from the source chapter + +protected: + // Add a data member, for record the TOC field expression of MS Word binary format + // For keeping fidelity and may giving a better exporting performance + OUString maMSTOCExpression; + bool mbKeepExpression; + +public: + SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm, + SwTOXElement nCreaType, const OUString& rTitle ); + SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = nullptr ); + virtual ~SwTOXBase() override; + + virtual bool GetInfo( SfxPoolItem& rInfo ) const override; + + // a kind of CopyCtor - check if the TOXBase is at TOXType of the doc. + // If not, so create it and copy all other used things. + void CopyTOXBase( SwDoc*, const SwTOXBase& ); + + const SwTOXType* GetTOXType() const; + + SwTOXElement GetCreateType() const; // creation types + + const OUString& GetTOXName() const {return m_aName;} + void SetTOXName(const OUString& rSet) {m_aName = rSet;} + + // for record the TOC field expression of MS Word binary format + const OUString& GetMSTOCExpression() const{return maMSTOCExpression;} + void SetMSTOCExpression(const OUString& rExp) {maMSTOCExpression = rExp;} + void EnableKeepExpression() {mbKeepExpression = true;} + void DisableKeepExpression() {mbKeepExpression = false;} + + const OUString& GetTitle() const; // Title + const OUString& GetBookmarkName() const; + OUString const & GetTypeName() const; // Name + const SwForm& GetTOXForm() const; // description of the lines + + void SetCreate(SwTOXElement); + void SetTitle(const OUString& rTitle); + void SetTOXForm(const SwForm& rForm); + void SetBookmarkName(const OUString& bName); + + TOXTypes GetType() const; + + const OUString& GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;} + void SetMainEntryCharStyle(const OUString& rSet) {m_sMainEntryCharStyle = rSet;} + + // for record the Index field expression of MS Word + const OUString& GetEntryTypeName() const; + void SetEntryTypeName(const OUString& sName); + + // content index only + inline void SetLevel(sal_uInt16); // consider outline level + inline sal_uInt16 GetLevel() const; + + // alphabetical index only + inline SwTOIOptions GetOptions() const; // alphabetical index options + inline void SetOptions(SwTOIOptions nOpt); + + // index of objects + SwTOOElements GetOLEOptions() const {return m_nOLEOptions;} + void SetOLEOptions(SwTOOElements nOpt) {m_nOLEOptions = nOpt;} + + // index of objects + + OUString const & GetStyleNames(sal_uInt16 nLevel) const + { + SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?"); + return m_aStyleNames[nLevel]; + } + void SetStyleNames(const OUString& rSet, sal_uInt16 nLevel) + { + SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?"); + m_aStyleNames[nLevel] = rSet; + } + bool IsFromChapter() const { return m_bFromChapter;} + void SetFromChapter(bool bSet) { m_bFromChapter = bSet;} + + bool IsFromObjectNames() const {return m_bFromObjectNames;} + void SetFromObjectNames(bool bSet) {m_bFromObjectNames = bSet;} + + bool IsLevelFromChapter() const {return m_bLevelFromChapter;} + void SetLevelFromChapter(bool bSet) {m_bLevelFromChapter = bSet;} + + bool IsProtected() const { return m_bProtected; } + void SetProtected(bool bSet) { m_bProtected = bSet; } + + const OUString& GetSequenceName() const {return m_sSequenceName;} + void SetSequenceName(const OUString& rSet) {m_sSequenceName = rSet;} + + SwCaptionDisplay GetCaptionDisplay() const { return m_eCaptionDisplay;} + void SetCaptionDisplay(SwCaptionDisplay eSet) {m_eCaptionDisplay = eSet;} + + bool IsTOXBaseInReadonly() const; + + const SfxItemSet* GetAttrSet() const; + void SetAttrSet( const SfxItemSet& ); + + LanguageType GetLanguage() const {return m_eLanguage;} + void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;} + + const OUString& GetSortAlgorithm()const {return m_sSortAlgorithm;} + void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;} + // #i21237# + void AdjustTabStops( SwDoc const & rDoc ) + { + m_aForm.AdjustTabStops( rDoc ); + } + + SwTOXBase& operator=(const SwTOXBase& rSource); + void RegisterToTOXType( SwTOXType& rMark ); +}; + +//SwTOXMark + +inline const OUString& SwTOXMark::GetAlternativeText() const + { return m_aAltText; } + +inline const OUString& SwTOXMark::GetBookmarkName() const + { return m_aBookmarkName; } + +inline const OUString& SwTOXMark::GetEntryTypeName() const + { return m_aEntryTypeName; } + +inline const SwTOXType* SwTOXMark::GetTOXType() const + { return static_cast<const SwTOXType*>(GetRegisteredIn()); } + +inline bool SwTOXMark::IsAlternativeText() const + { return !m_aAltText.isEmpty(); } + +inline void SwTOXMark::SetAlternativeText(const OUString& rAlt) +{ + m_aAltText = rAlt; +} + +inline void SwTOXMark::SetBookmarkName(const OUString& bName) +{ + m_aBookmarkName = bName; +} + +inline void SwTOXMark::SetEntryTypeName(const OUString& sName) +{ + m_aEntryTypeName = sName; +} +inline void SwTOXMark::SetLevel( sal_uInt16 nLvl ) +{ + SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); + m_nLevel = nLvl; +} + +inline void SwTOXMark::SetPrimaryKey( const OUString& rKey ) +{ + SAL_WARN_IF( GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + m_aPrimaryKey = rKey; +} + +inline void SwTOXMark::SetSecondaryKey( const OUString& rKey ) +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + m_aSecondaryKey = rKey; +} + +inline void SwTOXMark::SetTextReading( const OUString& rText ) +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + m_aTextReading = rText; +} + +inline void SwTOXMark::SetPrimaryKeyReading( const OUString& rKey ) +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + m_aPrimaryKeyReading = rKey; +} + +inline void SwTOXMark::SetSecondaryKeyReading( const OUString& rKey ) +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + m_aSecondaryKeyReading = rKey; +} + +inline sal_uInt16 SwTOXMark::GetLevel() const +{ + SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); + return m_nLevel; +} + +inline OUString const & SwTOXMark::GetPrimaryKey() const +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + return m_aPrimaryKey; +} + +inline OUString const & SwTOXMark::GetSecondaryKey() const +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + return m_aSecondaryKey; +} + +inline OUString const & SwTOXMark::GetTextReading() const +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + return m_aTextReading; +} + +inline OUString const & SwTOXMark::GetPrimaryKeyReading() const +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + return m_aPrimaryKeyReading; +} + +inline OUString const & SwTOXMark::GetSecondaryKeyReading() const +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + return m_aSecondaryKeyReading; +} + +//SwForm + +inline void SwForm::SetTemplate(sal_uInt16 nLevel, const OUString& rTemplate) +{ + SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()"); + m_aTemplate[nLevel] = rTemplate; +} + +inline OUString const & SwForm::GetTemplate(sal_uInt16 nLevel) const +{ + SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()"); + return m_aTemplate[nLevel]; +} + +inline TOXTypes SwForm::GetTOXType() const +{ + return m_eType; +} + +inline sal_uInt16 SwForm::GetFormMax() const +{ + return m_nFormMaxLevel; +} + +//SwTOXType + +inline const OUString& SwTOXType::GetTypeName() const + { return m_aName; } + +inline TOXTypes SwTOXType::GetType() const + { return m_eType; } + +// SwTOXBase + +inline const SwTOXType* SwTOXBase::GetTOXType() const + { return static_cast<const SwTOXType*>(GetRegisteredIn()); } + +inline SwTOXElement SwTOXBase::GetCreateType() const + { return m_nCreateType; } + +inline const OUString& SwTOXBase::GetTitle() const + { return m_aTitle; } + +inline const OUString& SwTOXBase::GetBookmarkName() const + { return m_aBookmarkName; } + +inline const OUString& SwTOXBase::GetEntryTypeName() const + { return m_aEntryTypeName; } + +inline OUString const & SwTOXBase::GetTypeName() const + { return GetTOXType()->GetTypeName(); } + +inline const SwForm& SwTOXBase::GetTOXForm() const + { return m_aForm; } + +inline void SwTOXBase::SetCreate(SwTOXElement nCreate) + { m_nCreateType = nCreate; } + +inline void SwTOXBase::SetTOXForm(const SwForm& rForm) + { m_aForm = rForm; } + +inline TOXTypes SwTOXBase::GetType() const + { return GetTOXType()->GetType(); } + +inline void SwTOXBase::SetLevel(sal_uInt16 nLev) +{ + SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); + m_aData.nLevel = nLev; +} + +inline sal_uInt16 SwTOXBase::GetLevel() const +{ + SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); + return m_aData.nLevel; +} + +inline SwTOIOptions SwTOXBase::GetOptions() const +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + return m_aData.nOptions; +} + +inline void SwTOXBase::SetOptions(SwTOIOptions nOpt) +{ + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); + m_aData.nOptions = nOpt; +} + +#endif // INCLUDED_SW_INC_TOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/toxe.hxx b/sw/inc/toxe.hxx new file mode 100644 index 000000000..417cc10cb --- /dev/null +++ b/sw/inc/toxe.hxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TOXE_HXX +#define INCLUDED_SW_INC_TOXE_HXX + +enum SwTOXSearch +{ + TOX_NXT, + TOX_PRV, + TOX_SAME_NXT, + TOX_SAME_PRV +}; + +enum SwTOIKeyType +{ + TOI_PRIMARY, + TOI_SECONDARY +}; + +// Somewhat redundantly fix TOXType's underlying type to int, so that +// SwTOXEntryTabPage (sw/source/ui/index/cnttab.cxx) can initialize +// aLastTOXType.eType to (TOXTypes)USHRT_MAX without causing -fsanitize=enum: +enum TOXTypes: int +{ + TOX_INDEX, + TOX_USER, + TOX_CONTENT, + TOX_ILLUSTRATIONS, + TOX_OBJECTS, + TOX_TABLES, + TOX_AUTHORITIES, + TOX_BIBLIOGRAPHY, + TOX_CITATION +}; +// this enum contains all types of sources +enum ToxAuthorityType +{ + //BiBTeX - fields + AUTH_TYPE_ARTICLE, + AUTH_TYPE_BOOK, + AUTH_TYPE_BOOKLET, + AUTH_TYPE_CONFERENCE, + AUTH_TYPE_INBOOK, + AUTH_TYPE_INCOLLECTION, + AUTH_TYPE_INPROCEEDINGS, + AUTH_TYPE_JOURNAL, + AUTH_TYPE_MANUAL, + AUTH_TYPE_MASTERSTHESIS, + AUTH_TYPE_MISC, + AUTH_TYPE_PHDTHESIS, + AUTH_TYPE_PROCEEDINGS, + AUTH_TYPE_TECHREPORT, + AUTH_TYPE_UNPUBLISHED, + //additional types + AUTH_TYPE_EMAIL, + AUTH_TYPE_WWW, + AUTH_TYPE_CUSTOM1, + AUTH_TYPE_CUSTOM2, + AUTH_TYPE_CUSTOM3, + AUTH_TYPE_CUSTOM4, + AUTH_TYPE_CUSTOM5, + AUTH_TYPE_END +}; + +//this enum contains the fields of an authority entry +enum ToxAuthorityField +{ + AUTH_FIELD_IDENTIFIER, + AUTH_FIELD_AUTHORITY_TYPE, //ToxAuthorityType + //BibTex types + AUTH_FIELD_ADDRESS, + AUTH_FIELD_ANNOTE, + AUTH_FIELD_AUTHOR, + AUTH_FIELD_BOOKTITLE, + AUTH_FIELD_CHAPTER, + AUTH_FIELD_EDITION, + AUTH_FIELD_EDITOR, + AUTH_FIELD_HOWPUBLISHED, + AUTH_FIELD_INSTITUTION, + AUTH_FIELD_JOURNAL, + AUTH_FIELD_MONTH, + AUTH_FIELD_NOTE, + AUTH_FIELD_NUMBER, + AUTH_FIELD_ORGANIZATIONS, + AUTH_FIELD_PAGES, + AUTH_FIELD_PUBLISHER, + AUTH_FIELD_SCHOOL, + AUTH_FIELD_SERIES, + AUTH_FIELD_TITLE, + AUTH_FIELD_REPORT_TYPE, + AUTH_FIELD_VOLUME, + AUTH_FIELD_YEAR, + //additional types + AUTH_FIELD_URL, + AUTH_FIELD_CUSTOM1, + AUTH_FIELD_CUSTOM2, + AUTH_FIELD_CUSTOM3, + AUTH_FIELD_CUSTOM4, + AUTH_FIELD_CUSTOM5, + AUTH_FIELD_ISBN, + AUTH_FIELD_END +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/toxwrap.hxx b/sw/inc/toxwrap.hxx new file mode 100644 index 000000000..71feadb6f --- /dev/null +++ b/sw/inc/toxwrap.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_TOXWRAP_HXX +#define INCLUDED_SW_INC_TOXWRAP_HXX + +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp> +#include "swdllapi.h" + +namespace com::sun::star::i18n { class XExtendedIndexEntrySupplier; } + + +class SW_DLLPUBLIC IndexEntrySupplierWrapper +{ + css::lang::Locale aLcl; + css::uno::Reference < css::i18n::XExtendedIndexEntrySupplier > xIES; + +public: + IndexEntrySupplierWrapper(); + ~IndexEntrySupplierWrapper(); + + void SetLocale( const css::lang::Locale& rLocale ) { aLcl = rLocale; } + + OUString GetIndexKey( const OUString& rText, const OUString& rTextReading, + const css::lang::Locale& rLocale ) const; + + OUString GetFollowingText( bool bMorePages ) const; + + css::uno::Sequence< OUString > + GetAlgorithmList( const css::lang::Locale& rLcl ) const; + + bool LoadAlgorithm( const css::lang::Locale& rLcl, + const OUString& sSortAlgorithm, long nOptions ) const; + + sal_Int16 CompareIndexEntry( const OUString& rText1, const OUString& rTextReading1, + const css::lang::Locale& rLcl1, + const OUString& rText2, const OUString& rTextReading2, + const css::lang::Locale& rLcl2 ) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx new file mode 100644 index 000000000..90509a929 --- /dev/null +++ b/sw/inc/txatbase.hxx @@ -0,0 +1,248 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXATBASE_HXX +#define INCLUDED_SW_INC_TXATBASE_HXX + +#include <svl/poolitem.hxx> +#include "hintids.hxx" +#include "fmtautofmt.hxx" +#include "fmtinfmt.hxx" +#include "fmtrfmrk.hxx" +#include "fmtruby.hxx" +#include "fmtfld.hxx" +#include "fmtflcnt.hxx" +#include "fmtftn.hxx" +#include "fchrfmt.hxx" +#include "tox.hxx" +#include "ndhints.hxx" + +class SfxItemPool; + +class SAL_DLLPUBLIC_RTTI SwTextAttr +{ +friend class SwpHints; +private: + SfxPoolItem * const m_pAttr; + sal_Int32 m_nStart; + bool m_bDontExpand : 1; + bool m_bLockExpandFlag : 1; + + bool m_bDontMoveAttr : 1; // refmarks, toxmarks + bool m_bCharFormatAttr : 1; // charfmt, inet + bool m_bOverlapAllowedAttr : 1; // refmarks, toxmarks + bool m_bPriorityAttr : 1; // attribute has priority (redlining) + bool m_bDontExpandStart : 1; // don't expand start at paragraph start (ruby) + bool m_bNesting : 1; // SwTextAttrNesting + bool m_bHasDummyChar : 1; // without end + meta + bool m_bFormatIgnoreStart : 1; ///< text formatting should ignore start + bool m_bFormatIgnoreEnd : 1; ///< text formatting should ignore end + bool m_bHasContent : 1; // text attribute with content + + SwTextAttr(SwTextAttr const&) = delete; + SwTextAttr& operator=(SwTextAttr const&) = delete; + +protected: + SwpHints * m_pHints = nullptr; // the SwpHints holds a pointer to this, and needs to be notified if the start/end changes + + SwTextAttr( SfxPoolItem& rAttr, sal_Int32 nStart ); + virtual ~SwTextAttr() COVERITY_NOEXCEPT_FALSE; + + void SetLockExpandFlag( bool bFlag ) { m_bLockExpandFlag = bFlag; } + void SetDontMoveAttr( bool bFlag ) { m_bDontMoveAttr = bFlag; } + void SetCharFormatAttr( bool bFlag ) { m_bCharFormatAttr = bFlag; } + void SetOverlapAllowedAttr( bool bFlag ){ m_bOverlapAllowedAttr = bFlag; } + void SetDontExpandStartAttr(bool bFlag) { m_bDontExpandStart = bFlag; } + void SetNesting(const bool bFlag) { m_bNesting = bFlag; } + void SetHasDummyChar(const bool bFlag) { m_bHasDummyChar = bFlag; } + void SetHasContent( const bool bFlag ) { m_bHasContent = bFlag; } + +public: + + /// destroy instance + static void Destroy( SwTextAttr * pToDestroy, SfxItemPool& rPool ); + + /// start position + void SetStart(sal_Int32 n) { m_nStart = n; if (m_pHints) m_pHints->StartPosChanged(); } + sal_Int32 GetStart() const { return m_nStart; } + + /// end position + virtual const sal_Int32* GetEnd() const; + virtual void SetEnd(sal_Int32); + inline const sal_Int32* End() const; + /// end (if available), else start + inline sal_Int32 GetAnyEnd() const; + + inline void SetDontExpand( bool bDontExpand ); + bool DontExpand() const { return m_bDontExpand; } + bool IsLockExpandFlag() const { return m_bLockExpandFlag; } + bool IsDontMoveAttr() const { return m_bDontMoveAttr; } + bool IsCharFormatAttr() const { return m_bCharFormatAttr; } + bool IsOverlapAllowedAttr() const { return m_bOverlapAllowedAttr; } + bool IsPriorityAttr() const { return m_bPriorityAttr; } + void SetPriorityAttr( bool bFlag ) { m_bPriorityAttr = bFlag; } + bool IsDontExpandStartAttr() const { return m_bDontExpandStart; } + bool IsNesting() const { return m_bNesting; } + bool HasDummyChar() const { return m_bHasDummyChar; } + bool IsFormatIgnoreStart() const { return m_bFormatIgnoreStart; } + bool IsFormatIgnoreEnd () const { return m_bFormatIgnoreEnd ; } + void SetFormatIgnoreStart(bool bFlag) { m_bFormatIgnoreStart = bFlag; } + void SetFormatIgnoreEnd (bool bFlag) { m_bFormatIgnoreEnd = bFlag; } + bool HasContent() const { return m_bHasContent; } + + inline const SfxPoolItem& GetAttr() const; + inline SfxPoolItem& GetAttr(); + sal_uInt16 Which() const { return GetAttr().Which(); } + + bool operator==( const SwTextAttr& ) const; + + inline const SwFormatCharFormat &GetCharFormat() const; + inline const SwFormatAutoFormat &GetAutoFormat() const; + inline const SwFormatField &GetFormatField() const; + inline const SwFormatFootnote &GetFootnote() const; + inline const SwFormatFlyCnt &GetFlyCnt() const; + inline const SwTOXMark &GetTOXMark() const; + inline const SwFormatRefMark &GetRefMark() const; + inline const SwFormatINetFormat &GetINetFormat() const; + inline const SwFormatRuby &GetRuby() const; + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +class SAL_DLLPUBLIC_RTTI SwTextAttrEnd : public virtual SwTextAttr +{ +protected: + sal_Int32 m_nEnd; + +public: + SwTextAttrEnd( SfxPoolItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd ); + + virtual const sal_Int32* GetEnd() const override; + virtual void SetEnd(sal_Int32) override; +}; + +// attribute that must not overlap others +class SAL_DLLPUBLIC_RTTI SwTextAttrNesting : public SwTextAttrEnd +{ +protected: + SwTextAttrNesting( SfxPoolItem & i_rAttr, + const sal_Int32 i_nStart, const sal_Int32 i_nEnd ); + virtual ~SwTextAttrNesting() override; +}; + +inline const sal_Int32* SwTextAttr::End() const +{ + return GetEnd(); +} + +inline sal_Int32 SwTextAttr::GetAnyEnd() const +{ + const sal_Int32* pEnd = End(); + return pEnd ? *pEnd : m_nStart; +} + +inline const SfxPoolItem& SwTextAttr::GetAttr() const +{ + assert( m_pAttr ); + return *m_pAttr; +} + +inline SfxPoolItem& SwTextAttr::GetAttr() +{ + return const_cast<SfxPoolItem&>( + const_cast<const SwTextAttr*>(this)->GetAttr()); +} + +inline void SwTextAttr::SetDontExpand( bool bDontExpand ) +{ + if ( !m_bLockExpandFlag ) + { + m_bDontExpand = bDontExpand; + } +} + +inline const SwFormatCharFormat& SwTextAttr::GetCharFormat() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_CHARFMT ); + return static_cast<const SwFormatCharFormat&>(*m_pAttr); +} + +inline const SwFormatAutoFormat& SwTextAttr::GetAutoFormat() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_AUTOFMT ); + return static_cast<const SwFormatAutoFormat&>(*m_pAttr); +} + +inline const SwFormatField& SwTextAttr::GetFormatField() const +{ + assert( m_pAttr + && ( m_pAttr->Which() == RES_TXTATR_FIELD + || m_pAttr->Which() == RES_TXTATR_ANNOTATION + || m_pAttr->Which() == RES_TXTATR_INPUTFIELD )); + return static_cast<const SwFormatField&>(*m_pAttr); +} + +inline const SwFormatFootnote& SwTextAttr::GetFootnote() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FTN ); + return static_cast<const SwFormatFootnote&>(*m_pAttr); +} + +inline const SwFormatFlyCnt& SwTextAttr::GetFlyCnt() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FLYCNT ); + return static_cast<const SwFormatFlyCnt&>(*m_pAttr); +} + +inline const SwTOXMark& SwTextAttr::GetTOXMark() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_TOXMARK ); + return static_cast<const SwTOXMark&>(*m_pAttr); +} + +inline const SwFormatRefMark& SwTextAttr::GetRefMark() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_REFMARK ); + return static_cast<const SwFormatRefMark&>(*m_pAttr); +} + +inline const SwFormatINetFormat& SwTextAttr::GetINetFormat() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_INETFMT ); + return static_cast<const SwFormatINetFormat&>(*m_pAttr); +} + +inline const SwFormatRuby& SwTextAttr::GetRuby() const +{ + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY ); + return static_cast<const SwFormatRuby&>(*m_pAttr); +} + +// these should be static_casts but with virtual inheritance it's not possible +template<typename T, typename S> inline T static_txtattr_cast(S * s) +{ + return dynamic_cast<T>(s); +} +template<typename T, typename S> inline T static_txtattr_cast(S & s) +{ + return dynamic_cast<T>(s); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx new file mode 100644 index 000000000..76a865cab --- /dev/null +++ b/sw/inc/txatritr.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXATRITR_HXX +#define INCLUDED_SW_INC_TXATRITR_HXX + +#include <sal/types.h> +#include <editeng/langitem.hxx> +#include "swtypes.hxx" +#include <deque> + +class SwTextNode; +class SwTextAttr; +class SfxPoolItem; + +class SwScriptIterator +{ + const OUString& m_rText; + sal_Int32 m_nChgPos; + sal_uInt16 m_nCurScript; + bool m_bForward; + +public: + SwScriptIterator( const OUString& rStr, sal_Int32 nStart, + bool bFrwrd = true ); + + void Next(); + + sal_uInt16 GetCurrScript() const { return m_nCurScript; } + sal_Int32 GetScriptChgPos() const { return (m_nChgPos == -1) ? COMPLETE_STRING : m_nChgPos; } + const OUString& GetText() const { return m_rText; } +}; + +class SwLanguageIterator +{ + SwScriptIterator m_aScriptIter; + std::deque<const SwTextAttr*> + m_aStack; + const SwTextNode& m_rTextNode; + const SfxPoolItem* m_pParaItem; + const SfxPoolItem* m_pCurrentItem; + size_t m_nAttrPos; + sal_Int32 m_nChgPos; + + void AddToStack( const SwTextAttr& rAttr ); + void SearchNextChg(); + +public: + SwLanguageIterator( const SwTextNode& rTextNd, sal_Int32 nStart ); + + bool Next(); + sal_Int32 GetChgPos() const { return m_nChgPos; } + LanguageType GetLanguage() const + { return static_cast<const SvxLanguageItem&>(*m_pCurrentItem).GetValue(); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txtannotationfld.hxx b/sw/inc/txtannotationfld.hxx new file mode 100644 index 000000000..f45e0c5b9 --- /dev/null +++ b/sw/inc/txtannotationfld.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_TXTANNOTATIONFLD_HXX +#define INCLUDED_SW_INC_TXTANNOTATIONFLD_HXX + +#include "txtfld.hxx" + +namespace sw::mark { class IMark; } + +class SwTextAnnotationField final : public SwTextField +{ +public: + SwTextAnnotationField( + SwFormatField & rAttr, + sal_Int32 const nStart, + bool const bInClipboard ); + + virtual ~SwTextAnnotationField() override; + + ::sw::mark::IMark* GetAnnotationMark() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx new file mode 100644 index 000000000..fcc25811d --- /dev/null +++ b/sw/inc/txtatr.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXTATR_HXX +#define INCLUDED_SW_INC_TXTATR_HXX + +#include "txatbase.hxx" +#include "calbck.hxx" + +class SwTextNode; +class SwCharFormat; +class SwFormatMeta; + +namespace sw { + class MetaFieldManager; +} + +class SwTextCharFormat : public SwTextAttrEnd +{ + SwTextNode * m_pTextNode; + sal_uInt16 m_nSortNumber; + +public: + SwTextCharFormat( SwFormatCharFormat& rAttr, sal_Int32 nStart, sal_Int32 nEnd ); + virtual ~SwTextCharFormat( ) override; + + // Passed from SwFormatCharFormat (no derivation from SwClient!). + void ModifyNotification( const SfxPoolItem*, const SfxPoolItem* ); + bool GetInfo( SfxPoolItem const & rInfo ) const; + + // get and set TextNode pointer + void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } + + void SetSortNumber( sal_uInt16 nSortNumber ) { m_nSortNumber = nSortNumber; } + sal_uInt16 GetSortNumber() const { return m_nSortNumber; } +}; + + +class SwTextMeta final : public SwTextAttrNesting +{ +private: + SwTextMeta( SwFormatMeta & i_rAttr, + const sal_Int32 i_nStart, const sal_Int32 i_nEnd ); + +public: + static SwTextMeta * CreateTextMeta( + ::sw::MetaFieldManager & i_rTargetDocManager, + SwTextNode *const i_pTargetTextNode, + SwFormatMeta & i_rAttr, + sal_Int32 const i_nStart, sal_Int32 const i_nEnd, + bool const i_bIsCopy); + + virtual ~SwTextMeta() override; + + void ChgTextNode(SwTextNode * const pNode); +}; + + +class SW_DLLPUBLIC SwTextRuby : public SwTextAttrNesting, public SwClient +{ + SwTextNode* m_pTextNode; +protected: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; +public: + SwTextRuby( SwFormatRuby& rAttr, sal_Int32 nStart, sal_Int32 nEnd ); + virtual ~SwTextRuby() override; + + virtual bool GetInfo( SfxPoolItem& rInfo ) const override; + + SAL_DLLPRIVATE void InitRuby(SwTextNode & rNode); + + /// Get and set TextNode pointer. + inline const SwTextNode& GetTextNode() const; + void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } + + SwCharFormat* GetCharFormat(); + const SwCharFormat* GetCharFormat() const + { return const_cast<SwTextRuby*>(this)->GetCharFormat(); } +}; + +inline const SwTextNode& SwTextRuby::GetTextNode() const +{ + assert( m_pTextNode ); + return *m_pTextNode; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txtflcnt.hxx b/sw/inc/txtflcnt.hxx new file mode 100644 index 000000000..c9baa25ff --- /dev/null +++ b/sw/inc/txtflcnt.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXTFLCNT_HXX +#define INCLUDED_SW_INC_TXTFLCNT_HXX + +#include "txatbase.hxx" + +class SwFlyInContentFrame; +class SwFrame; +class SwTextNode; +class SwDoc; + +// Attribute for line-bound frames (without end index). +class SwTextFlyCnt : public SwTextAttr +{ + SwFlyInContentFrame *GetFlyFrame_( const SwFrame *pCurrFrame ); +public: + SwTextFlyCnt( SwFormatFlyCnt& rAttr, sal_Int32 nStart ); + + // Sets anchor in pFormat and + void SetAnchor( const SwTextNode *pNode ); + + inline SwFlyInContentFrame *GetFlyFrame( const SwFrame *pCurrFrame ); + inline const SwFlyInContentFrame *GetFlyFrame( const SwFrame *pCurrFrame ) const; + + // creates for itself a new FlyFrameFormat. + void CopyFlyFormat( SwDoc* pDoc ); +}; + +inline SwFlyInContentFrame *SwTextFlyCnt::GetFlyFrame( const SwFrame *pCurrFrame ) +{ + return GetFlyFrame_( pCurrFrame ); +} + +inline const SwFlyInContentFrame *SwTextFlyCnt::GetFlyFrame( const SwFrame *pCurrFrame ) const +{ + return const_cast<SwTextFlyCnt*>(this)->GetFlyFrame_( pCurrFrame ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx new file mode 100644 index 000000000..8055b337b --- /dev/null +++ b/sw/inc/txtfld.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXTFLD_HXX +#define INCLUDED_SW_INC_TXTFLD_HXX + +#include "txatbase.hxx" +#include <rtl/ustring.hxx> + +#include <memory> +#include <cassert> + +class SwPaM; +class SwTextNode; + +class SAL_DLLPUBLIC_RTTI SwTextField : public virtual SwTextAttr +{ + mutable OUString m_aExpand; // only used to determine, if field content is changing in <ExpandTextField()> + SwTextNode * m_pTextNode; + +public: + SwTextField( + SwFormatField & rAttr, + sal_Int32 const nStart, + bool const bInClipboard ); + + virtual ~SwTextField() override; + + void CopyTextField( SwTextField *pDest ) const; + + void ExpandTextField( const bool bForceNotify = false ) const; + + // get and set TextNode pointer + SwTextNode* GetpTextNode() const + { + return m_pTextNode; + } + SwTextNode& GetTextNode() const + { + assert(m_pTextNode); + return *m_pTextNode; + } + void ChgTextNode( SwTextNode* pNew ) + { + m_pTextNode = pNew; + } + + bool IsFieldInDoc() const; + + // enable notification that field content has changed and needs reformatting + virtual void NotifyContentChange( SwFormatField& rFormatField ); + + // deletes the given field via removing the corresponding text selection from the document's content + static void DeleteTextField( const SwTextField& rTextField ); + + // return text selection for the given field + static void GetPamForTextField( const SwTextField& rTextField, + std::shared_ptr< SwPaM >& rPamForTextField ); + +}; + +class SwTextInputField final + : public SwTextAttrNesting + , public SwTextField +{ +public: + SwTextInputField( + SwFormatField & rAttr, + sal_Int32 const nStart, + sal_Int32 const nEnd, + bool const bInClipboard ); + + virtual ~SwTextInputField() override; + + bool LockNotifyContentChange(); + void UnlockNotifyContentChange(); + virtual void NotifyContentChange( SwFormatField& rFormatField ) override; + + void UpdateTextNodeContent( const OUString& rNewContent ); + + OUString GetFieldContent() const; + void UpdateFieldContent(); + +private: + + bool m_bLockNotifyContentChange; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx new file mode 100644 index 000000000..9d6aa60ff --- /dev/null +++ b/sw/inc/txtftn.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXTFTN_HXX +#define INCLUDED_SW_INC_TXTFTN_HXX + +#include <rtl/ustring.hxx> +#include "txatbase.hxx" + +class SwNodeIndex; +class SwTextNode; +class SwNodes; +class SwDoc; +class SwRootFrame; + +class SW_DLLPUBLIC SwTextFootnote : public SwTextAttr +{ + std::unique_ptr<SwNodeIndex> m_pStartNode; + SwTextNode * m_pTextNode; + sal_uInt16 m_nSeqNo; + +public: + SwTextFootnote( SwFormatFootnote& rAttr, sal_Int32 nStart ); + virtual ~SwTextFootnote() override; + + SwNodeIndex *GetStartNode() const { return m_pStartNode.get(); } + void SetStartNode( const SwNodeIndex *pNode, bool bDelNodes = true ); + void SetNumber(sal_uInt16 nNumber, sal_uInt16 nNumberRLHidden, const OUString &sNumStr); + void CopyFootnote(SwTextFootnote & rDest, SwTextNode & rDestNode) const; + + // Get and set TextNode pointer. + inline const SwTextNode& GetTextNode() const; + void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } + + // Create a new empty TextSection for this footnote. + void MakeNewTextSection( SwNodes& rNodes ); + + // Delete the FootnoteFrame from page. + void DelFrames(const SwRootFrame *); + + // Check conditional paragraph styles. + void CheckCondColl(); + + void InvalidateNumberInLayout(); + + // For references to footnotes. + void SetSeqRefNo(); + void SetSeqNo( sal_uInt16 n ) { m_nSeqNo = n; } // For Readers. + sal_uInt16 GetSeqRefNo() const { return m_nSeqNo; } + + static void SetUniqueSeqRefNo( SwDoc& rDoc ); +}; + +inline const SwTextNode& SwTextFootnote::GetTextNode() const +{ + assert( m_pTextNode ); + return *m_pTextNode; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx new file mode 100644 index 000000000..f46601dba --- /dev/null +++ b/sw/inc/txtinet.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXTINET_HXX +#define INCLUDED_SW_INC_TXTINET_HXX + +#include "txatbase.hxx" +#include "calbck.hxx" + +class SwTextNode; +class SwCharFormat; + +class SW_DLLPUBLIC SwTextINetFormat : public SwTextAttrNesting, public SwClient +{ + SwTextNode * m_pTextNode; + bool m_bVisited : 1; // visited link? + bool m_bVisitedValid : 1; // is m_bVisited valid? + +protected: +virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; + +public: + SwTextINetFormat( SwFormatINetFormat& rAttr, sal_Int32 nStart, sal_Int32 nEnd ); + virtual ~SwTextINetFormat() override; + + virtual bool GetInfo( SfxPoolItem& rInfo ) const override; + + SAL_DLLPRIVATE void InitINetFormat(SwTextNode & rNode); + + // get and set TextNode pointer + const SwTextNode* GetpTextNode() const { return m_pTextNode; } + inline const SwTextNode& GetTextNode() const; + inline SwTextNode& GetTextNode(); + void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } + + SwCharFormat* GetCharFormat(); + const SwCharFormat* GetCharFormat() const + { return const_cast<SwTextINetFormat*>(this)->GetCharFormat(); } + + bool IsVisited() const { return m_bVisited; } + void SetVisited( bool bNew ) { m_bVisited = bNew; } + + bool IsVisitedValid() const { return m_bVisitedValid; } + void SetVisitedValid( bool bNew ) { m_bVisitedValid = bNew; } + + bool IsProtect() const; +}; + +inline const SwTextNode& SwTextINetFormat::GetTextNode() const +{ + assert( m_pTextNode ); + return *m_pTextNode; +} + +inline SwTextNode& SwTextINetFormat::GetTextNode() +{ + assert( m_pTextNode ); + return *m_pTextNode; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx new file mode 100644 index 000000000..c8261c0e5 --- /dev/null +++ b/sw/inc/txtrfmrk.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXTRFMRK_HXX +#define INCLUDED_SW_INC_TXTRFMRK_HXX + +#include "txatbase.hxx" + +class SwTextNode; + +// Attribute for content-/position references in text. +class SwTextRefMark : public SwTextAttrEnd +{ + SwTextNode * m_pTextNode; + sal_Int32 * m_pEnd; // end is optional (point reference) + +public: + SwTextRefMark( SwFormatRefMark& rAttr, + sal_Int32 const nStart, sal_Int32 const*const pEnd = nullptr); + + virtual const sal_Int32* GetEnd() const override; // SwTextAttr + virtual void SetEnd(sal_Int32) override; // SwTextAttr + + // get and set TextNode pointer + inline const SwTextNode& GetTextNode() const; + void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } +}; + +inline const SwTextNode& SwTextRefMark::GetTextNode() const +{ + assert( m_pTextNode ); + return *m_pTextNode; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/txttxmrk.hxx b/sw/inc/txttxmrk.hxx new file mode 100644 index 000000000..bcb0a5b06 --- /dev/null +++ b/sw/inc/txttxmrk.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_TXTTXMRK_HXX +#define INCLUDED_SW_INC_TXTTXMRK_HXX + +#include "txatbase.hxx" + +class SwTextNode; +class SwDoc; + +// Attribute for indices/tables of contents. +class SAL_DLLPUBLIC_RTTI SwTextTOXMark : public SwTextAttrEnd +{ + SwTextNode * m_pTextNode; + sal_Int32 * m_pEnd; // 0 if SwTOXMark without AlternativeText + +public: + SwTextTOXMark( SwTOXMark& rAttr, + sal_Int32 const nStart, sal_Int32 const*const pEnd); + virtual ~SwTextTOXMark() override; + + virtual const sal_Int32 *GetEnd() const override; // SwTextAttr + virtual void SetEnd(sal_Int32) override; // SwTextAttr + + void CopyTOXMark( SwDoc* pDestDoc ); + + // get and set TextNode pointer + const SwTextNode* GetpTextNd() const { return m_pTextNode; } + inline const SwTextNode& GetTextNode() const; + void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } +}; + +inline const SwTextNode& SwTextTOXMark::GetTextNode() const +{ + assert( m_pTextNode ); + return *m_pTextNode; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx new file mode 100644 index 000000000..d94acc6f3 --- /dev/null +++ b/sw/inc/undobj.hxx @@ -0,0 +1,350 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNDOBJ_HXX +#define INCLUDED_SW_INC_UNDOBJ_HXX + +#include <vector> +#include <memory> + +#include <svl/undo.hxx> +#include <tools/solar.h> +#include "SwRewriter.hxx" +#include "swundo.hxx" +#include <o3tl/typed_flags_set.hxx> +#include <optional> + +class SwHistory; +class SwPaM; +struct SwPosition; +class SwDoc; +class SwTextFormatColl; +class SwFrameFormat; +class SwFormatAnchor; +class SwNodeIndex; +class SwNodeRange; +class SwRedlineData; +class SwRedlineSaveDatas; +enum class RedlineFlags; +enum class RndStdIds; + +namespace sw { + class UndoRedoContext; + class RepeatContext; +} + +class SwUndo + : public SfxUndoAction +{ + SwUndoId const m_nId; + RedlineFlags m_nOrigRedlineFlags; + ViewShellId m_nViewShellId; + bool m_isRepeatIgnored; ///< for multi-selection, only repeat 1st selection + +protected: + bool m_bCacheComment; + mutable std::optional<OUString> maComment; + + static void RemoveIdxFromSection( SwDoc&, sal_uLong nSttIdx, const sal_uLong* pEndIdx = nullptr ); + static void RemoveIdxFromRange( SwPaM& rPam, bool bMoveNext ); + static void RemoveIdxRel( sal_uLong, const SwPosition& ); + + static bool CanRedlineGroup( SwRedlineSaveDatas& rCurr, + const SwRedlineSaveDatas& rCheck, + bool bCurrIsEnd ); + + /** + Returns the rewriter for this object. + + @return the rewriter for this object + */ + virtual SwRewriter GetRewriter() const; + + // the 4 methods that derived classes have to override + // base implementation does nothing + virtual void RepeatImpl( ::sw::RepeatContext & ); +public: // should not be public, but ran into trouble in untbl.cxx + virtual void UndoImpl( ::sw::UndoRedoContext & ) = 0; + virtual void RedoImpl( ::sw::UndoRedoContext & ) = 0; + +private: + /// Try to obtain the view shell ID of the current view. + static ViewShellId CreateViewShellId(const SwDoc* pDoc); + // SfxUndoAction + virtual void Undo() override; + virtual void Redo() override; + virtual void UndoWithContext(SfxUndoContext &) override; + virtual void RedoWithContext(SfxUndoContext &) override; + virtual void Repeat(SfxRepeatTarget &) override; + virtual bool CanRepeat(SfxRepeatTarget &) const override; + +public: + SwUndo(SwUndoId const nId, const SwDoc* pDoc); + virtual ~SwUndo() override; + + SwUndoId GetId() const { return m_nId; } + + /** + Returns textual comment for this undo object. + + The textual comment is created from the resource string + corresponding to this object's ID. The rewriter of this object + is applied to the resource string to get the final comment. + + @return textual comment for this undo object + */ + virtual OUString GetComment() const override; + + /// See SfxUndoAction::GetViewShellId(). + ViewShellId GetViewShellId() const override; + + // UndoObject remembers which mode was turned on. + // In Undo/Redo/Repeat this remembered mode is switched on. + RedlineFlags GetRedlineFlags() const { return m_nOrigRedlineFlags; } + void SetRedlineFlags( RedlineFlags eMode ) { m_nOrigRedlineFlags = eMode; } + + bool IsDelBox() const; + + // Save and set Redline data. + static bool FillSaveData( const SwPaM& rRange, SwRedlineSaveDatas& rSData, + bool bDelRange = true, bool bCopyNext = true ); + static bool FillSaveDataForFormat( const SwPaM& , SwRedlineSaveDatas& ); + static void SetSaveData( SwDoc& rDoc, SwRedlineSaveDatas& rSData ); + static bool HasHiddenRedlines( const SwRedlineSaveDatas& rSData ); + void IgnoreRepeat() { m_isRepeatIgnored = true; } +}; + +enum class DelContentType : sal_uInt16 +{ + Ftn = 0x01, + Fly = 0x02, + Bkm = 0x08, + AllMask = 0x0b, + Replace = 0x10, + WriterfilterHack = 0x20, + ExcludeFlyAtStartEnd = 0x40, + CheckNoCntnt = 0x80, +}; +namespace o3tl { + template<> struct typed_flags<DelContentType> : is_typed_flags<DelContentType, 0xfb> {}; +} + +/// will DelContentIndex destroy a frame anchored at character at rAnchorPos? +bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos, + SwPosition const & rStart, SwPosition const & rEnd, + DelContentType const nDelContentType = DelContentType::AllMask); +/// is a fly anchored at paragraph at rAnchorPos selected? +bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos, + SwPosition const & rStart, SwPosition const & rEnd, + DelContentType const nDelContentType = DelContentType::AllMask); +/// check at-char and at-para flys in rDoc +bool IsFlySelectedByCursor(SwDoc const & rDoc, + SwPosition const & rStart, SwPosition const & rEnd); + +// This class has to be inherited into an Undo-object if it saves content +// for Redo/Undo... +class SwUndoSaveContent +{ +protected: + + std::unique_ptr<SwHistory> m_pHistory; + + // Needed for deletion of content. For Redo content is moved into the + // UndoNodesArray. These methods always create a new node to insert + // content. So the attributes do not get expanded. + // MoveTo: moves from the NodesArray into the UndoNodesArray. + // MoveFrom: moves from the UndoNodesArray into the NodesArray. + static void MoveToUndoNds( SwPaM& rPam, + SwNodeIndex* pNodeIdx, + sal_uLong* pEndNdIdx = nullptr ); + static void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, + SwPosition& rInsPos, + const sal_uLong* pEndNdIdx = nullptr, + bool bForceCreateFrames = false); + + // These two methods move the SPoint back/forth from PaM. With it + // a range can be spanned for Undo/Redo. (In this case the SPoint + // is before the manipulated range!!) + // The flag indicates if there is content before the SPoint. + static bool MovePtBackward( SwPaM& rPam ); + static void MovePtForward( SwPaM& rPam, bool bMvBkwrd ); + + // Before moving stuff into UndoNodes-Array care has to be taken that + // the content-bearing attributes are removed from the nodes-array. + void DelContentIndex( const SwPosition& pMark, const SwPosition& pPoint, + DelContentType nDelContentType = DelContentType::AllMask ); + +public: + SwUndoSaveContent(); + ~SwUndoSaveContent() COVERITY_NOEXCEPT_FALSE; +}; + +// Save a complete section in nodes-array. +class SwUndoSaveSection : private SwUndoSaveContent +{ + std::unique_ptr<SwNodeIndex> m_pMovedStart; + std::unique_ptr<SwRedlineSaveDatas> m_pRedlineSaveData; + sal_uLong m_nMoveLen; // Index into UndoNodes-Array. + sal_uLong m_nStartPos; + +protected: + SwNodeIndex* GetMvSttIdx() const { return m_pMovedStart.get(); } + sal_uLong GetMvNodeCnt() const { return m_nMoveLen; } + +public: + SwUndoSaveSection(); + ~SwUndoSaveSection(); + + void SaveSection( const SwNodeIndex& rSttIdx ); + void SaveSection(const SwNodeRange& rRange, bool bExpandNodes = true); + void RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, sal_uInt16 nSectType ); + void RestoreSection(SwDoc* pDoc, const SwNodeIndex& rInsPos, bool bForceCreateFrames = false); + + const SwHistory* GetHistory() const { return m_pHistory.get(); } + SwHistory* GetHistory() { return m_pHistory.get(); } +}; + +// This class saves the PaM as sal_uInt16's and is able to restore it +// into a PaM. +class SwUndRng +{ +public: + sal_uLong m_nSttNode, m_nEndNode; + sal_Int32 m_nSttContent, m_nEndContent; + + SwUndRng(); + SwUndRng( const SwPaM& ); + + void SetValues( const SwPaM& rPam ); + void SetPaM( SwPaM&, bool bCorrToContent = false ) const; + SwPaM & AddUndoRedoPaM( + ::sw::UndoRedoContext &, bool const bCorrToContent = false) const; +}; + +class SwUndoInsLayFormat; + +namespace sw { + +std::unique_ptr<std::vector<SwFrameFormat*>> +GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong nSttNode); + +} + +// base class for insertion of Document, Glossaries and Copy +class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveContent +{ + SwTextFormatColl *m_pTextFormatColl, *m_pLastNodeColl; + std::unique_ptr<std::vector<SwFrameFormat*>> m_pFrameFormats; + std::vector< std::shared_ptr<SwUndoInsLayFormat> > m_FlyUndos; + std::unique_ptr<SwRedlineData> m_pRedlineData; + int m_nDeleteTextNodes; + +protected: + sal_uLong m_nNodeDiff; + /// start of Content in UndoNodes for Redo + std::unique_ptr<SwNodeIndex> m_pUndoNodeIndex; + sal_uInt16 m_nSetPos; // Start in the history list. + + SwUndoInserts( SwUndoId nUndoId, const SwPaM& ); +public: + virtual ~SwUndoInserts() override; + + virtual void UndoImpl( ::sw::UndoRedoContext & ) override; + virtual void RedoImpl( ::sw::UndoRedoContext & ) override; + virtual void RepeatImpl( ::sw::RepeatContext & ) override; + + // Set destination range after reading. + void SetInsertRange( const SwPaM&, bool bScanFlys = true, + int nDeleteTextNodes = 1); + + static bool IsCreateUndoForNewFly(SwFormatAnchor const& rAnchor, + sal_uLong const nStartNode, sal_uLong const nEndNode); + std::vector<SwFrameFormat*> * GetFlysAnchoredAt() { return m_pFrameFormats.get(); } +}; + +class SwUndoInsDoc final : public SwUndoInserts +{ +public: + SwUndoInsDoc( const SwPaM& ); +}; + +class SwUndoCpyDoc final : public SwUndoInserts +{ +public: + SwUndoCpyDoc( const SwPaM& ); +}; + +class SwUndoFlyBase : public SwUndo, private SwUndoSaveSection +{ +protected: + SwFrameFormat* m_pFrameFormat; // The saved FlyFormat. + sal_uLong m_nNodePagePos; + sal_Int32 m_nContentPos; // Page at/in paragraph. + RndStdIds m_nRndId; + bool m_bDelFormat; // Delete saved format. + + void InsFly(::sw::UndoRedoContext & rContext, bool bShowSel = true); + void DelFly( SwDoc* ); + + SwUndoFlyBase( SwFrameFormat* pFormat, SwUndoId nUndoId ); + + SwNodeIndex* GetMvSttIdx() const { return SwUndoSaveSection::GetMvSttIdx(); } + sal_uLong GetMvNodeCnt() const { return SwUndoSaveSection::GetMvNodeCnt(); } + +public: + virtual ~SwUndoFlyBase() override; + +}; + +class SwUndoInsLayFormat : public SwUndoFlyBase +{ + sal_uLong mnCursorSaveIndexPara; // Cursor position + sal_Int32 mnCursorSaveIndexPos; // for undo +public: + SwUndoInsLayFormat( SwFrameFormat* pFormat, sal_uLong nNodeIdx, sal_Int32 nCntIdx ); + + virtual ~SwUndoInsLayFormat() override; + + virtual void UndoImpl( ::sw::UndoRedoContext & ) override; + virtual void RedoImpl( ::sw::UndoRedoContext & ) override; + virtual void RepeatImpl( ::sw::RepeatContext & ) override; + + virtual OUString GetComment() const override; + +}; + +class SwUndoDelLayFormat final : public SwUndoFlyBase +{ + bool m_bShowSelFrame; +public: + SwUndoDelLayFormat( SwFrameFormat* pFormat ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ) override; + virtual void RedoImpl( ::sw::UndoRedoContext & ) override; + + void RedoForRollback(); + + void ChgShowSel( bool bNew ) { m_bShowSelFrame = bNew; } + + virtual SwRewriter GetRewriter() const override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx new file mode 100644 index 000000000..289d5f0b7 --- /dev/null +++ b/sw/inc/unobaseclass.hxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOBASECLASS_HXX +#define INCLUDED_SW_INC_UNOBASECLASS_HXX + +#include <memory> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XEnumeration.hpp> + +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <vcl/svapp.hxx> + +class SfxPoolItem; +class SwDoc; +class SwUnoTableCursor; + +typedef ::cppu::WeakImplHelper +< css::lang::XServiceInfo +, css::container::XEnumeration +> +SwSimpleEnumeration_Base; + +enum class CursorType +{ + Body, + Frame, + TableText, + Footnote, + Header, + Footer, + Redline, + All, // for Search&Replace + Selection, // create a paragraph enumeration from + // a text range or cursor + SelectionInTable, + Meta, // meta/meta-field +}; + +/* + Start/EndAction or Start/EndAllAction +*/ +class UnoActionContext +{ +private: + SwDoc * m_pDoc; + +public: + UnoActionContext(SwDoc *const pDoc); + ~UnoActionContext() COVERITY_NOEXCEPT_FALSE; +}; + +/* + interrupt Actions for a little while + FIXME: this is a vile abomination that may cause recursive layout actions! + C'thulhu fhtagn. +*/ +class UnoActionRemoveContext +{ +private: + SwDoc *const m_pDoc; + +public: + UnoActionRemoveContext(SwDoc *const pDoc); + UnoActionRemoveContext(SwUnoTableCursor const& rCursor); + ~UnoActionRemoveContext() COVERITY_NOEXCEPT_FALSE; +}; + +namespace sw { + template<typename T> + struct UnoImplPtrDeleter + { + void operator()(T* pUnoImpl) + { + SolarMutexGuard g; // #i105557#: call dtor with locked solar mutex + delete pUnoImpl; + } + }; + /// Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex. + template<typename T> + using UnoImplPtr = std::unique_ptr<T, UnoImplPtrDeleter<T> >; + + template< class C > C * + UnoTunnelGetImplementation( css::uno::Reference< css::lang::XUnoTunnel > const & xUnoTunnel) + { + if (!xUnoTunnel.is()) { return 0; } + C *const pC( reinterpret_cast< C* >( + ::sal::static_int_cast< sal_IntPtr >( + xUnoTunnel->getSomething(C::getUnoTunnelId())))); + return pC; + } + + template< class C > sal_Int64 + UnoTunnelImpl(const css::uno::Sequence< sal_Int8 > & rId, + C *const pThis) + { + if (isUnoTunnelId<C>(rId)) + { + return ::sal::static_int_cast< sal_Int64 >( + reinterpret_cast< sal_IntPtr >(pThis) ); + } + return 0; + } + +} // namespace sw + +#endif // INCLUDED_SW_INC_UNOBASECLASS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx new file mode 100644 index 000000000..7eb499a84 --- /dev/null +++ b/sw/inc/unochart.hxx @@ -0,0 +1,380 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOCHART_HXX +#define INCLUDED_SW_INC_UNOCHART_HXX + +#include <map> +#include <set> + +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/chart2/data/XDataProvider.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/data/XDataSequence.hpp> +#include <com/sun/star/chart2/data/XTextualDataSequence.hpp> +#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <com/sun/star/chart2/data/XLabeledDataSequence2.hpp> +#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> +#include <com/sun/star/chart2/data/DataSequenceRole.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/util/XModifyListener.hpp> + +#include <comphelper/interfacecontainer2.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/weakref.hxx> + +#include <rtl/ref.hxx> +#include <svl/listener.hxx> +#include <tools/link.hxx> +#include <vcl/timer.hxx> + +#include "frmfmt.hxx" +#include "unocrsr.hxx" + +class SfxItemPropertySet; +class SwDoc; +class SwTable; +class SwTableBox; +struct SwRangeDescriptor; +class SwSelBoxes; +namespace com::sun::star::table { class XCell; } + +bool FillRangeDescriptor( SwRangeDescriptor &rDesc, const OUString &rCellRangeName ); + +class SwChartHelper +{ +public: + static void DoUpdateAllCharts( SwDoc* pDoc ); +}; + +class SwChartLockController_Helper +{ + SwDoc *m_pDoc; + + DECL_LINK( DoUnlockAllCharts, Timer *, void ); + Timer m_aUnlockTimer; // timer to unlock chart controllers + bool m_bIsLocked; + + SwChartLockController_Helper( const SwChartLockController_Helper & ) = delete; + SwChartLockController_Helper & operator = ( const SwChartLockController_Helper & ) = delete; + + void LockUnlockAllCharts( bool bLock ); + void LockAllCharts() { LockUnlockAllCharts( true ); }; + void UnlockAllCharts() { LockUnlockAllCharts( false ); }; + +public: + SwChartLockController_Helper( SwDoc *pDocument ); + ~SwChartLockController_Helper() COVERITY_NOEXCEPT_FALSE; + + void StartOrContinueLocking(); + void Disconnect(); +}; + +typedef cppu::WeakImplHelper +< + css::chart2::data::XDataProvider, + css::chart2::data::XRangeXMLConversion, + css::lang::XComponent, + css::lang::XServiceInfo +> +SwChartDataProviderBaseClass; + +class SwChartDataProvider final : + public SwChartDataProviderBaseClass +{ + + // used to keep weak-references to all data-sequences of a single table + // see set definition below... + struct lt_DataSequenceRef + { + bool operator()( css::uno::WeakReference< css::chart2::data::XDataSequence > xWRef1, css::uno::WeakReference< css::chart2::data::XDataSequence > xWRef2 ) const + { + css::uno::Reference< css::chart2::data::XDataSequence > xRef1( xWRef1 ); + css::uno::Reference< css::chart2::data::XDataSequence > xRef2( xWRef2 ); + return xRef1.get() < xRef2.get(); + } + }; + typedef std::set< css::uno::WeakReference < css::chart2::data::XDataSequence >, lt_DataSequenceRef > Set_DataSequenceRef_t; + + // map of data-sequence sets for each table + typedef std::map< const SwTable *, Set_DataSequenceRef_t > Map_Set_DataSequenceRef_t; + + // map of all data-sequences provided directly or indirectly (e.g. via + // data-source) by this object. Since there is only one object of this type + // for each document it should hold references to all used data-sequences for + // all tables of the document. + mutable Map_Set_DataSequenceRef_t m_aDataSequences; + + ::comphelper::OInterfaceContainerHelper2 m_aEventListeners; + const SwDoc * m_pDoc; + bool m_bDisposed; + + SwChartDataProvider( const SwChartDataProvider & ) = delete; + SwChartDataProvider & operator = ( const SwChartDataProvider & ) = delete; + + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + css::uno::Reference< css::chart2::data::XDataSource > Impl_createDataSource( const css::uno::Sequence< css::beans::PropertyValue >& aArguments, bool bTestOnly = false ); + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + css::uno::Reference< css::chart2::data::XDataSequence > Impl_createDataSequenceByRangeRepresentation( const OUString& aRangeRepresentation, bool bTestOnly = false ); + + static OUString GetBrokenCellRangeForExport( const OUString &rCellRangeRepresentation ); + +public: + SwChartDataProvider( const SwDoc* pDoc ); + virtual ~SwChartDataProvider() override; + + // XDataProvider + virtual sal_Bool SAL_CALL createDataSourcePossible( const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override; + virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource( const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments( const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource ) override; + virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( const OUString& aRangeRepresentation ) override; + virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( const OUString& aRangeRepresentation ) override; + virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection( ) override; + + virtual css::uno::Reference<css::chart2::data::XDataSequence> + SAL_CALL createDataSequenceByValueArray( + const OUString& aRole, const OUString& aRangeRepresentation ) override; + + // XRangeXMLConversion + virtual OUString SAL_CALL convertRangeToXML( const OUString& aRangeRepresentation ) override; + virtual OUString SAL_CALL convertRangeFromXML( const OUString& aXMLRange ) override; + + // XComponent + virtual void SAL_CALL dispose( ) override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + void AddDataSequence( const SwTable &rTable, css::uno::Reference< css::chart2::data::XDataSequence > const &rxDataSequence ); + void RemoveDataSequence( const SwTable &rTable, css::uno::Reference< css::chart2::data::XDataSequence > const &rxDataSequence ); + + // will send modified events for all data-sequences of the table + void InvalidateTable( const SwTable *pTable ); + void DeleteBox( const SwTable *pTable, const SwTableBox &rBox ); + void DisposeAllDataSequences( const SwTable *pTable ); + + // functionality needed to get notified about new added rows/cols + void AddRowCols( const SwTable &rTable, const SwSelBoxes& rBoxes, sal_uInt16 nLines, bool bBehind ); +}; + +typedef cppu::WeakImplHelper +< + css::chart2::data::XDataSource, + css::lang::XServiceInfo +> +SwChartDataSourceBaseClass; + +class SwChartDataSource final : + public SwChartDataSourceBaseClass +{ + css::uno::Sequence< + css::uno::Reference< css::chart2::data::XLabeledDataSequence > > m_aLDS; + + SwChartDataSource( const SwChartDataSource & ) = delete; + SwChartDataSource & operator = ( const SwChartDataSource & ) = delete; + +public: + SwChartDataSource( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > &rLDS ); + virtual ~SwChartDataSource() override; + + // XDataSource + virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences( ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; +}; + +typedef cppu::WeakImplHelper +< + css::chart2::data::XDataSequence, + css::chart2::data::XTextualDataSequence, + css::chart2::data::XNumericalDataSequence, + css::util::XCloneable, + css::beans::XPropertySet, + css::lang::XServiceInfo, + css::lang::XUnoTunnel, + css::util::XModifiable, + css::lang::XEventListener, + css::lang::XComponent +> +SwChartDataSequenceBaseClass; + +class SwChartDataSequence final : + public SwChartDataSequenceBaseClass, + public SvtListener +{ + SwFrameFormat* m_pFormat; + ::comphelper::OInterfaceContainerHelper2 m_aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; + css::chart2::data::DataSequenceRole m_aRole; + + OUString m_aRowLabelText; + OUString m_aColLabelText; + + rtl::Reference<SwChartDataProvider> m_xDataProvider; + + sw::UnoCursorPointer m_pTableCursor; // cursor spanned over cells to use + + const SfxItemPropertySet* m_pPropSet; + + bool m_bDisposed; + + SwChartDataSequence( const SwChartDataSequence &rObj ); + SwChartDataSequence & operator = ( const SwChartDataSequence & ) = delete; + +public: + SwChartDataSequence( SwChartDataProvider &rProvider, + SwFrameFormat &rTableFormat, + const std::shared_ptr<SwUnoCursor>& pTableCursor ); + virtual ~SwChartDataSequence() override; + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // XDataSequence + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getData() override; + virtual OUString SAL_CALL getSourceRangeRepresentation() override; + virtual css::uno::Sequence< OUString > SAL_CALL generateLabel( css::chart2::data::LabelOrigin eLabelOrigin ) override; + virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) override; + + // XTextualDataSequence + virtual css::uno::Sequence< OUString > SAL_CALL getTextualData() override; + + // XNumericalDataSequence + virtual css::uno::Sequence< double > SAL_CALL getNumericalData() override; + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XModifiable + virtual sal_Bool SAL_CALL isModified( ) override; + virtual void SAL_CALL setModified( sal_Bool bModified ) override; + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XComponent + virtual void SAL_CALL dispose( ) override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + SwFrameFormat* GetFrameFormat() const { return m_pFormat; } + bool DeleteBox( const SwTableBox &rBox ); + + void FillRangeDesc( SwRangeDescriptor &rRangeDesc ) const; + void ExtendTo( bool bExtendCol, sal_Int32 nFirstNew, sal_Int32 nCount ); + std::vector< css::uno::Reference< css::table::XCell > > GetCells(); + + virtual void Notify(const SfxHint& rHint) override; +}; + +typedef cppu::WeakImplHelper +< + css::chart2::data::XLabeledDataSequence2, + css::lang::XServiceInfo, + css::util::XModifyListener, + css::lang::XComponent +> +SwChartLabeledDataSequenceBaseClass; + +class SwChartLabeledDataSequence final : + public SwChartLabeledDataSequenceBaseClass +{ + ::comphelper::OInterfaceContainerHelper2 m_aEventListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; + + css::uno::Reference< css::chart2::data::XDataSequence > m_xData; + css::uno::Reference< css::chart2::data::XDataSequence > m_xLabels; + + bool m_bDisposed; + + SwChartLabeledDataSequence( const SwChartLabeledDataSequence & ) = delete; + SwChartLabeledDataSequence & operator = ( const SwChartLabeledDataSequence & ) = delete; + + void SetDataSequence( css::uno::Reference< css::chart2::data::XDataSequence >& rxDest, const css::uno::Reference< css::chart2::data::XDataSequence >& rxSource ); + +public: + SwChartLabeledDataSequence(); + virtual ~SwChartLabeledDataSequence() override; + + // XLabeledDataSequence + virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getValues( ) override; + virtual void SAL_CALL setValues( const css::uno::Reference< css::chart2::data::XDataSequence >& xSequence ) override; + virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getLabel( ) override; + virtual void SAL_CALL setLabel( const css::uno::Reference< css::chart2::data::XDataSequence >& xSequence ) override; + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + + // XComponent + virtual void SAL_CALL dispose( ) override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx new file mode 100644 index 000000000..ae16ab4ab --- /dev/null +++ b/sw/inc/unocoll.hxx @@ -0,0 +1,505 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOCOLL_HXX +#define INCLUDED_SW_INC_UNOCOLL_HXX +#include <limits.h> +#include "flyenum.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <cppuhelper/implbase.hxx> +#include "swdllapi.h" + +class SwDoc; +class SwFrameFormat; +namespace com::sun::star::text +{ + class XTextTable; + class XTextSection; + class XFootnote; +} +class SwFormatFootnote; +class SwSectionFormat; +struct SvEventDescription; + +const SvEventDescription* sw_GetSupportedMacroItems(); + +class SwUnoCollection +{ + SwDoc* m_pDoc; + bool m_bObjectValid; + + public: + SwUnoCollection(SwDoc* p) : + m_pDoc(p), + m_bObjectValid(true){} + + virtual ~SwUnoCollection() {} + + virtual void Invalidate(); + bool IsValid() const {return m_bObjectValid;} + + SwDoc* GetDoc() const {return m_pDoc;} +}; + +/** entries in this enum are mapped in an array in unocoll.cxx */ +enum class SwServiceType { + TypeTextTable = 0, + TypeTextFrame = 1, + TypeGraphic = 2, + TypeOLE = 3, + TypeBookmark = 4, + TypeFootnote = 5, + TypeEndnote = 6, + TypeIndexMark = 7, + TypeIndex = 8, + ReferenceMark = 9, + StyleCharacter = 10, + StyleParagraph = 11, + StyleFrame = 12, + StylePage = 13, + StyleNumbering = 14, + ContentIndexMark = 15, + ContentIndex = 16, + UserIndexMark = 17, + UserIndex = 18, + TextSection = 19, + FieldTypeDateTime = 20, + FieldTypeUser = 21, + FieldTypeSetExp = 22, + FieldTypeGetExp = 23, + FieldTypeFileName = 24, + FieldTypePageNum = 25, + FieldTypeAuthor = 26, + FieldTypeChapter = 27, + FieldTypeDummy0 = 28, + FieldTypeGetReference = 29, + FieldTypeConditionedText = 30, + FieldTypeAnnotation = 31, + FieldTypeInput = 32, + FieldTypeMacro = 33, + FieldTypeDDE = 34, + FieldTypeHiddenPara = 35, + FieldTypeDocInfo = 36, + FieldTypeTemplateName = 37, + FieldTypeUserExt = 38, + FieldTypeRefPageSet = 39, + FieldTypeRefPageGet = 40, + FieldTypeJumpEdit = 41, + FieldTypeScript = 42, + FieldTypeDatabaseNextSet = 43, + FieldTypeDatabaseNumSet = 44, + FieldTypeDatabaseSetNum = 45, + FieldTypeDatabase = 46, + FieldTypeDatabaseName = 47, + FieldTypeTableFormula = 48, + FieldTypePageCount = 49, + FieldTypeParagraphCount = 50, + FieldTypeWordCount = 51, + FieldTypeCharacterCount = 52, + FieldTypeTableCount = 53, + FieldTypeGraphicObjectCount = 54, + FieldTypeEmbeddedObjectCount = 55, + FieldTypeDocInfoChangeAuthor = 56, + FieldTypeDocInfoChangeDateTime = 57, + FieldTypeDocInfoEditTime = 58, + FieldTypeDocInfoDescription = 59, + FieldTypeDocInfoCreateAuthor = 60, + FieldTypeDocInfoCreateDateTime = 61, + FieldTypeDummy1 = 63, + FieldTypeDummy2 = 64, + FieldTypeDummy3 = 65, + FieldTypeDocInfoCustom = 66, + FieldTypeDocInfoPrintAuthor = 67, + FieldTypeDocInfoPrintDateTime = 68, + FieldTypeDocInfoKeywords = 69, + FieldTypeDocInfoSubject = 70, + FieldTypeDocInfoTitle = 71, + FieldTypeDocInfoRevision = 72, + FieldTypeBibliography = 73, + FieldTypeCombinedCharacters = 74, + FieldTypeDropdown = 75, + FieldTypeMetafield = 76, + FieldTypeDummy4 = 77, + FieldTypeDummy5 = 78, + FieldTypeDummy6 = 79, + FieldTypeDummy7 = 80, + FieldMasterUser = 81, + FieldMasterDDE = 82, + FieldMasterSetExp = 83, + FieldMasterDatabase = 84, + FieldMasterBibliography = 85, + FieldMasterDummy2 = 86, + FieldMasterDummy3 = 87, + FieldMasterDummy4 = 88, + FieldMasterDummy5 = 89, + IndexIllustrations = 90, + IndexObjects = 91, + IndexTables = 92, + IndexBibliography = 93, + Paragraph = 94, + FieldTypeInputUser = 95, + FieldTypeHiddenText = 96, + StyleConditionalParagraph = 97, + NumberingRules = 98, + TextColumns = 99, + IndexHeaderSection = 100, + Defaults = 101, + IMapRectangle = 102, + IMapCircle = 103, + IMapPolygon = 104, + TypeTextGraphic = 105, + Chart2DataProvider = 106, + TypeFieldMark = 107, + TypeFormFieldMark = 108, + TypeMeta = 109, + VbaObjectProvider = 110, + VbaCodeNameProvider = 111, + VbaProjectNameProvider = 112, + VbaGlobals = 113, + StyleTable = 114, + StyleCell = 115, + + Invalid = USHRT_MAX +}; + +// case-corrected versions of service-names (see #i67811) + +#define CSS_TEXT_TEXTFIELD_DATE_TIME "com.sun.star.text.textfield.DateTime" +#define CSS_TEXT_TEXTFIELD_USER "com.sun.star.text.textfield.User" +#define CSS_TEXT_TEXTFIELD_SET_EXPRESSION "com.sun.star.text.textfield.SetExpression" +#define CSS_TEXT_TEXTFIELD_GET_EXPRESSION "com.sun.star.text.textfield.GetExpression" +#define CSS_TEXT_TEXTFIELD_FILE_NAME "com.sun.star.text.textfield.FileName" +#define CSS_TEXT_TEXTFIELD_PAGE_NUMBER "com.sun.star.text.textfield.PageNumber" +#define CSS_TEXT_TEXTFIELD_AUTHOR "com.sun.star.text.textfield.Author" +#define CSS_TEXT_TEXTFIELD_CHAPTER "com.sun.star.text.textfield.Chapter" +#define CSS_TEXT_TEXTFIELD_GET_REFERENCE "com.sun.star.text.textfield.GetReference" +#define CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT "com.sun.star.text.textfield.ConditionalText" +#define CSS_TEXT_TEXTFIELD_ANNOTATION "com.sun.star.text.textfield.Annotation" +#define CSS_TEXT_TEXTFIELD_INPUT "com.sun.star.text.textfield.Input" +#define CSS_TEXT_TEXTFIELD_MACRO "com.sun.star.text.textfield.Macro" +#define CSS_TEXT_TEXTFIELD_DDE "com.sun.star.text.textfield.DDE" +#define CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH "com.sun.star.text.textfield.HiddenParagraph" +#define CSS_TEXT_TEXTFIELD_TEMPLATE_NAME "com.sun.star.text.textfield.TemplateName" +#define CSS_TEXT_TEXTFIELD_EXTENDED_USER "com.sun.star.text.textfield.ExtendedUser" +#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET "com.sun.star.text.textfield.ReferencePageSet" +#define CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET "com.sun.star.text.textfield.ReferencePageGet" +#define CSS_TEXT_TEXTFIELD_JUMP_EDIT "com.sun.star.text.textfield.JumpEdit" +#define CSS_TEXT_TEXTFIELD_SCRIPT "com.sun.star.text.textfield.Script" +#define CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET "com.sun.star.text.textfield.DatabaseNextSet" +#define CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET "com.sun.star.text.textfield.DatabaseNumberOfSet" +#define CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER "com.sun.star.text.textfield.DatabaseSetNumber" +#define CSS_TEXT_TEXTFIELD_DATABASE "com.sun.star.text.textfield.Database" +#define CSS_TEXT_TEXTFIELD_DATABASE_NAME "com.sun.star.text.textfield.DatabaseName" +#define CSS_TEXT_TEXTFIELD_TABLE_FORMULA "com.sun.star.text.textfield.TableFormula" +#define CSS_TEXT_TEXTFIELD_PAGE_COUNT "com.sun.star.text.textfield.PageCount" +#define CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT "com.sun.star.text.textfield.ParagraphCount" +#define CSS_TEXT_TEXTFIELD_WORD_COUNT "com.sun.star.text.textfield.WordCount" +#define CSS_TEXT_TEXTFIELD_CHARACTER_COUNT "com.sun.star.text.textfield.CharacterCount" +#define CSS_TEXT_TEXTFIELD_TABLE_COUNT "com.sun.star.text.textfield.TableCount" +#define CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT "com.sun.star.text.textfield.GraphicObjectCount" +#define CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT "com.sun.star.text.textfield.EmbeddedObjectCount" +#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR "com.sun.star.text.textfield.docinfo.ChangeAuthor" +#define CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME "com.sun.star.text.textfield.docinfo.ChangeDateTime" +#define CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME "com.sun.star.text.textfield.docinfo.EditTime" +#define CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION "com.sun.star.text.textfield.docinfo.Description" +#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR "com.sun.star.text.textfield.docinfo.CreateAuthor" +#define CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME "com.sun.star.text.textfield.docinfo.CreateDateTime" +#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR "com.sun.star.text.textfield.docinfo.PrintAuthor" +#define CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME "com.sun.star.text.textfield.docinfo.PrintDateTime" +#define CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS "com.sun.star.text.textfield.docinfo.KeyWords" +#define CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT "com.sun.star.text.textfield.docinfo.Subject" +#define CSS_TEXT_TEXTFIELD_DOCINFO_TITLE "com.sun.star.text.textfield.docinfo.Title" +#define CSS_TEXT_TEXTFIELD_DOCINFO_REVISION "com.sun.star.text.textfield.docinfo.Revision" +#define CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM "com.sun.star.text.textfield.docinfo.Custom" +#define CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY "com.sun.star.text.textfield.Bibliography" +#define CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS "com.sun.star.text.textfield.CombinedCharacters" +#define CSS_TEXT_TEXTFIELD_DROP_DOWN "com.sun.star.text.textfield.DropDown" +#define CSS_TEXT_TEXTFIELD_INPUT_USER "com.sun.star.text.textfield.InputUser" +#define CSS_TEXT_TEXTFIELD_HIDDEN_TEXT "com.sun.star.text.textfield.HiddenText" +#define CSS_TEXT_FIELDMASTER_USER "com.sun.star.text.fieldmaster.User" +#define CSS_TEXT_FIELDMASTER_DDE "com.sun.star.text.fieldmaster.DDE" +#define CSS_TEXT_FIELDMASTER_SET_EXPRESSION "com.sun.star.text.fieldmaster.SetExpression" +#define CSS_TEXT_FIELDMASTER_DATABASE "com.sun.star.text.fieldmaster.Database" +#define CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY "com.sun.star.text.fieldmaster.Bibliography" + +class SwXServiceProvider +{ +public: + static OUString GetProviderName(SwServiceType nObjectType); + static SwServiceType GetProviderType(const OUString& rServiceName); + static css::uno::Reference< css::uno::XInterface > MakeInstance(SwServiceType nObjectType, SwDoc & rDoc); + static css::uno::Sequence<OUString> GetAllServiceNames(); + +}; + +typedef +cppu::WeakImplHelper +< + css::container::XNameAccess, + css::container::XIndexAccess, + css::lang::XServiceInfo +> +SwCollectionBaseClass; +class SW_DLLPUBLIC SwXTextTables final : public SwCollectionBaseClass, + public SwUnoCollection +{ + virtual ~SwXTextTables() override; +public: + SwXTextTables(SwDoc* pDoc); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + static css::uno::Reference<css::text::XTextTable> GetObject(SwFrameFormat& rFormat); +}; + +typedef +cppu::WeakImplHelper +< + css::container::XEnumerationAccess, + css::container::XNameAccess, + css::container::XIndexAccess, + css::lang::XServiceInfo +> SwXFramesBaseClass; + +class SwXFrames : public SwXFramesBaseClass, + public SwUnoCollection +{ + const FlyCntType m_eType; +protected: + virtual ~SwXFrames() override; +public: + SwXFrames(SwDoc* pDoc, FlyCntType eSet); + + //XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + +class SwXTextFrames final : public SwXFrames +{ + virtual ~SwXTextFrames() override; +public: + SwXTextFrames(SwDoc* pDoc); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXTextGraphicObjects final : public SwXFrames +{ + virtual ~SwXTextGraphicObjects() override; +public: + SwXTextGraphicObjects(SwDoc* pDoc); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXTextEmbeddedObjects final : public SwXFrames +{ + virtual ~SwXTextEmbeddedObjects() override; +public: + SwXTextEmbeddedObjects(SwDoc* pDoc); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXTextSections final : public SwCollectionBaseClass, + public SwUnoCollection +{ + virtual ~SwXTextSections() override; +public: + SwXTextSections(SwDoc* pDoc); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + static css::uno::Reference< css::text::XTextSection> GetObject( SwSectionFormat& rFormat ); +}; + +class SwXBookmarks final : public SwCollectionBaseClass, + public SwUnoCollection +{ + virtual ~SwXBookmarks() override; + public: + SwXBookmarks(SwDoc* pDoc); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXNumberingRulesCollection final : public cppu::WeakImplHelper +< + css::container::XIndexAccess +>, + public SwUnoCollection +{ + virtual ~SwXNumberingRulesCollection() override; + +public: + SwXNumberingRulesCollection( SwDoc* pDoc ); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; +}; + +typedef +cppu::WeakImplHelper +< + css::container::XIndexAccess, + css::lang::XServiceInfo +> +SwSimpleIndexAccessBaseClass; + +class SwXFootnotes final : public SwSimpleIndexAccessBaseClass, + public SwUnoCollection +{ + const bool m_bEndnote; + + virtual ~SwXFootnotes() override; +public: + SwXFootnotes(bool bEnd, SwDoc* pDoc); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + static css::uno::Reference< css::text::XFootnote> GetObject( SwDoc& rDoc, const SwFormatFootnote& rFormat ); +}; + +class SwXReferenceMarks final : public SwCollectionBaseClass, + public SwUnoCollection +{ + virtual ~SwXReferenceMarks() override; +public: + SwXReferenceMarks(SwDoc* pDoc); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx new file mode 100644 index 000000000..72c8fa744 --- /dev/null +++ b/sw/inc/unocrsr.hxx @@ -0,0 +1,171 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOCRSR_HXX +#define INCLUDED_SW_INC_UNOCRSR_HXX + +#include "swcrsr.hxx" +#include <svl/SfxBroadcaster.hxx> +#include <svl/lstner.hxx> + +namespace sw +{ + struct SW_DLLPUBLIC UnoCursorHint final : public SfxHint + { + UnoCursorHint() {} + virtual ~UnoCursorHint() override; + }; +} + +class SAL_DLLPUBLIC_RTTI SwUnoCursor : public virtual SwCursor +{ +private: + bool m_bRemainInSection : 1; + bool m_bSkipOverHiddenSections : 1; + bool m_bSkipOverProtectSections : 1; + +public: + SfxBroadcaster m_aNotifier; + SwUnoCursor( const SwPosition &rPos ); + virtual ~SwUnoCursor() override; + +protected: + + virtual const SwContentFrame* DoSetBidiLevelLeftRight( + bool & io_rbLeft, bool bVisualAllowed, bool bInsertCursor) override; + virtual void DoSetBidiLevelUpDown() override; + +public: + + // Does a selection of content exist in table? + // Return value indicates if the cursor remains at its old position. + virtual bool IsSelOvr( SwCursorSelOverFlags eFlags = + SwCursorSelOverFlags::CheckNodeSection | + SwCursorSelOverFlags::Toggle | + SwCursorSelOverFlags::ChangePos ) override; + + virtual bool IsReadOnlyAvailable() const override; + + bool IsRemainInSection() const { return m_bRemainInSection; } + void SetRemainInSection( bool bFlag ) { m_bRemainInSection = bFlag; } + + virtual bool IsSkipOverProtectSections() const override + { return m_bSkipOverProtectSections; } + void SetSkipOverProtectSections( bool bFlag ) + { m_bSkipOverProtectSections = bFlag; } + + virtual bool IsSkipOverHiddenSections() const override + { return m_bSkipOverHiddenSections; } + void SetSkipOverHiddenSections( bool bFlag ) + { m_bSkipOverHiddenSections = bFlag; } +}; + +class SwUnoTableCursor final : public virtual SwUnoCursor, public virtual SwTableCursor +{ + // The selection has the same order as the table boxes, i.e. + // if something is deleted from the one array at a certain position + // it has also to be deleted from the other! + SwCursor m_aTableSel; + + using SwTableCursor::MakeBoxSels; + +public: + SwUnoTableCursor( const SwPosition& rPos ); + virtual ~SwUnoTableCursor() override; + + // Does a selection of content exist in table? + // Return value indicates if the cursor remains at its old position. + virtual bool IsSelOvr( SwCursorSelOverFlags eFlags = + SwCursorSelOverFlags::CheckNodeSection | + SwCursorSelOverFlags::Toggle | + SwCursorSelOverFlags::ChangePos ) override; + + void MakeBoxSels(); + + SwCursor& GetSelRing() { return m_aTableSel; } + const SwCursor& GetSelRing() const { return m_aTableSel; } +}; + +namespace sw +{ + class UnoCursorPointer final : public SfxListener + { + public: + UnoCursorPointer() + {} + UnoCursorPointer(std::shared_ptr<SwUnoCursor> const & pCursor) + : m_pCursor(pCursor) + { + StartListening(m_pCursor->m_aNotifier); + } + UnoCursorPointer(const UnoCursorPointer& rOther) + : SfxListener() + , m_pCursor(rOther.m_pCursor) + { + if(m_pCursor) + StartListening(m_pCursor->m_aNotifier); + } + virtual ~UnoCursorPointer() override + { + if(m_pCursor) + EndListening(m_pCursor->m_aNotifier); + } + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override + { + if(m_pCursor) + { + if(typeid(rHint) == typeid(UnoCursorHint)) + EndListening(rBC); + } + if(!GetBroadcasterCount()) + m_pCursor.reset(); + }; + SwUnoCursor* get() const + { return m_pCursor.get(); } + SwUnoCursor* operator->() const + { return get(); } + SwUnoCursor& operator*() const + { return *get(); } + UnoCursorPointer& operator=(UnoCursorPointer aOther) + { + if (m_pCursor) + { + EndListening(m_pCursor->m_aNotifier); + } + if(aOther.m_pCursor) + StartListening(aOther.m_pCursor->m_aNotifier); + m_pCursor = aOther.m_pCursor; + return *this; + } + explicit operator bool() const + { return static_cast<bool>(m_pCursor); } + void reset(std::shared_ptr<SwUnoCursor> pNew) + { + if(pNew) + StartListening(pNew->m_aNotifier); + if (m_pCursor) + EndListening(m_pCursor->m_aNotifier); + m_pCursor = pNew; + } + private: + std::shared_ptr<SwUnoCursor> m_pCursor; + }; +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx new file mode 100644 index 000000000..043446a7c --- /dev/null +++ b/sw/inc/unocrsrhelper.hxx @@ -0,0 +1,241 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOCRSRHELPER_HXX +#define INCLUDED_SW_INC_UNOCRSRHELPER_HXX + +#include "swtypes.hxx" +#include "flyenum.hxx" +#include "pam.hxx" + +#include <map> + +class SfxItemSet; +class SfxItemPropertySet; +struct SfxItemPropertySimpleEntry; +class SdrObject; +class SwTextNode; +class SwCursor; +class SwUnoCursor; +class SwUnoTableCursor; +class SwFormatColl; +struct SwSortOptions; +class SwDoc; +class SwRootFrame; + +namespace sw::mark { class IMark; } + +namespace com::sun::star{ + namespace beans{ + struct PropertyValue; + enum class PropertyState; + } + namespace text { + class XTextContent; + class XFlatParagraphIterator; + } +} + +enum SwGetPropertyStatesCaller +{ + SW_PROPERTY_STATE_CALLER_DEFAULT, + SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION, + SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY, + SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT +}; + +namespace SwUnoCursorHelper +{ + class SwAnyMapHelper + { + private: + // keep Any's mapped by (WhichId << 16 ) + (MemberId) + std::map<sal_uInt32, css::uno::Any> m_Map; + + public: + void SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any& rAny ); + bool FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any*& pAny ); + }; + + css::uno::Reference< css::text::XTextContent > + GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex, + bool const bParent); + + bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry + , SwPaM& rPam + , css::uno::Any *pAny + , css::beans::PropertyState& eState + , const SwTextNode* pNode = nullptr ); + + void GetCurPageStyle(SwPaM const & rPaM, OUString &rString); + + inline bool IsStartOfPara(SwPaM& rUnoCursor) + { return rUnoCursor.GetPoint()->nContent == 0;} + inline bool IsEndOfPara(SwPaM& rUnoCursor) + { return rUnoCursor.GetContentNode() && + rUnoCursor.GetPoint()->nContent == rUnoCursor.GetContentNode()->Len();} + + void resetCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam); + /// @throws css::lang::IllegalArgumentException + /// @throws css::io::IOException + /// @throws css::uno::RuntimeException + void InsertFile(SwUnoCursor* pUnoCursor, + const OUString& rURL, + const css::uno::Sequence< css::beans::PropertyValue >& rOptions); + + void getNumberingProperty( + SwPaM& rPam, + css::beans::PropertyState& eState, + css::uno::Any *pAny ); + + void setNumberingProperty( + const css::uno::Any& rValue, + SwPaM& rPam); + + sal_Int16 IsNodeNumStart( + SwPaM const & rPam, + css::beans::PropertyState& eState); + + bool DocInsertStringSplitCR( SwDoc &rDoc, + const SwPaM &rNewCursor, const OUString &rText, + const bool bForceExpandHints ); + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + void makeRedline( SwPaM const & rPaM, const OUString& RedlineType, + const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties ); + + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + void makeTableRowRedline( SwTableLine& rTableLine, const OUString& RedlineType, + const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties ); + + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + SW_DLLPUBLIC void makeTableCellRedline( SwTableBox& rTableBox, const OUString& RedlineType, + const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties ); + + /// @param bTableMode: attributes should be applied to a table selection + void SetCursorAttr(SwPaM & rPam, const SfxItemSet & rSet, + const SetAttrMode nAttrMode, + const bool bTableMode = false); + void GetCursorAttr(SwPaM & rPam, SfxItemSet & rSet, + const bool bOnlyTextAttr = false, + const bool bGetFromChrFormat = true); + void GetTextFromPam(SwPaM & rPam, OUString & rBuffer, SwRootFrame const* pLayout = nullptr); + SwFormatColl * GetCurTextFormatColl(SwPaM & rPam, const bool bConditional); + + void SelectPam(SwPaM & rPam, const bool bExpand); + void SetString(SwCursor & rCursor, const OUString & rString); + + css::uno::Sequence< css::beans::PropertyValue > + CreateSortDescriptor(const bool bFromTable); + bool ConvertSortProperties( + const css::uno::Sequence< css::beans::PropertyValue >& rDescriptor, + SwSortOptions & rSortOpt); + + /// @throws css::beans::UnknownPropertyException + /// @throws css::beans::PropertyVetoException + /// @throws css::lang::IllegalArgumentException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void SetPropertyValue( + SwPaM& rPaM, + const SfxItemPropertySet & rPropSet, + const OUString & rPropertyName, + const css::uno::Any & rValue, + const SetAttrMode nAttrMode = SetAttrMode::DEFAULT); + /// @throws css::beans::UnknownPropertyException + /// @throws css::beans::PropertyVetoException + /// @throws css::lang::IllegalArgumentException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void SetPropertyValues( + SwPaM& rPaM, + const SfxItemPropertySet & rPropSet, + const css::uno::Sequence< css::beans::PropertyValue > & + rPropertyValues, + const SetAttrMode nAttrMode = SetAttrMode::DEFAULT); + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + css::uno::Any GetPropertyValue( + SwPaM& rPaM, + const SfxItemPropertySet & rPropSet, + const OUString & rPropertyName); + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + css::uno::Sequence< css::beans::PropertyState > GetPropertyStates( + SwPaM & rPaM, + const SfxItemPropertySet & rPropSet, + const css::uno::Sequence< OUString >& + rPropertyNames, + const SwGetPropertyStatesCaller eCaller = + SW_PROPERTY_STATE_CALLER_DEFAULT); + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + css::beans::PropertyState GetPropertyState( + SwPaM & rPaM, + const SfxItemPropertySet & rPropSet, + const OUString & rPropertyName); + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + void SetPropertyToDefault( + SwPaM & rPaM, + const SfxItemPropertySet & rPropSet, + const OUString & rPropertyName); + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + css::uno::Any GetPropertyDefault( + SwPaM const & rPaM, + const SfxItemPropertySet & rPropSet, + const OUString & rPropertyName); + + bool SetPageDesc( + const css::uno::Any& rValue, + SwDoc & rDoc, SfxItemSet & rSet); + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + void SetTextFormatColl(const css::uno::Any & rAny, SwPaM & rPaM); + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + /// @throws css::uno::DeploymentException + bool SetCursorPropertyValue( + SfxItemPropertySimpleEntry const& rEntry, + css::uno::Any const& rValue, + SwPaM & rPam, SfxItemSet & rItemSet); + + /// try to get something that can be selected out of the XInterface + /// at most one of the out parameters gets assigned a non-null value + /// o_rpPaM is newly allocated and must be deleted; other parameters not + SW_DLLPUBLIC void GetSelectableFromAny( + css::uno::Reference<css::uno::XInterface> const& xIfc, + SwDoc & rTargetDoc, + SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame, + OUString & o_rTableName, SwUnoTableCursor const*& o_rpTableCursor, + ::sw::mark::IMark const*& o_rpMark, + std::vector<SdrObject *> & o_rSdrObjects); + + css::uno::Reference<css::text::XFlatParagraphIterator> + CreateFlatParagraphIterator(SwDoc &, sal_Int32, bool); + +} // namespace SwUnoCursorHelper + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx new file mode 100644 index 000000000..599a3308e --- /dev/null +++ b/sw/inc/unodraw.hxx @@ -0,0 +1,293 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNODRAW_HXX +#define INCLUDED_SW_INC_UNODRAW_HXX + +#include <svl/itemprop.hxx> +#include <svl/listener.hxx> +#include <svx/fmdpage.hxx> +#include "calbck.hxx" +#include "frmfmt.hxx" +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase6.hxx> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/drawing/HomogenMatrix3.hpp> + +class SdrMarkList; +class SdrView; +class SwDoc; +class SwXShape; + +class SwFmDrawPage final : public SvxFmDrawPage +{ + SdrPageView* pPageView; + std::vector<SwXShape*> m_vShapes; +public: + SwFmDrawPage( SdrPage* pPage ); + virtual ~SwFmDrawPage() throw () override; + + const SdrMarkList& PreGroup(const css::uno::Reference< css::drawing::XShapes >& rShapes); + void PreUnGroup(const css::uno::Reference< css::drawing::XShapeGroup >& rShapeGroup); + + SdrView* GetDrawView() {return mpView.get();} + SdrPageView* GetPageView(); + void RemovePageView(); + static css::uno::Reference<css::drawing::XShape> GetShape(SdrObject* pObj); + static css::uno::Reference<css::drawing::XShapeGroup> GetShapeGroup(SdrObject* pObj); + + // The following method is called when a SvxShape-object is to be created. + // Derived classes may obtain at this point a derivation or an object + // that is aggregating a SvxShape. + virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const override; + void RemoveShape(const SwXShape* pShape) + { + auto ppShape = find(m_vShapes.begin(), m_vShapes.end(), pShape); + if(ppShape != m_vShapes.end()) + m_vShapes.erase(ppShape); + }; +}; + +typedef cppu::WeakAggImplHelper4 +< + css::container::XEnumerationAccess, + css::drawing::XDrawPage, + css::lang::XServiceInfo, + css::drawing::XShapeGrouper +> +SwXDrawPageBaseClass; +class SwXDrawPage final : public SwXDrawPageBaseClass +{ + SwDoc* pDoc; + css::uno::Reference< css::uno::XAggregation > xPageAgg; + SwFmDrawPage* pDrawPage; +public: + SwXDrawPage(SwDoc* pDoc); + virtual ~SwXDrawPage() override; + + //XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XShapes + virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > & xShape) override; + virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > & xShape) override; + + //XShapeGrouper + virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group(const css::uno::Reference< css::drawing::XShapes > & xShapes) override; + virtual void SAL_CALL ungroup(const css::uno::Reference< css::drawing::XShapeGroup > & aGroup) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + SwFmDrawPage* GetSvxPage(); + // renamed and outlined to detect where it's called + void InvalidateSwDoc(); // {pDoc = 0;} +}; + +class SwShapeDescriptor_Impl; +typedef +cppu::WeakAggImplHelper6 +< + css::beans::XPropertySet, + css::beans::XPropertyState, + css::text::XTextContent, + css::lang::XServiceInfo, + css::lang::XUnoTunnel, + css::drawing::XShape +> +SwXShapeBaseClass; +class SwXShape : public SwXShapeBaseClass, public SvtListener +{ + friend class SwXGroupShape; + friend class SwXDrawPage; + friend class SwFmDrawPage; + const SwFmDrawPage* m_pPage; + SwFrameFormat* m_pFormat; + + css::uno::Reference< css::uno::XAggregation > xShapeAgg; + // reference to <XShape>, determined in the + // constructor by <queryAggregation> at <xShapeAgg>. + css::uno::Reference< css::drawing::XShape > mxShape; + + const SfxItemPropertySet* m_pPropSet; + const SfxItemPropertyMapEntry* m_pPropertyMapEntries; + + std::unique_ptr<SwShapeDescriptor_Impl> pImpl; + + bool m_bDescriptor; + + SvxShape* GetSvxShape(); + + /** method to determine top group object */ + SdrObject* GetTopGroupObj( SvxShape* _pSvxShape = nullptr ); + + /** method to determine position according to the positioning attributes */ + css::awt::Point GetAttrPosition(); + + /** method to convert the position (translation) of the drawing object to + the layout direction horizontal left-to-right. */ + css::awt::Point ConvertPositionToHoriL2R( + const css::awt::Point& rObjPos, + const css::awt::Size& rObjSize ); + + /** method to convert the transformation of the drawing object to the layout + direction, the drawing object is in + */ + css::drawing::HomogenMatrix3 ConvertTransformationToLayoutDir( + const css::drawing::HomogenMatrix3& rMatrixInHoriL2R ); + + /** method to adjust the positioning properties + + @param _aPosition + input parameter - point representing the new shape position. The position + has to be given in the layout direction the shape is in and relative to + its position alignment areas. + */ + void AdjustPositionProperties(const css::awt::Point& rPosition); + + /** method to convert start or end position of the drawing object to the + Writer specific position, which is the attribute position in layout direction + */ + css::awt::Point ConvertStartOrEndPosToLayoutDir( + const css::awt::Point& aStartOrEndPos ); + + /** method to convert PolyPolygonBezier of the drawing object to the + Writer specific position, which is the attribute position in layout direction + */ + css::drawing::PolyPolygonBezierCoords ConvertPolyPolygonBezierToLayoutDir( + const css::drawing::PolyPolygonBezierCoords& aPath ); + + /** method to get property from aggregation object + + @throws css::beans::UnknownPropertyException + @throws css::lang::WrappedTargetException + @throws css::uno::RuntimeException + */ + css::uno::Any _getPropAtAggrObj( const OUString& _rPropertyName ); + void SetFrameFormat(SwFrameFormat* pFormat) + { + EndListeningAll(); + StartListening(pFormat->GetNotifier()); + m_pFormat = pFormat; + } + +protected: + virtual ~SwXShape() override; +public: + SwXShape(css::uno::Reference<css::uno::XInterface> & xShape, SwDoc const*const pDoc); + + virtual void Notify(const SfxHint&) override; + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + //XTextContent + virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override; + + //XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + virtual css::awt::Point SAL_CALL getPosition( ) override; + virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override; + virtual css::awt::Size SAL_CALL getSize( ) override; + virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override; + virtual OUString SAL_CALL getShapeType( ) override; + + SwShapeDescriptor_Impl* GetDescImpl() {return pImpl.get();} + SwFrameFormat* GetFrameFormat() const { return m_pFormat; } + const css::uno::Reference< css::uno::XAggregation >& GetAggregationInterface() const {return xShapeAgg;} + + // helper + static void AddExistingShapeToFormat( SdrObject const & _rObj ); +}; + +class SwXGroupShape : + public SwXShape, + public css::drawing::XShapes +{ +protected: + virtual ~SwXGroupShape() override; +public: + SwXGroupShape(css::uno::Reference<css::uno::XInterface> & xShape, SwDoc const* pDoc); + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) throw() override; + virtual void SAL_CALL release( ) throw() override; + + //XShapes + virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unofieldcoll.hxx b/sw/inc/unofieldcoll.hxx new file mode 100644 index 000000000..efe3f814e --- /dev/null +++ b/sw/inc/unofieldcoll.hxx @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOFIELDCOLL_HXX +#define INCLUDED_SW_INC_UNOFIELDCOLL_HXX + +#include <memory> + +#include <com/sun/star/util/XRefreshable.hpp> + +#include "unocoll.hxx" + +class SwFieldType; + +typedef ::cppu::WeakImplHelper +< css::container::XNameAccess +, css::lang::XServiceInfo +> SwXTextFieldMasters_Base; + +class SwXTextFieldMasters final + : public SwXTextFieldMasters_Base + , public SwUnoCollection +{ + virtual ~SwXTextFieldMasters() override; + +public: + SwXTextFieldMasters(SwDoc* pDoc); + + static bool getInstanceName(const SwFieldType& rFieldType, OUString& rName); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName( + const OUString& rName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& rName) override; + +}; + +typedef ::cppu::WeakImplHelper +< css::container::XEnumerationAccess +, css::lang::XServiceInfo +, css::util::XRefreshable +> SwXTextFieldTypes_Base; + +class SwXTextFieldTypes final + : public SwXTextFieldTypes_Base + , public SwUnoCollection +{ +private: + class Impl; + std::unique_ptr<Impl> m_pImpl; // currently does not need UnoImplPtr + + virtual ~SwXTextFieldTypes() override; + +public: + SwXTextFieldTypes(SwDoc* pDoc); + + // SwUnoCollection + virtual void Invalidate() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XEnumerationAccess + virtual css::uno::Reference< + css::container::XEnumeration > SAL_CALL + createEnumeration() override; + + // XRefreshable + virtual void SAL_CALL refresh() override; + virtual void SAL_CALL addRefreshListener( + const css::uno::Reference< + css::util::XRefreshListener>& xListener) override; + virtual void SAL_CALL removeRefreshListener( + const css::uno::Reference< + css::util::XRefreshListener>& xListener) override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx new file mode 100644 index 000000000..1b9851e5d --- /dev/null +++ b/sw/inc/unoframe.hxx @@ -0,0 +1,328 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOFRAME_HXX +#define INCLUDED_SW_INC_UNOFRAME_HXX + +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp> +#include <com/sun/star/text/XTextFrame.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> + +#include <cppuhelper/implbase.hxx> +#include <svl/listener.hxx> + +#include "flyenum.hxx" +#include "frmfmt.hxx" +#include "unotext.hxx" + +#include <memory> + +class SdrObject; +class SwDoc; +class SwFormat; +class SfxItemPropertySet; +namespace com::sun::star::frame { class XModel; } + +class BaseFrameProperties_Impl; +class SwXFrame : public cppu::WeakImplHelper +< + css::lang::XServiceInfo, + css::lang::XUnoTunnel, + css::beans::XPropertySet, + css::beans::XPropertyState, + css::drawing::XShape, + css::container::XNamed, + css::text::XTextContent +>, + public SvtListener +{ +private: + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + SwFrameFormat* m_pFrameFormat; + + const SfxItemPropertySet* m_pPropSet; + SwDoc* m_pDoc; + + const FlyCntType eType; + + // Descriptor-interface + std::unique_ptr<BaseFrameProperties_Impl> m_pProps; + bool bIsDescriptor; + OUString m_sName; + + sal_Int64 m_nDrawAspect; + sal_Int64 m_nVisibleAreaWidth; + sal_Int64 m_nVisibleAreaHeight; + css::uno::Reference<css::text::XText> m_xParentText; + void DisposeInternal(); + +protected: + css::uno::Reference< css::beans::XPropertySet > mxStyleData; + css::uno::Reference< css::container::XNameAccess > mxStyleFamily; + virtual void Notify(const SfxHint&) override; + + virtual ~SwXFrame() override; + + SwXFrame(FlyCntType eSet, + const SfxItemPropertySet* pPropSet, + SwDoc *pDoc ); //Descriptor-If + SwXFrame(SwFrameFormat& rFrameFormat, FlyCntType eSet, + const SfxItemPropertySet* pPropSet); + + template<class Interface, class Impl> + static css::uno::Reference<Interface> + CreateXFrame(SwDoc & rDoc, SwFrameFormat *const pFrameFormat); + +public: + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + + //XNamed + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName(const OUString& Name_) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + //XShape + virtual css::awt::Point SAL_CALL getPosition( ) override; + virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override; + virtual css::awt::Size SAL_CALL getSize( ) override; + virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override; + + //XShapeDescriptor + virtual OUString SAL_CALL getShapeType() override; + + //Base implementation + //XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference<css::lang::XEventListener>& xListener) override; + virtual void SAL_CALL removeEventListener(const css::uno::Reference<css::lang::XEventListener>& xListener) override; + + // XTextContent + virtual void SAL_CALL attach(const css::uno::Reference<css::text::XTextRange>& xTextRange) override; + virtual css::uno::Reference<css::text::XTextRange> SAL_CALL getAnchor() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + void attachToRange(css::uno::Reference<css::text::XTextRange> const& xTextRange, + SwPaM const* pCopySource = nullptr); + + const SwFrameFormat* GetFrameFormat() const + { return m_pFrameFormat; } + SwFrameFormat* GetFrameFormat() + { return m_pFrameFormat; } + + FlyCntType GetFlyCntType()const {return eType;} + + bool IsDescriptor() const {return bIsDescriptor;} + void ResetDescriptor(); + //copy text from a given source PaM + static SdrObject *GetOrCreateSdrObject(SwFlyFrameFormat &rFormat); +}; + +typedef cppu::WeakImplHelper +< + css::text::XTextFrame, + css::container::XEnumerationAccess, + css::document::XEventsSupplier +> +SwXTextFrameBaseClass; + +class SwXTextFrame final : public SwXTextFrameBaseClass, + public SwXText, + public SwXFrame +{ + friend class SwXFrame; // just for CreateXFrame + + virtual const SwStartNode *GetStartNode() const override; + + virtual css::uno::Reference< css::text::XTextCursor > + CreateCursor() override; + + virtual ~SwXTextFrame() override; + + SwXTextFrame(SwDoc *pDoc); + SwXTextFrame(SwFrameFormat& rFormat); + +public: + static SW_DLLPUBLIC css::uno::Reference<css::text::XTextFrame> + CreateXTextFrame(SwDoc & rDoc, SwFrameFormat * pFrameFormat); + + // FIXME: EVIL HACK: make available for SwXFrame::attachToRange + using SwXText::SetDoc; + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) throw() override; + virtual void SAL_CALL release( ) throw() override; + + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + //XTextFrame + virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override; + + //XText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; + + //XEnumerationAccess - frueher XParagraphEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XTextContent + virtual void SAL_CALL attach( const css::uno::Reference< css::text::XTextRange >& xTextRange ) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override; + + //XComponent + virtual void SAL_CALL dispose( ) override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XEventsSupplier + virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents( ) override; + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XPropertySet + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; +}; + +typedef cppu::ImplInheritanceHelper +< SwXFrame, + css::document::XEventsSupplier +> +SwXTextGraphicObjectBaseClass; +class SwXTextGraphicObject final : public SwXTextGraphicObjectBaseClass +{ + friend class SwXFrame; // just for CreateXFrame + + virtual ~SwXTextGraphicObject() override; + + SwXTextGraphicObject( SwDoc *pDoc ); + SwXTextGraphicObject(SwFrameFormat& rFormat); + +public: + + static css::uno::Reference<css::text::XTextContent> + CreateXTextGraphicObject(SwDoc & rDoc, SwFrameFormat * pFrameFormat); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XEventsSupplier + virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents( ) override; +}; + +typedef cppu::ImplInheritanceHelper +< SwXFrame, + css::document::XEmbeddedObjectSupplier2, + css::document::XEventsSupplier +> SwXTextEmbeddedObjectBaseClass; + +class SwXTextEmbeddedObject final : public SwXTextEmbeddedObjectBaseClass +{ + css::uno::Reference<css::util::XModifyListener> m_xOLEListener; + + friend class SwXFrame; // just for CreateXFrame + + virtual ~SwXTextEmbeddedObject() override; + + SwXTextEmbeddedObject( SwDoc *pDoc ); + SwXTextEmbeddedObject(SwFrameFormat& rFormat); + +public: + + static css::uno::Reference<css::text::XTextContent> + CreateXTextEmbeddedObject(SwDoc & rDoc, SwFrameFormat * pFrameFormat); + + //XEmbeddedObjectSupplier2 + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getEmbeddedObject() override; + virtual css::uno::Reference< css::embed::XEmbeddedObject > SAL_CALL getExtendedControlOverEmbeddedObject() override; + virtual ::sal_Int64 SAL_CALL getAspect() override; + virtual void SAL_CALL setAspect( ::sal_Int64 _aspect ) override; + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getReplacementGraphic() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XEventsSupplier + virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents( ) override; +}; + +class SwXOLEListener final : public cppu::WeakImplHelper<css::util::XModifyListener>, public SvtListener +{ + SwFormat* m_pOLEFormat; + css::uno::Reference<css::frame::XModel> m_xOLEModel; + +public: + SwXOLEListener(SwFormat& rOLEFormat, css::uno::Reference< css::frame::XModel > const & xOLE); + virtual ~SwXOLEListener() override; + +// css::lang::XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + +// css::util::XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + virtual void Notify( const SfxHint& ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoidxcoll.hxx b/sw/inc/unoidxcoll.hxx new file mode 100644 index 000000000..b1bbe1724 --- /dev/null +++ b/sw/inc/unoidxcoll.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOIDXCOLL_HXX +#define INCLUDED_SW_INC_UNOIDXCOLL_HXX + +#include "unocoll.hxx" + +class SwXDocumentIndexes final + : public SwCollectionBaseClass + , public SwUnoCollection +{ + +private: + + virtual ~SwXDocumentIndexes() override; + +public: + + SwXDocumentIndexes(SwDoc *const pDoc); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName( + const OUString& rName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& rName) override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx new file mode 100644 index 000000000..caee6bc5c --- /dev/null +++ b/sw/inc/unomap.hxx @@ -0,0 +1,370 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOMAP_HXX +#define INCLUDED_SW_INC_UNOMAP_HXX + +#include <sal/types.h> + +class SfxItemPropertySet; +struct SfxItemPropertyMapEntry; + +#define PROPERTY_MAP_TEXT_CURSOR 0 +#define PROPERTY_MAP_CHAR_STYLE 1 +#define PROPERTY_MAP_PARA_STYLE 2 +#define PROPERTY_MAP_FRAME_STYLE 3 +#define PROPERTY_MAP_PAGE_STYLE 4 +#define PROPERTY_MAP_NUM_STYLE 5 +#define PROPERTY_MAP_SECTION 6 +#define PROPERTY_MAP_TEXT_TABLE 7 +#define PROPERTY_MAP_TABLE_CELL 8 +#define PROPERTY_MAP_TABLE_RANGE 9 +#define PROPERTY_MAP_TEXT_SEARCH 10 +#define PROPERTY_MAP_TEXT_FRAME 11 +#define PROPERTY_MAP_TEXT_GRAPHIC 12 +#define PROPERTY_MAP_TEXT_SHAPE 13 +#define PROPERTY_MAP_INDEX_USER 14 +#define PROPERTY_MAP_INDEX_CNTNT 15 +#define PROPERTY_MAP_INDEX_IDX 16 +#define PROPERTY_MAP_USER_MARK 17 +#define PROPERTY_MAP_CNTIDX_MARK 18 +#define PROPERTY_MAP_INDEX_MARK 19 +#define PROPERTY_MAP_TEXT_TABLE_ROW 20 +#define PROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR 21 +#define PROPERTY_MAP_TEXT_TABLE_CURSOR 22 +#define PROPERTY_MAP_BOOKMARK 23 +#define PROPERTY_MAP_PARAGRAPH_EXTENSIONS 24 +#define PROPERTY_MAP_INDEX_ILLUSTRATIONS 25 +#define PROPERTY_MAP_INDEX_OBJECTS 26 +#define PROPERTY_MAP_INDEX_TABLES 27 +#define PROPERTY_MAP_BIBLIOGRAPHY 28 +#define PROPERTY_MAP_TEXT_DOCUMENT 29 +#define PROPERTY_MAP_LINK_TARGET 30 +#define PROPERTY_MAP_AUTO_TEXT_GROUP 31 +#define PROPERTY_MAP_TEXTPORTION_EXTENSIONS 34 +#define PROPERTY_MAP_FOOTNOTE 35 +#define PROPERTY_MAP_TEXT_COLUMS 36 +#define PROPERTY_MAP_PARAGRAPH 37 +#define PROPERTY_MAP_EMBEDDED_OBJECT 38 +#define PROPERTY_MAP_REDLINE 39 +#define PROPERTY_MAP_TEXT_DEFAULT 40 + +#define PROPERTY_MAP_FLDTYP_DATETIME 41 +#define PROPERTY_MAP_FLDTYP_USER 42 +#define PROPERTY_MAP_FLDTYP_SET_EXP 43 +#define PROPERTY_MAP_FLDTYP_GET_EXP 44 +#define PROPERTY_MAP_FLDTYP_FILE_NAME 45 +#define PROPERTY_MAP_FLDTYP_PAGE_NUM 46 +#define PROPERTY_MAP_FLDTYP_AUTHOR 47 +#define PROPERTY_MAP_FLDTYP_CHAPTER 48 +#define PROPERTY_MAP_FLDTYP_GET_REFERENCE 49 +#define PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT 50 +#define PROPERTY_MAP_FLDTYP_HIDDEN_TEXT 51 +#define PROPERTY_MAP_FLDTYP_ANNOTATION 52 +#define PROPERTY_MAP_FLDTYP_INPUT 53 +#define PROPERTY_MAP_FLDTYP_MACRO 54 +#define PROPERTY_MAP_FLDTYP_DDE 55 +#define PROPERTY_MAP_FLDTYP_HIDDEN_PARA 56 +#define PROPERTY_MAP_FLDTYP_DOC_INFO 57 +#define PROPERTY_MAP_FLDTYP_TEMPLATE_NAME 58 +#define PROPERTY_MAP_FLDTYP_USER_EXT 59 +#define PROPERTY_MAP_FLDTYP_REF_PAGE_SET 60 +#define PROPERTY_MAP_FLDTYP_REF_PAGE_GET 61 +#define PROPERTY_MAP_FLDTYP_JUMP_EDIT 62 +#define PROPERTY_MAP_FLDTYP_SCRIPT 63 +#define PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET 64 +#define PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET 65 +#define PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM 66 +#define PROPERTY_MAP_FLDTYP_DATABASE 67 +#define PROPERTY_MAP_FLDTYP_DATABASE_NAME 68 +#define PROPERTY_MAP_FLDTYP_DOCSTAT 69 +#define PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR 70 +#define PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME 71 +#define PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME 72 +#define PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME 73 +#define PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME 74 +#define PROPERTY_MAP_FLDTYP_DOCINFO_MISC 75 +#define PROPERTY_MAP_FLDTYP_DOCINFO_REVISION 76 +#define PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS 77 +#define PROPERTY_MAP_FLDTYP_DUMMY_0 78 +#define PROPERTY_MAP_FLDTYP_TABLE_FORMULA 79 +#define PROPERTY_MAP_FLDMSTR_USER 80 +#define PROPERTY_MAP_FLDMSTR_DDE 81 +#define PROPERTY_MAP_FLDMSTR_SET_EXP 82 +#define PROPERTY_MAP_FLDMSTR_DATABASE 83 +#define PROPERTY_MAP_FLDMSTR_DUMMY0 84 +#define PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY 85 +#define PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY 86 +#define PROPERTY_MAP_TEXT 87 +#define PROPERTY_MAP_REDLINE_PORTION 88 +#define PROPERTY_MAP_MAILMERGE 89 +#define PROPERTY_MAP_FLDTYP_DROPDOWN 90 +#define PROPERTY_MAP_CHART2_DATA_SEQUENCE 91 +#define PROPERTY_MAP_TEXT_VIEW 92 +#define PROPERTY_MAP_CONDITIONAL_PARA_STYLE 93 +#define PROPERTY_MAP_CHAR_AUTO_STYLE 94 +#define PROPERTY_MAP_RUBY_AUTO_STYLE 95 +#define PROPERTY_MAP_PARA_AUTO_STYLE 96 +#define PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM 97 +#define PROPERTY_MAP_METAFIELD 98 +#define PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE 99 +#define PROPERTY_MAP_TABLE_STYLE 100 +#define PROPERTY_MAP_CELL_STYLE 101 +#define PROPERTY_MAP_END 102 + +//S&E +#define WID_WORDS 0 +#define WID_BACKWARDS 1 +#define WID_REGULAR_EXPRESSION 2 +#define WID_CASE_SENSITIVE 3 +#define WID_IN_SELECTION 4 +#define WID_STYLES 5 +#define WID_SIMILARITY 6 +#define WID_SIMILARITY_RELAX 7 +#define WID_SIMILARITY_EXCHANGE 8 +#define WID_SIMILARITY_ADD 9 +#define WID_SIMILARITY_REMOVE 10 +#define WID_SEARCH_ALL 11 + +//Sections +#define WID_SECT_CONDITION 8000 +#define WID_SECT_DDE_TYPE 8001 +#define WID_SECT_DDE_FILE 8002 +#define WID_SECT_DDE_ELEMENT 8003 +#define WID_SECT_LINK 8004 +#define WID_SECT_VISIBLE 8005 +#define WID_SECT_PROTECTED 8006 +#define WID_SECT_REGION 8007 +#define WID_SECT_DDE_AUTOUPDATE 8008 +#define WID_SECT_DOCUMENT_INDEX 8009 +#define WID_SECT_IS_GLOBAL_DOC_SECTION 8010 +#define WID_SECT_PASSWORD 8011 +#define WID_SECT_CURRENTLY_VISIBLE 8012 +#define WID_SECT_EDIT_IN_READONLY 8013 + +// Indices/Tables of content +#define WID_PRIMARY_KEY 1000 +#define WID_SECONDARY_KEY 1001 +#define WID_ALT_TEXT 1002 +#define WID_IDX_TITLE 1003 +#define WID_LEVEL 1004 +#define WID_CREATE_FROM_MARKS 1005 +#define WID_CREATE_FROM_OUTLINE 1006 +#define WID_MAIN_ENTRY 1007 +#define WID_CREATE_FROM_CHAPTER 1008 +#define WID_CREATE_FROM_LABELS 1009 +#define WID_USE_ALPHABETICAL_SEPARATORS 1010 +#define WID_USE_KEY_AS_ENTRY 1011 +#define WID_USE_COMBINED_ENTRIES 1012 +#define WID_IS_CASE_SENSITIVE 1013 +#define WID_USE_P_P 1014 +#define WID_USE_DASH 1015 +#define WID_USE_UPPER_CASE 1016 +#define WID_LABEL_CATEGORY 1018 +#define WID_LABEL_DISPLAY_TYPE 1019 +#define WID_USE_LEVEL_FROM_SOURCE 1020 +#define WID_LEVEL_FORMAT 1021 +#define WID_LEVEL_PARAGRAPH_STYLES 1022 +#define WID_HIDE_TABLEADER_PAGENUMBERS 1023 +#define WID_TAB_IN_TOC 1024 +#define WID_MAIN_ENTRY_CHARACTER_STYLE_NAME 1025 +#define WID_CREATE_FROM_TABLES 1026 +#define WID_CREATE_FROM_TEXT_FRAMES 1027 +#define WID_CREATE_FROM_GRAPHIC_OBJECTS 1028 +#define WID_CREATE_FROM_EMBEDDED_OBJECTS 1029 +#define WID_CREATE_FROM_STAR_MATH 1030 +#define WID_PROTECTED 1031 + +#define WID_CREATE_FROM_STAR_CHART 1032 +#define WID_CREATE_FROM_STAR_CALC 1033 +#define WID_CREATE_FROM_STAR_DRAW 1034 +#define WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS 1035 +#define WID_USER_IDX_NAME 1036 +#define WID_PARA_HEAD 1037 +#define WID_PARA_SEP 1038 +#define WID_PARA_LEV1 1039 +#define WID_PARA_LEV2 1040 +#define WID_PARA_LEV3 1041 +#define WID_PARA_LEV4 1042 +#define WID_PARA_LEV5 1043 +#define WID_PARA_LEV6 1044 +#define WID_PARA_LEV7 1045 +#define WID_PARA_LEV8 1046 +#define WID_PARA_LEV9 1047 +#define WID_PARA_LEV10 1048 +#define WID_IS_COMMA_SEPARATED 1049 +#define WID_INDEX_MARKS 1050 +#define WID_IS_RELATIVE_TABSTOPS 1051 +#define WID_CREATE_FROM_PARAGRAPH_STYLES 1052 +#define WID_IDX_CONTENT_SECTION 1053 +#define WID_IDX_HEADER_SECTION 1054 +#define WID_IDX_LOCALE 1055 +#define WID_IDX_SORT_ALGORITHM 1056 +#define WID_IDX_NAME 1057 + +#define WID_TEXT_READING 1058 +#define WID_PRIMARY_KEY_READING 1059 +#define WID_SECONDARY_KEY_READING 1060 +#define WID_TOC_BOOKMARK 1061 +#define WID_TOC_NEWLINE 1062 +#define WID_TOC_PARAGRAPH_OUTLINE_LEVEL 1063 +#define WID_INDEX_ENTRY_TYPE 1064 + +// Text document +#define WID_DOC_CHAR_COUNT 1000 +#define WID_DOC_PARA_COUNT 1001 +#define WID_DOC_WORD_COUNT 1002 +#define WID_DOC_WORD_SEPARATOR 1003 +#define WID_DOC_CHANGES_SHOW 1004 +#define WID_DOC_CHANGES_RECORD 1005 +#define WID_DOC_AUTO_MARK_URL 1006 +#define WID_DOC_HIDE_TIPS 1007 +#define WID_DOC_REDLINE_DISPLAY 1008 +#define WID_DOC_FORBIDDEN_CHARS 1009 +#define WID_DOC_CHANGES_PASSWORD 1010 +#define WID_DOC_TWO_DIGIT_YEAR 1011 +#define WID_DOC_AUTOMATIC_CONTROL_FOCUS 1012 +#define WID_DOC_APPLY_FORM_DESIGN_MODE 1013 +#define WID_DOC_BASIC_LIBRARIES 1014 +#define WID_DOC_RUNTIME_UID 1015 +#define WID_DOC_LOCK_UPDATES 1016 +#define WID_DOC_HAS_VALID_SIGNATURES 1017 +#define WID_DOC_INTEROP_GRAB_BAG 1018 +#define WID_DOC_WRITERFILTER 1019 +#define WID_DOC_BUILDID 1024 +#define WID_DOC_ISTEMPLATEID 1025 +#define WID_DOC_DEFAULT_PAGE_MODE 1069 + +// MailMerge +#define WID_SELECTION 1071 +#define WID_RESULT_SET 1072 +#define WID_CONNECTION 1073 +#define WID_MODEL 1074 +#define WID_DATA_SOURCE_NAME 1075 +#define WID_DATA_COMMAND 1076 +#define WID_FILTER 1077 +#define WID_DOCUMENT_URL 1078 +#define WID_OUTPUT_URL 1079 +#define WID_DATA_COMMAND_TYPE 1080 +#define WID_OUTPUT_TYPE 1081 +#define WID_ESCAPE_PROCESSING 1082 +#define WID_SINGLE_PRINT_JOBS 1083 +#define WID_FILE_NAME_FROM_COLUMN 1084 +#define WID_FILE_NAME_PREFIX 1085 +#define WID_MAIL_SUBJECT 1086 +#define WID_ADDRESS_FROM_COLUMN 1087 +#define WID_SEND_AS_HTML 1088 +#define WID_SEND_AS_ATTACHMENT 1089 +#define WID_MAIL_BODY 1090 +#define WID_ATTACHMENT_NAME 1091 +#define WID_ATTACHMENT_FILTER 1092 +#define WID_PRINT_OPTIONS 1093 +#define WID_SAVE_AS_SINGLE_FILE 1094 +#define WID_SAVE_FILTER 1095 +#define WID_COPIES_TO 1096 +#define WID_BLIND_COPIES_TO 1097 +#define WID_IN_SERVER_PASSWORD 1098 +#define WID_OUT_SERVER_PASSWORD 1099 +#define WID_SAVE_FILTER_OPTIONS 1100 +#define WID_SAVE_FILTER_DATA 1101 + +#define WID_PAGE_COUNT 1100 +#define WID_LINE_COUNT 1101 +#define WID_IS_CONSTANT_SPELLCHECK 1102 +#define WID_IS_HIDE_SPELL_MARKS 1103 /* deprecated #i91949 */ + +#define WID_LAYOUT_SIZE 1104 +#define WID_DOC_DIALOG_LIBRARIES 1105 +#define WID_DOC_VBA_DOCOBJ 1106 + +// AutoText +#define WID_GROUP_PATH 0 +#define WID_GROUP_TITLE 1 + +// NumberingRules +#define WID_IS_AUTOMATIC 0 +#define WID_CONTINUOUS 1 +#define WID_RULE_NAME 2 +#define WID_IS_ABS_MARGINS 3 +#define WID_IS_OUTLINE 4 +#define WID_DEFAULT_LIST_ID 5 + +// TextColumns +#define WID_TXTCOL_LINE_WIDTH 0 +#define WID_TXTCOL_LINE_COLOR 1 +#define WID_TXTCOL_LINE_REL_HGT 2 +#define WID_TXTCOL_LINE_ALIGN 3 +#define WID_TXTCOL_LINE_IS_ON 4 +#define WID_TXTCOL_IS_AUTOMATIC 5 +#define WID_TXTCOL_AUTO_DISTANCE 6 +#define WID_TXTCOL_LINE_STYLE 7 + +// This define would need the include of <svx/unoshprp.hxx>, but this ends +// in a mess; there *are* double used symbols which are used in a #define in +// editengine and as an enum in sw; these will then collide and lead to severe +// problems which will be hard to detect at all (e.g. look for UNO_NAME_CHAR_COLOR). +// More of these are likely, so better use a local define here, but at least the same +// as in svx/inc/unoshprp.hxx +#define OWN_ATTR_FILLBMP_MODE (OWN_ATTR_VALUE_START+45) + +class SwUnoPropertyMapProvider +{ + SfxItemPropertyMapEntry const * m_aMapEntriesArr[PROPERTY_MAP_END]; + SfxItemPropertySet* m_aPropertySetArr[PROPERTY_MAP_END]; + +public: + SwUnoPropertyMapProvider(); + ~SwUnoPropertyMapProvider(); + + const SfxItemPropertyMapEntry* GetPropertyMapEntries(sal_uInt16 PropertyId); + const SfxItemPropertySet* GetPropertySet( sal_uInt16 PropertyId ); + +private: + static const SfxItemPropertyMapEntry* GetTextCursorPropertyMap(); + static const SfxItemPropertyMapEntry* GetAccessibilityTextAttrPropertyMap(); + static const SfxItemPropertyMapEntry* GetParagraphPropertyMap(); + static const SfxItemPropertyMapEntry* GetAutoParaStylePropertyMap(); + static const SfxItemPropertyMapEntry* GetCharStylePropertyMap(); + static const SfxItemPropertyMapEntry* GetAutoCharStylePropertyMap(); + static const SfxItemPropertyMapEntry* GetParaStylePropertyMap(); + static const SfxItemPropertyMapEntry* GetConditionalParaStylePropertyMap(); + static const SfxItemPropertyMapEntry* GetFrameStylePropertyMap(); + static const SfxItemPropertyMapEntry* GetPageStylePropertyMap(); + static const SfxItemPropertyMapEntry* GetTablePropertyMap(); + static const SfxItemPropertyMapEntry* GetRangePropertyMap(); + static const SfxItemPropertyMapEntry* GetSectionPropertyMap(); + static const SfxItemPropertyMapEntry* GetFramePropertyMap(); + static const SfxItemPropertyMapEntry* GetGraphicPropertyMap(); + static const SfxItemPropertyMapEntry* GetEmbeddedPropertyMap(); + static const SfxItemPropertyMapEntry* GetIndexMarkPropertyMap(); + static const SfxItemPropertyMapEntry* GetContentMarkPropertyMap(); + static const SfxItemPropertyMapEntry* GetUserMarkPropertyMap(); + static const SfxItemPropertyMapEntry* GetTextTableCursorPropertyMap(); + static const SfxItemPropertyMapEntry* GetBookmarkPropertyMap(); + static const SfxItemPropertyMapEntry* GetParagraphExtensionsPropertyMap(); + static const SfxItemPropertyMapEntry* GetTextPortionExtensionPropertyMap(); + static const SfxItemPropertyMapEntry* GetFootnotePropertyMap(); + static const SfxItemPropertyMapEntry* GetRedlinePropertyMap(); + static const SfxItemPropertyMapEntry* GetRedlinePortionPropertyMap(); + static SfxItemPropertyMapEntry* GetTextDefaultPropertyMap(); +}; + +extern SwUnoPropertyMapProvider aSwMapProvider; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unomid.h b/sw/inc/unomid.h new file mode 100644 index 000000000..d249b32fc --- /dev/null +++ b/sw/inc/unomid.h @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOMID_H +#define INCLUDED_SW_INC_UNOMID_H + +#define MID_MIRROR_VERT 0 +#define MID_MIRROR_HORZ_EVEN_PAGES 1 +#define MID_MIRROR_HORZ_ODD_PAGES 2 + +#define MID_PAGEDESC_PAGEDESCNAME 0 +#define MID_PAGEDESC_PAGENUMOFFSET 1 + +#define MID_SURROUND_SURROUNDTYPE 0 +#define MID_SURROUND_ANCHORONLY 1 +#define MID_SURROUND_CONTOUR 2 +#define MID_SURROUND_CONTOUROUTSIDE 3 + +#define MID_VERTORIENT_ORIENT 0 +#define MID_VERTORIENT_RELATION 1 +#define MID_VERTORIENT_POSITION 2 + +#define MID_HORIORIENT_ORIENT 0 +#define MID_HORIORIENT_RELATION 1 +#define MID_HORIORIENT_POSITION 2 +#define MID_HORIORIENT_PAGETOGGLE 3 + +#define MID_ANCHOR_ANCHORTYPE 0 +#define MID_ANCHOR_PAGENUM 1 +#define MID_ANCHOR_ANCHORFRAME 2 + +#define MID_URL_HYPERLINKNAME 1 +#define MID_URL_CLIENTMAP 2 +#define MID_URL_SERVERMAP 3 +#define MID_URL_URL 4 +#define MID_URL_TARGET 5 +#define MID_URL_VISITED_FMT 6 +#define MID_URL_UNVISITED_FMT 7 +#define MID_URL_HYPERLINKEVENTS 8 + +#define MID_CHAIN_PREVNAME 0 +#define MID_CHAIN_NEXTNAME 1 +#define MID_CHAIN_NAME 2 + +#define MID_LINENUMBER_COUNT 0 +#define MID_LINENUMBER_STARTVALUE 1 + +#define MID_DROPCAP_FORMAT 0 +#define MID_DROPCAP_WHOLE_WORD 1 +#define MID_DROPCAP_CHAR_STYLE_NAME 2 +#define MID_DROPCAP_LINES 3 +#define MID_DROPCAP_COUNT 4 +#define MID_DROPCAP_DISTANCE 5 + +#define MID_FRMSIZE_SIZE 0 +#define MID_FRMSIZE_REL_HEIGHT 1 +#define MID_FRMSIZE_REL_WIDTH 2 + +#define MID_FRMSIZE_WIDTH 4 +#define MID_FRMSIZE_HEIGHT 5 +#define MID_FRMSIZE_SIZE_TYPE 6 +#define MID_FRMSIZE_IS_AUTO_HEIGHT 7 +/* XML only */ +#define MID_FRMSIZE_MIN_HEIGHT 8 +#define MID_FRMSIZE_FIX_HEIGHT 9 +#define MID_FRMSIZE_COL_WIDTH 10 +#define MID_FRMSIZE_REL_COL_WIDTH 11 +/* UNO */ +#define MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT 12 +#define MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH 13 +#define MID_FRMSIZE_WIDTH_TYPE 14 +#define MID_FRMSIZE_REL_WIDTH_RELATION 15 +#define MID_FRMSIZE_REL_HEIGHT_RELATION 16 + +#define MID_COLUMNS 0 +#define MID_COLUMN_SEPARATOR_LINE 1 + +//SwFormatFootnoteAtTextEnd +#define MID_COLLECT 0 +#define MID_RESTART_NUM 1 +#define MID_NUM_START_AT 2 +#define MID_OWN_NUM 3 +#define MID_NUM_TYPE 4 +#define MID_PREFIX 5 +#define MID_SUFFIX 6 + +//page style footnote +#define MID_FTN_HEIGHT 0 +#define MID_LINE_WEIGHT 1 +#define MID_LINE_COLOR 2 +#define MID_LINE_RELWIDTH 3 +#define MID_LINE_ADJUST 4 +#define MID_LINE_TEXT_DIST 5 +#define MID_LINE_FOOTNOTE_DIST 6 +#define MID_FTN_LINE_STYLE 7 + +//SwFormatRuby +#define MID_RUBY_TEXT 0 +#define MID_RUBY_ADJUST 1 +#define MID_RUBY_CHARSTYLE 2 +#define MID_RUBY_ABOVE 3 +#define MID_RUBY_POSITION 4 + +//SwTextGridItem +#define MID_GRID_COLOR 0 +#define MID_GRID_LINES 1 +#define MID_GRID_BASEHEIGHT 2 +#define MID_GRID_RUBYHEIGHT 3 +#define MID_GRID_TYPE 4 +#define MID_GRID_RUBY_BELOW 5 +#define MID_GRID_PRINT 6 +#define MID_GRID_DISPLAY 7 +#define MID_GRID_BASEWIDTH 8 +#define MID_GRID_SNAPTOCHARS 9 +#define MID_GRID_STANDARD_MODE 10 + +//SwEnvItem +#define MID_ENV_ADDR_TEXT 1 +#define MID_ENV_SEND 2 +#define MID_SEND_TEXT 3 +#define MID_ENV_ADDR_FROM_LEFT 4 +#define MID_ENV_ADDR_FROM_TOP 5 +#define MID_ENV_SEND_FROM_LEFT 6 +#define MID_ENV_SEND_FROM_TOP 7 +#define MID_ENV_WIDTH 8 +#define MID_ENV_HEIGHT 9 +#define MID_ENV_ALIGN 10 +#define MID_ENV_PRINT_FROM_ABOVE 11 +#define MID_ENV_SHIFT_RIGHT 12 +#define MID_ENV_SHIFT_DOWN 13 + +// SwFormatWrapInfluenceOnObjPos +#define MID_WRAP_INFLUENCE 0 +#define MID_ALLOW_OVERLAP 1 + +// SwFormatFollowTextFlow +#define MID_FOLLOW_TEXT_FLOW 0 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoparagraph.hxx b/sw/inc/unoparagraph.hxx new file mode 100644 index 000000000..64a8defd8 --- /dev/null +++ b/sw/inc/unoparagraph.hxx @@ -0,0 +1,225 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOPARAGRAPH_HXX +#define INCLUDED_SW_INC_UNOPARAGRAPH_HXX + +#include <memory> + +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XTextRange.hpp> + +#include <cppuhelper/implbase.hxx> + +#include <sfx2/Metadatable.hxx> + +#include "unobaseclass.hxx" + +class SwPaM; +class SwUnoCursor; +class SwStartNode; +class SwTextNode; +class SwTable; +class SwXText; + +typedef ::cppu::ImplInheritanceHelper +< ::sfx2::MetadatableMixin +, css::lang::XUnoTunnel +, css::lang::XServiceInfo +, css::beans::XPropertySet +, css::beans::XPropertyState +, css::beans::XMultiPropertySet +, css::beans::XTolerantMultiPropertySet +, css::container::XEnumerationAccess +, css::container::XContentEnumerationAccess +, css::text::XTextContent +, css::text::XTextRange +> SwXParagraph_Base; + +class SwXParagraph final + : public SwXParagraph_Base +{ + +private: + + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + virtual ~SwXParagraph() override; + + SwXParagraph(css::uno::Reference< css::text::XText > const & xParent, + SwTextNode & rTextNode, + const sal_Int32 nSelStart, const sal_Int32 nSelEnd); + + /// descriptor + SwXParagraph(); + +public: + + static css::uno::Reference<css::text::XTextContent> + CreateXParagraph(SwDoc & rDoc, SwTextNode * pTextNode, + css::uno::Reference< css::text::XText> + const& xParentText = nullptr, + const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1); + + const SwTextNode * GetTextNode() const; + bool IsDescriptor() const; + /// make rPaM select the paragraph + bool SelectPaM(SwPaM & rPaM); + /// for SwXText + void attachToText(SwXText & rParent, SwTextNode & rTextNode); + + // MetadatableMixin + virtual ::sfx2::Metadatable* GetCoreObject() override; + virtual css::uno::Reference< css::frame::XModel > + GetModel() override; + + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( + const css::uno::Sequence< sal_Int8 >& rIdentifier) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener( + const css::uno::Reference< css::lang::XEventListener > & xListener) override; + virtual void SAL_CALL removeEventListener( + const css::uno::Reference< css::lang::XEventListener > & xListener) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue( + const OUString& rPropertyName, + const css::uno::Any& rValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue( + const OUString& rPropertyName) override; + virtual void SAL_CALL addPropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL removePropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL addVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; + virtual void SAL_CALL removeVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; + + // XPropertyState + virtual css::beans::PropertyState SAL_CALL + getPropertyState(const OUString& rPropertyName) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL + getPropertyStates( + const css::uno::Sequence< OUString >& rPropertyNames) override; + virtual void SAL_CALL setPropertyToDefault( + const OUString& rPropertyName) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( + const OUString& rPropertyName) override; + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( + const css::uno::Sequence< OUString >& rPropertyNames, + const css::uno::Sequence< css::uno::Any >& rValues) override; + virtual css::uno::Sequence< css::uno::Any > + SAL_CALL getPropertyValues( + const css::uno::Sequence< OUString >& rPropertyNames) override; + virtual void SAL_CALL addPropertiesChangeListener( + const css::uno::Sequence< OUString >& rPropertyNames, + const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override; + virtual void SAL_CALL removePropertiesChangeListener( + const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override; + virtual void SAL_CALL firePropertiesChangeEvent( + const css::uno::Sequence< OUString >& rPropertyNames, + const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override; + + // XTolerantMultiPropertySet + virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL + setPropertyValuesTolerant( + const css::uno::Sequence< OUString >& rPropertyNames, + const css::uno::Sequence< css::uno::Any >& rValues) override; + virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL + getPropertyValuesTolerant( + const css::uno::Sequence< OUString >& rPropertyNames) override; + virtual css::uno::Sequence< + css::beans::GetDirectPropertyTolerantResult > SAL_CALL + getDirectPropertyValuesTolerant( + const css::uno::Sequence< OUString >& rPropertyNames) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createEnumeration() override; + + // XContentEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createContentEnumeration(const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getAvailableServiceNames() override; + + // XTextContent + virtual void SAL_CALL attach( + const css::uno::Reference< css::text::XTextRange > & xTextRange) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override; + + // XTextRange + virtual css::uno::Reference< css::text::XText > + SAL_CALL getText() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString(const OUString& rString) override; + +}; + + +struct SwXParagraphEnumeration + : public SwSimpleEnumeration_Base +{ + static SwXParagraphEnumeration* Create( + css::uno::Reference< css::text::XText > const & xParent, + const std::shared_ptr<SwUnoCursor>& pCursor, + const CursorType eType, + SwStartNode const*const pStartNode = nullptr, + SwTable const*const pTable = nullptr); +}; + +#endif // INCLUDED_SW_INC_UNOPARAGRAPH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx new file mode 100644 index 000000000..1f79400bb --- /dev/null +++ b/sw/inc/unoprnms.hxx @@ -0,0 +1,866 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOPRNMS_HXX +#define INCLUDED_SW_INC_UNOPRNMS_HXX + +#include <sal/config.h> + +#define UNO_NAME_FOLLOW_STYLE "FollowStyle" +#define UNO_NAME_IS_PHYSICAL "IsPhysical" +#define UNO_NAME_IS_AUTO_UPDATE "IsAutoUpdate" +#define UNO_NAME_DISPLAY_NAME "DisplayName" +#define UNO_NAME_PARA_GRAPHIC "ParaBackGraphic" +#define UNO_NAME_PARA_GRAPHIC_URL "ParaBackGraphicURL" +#define UNO_NAME_PARA_GRAPHIC_FILTER "ParaBackGraphicFilter" +#define UNO_NAME_HEADER_GRAPHIC "HeaderBackGraphic" +#define UNO_NAME_HEADER_GRAPHIC_URL "HeaderBackGraphicURL" +#define UNO_NAME_HEADER_GRAPHIC_FILTER "HeaderBackGraphicFilter" +#define UNO_NAME_FOOTER_GRAPHIC "FooterBackGraphic" +#define UNO_NAME_FOOTER_GRAPHIC_URL "FooterBackGraphicURL" +#define UNO_NAME_FOOTER_GRAPHIC_FILTER "FooterBackGraphicFilter" +#define UNO_NAME_BACK_GRAPHIC_URL "BackGraphicURL" +#define UNO_NAME_BACK_GRAPHIC "BackGraphic" +#define UNO_NAME_BACK_GRAPHIC_FILTER "BackGraphicFilter" +#define UNO_NAME_BACK_GRAPHIC_LOCATION "BackGraphicLocation" +#define UNO_NAME_GRAPHIC_FILTER "GraphicFilter" +#define UNO_NAME_GRAPHIC_SIZE "GraphicSize" +#define UNO_NAME_GRAPHIC_BITMAP "GraphicBitmap" +#define UNO_NAME_GRAPHIC_URL "GraphicURL" +#define UNO_NAME_BULLET_ID "BulletId" +#define UNO_NAME_BULLET_CHAR "BulletChar" +#define UNO_NAME_BULLET_REL_SIZE "BulletRelSize" +#define UNO_NAME_BULLET_FONT "BulletFont" +#define UNO_NAME_BULLET_FONT_NAME "BulletFontName" +#define UNO_NAME_BULLET_COLOR "BulletColor" +#define UNO_NAME_PARA_GRAPHIC_LOCATION "ParaBackGraphicLocation" +#define UNO_NAME_HEADER_GRAPHIC_LOCATION "HeaderBackGraphicLocation" +#define UNO_NAME_FOOTER_GRAPHIC_LOCATION "FooterBackGraphicLocation" +#define UNO_NAME_PARA_LEFT_MARGIN "ParaLeftMargin" +#define UNO_NAME_PARA_RIGHT_MARGIN "ParaRightMargin" +#define UNO_NAME_PARA_LEFT_MARGIN_RELATIVE "ParaLeftMarginRelative" +#define UNO_NAME_PARA_RIGHT_MARGIN_RELATIVE "ParaRightMarginRelative" +#define UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT "ParaIsAutoFirstLineIndent" +#define UNO_NAME_PARA_FIRST_LINE_INDENT "ParaFirstLineIndent" +#define UNO_NAME_PARA_FIRST_LINE_INDENT_RELATIVE "ParaFirstLineIndentRelative" +#define UNO_NAME_PARA_IS_HYPHENATION "ParaIsHyphenation" +#define UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS "ParaHyphenationMaxLeadingChars" +#define UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS "ParaHyphenationMaxTrailingChars" +#define UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS "ParaHyphenationMaxHyphens" +#define UNO_NAME_PARA_HYPHENATION_NO_CAPS "ParaHyphenationNoCaps" +#define UNO_NAME_LEFT_MARGIN "LeftMargin" +#define UNO_NAME_RIGHT_MARGIN "RightMargin" +#define UNO_NAME_HEADER_LEFT_MARGIN "HeaderLeftMargin" +#define UNO_NAME_HEADER_RIGHT_MARGIN "HeaderRightMargin" +#define UNO_NAME_FOOTER_LEFT_MARGIN "FooterLeftMargin" +#define UNO_NAME_FOOTER_RIGHT_MARGIN "FooterRightMargin" +#define UNO_NAME_TEXT_RANGE "TextRange" +#define UNO_NAME_TEXT_BOX "TextBox" +#define UNO_NAME_NAME "Name" +#define UNO_NAME_CHAR_STYLE_NAME "CharStyleName" +#define UNO_NAME_ANCHOR_CHAR_STYLE_NAME "AnchorCharStyleName" +#define UNO_NAME_SUFFIX "Suffix" +#define UNO_NAME_PREFIX "Prefix" +#define UNO_NAME_LIST_FORMAT "ListFormat" +#define UNO_NAME_PARENT_NUMBERING "ParentNumbering" +#define UNO_NAME_CHAR_FONT_NAME "CharFontName" +#define UNO_NAME_CHAR_FONT_STYLE_NAME "CharFontStyleName" +#define UNO_NAME_CHAR_FONT_FAMILY "CharFontFamily" +#define UNO_NAME_CHAR_FONT_CHAR_SET "CharFontCharSet" +#define UNO_NAME_CHAR_FONT_PITCH "CharFontPitch" +#define UNO_NAME_CHAR_LOCALE "CharLocale" +#define UNO_NAME_CHAR_FONT_NAME_ASIAN "CharFontNameAsian" +#define UNO_NAME_CHAR_FONT_STYLE_NAME_ASIAN "CharFontStyleNameAsian" +#define UNO_NAME_CHAR_FONT_FAMILY_ASIAN "CharFontFamilyAsian" +#define UNO_NAME_CHAR_FONT_CHAR_SET_ASIAN "CharFontCharSetAsian" +#define UNO_NAME_CHAR_FONT_PITCH_ASIAN "CharFontPitchAsian" +#define UNO_NAME_CHAR_POSTURE_ASIAN "CharPostureAsian" +#define UNO_NAME_CHAR_WEIGHT_ASIAN "CharWeightAsian" +#define UNO_NAME_CHAR_HEIGHT_ASIAN "CharHeightAsian" +#define UNO_NAME_CHAR_LOCALE_ASIAN "CharLocaleAsian" +#define UNO_NAME_CHAR_FONT_NAME_COMPLEX "CharFontNameComplex" +#define UNO_NAME_CHAR_FONT_STYLE_NAME_COMPLEX "CharFontStyleNameComplex" +#define UNO_NAME_CHAR_FONT_FAMILY_COMPLEX "CharFontFamilyComplex" +#define UNO_NAME_CHAR_FONT_CHAR_SET_COMPLEX "CharFontCharSetComplex" +#define UNO_NAME_CHAR_FONT_PITCH_COMPLEX "CharFontPitchComplex" +#define UNO_NAME_CHAR_POSTURE_COMPLEX "CharPostureComplex" +#define UNO_NAME_CHAR_WEIGHT_COMPLEX "CharWeightComplex" +#define UNO_NAME_CHAR_HEIGHT_COMPLEX "CharHeightComplex" +#define UNO_NAME_CHAR_LOCALE_COMPLEX "CharLocaleComplex" +#define UNO_NAME_CHAR_AUTO_KERNING "CharAutoKerning" +#define UNO_NAME_CHAR_UNDERLINE_COLOR "CharUnderlineColor" +#define UNO_NAME_CHAR_UNDERLINE_HAS_COLOR "CharUnderlineHasColor" +#define UNO_NAME_CHAR_ESCAPEMENT "CharEscapement" +#define UNO_NAME_CHAR_CASE_MAP "CharCaseMap" +#define UNO_NAME_CHAR_STRIKEOUT "CharStrikeout" +#define UNO_NAME_CHAR_CROSSED_OUT "CharCrossedOut" +#define UNO_NAME_CHAR_NO_HYPHENATION "CharNoHyphenation" +#define UNO_NAME_CHAR_AUTO_ESCAPEMENT "CharAutoEscapement" +#define UNO_NAME_CHAR_PROP_HEIGHT "CharPropHeight" +#define UNO_NAME_CHAR_DIFF_HEIGHT "CharDiffHeight" +#define UNO_NAME_CHAR_PROP_HEIGHT_ASIAN "CharPropHeightAsian" +#define UNO_NAME_CHAR_DIFF_HEIGHT_ASIAN "CharDiffHeightAsian" +#define UNO_NAME_CHAR_PROP_HEIGHT_COMPLEX "CharPropHeightComplex" +#define UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX "CharDiffHeightComplex" +#define UNO_NAME_CHAR_ESCAPEMENT_HEIGHT "CharEscapementHeight" +#define UNO_NAME_CHAR_TRANSPARENCE "CharTransparence" +#define UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS "HideTabLeaderAndPageNumber" +#define UNO_NAME_TAB_IN_TOC "TabInTOC" +#define UNO_NAME_TOC_BOOKMARK "TOCBookmark" +#define UNO_NAME_TOC_NEWLINE "TOCNewLine" +#define UNO_NAME_TOC_PARAGRAPH_OUTLINE_LEVEL "TOCParagraphOutlineLevel" + +#define UNO_NAME_CHAR_FLASH "CharFlash" +#define UNO_NAME_CHAR_KERNING "CharKerning" +#define UNO_NAME_CHAR_BACK_COLOR "CharBackColor" +#define UNO_NAME_CHAR_BACK_TRANSPARENT "CharBackTransparent" +#define UNO_NAME_CHAR_COMBINE_IS_ON "CharCombineIsOn" +#define UNO_NAME_CHAR_COMBINE_PREFIX "CharCombinePrefix" +#define UNO_NAME_CHAR_COMBINE_SUFFIX "CharCombineSuffix" +#define UNO_NAME_CHAR_EMPHASIS "CharEmphasis" +#define UNO_NAME_PARA_LINE_SPACING "ParaLineSpacing" +#define UNO_NAME_PARA_TOP_MARGIN "ParaTopMargin" +#define UNO_NAME_PARA_BOTTOM_MARGIN "ParaBottomMargin" +#define UNO_NAME_PARA_TOP_MARGIN_RELATIVE "ParaTopMarginRelative" +#define UNO_NAME_PARA_BOTTOM_MARGIN_RELATIVE "ParaBottomMarginRelative" +#define UNO_NAME_PARA_EXPAND_SINGLE_WORD "ParaExpandSingleWord" +#define UNO_NAME_END_NOTICE "EndNotice" +#define UNO_NAME_BEGIN_NOTICE "BeginNotice" +#define UNO_NAME_FRAME_STYLE_NAME "FrameStyleName" +#define UNO_NAME_NUMBERING_STYLE_NAME "NumberingStyleName" +#define UNO_NAME_NUMBERING_START_VALUE "NumberingStartValue" +#define UNO_NAME_NUMBERING_IS_NUMBER "NumberingIsNumber" +#define UNO_NAME_COUNT_LINES_IN_FRAMES "CountLinesInFrames" +#define UNO_NAME_DDE_COMMAND_TYPE "DDECommandType" +#define UNO_NAME_DDE_COMMAND_FILE "DDECommandFile" +#define UNO_NAME_DDE_COMMAND_ELEMENT "DDECommandElement" +#define UNO_NAME_IS_AUTOMATIC_UPDATE "IsAutomaticUpdate" +#define UNO_NAME_DISTANCE "Distance" +#define UNO_NAME_DROP_CAP_FORMAT "DropCapFormat" +#define UNO_NAME_DROP_CAP_WHOLE_WORD "DropCapWholeWord" +#define UNO_NAME_DROP_CAP_CHAR_STYLE_NAME "DropCapCharStyleName" +#define UNO_NAME_FILE_LINK "FileLink" +#define UNO_NAME_GRAPHIC "Graphic" +#define UNO_NAME_TRANSFORMED_GRAPHIC "TransformedGraphic" +#define UNO_NAME_IS_PROTECTED "IsProtected" +#define UNO_NAME_PARA_KEEP_TOGETHER "ParaKeepTogether" +#define UNO_NAME_KEEP_TOGETHER "KeepTogether" +#define UNO_NAME_IS_LANDSCAPE "IsLandscape" +#define UNO_NAME_SEPARATOR_TEXT "SeparatorText" +#define UNO_NAME_NUMBER_POSITION "NumberPosition" +#define UNO_NAME_PAGE_STYLE_NAME "PageStyleName" +#define UNO_NAME_PAGE_STYLE_LAYOUT "PageStyleLayout" +#define UNO_NAME_PARA_ADJUST "ParaAdjust" +#define UNO_NAME_PARA_REGISTER_MODE_ACTIVE "ParaRegisterModeActive" +#define UNO_NAME_PARA_STYLE_NAME "ParaStyleName" +#define UNO_NAME_PARA_LAST_LINE_ADJUST "ParaLastLineAdjust" +#define UNO_NAME_PARA_LINE_NUMBER_COUNT "ParaLineNumberCount" +#define UNO_NAME_PARA_LINE_NUMBER_START_VALUE "ParaLineNumberStartValue" +#define UNO_NAME_BACK_COLOR "BackColor" +#define UNO_NAME_PARA_BACK_COLOR "ParaBackColor" +#define UNO_NAME_PARA_WIDOWS "ParaWidows" +#define UNO_NAME_PARA_ORPHANS "ParaOrphans" +#define UNO_NAME_PARA_BACK_TRANSPARENT "ParaBackTransparent" +#define UNO_NAME_POSITION_END_OF_DOC "PositionEndOfDoc" +#define UNO_NAME_POSITION_PROTECTED "PositionProtected" +#define UNO_NAME_ALTERNATIVE_TEXT "AlternativeText" +#define UNO_NAME_PRIMARY_KEY "PrimaryKey" +#define UNO_NAME_PRINTER_PAPER_TRAY "PrinterPaperTray" +#define UNO_NAME_REGISTER_MODE_ACTIVE "RegisterModeActive" +#define UNO_NAME_RELATIVE_WIDTH "RelativeWidth" +#define UNO_NAME_RELATIVE_WIDTH_RELATION "RelativeWidthRelation" +#define UNO_NAME_RELATIVE_HEIGHT "RelativeHeight" +#define UNO_NAME_RELATIVE_HEIGHT_RELATION "RelativeHeightRelation" +#define UNO_NAME_REPEAT_HEADLINE "RepeatHeadline" +#define UNO_NAME_SEARCH_STYLES "SearchStyles" +#define UNO_NAME_SEARCH_BACKWARDS "SearchBackwards" +#define UNO_NAME_SEARCH_SIMILARITY "SearchSimilarity" +#define UNO_NAME_SEARCH_CASE_SENSITIVE "SearchCaseSensitive" +#define UNO_NAME_SEARCH_SIMILARITY_ADD "SearchSimilarityAdd" +#define UNO_NAME_SEARCH_SIMILARITY_RELAX "SearchSimilarityRelax" +#define UNO_NAME_SEARCH_SIMILARITY_REMOVE "SearchSimilarityRemove" +#define UNO_NAME_SEARCH_REGULAR_EXPRESSION "SearchRegularExpression" +#define UNO_NAME_SEARCH_SIMILARITY_EXCHANGE "SearchSimilarityExchange" +#define UNO_NAME_SECONDARY_KEY "SecondaryKey" +#define UNO_NAME_SEPARATOR_INTERVAL "SeparatorInterval" +#define UNO_NAME_SHOW_BREAKS "ShowBreaks" +#define UNO_NAME_SHOW_SPACES "ShowSpaces" +#define UNO_NAME_SHOW_TABLES "ShowTables" +#define UNO_NAME_SHOW_GRAPHICS "ShowGraphics" + +#define UNO_NAME_SHOW_DRAWINGS "ShowDrawings" +#define UNO_NAME_SHOW_TABSTOPS "ShowTabstops" +#define UNO_NAME_SHOW_VERT_RULER "ShowVertRuler" +#define UNO_NAME_SHOW_PARA_BREAKS "ShowParaBreaks" +#define UNO_NAME_SHOW_HIDDEN_TEXT "ShowHiddenText" +#define UNO_NAME_SHOW_SOFT_HYPHENS "ShowSoftHyphens" +#define UNO_NAME_SHOW_VERT_SCROLL_BAR "ShowVertScrollBar" +#define UNO_NAME_SHOW_HORI_SCROLL_BAR "ShowHoriScrollBar" +#define UNO_NAME_SHOW_FIELD_COMMANDS "ShowFieldCommands" +#define UNO_NAME_SHOW_PROTECTED_SPACES "ShowProtectedSpaces" +#define UNO_NAME_SHOW_HIDDEN_PARAGRAPHS "ShowHiddenParagraphs" +#define UNO_NAME_HIDE_WHITESPACE "HideWhitespace" +#define UNO_NAME_IS_SYNC_WIDTH_TO_HEIGHT "IsSyncWidthToHeight" +#define UNO_NAME_IS_SYNC_HEIGHT_TO_WIDTH "IsSyncHeightToWidth" +#define UNO_NAME_SIZE_PROTECTED "SizeProtected" +#define UNO_NAME_TEXT_COLUMNS "TextColumns" +#define UNO_NAME_BACK_TRANSPARENT "BackTransparent" +#define UNO_NAME_ANCHOR_TYPE "AnchorType" +#define UNO_NAME_ANCHOR_TYPES "AnchorTypes" +#define UNO_NAME_ANCHOR_PAGE_NO "AnchorPageNo" +#define UNO_NAME_ANCHOR_FRAME "AnchorFrame" +#define UNO_NAME_AUTHOR "Author" +#define UNO_NAME_BREAK_TYPE "BreakType" +#define UNO_NAME_CHAIN_NEXT_NAME "ChainNextName" +#define UNO_NAME_CHAIN_PREV_NAME "ChainPrevName" +#define UNO_NAME_CHAIN_NAME "ChainName" +#define UNO_NAME_CHAPTER_FORMAT "ChapterFormat" +#define UNO_NAME_CLIENT_MAP "ClientMap" +#define UNO_NAME_CONDITION "Condition" +#define UNO_NAME_CONTENT "Content" +#define UNO_NAME_CHAR_CONTOURED "CharContoured" +#define UNO_NAME_CONTOUR_OUTSIDE "ContourOutside" +#define UNO_NAME_CONTENT_PROTECTED "ContentProtected" +#define UNO_NAME_COUNT_EMPTY_LINES "CountEmptyLines" +#define UNO_NAME_RESTART_AT_EACH_PAGE "RestartAtEachPage" +#define UNO_NAME_DATA_BASE_NAME "DataBaseName" +#define UNO_NAME_DATA_TABLE_NAME "DataTableName" +#define UNO_NAME_DATA_COMMAND_TYPE "DataCommandType" +#define UNO_NAME_DATA_COLUMN_NAME "DataColumnName" +#define UNO_NAME_IS_DATA_BASE_FORMAT "DataBaseFormat" +#define UNO_NAME_DATE "Date" +#define UNO_NAME_IS_DATE "IsDate" +#define UNO_NAME_EDIT_IN_READONLY "EditInReadonly" +#define UNO_NAME_FALSE_CONTENT "FalseContent" +#define UNO_NAME_FILE_FORMAT "FileFormat" +#define UNO_NAME_IS_FIXED "IsFixed" +#define UNO_NAME_FOOTNOTE_COUNTING "FootnoteCounting" +#define UNO_NAME_FULL_NAME "FullName" +#define UNO_NAME_HEIGHT "Height" +#define UNO_NAME_IS_AUTO_HEIGHT "IsAutoHeight" +#define UNO_NAME_SIZE_TYPE "SizeType" +#define UNO_NAME_HINT "Hint" +#define UNO_NAME_HORI_ORIENT "HoriOrient" +#define UNO_NAME_HORI_MIRRORED_ON_EVEN_PAGES "HoriMirroredOnEvenPages" +#define UNO_NAME_HORI_MIRRORED_ON_ODD_PAGES "HoriMirroredOnOddPages" +#define UNO_NAME_HORI_ORIENT_RELATION "HoriOrientRelation" +#define UNO_NAME_HORI_ORIENT_POSITION "HoriOrientPosition" +#define UNO_NAME_HYPER_LINK_U_R_L "HyperLinkURL" +#define UNO_NAME_HYPER_LINK_TARGET "HyperLinkTarget" +#define UNO_NAME_HYPER_LINK_NAME "HyperLinkName" +#define UNO_NAME_HYPER_LINK_EVENTS "HyperLinkEvents" +#define UNO_NAME_INFO_TYPE "InfoType" +#define UNO_NAME_INFO_FORMAT "InfoFormat" +#define UNO_NAME_IS_INPUT "IsInput" +#define UNO_NAME_LEVEL "Level" +#define UNO_NAME_INTERVAL "Interval" +#define UNO_NAME_LINK_REGION "LinkRegion" +#define UNO_NAME_MACRO_NAME "MacroName" +#define UNO_NAME_SPLIT "Split" +#define UNO_NAME_PARA_SPLIT "ParaSplit" +#define UNO_NAME_NUMBER_FORMAT "NumberFormat" +#define UNO_NAME_NUMBERING_TYPE "NumberingType" +#define UNO_NAME_OFFSET "Offset" +#define UNO_NAME_ON "On" +#define UNO_NAME_OPAQUE "Opaque" +#define UNO_NAME_PAGE_TOGGLE "PageToggle" +#define UNO_NAME_PAGE_DESC_NAME "PageDescName" +#define UNO_NAME_PAGE_NUMBER_OFFSET "PageNumberOffset" +#define UNO_NAME_PLACEHOLDER "PlaceHolder" +#define UNO_NAME_PLACEHOLDER_TYPE "PlaceHolderType" +#define UNO_NAME_PRINT "Print" +#define UNO_NAME_REFERENCE_FIELD_PART "ReferenceFieldPart" +#define UNO_NAME_REFERENCE_FIELD_SOURCE "ReferenceFieldSource" +#define UNO_NAME_REFERENCE_FIELD_LANGUAGE "ReferenceFieldLanguage" +#define UNO_NAME_REGISTER_PARAGRAPH_STYLE "RegisterParagraphStyle" +#define UNO_NAME_SCRIPT_TYPE "ScriptType" +#define UNO_NAME_SEARCH_ALL "SearchAll" + +#define UNO_NAME_SEARCH_WORDS "SearchWords" +#define UNO_NAME_SEQUENCE_VALUE "SequenceValue" +#define UNO_NAME_SERVER_MAP "ServerMap" +#define UNO_NAME_IMAGE_MAP "ImageMap" +#define UNO_NAME_SET_NUMBER "SetNumber" +#define UNO_NAME_SHADOW_FORMAT "ShadowFormat" +#define UNO_NAME_SHOW_HORI_RULER "ShowHoriRuler" +#define UNO_NAME_SIZE "Size" +#define UNO_NAME_ACTUAL_SIZE "ActualSize" +#define UNO_NAME_SOURCE_NAME "SourceName" +#define UNO_NAME_START_AT "StartAt" +#define UNO_NAME_START_WITH "StartWith" +#define UNO_NAME_STATISTIC_TYPE_ID "StatisticTypeId" +#define UNO_NAME_SUB_TYPE "SubType" +#define UNO_NAME_SURROUND "Surround" +#define UNO_NAME_IS_EXPRESSION "IsExpression" +#define UNO_NAME_IS_SHOW_FORMULA "IsShowFormula" +#define UNO_NAME_TEXT_WRAP "TextWrap" +#define UNO_NAME_SURROUND_CONTOUR "SurroundContour" +#define UNO_NAME_SURROUND_ANCHORONLY "SurroundAnchorOnly" +#define UNO_NAME_TABLE_NAME "TableName" +#define UNO_NAME_TABLE_TEMPLATE_NAME "TableTemplateName" +#define UNO_NAME_TABSTOPS "ParaTabStops" +#define UNO_NAME_TITLE "Title" +#define UNO_NAME_TOP_MARGIN "TopMargin" +#define UNO_NAME_BOTTOM_MARGIN "BottomMargin" +#define UNO_NAME_TRUE_CONTENT "TrueContent" +#define UNO_NAME_URL_CONTENT "URLContent" +#define UNO_NAME_USERTEXT "UserText" +#define UNO_NAME_USER_DATA_TYPE "UserDataType" +#define UNO_NAME_VALUE "Value" +#define UNO_NAME_VARIABLE_NAME "VariableName" +#define UNO_NAME_VARIABLE_SUBTYPE "VariableSubtype" +#define UNO_NAME_VERT_ORIENT "VertOrient" +#define UNO_NAME_VERT_MIRRORED "VertMirrored" +#define UNO_NAME_VERT_ORIENT_POSITION "VertOrientPosition" +#define UNO_NAME_VERT_ORIENT_RELATION "VertOrientRelation" +#define UNO_NAME_IS_VISIBLE "IsVisible" +#define UNO_NAME_WIDTH "Width" +#define UNO_NAME_CHAR_WORD_MODE "CharWordMode" +#define UNO_NAME_GRAPHIC_CROP "GraphicCrop" +#define UNO_NAME_CHARACTER_FORMAT_NONE "CharacterFormatNone" +#define UNO_NAME_DOCUMENT_INDEX_MARK "DocumentIndexMark" +#define UNO_NAME_DOCUMENT_INDEX "DocumentIndex" +#define UNO_NAME_IS_GLOBAL_DOCUMENT_SECTION "IsGlobalDocumentSection" +#define UNO_NAME_TEXT_FIELD "TextField" +#define UNO_NAME_BOOKMARK "Bookmark" +#define UNO_NAME_BOOKMARK_HIDDEN "BookmarkHidden" +#define UNO_NAME_BOOKMARK_CONDITION "BookmarkCondition" +#define UNO_NAME_TEXT_TABLE "TextTable" +#define UNO_NAME_CELL "Cell" +#define UNO_NAME_TEXT_FRAME "TextFrame" +#define UNO_NAME_REFERENCE_MARK "ReferenceMark" +#define UNO_NAME_TEXT_SECTION "TextSection" +#define UNO_NAME_FOOTNOTE "Footnote" +#define UNO_NAME_ENDNOTE "Endnote" +#define UNO_NAME_CHART_ROW_AS_LABEL "ChartRowAsLabel" +#define UNO_NAME_CHART_COLUMN_AS_LABEL "ChartColumnAsLabel" +#define UNO_NAME_LEFT_BORDER "LeftBorder" +#define UNO_NAME_RIGHT_BORDER "RightBorder" +#define UNO_NAME_TOP_BORDER "TopBorder" +#define UNO_NAME_BOTTOM_BORDER "BottomBorder" +#define UNO_NAME_BORDER_DISTANCE "BorderDistance" +#define UNO_NAME_LEFT_BORDER_DISTANCE "LeftBorderDistance" +#define UNO_NAME_RIGHT_BORDER_DISTANCE "RightBorderDistance" +#define UNO_NAME_TOP_BORDER_DISTANCE "TopBorderDistance" +#define UNO_NAME_BOTTOM_BORDER_DISTANCE "BottomBorderDistance" +#define UNO_NAME_TABLE_BORDER "TableBorder" +#define UNO_NAME_TABLE_COLUMN_SEPARATORS "TableColumnSeparators" +#define UNO_NAME_TABLE_COLUMN_RELATIVE_SUM "TableColumnRelativeSum" +#define UNO_NAME_HEADER_TEXT "HeaderText" +#define UNO_NAME_HEADER_TEXT_LEFT "HeaderTextLeft" +#define UNO_NAME_HEADER_TEXT_RIGHT "HeaderTextRight" +#define UNO_NAME_FOOTER_TEXT "FooterText" +#define UNO_NAME_FOOTER_TEXT_LEFT "FooterTextLeft" +#define UNO_NAME_FOOTER_TEXT_RIGHT "FooterTextRight" +#define UNO_NAME_HEADER_BACK_COLOR "HeaderBackColor" +#define UNO_NAME_HEADER_BACK_TRANSPARENT "HeaderBackTransparent" +#define UNO_NAME_HEADER_LEFT_BORDER "HeaderLeftBorder" +#define UNO_NAME_HEADER_RIGHT_BORDER "HeaderRightBorder" +#define UNO_NAME_HEADER_TOP_BORDER "HeaderTopBorder" +#define UNO_NAME_HEADER_BOTTOM_BORDER "HeaderBottomBorder" +#define UNO_NAME_HEADER_BORDER_DISTANCE "HeaderBorderDistance" +#define UNO_NAME_HEADER_SHADOW_FORMAT "HeaderShadowFormat" +#define UNO_NAME_HEADER_BODY_DISTANCE "HeaderBodyDistance" +#define UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT "HeaderIsDynamicHeight" +#define UNO_NAME_HEADER_IS_SHARED "HeaderIsShared" +#define UNO_NAME_HEADER_HEIGHT "HeaderHeight" +#define UNO_NAME_HEADER_IS_ON "HeaderIsOn" +#define UNO_NAME_FOOTER_BACK_COLOR "FooterBackColor" +#define UNO_NAME_FOOTER_BACK_TRANSPARENT "FooterBackTransparent" +#define UNO_NAME_FOOTER_LEFT_BORDER "FooterLeftBorder" +#define UNO_NAME_FOOTER_RIGHT_BORDER "FooterRightBorder" +#define UNO_NAME_FOOTER_TOP_BORDER "FooterTopBorder" +#define UNO_NAME_FOOTER_BOTTOM_BORDER "FooterBottomBorder" +#define UNO_NAME_FOOTER_BORDER_DISTANCE "FooterBorderDistance" +#define UNO_NAME_FOOTER_SHADOW_FORMAT "FooterShadowFormat" +#define UNO_NAME_FOOTER_BODY_DISTANCE "FooterBodyDistance" +#define UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT "FooterIsDynamicHeight" +#define UNO_NAME_FOOTER_IS_SHARED "FooterIsShared" +#define UNO_NAME_TEXT_PARAGRAPH "TextParagraph" +#define UNO_NAME_PARENT_TEXT "ParentText" + +#define UNO_NAME_FOOTER_HEIGHT "FooterHeight" +#define UNO_NAME_FOOTER_IS_ON "FooterIsOn" +#define UNO_NAME_OVERWRITE_STYLES "OverwriteStyles" +#define UNO_NAME_LOAD_NUMBERING_STYLES "LoadNumberingStyles" +#define UNO_NAME_LOAD_PAGE_STYLES "LoadPageStyles" +#define UNO_NAME_LOAD_FRAME_STYLES "LoadFrameStyles" +#define UNO_NAME_LOAD_TEXT_STYLES "LoadTextStyles" +#define UNO_NAME_FILE_NAME "FileName" +#define UNO_NAME_COPY_COUNT "CopyCount" +#define UNO_NAME_COLLATE "Collate" +#define UNO_NAME_SORT "Sort" +#define UNO_NAME_PAGES "Pages" +#define UNO_NAME_FIRST_LINE_OFFSET "FirstLineOffset" +#define UNO_NAME_SYMBOL_TEXT_DISTANCE "SymbolTextDistance" +#define UNO_NAME_USER_INDEX_NAME "UserIndexName" +#define UNO_NAME_REVISION "Revision" +#define UNO_NAME_UNVISITED_CHAR_STYLE_NAME "UnvisitedCharStyleName" +#define UNO_NAME_VISITED_CHAR_STYLE_NAME "VisitedCharStyleName" +#define UNO_NAME_PARAGRAPH_COUNT "ParagraphCount" +#define UNO_NAME_WORD_COUNT "WordCount" +#define UNO_NAME_WORD_SEPARATOR "WordSeparator" +#define UNO_NAME_CHARACTER_COUNT "CharacterCount" +#define UNO_NAME_ZOOM_VALUE "ZoomValue" +#define UNO_NAME_ZOOM_TYPE "ZoomType" +#define UNO_NAME_CREATE_FROM_MARKS "CreateFromMarks" +#define UNO_NAME_CREATE_FROM_OUTLINE "CreateFromOutline" +#define UNO_NAME_CREATE_FROM_CHAPTER "CreateFromChapter" +#define UNO_NAME_CREATE_FROM_LABELS "CreateFromLabels" +#define UNO_NAME_USE_ALPHABETICAL_SEPARATORS "UseAlphabeticalSeparators" +#define UNO_NAME_USE_KEY_AS_ENTRY "UseKeyAsEntry" +#define UNO_NAME_USE_COMBINED_ENTRIES "UseCombinedEntries" +#define UNO_NAME_IS_CASE_SENSITIVE "IsCaseSensitive" +#define UNO_NAME_USE_P_P "UsePP" +#define UNO_NAME_USE_DASH "UseDash" +#define UNO_NAME_USE_UPPER_CASE "UseUpperCase" +#define UNO_NAME_LABEL_CATEGORY "LabelCategory" +#define UNO_NAME_LABEL_DISPLAY_TYPE "LabelDisplayType" +#define UNO_NAME_USE_LEVEL_FROM_SOURCE "UseLevelFromSource" +#define UNO_NAME_LEVEL_FORMAT "LevelFormat" +#define UNO_NAME_LEVEL_PARAGRAPH_STYLES "LevelParagraphStyles" +#define UNO_NAME_MAIN_ENTRY_CHARACTER_STYLE_NAME "MainEntryCharacterStyleName" +#define UNO_NAME_CREATE_FROM_TABLES "CreateFromTables" +#define UNO_NAME_CREATE_FROM_TEXT_FRAMES "CreateFromTextFrames" +#define UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS "CreateFromGraphicObjects" +#define UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS "CreateFromEmbeddedObjects" +#define UNO_NAME_CREATE_FROM_STAR_MATH "CreateFromStarMath" +#define UNO_NAME_CREATE_FROM_STAR_CHART "CreateFromStarChart" +#define UNO_NAME_CREATE_FROM_STAR_CALC "CreateFromStarCalc" +#define UNO_NAME_CREATE_FROM_STAR_DRAW "CreateFromStarDraw" +#define UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS "CreateFromOtherEmbeddedObjects" +#define UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L "IndexAutoMarkFileURL" +#define UNO_NAME_IS_COMMA_SEPARATED "IsCommaSeparated" +#define UNO_NAME_IS_RELATIVE_TABSTOPS "IsRelativeTabstops" +#define UNO_NAME_CREATE_FROM_LEVEL_PARAGRAPH_STYLES "CreateFromLevelParagraphStyles" +#define UNO_NAME_SHOW_CHANGES "ShowChanges" +#define UNO_NAME_RECORD_CHANGES "RecordChanges" +#define UNO_LINK_DISPLAY_NAME "LinkDisplayName" +#define UNO_LINK_DISPLAY_BITMAP "LinkDisplayBitmap" +#define UNO_NAME_HEADING_STYLE_NAME "HeadingStyleName" +#define UNO_NAME_SHOW_ONLINE_LAYOUT "ShowOnlineLayout" +#define UNO_NAME_USER_DEFINED_ATTRIBUTES "UserDefinedAttributes" +#define UNO_NAME_TEXT_USER_DEFINED_ATTRIBUTES "TextUserDefinedAttributes" +#define UNO_NAME_FILE_PATH "FilePath" +#define UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL "ParaChapterNumberingLevel" +#define UNO_NAME_PARA_CONDITIONAL_STYLE_NAME "ParaConditionalStyleName" +#define UNO_NAME_CHAPTER_NUMBERING_LEVEL "ChapterNumberingLevel" +#define UNO_NAME_NUMBERING_SEPARATOR "NumberingSeparator" +#define UNO_NAME_IS_CONTINUOUS_NUMBERING "IsContinuousNumbering" +#define UNO_NAME_IS_AUTOMATIC "IsAutomatic" +#define UNO_NAME_IS_ABSOLUTE_MARGINS "IsAbsoluteMargins" +#define UNO_NAME_CATEGORY "Category" +#define UNO_NAME_DEPENDENT_TEXT_FIELDS "DependentTextFields" +#define UNO_NAME_CURRENT_PRESENTATION "CurrentPresentation" +#define UNO_NAME_ADJUST "Adjust" +#define UNO_NAME_INSTANCE_NAME "InstanceName" +#define UNO_NAME_TEXT_PORTION_TYPE "TextPortionType" +#define UNO_NAME_CONTROL_CHARACTER "ControlCharacter" +#define UNO_NAME_IS_COLLAPSED "IsCollapsed" +#define UNO_NAME_IS_START "IsStart" +#define UNO_NAME_SEQUENCE_NUMBER "SequenceNumber" +#define UNO_NAME_REFERENCE_ID "ReferenceId" +#define UNO_NAME_HEADER_LEFT_BORDER_DISTANCE "HeaderLeftBorderDistance" +#define UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE "HeaderRightBorderDistance" +#define UNO_NAME_HEADER_TOP_BORDER_DISTANCE "HeaderTopBorderDistance" +#define UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE "HeaderBottomBorderDistance" +#define UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE "FooterLeftBorderDistance" +#define UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE "FooterRightBorderDistance" +#define UNO_NAME_FOOTER_TOP_BORDER_DISTANCE "FooterTopBorderDistance" +#define UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE "FooterBottomBorderDistance" +#define UNO_NAME_PARA_IS_NUMBERING_RESTART "ParaIsNumberingRestart" +#define UNO_NAME_HIDE_FIELD_TIPS "HideFieldTips" +#define UNO_NAME_PARA_SHADOW_FORMAT "ParaShadowFormat" +#define UNO_NAME_CONTOUR_POLY_POLYGON "ContourPolyPolygon" +#define UNO_NAME_INDEX_ENTRY_TYPE "IndexEntryType" + +#define UNO_NAME_IS_PIXEL_CONTOUR "IsPixelContour" +#define UNO_NAME_IS_AUTOMATIC_CONTOUR "IsAutomaticContour" +#define UNO_NAME_SEPARATOR_LINE_WIDTH "SeparatorLineWidth" +#define UNO_NAME_SEPARATOR_LINE_COLOR "SeparatorLineColor" +#define UNO_NAME_SEPARATOR_LINE_RELATIVE_HEIGHT "SeparatorLineRelativeHeight" +#define UNO_NAME_SEPARATOR_LINE_VERTIVAL_ALIGNMENT "SeparatorLineVerticalAlignment" +#define UNO_NAME_SEPARATOR_LINE_IS_ON "SeparatorLineIsOn" +#define UNO_NAME_IS_SKIP_HIDDEN_TEXT "IsSkipHiddenText" +#define UNO_NAME_IS_SKIP_PROTECTED_TEXT "IsSkipProtectedText" +#define UNO_NAME_DOCUMENT_INDEX_MARKS "DocumentIndexMarks" +#define UNO_NAME_FOOTNOTE_IS_COLLECT_AT_TEXT_END "FootnoteIsCollectAtTextEnd" +#define UNO_NAME_FOOTNOTE_IS_RESTART_NUMBERING "FootnoteIsRestartNumbering" +#define UNO_NAME_FOOTNOTE_RESTART_NUMBERING_AT "FootnoteRestartNumberingAt" +#define UNO_NAME_FOOTNOTE_IS_OWN_NUMBERING "FootnoteIsOwnNumbering" +#define UNO_NAME_FOOTNOTE_NUMBERING_TYPE "FootnoteNumberingType" +#define UNO_NAME_FOOTNOTE_NUMBERING_PREFIX "FootnoteNumberingPrefix" +#define UNO_NAME_FOOTNOTE_NUMBERING_SUFFIX "FootnoteNumberingSuffix" +#define UNO_NAME_ENDNOTE_IS_COLLECT_AT_TEXT_END "EndnoteIsCollectAtTextEnd" +#define UNO_NAME_ENDNOTE_IS_RESTART_NUMBERING "EndnoteIsRestartNumbering" +#define UNO_NAME_ENDNOTE_RESTART_NUMBERING_AT "EndnoteRestartNumberingAt" +#define UNO_NAME_ENDNOTE_IS_OWN_NUMBERING "EndnoteIsOwnNumbering" +#define UNO_NAME_ENDNOTE_NUMBERING_TYPE "EndnoteNumberingType" +#define UNO_NAME_ENDNOTE_NUMBERING_PREFIX "EndnoteNumberingPrefix" +#define UNO_NAME_ENDNOTE_NUMBERING_SUFFIX "EndnoteNumberingSuffix" +#define UNO_NAME_BRACKET_BEFORE "BracketBefore" +#define UNO_NAME_BRACKET_AFTER "BracketAfter" +#define UNO_NAME_IS_NUMBER_ENTRIES "IsNumberEntries" +#define UNO_NAME_IS_SORT_BY_POSITION "IsSortByPosition" +#define UNO_NAME_SORT_KEYS "SortKeys" +#define UNO_NAME_IS_SORT_ASCENDING "IsSortAscending" +#define UNO_NAME_SORT_KEY "SortKey" +#define UNO_NAME_FIELDS "Fields" +#define UNO_NAME_DATE_TIME_VALUE "DateTimeValue" +#define UNO_NAME_IS_ON "IsOn" +#define UNO_NAME_Z_ORDER "ZOrder" +#define UNO_NAME_CONTENT_SECTION "ContentSection" +#define UNO_NAME_HEADER_SECTION "HeaderSection" +#define UNO_NAME_PARA_IS_HANGING_PUNCTUATION "ParaIsHangingPunctuation" +#define UNO_NAME_PARA_IS_CHARACTER_DISTANCE "ParaIsCharacterDistance" +#define UNO_NAME_PARA_IS_FORBIDDEN_RULES "ParaIsForbiddenRules" +#define UNO_NAME_PARA_VERT_ALIGNMENT "ParaVertAlignment" +#define UNO_NAME_IS_MAIN_ENTRY "IsMainEntry" +#define UNO_NAME_GRAPHIC_ROTATION "GraphicRotation" +#define UNO_NAME_ADJUST_LUMINANCE "AdjustLuminance" +#define UNO_NAME_ADJUST_CONTRAST "AdjustContrast" +#define UNO_NAME_ADJUST_RED "AdjustRed" +#define UNO_NAME_ADJUST_GREEN "AdjustGreen" +#define UNO_NAME_ADJUST_BLUE "AdjustBlue" +#define UNO_NAME_GAMMA "Gamma" +#define UNO_NAME_GRAPHIC_IS_INVERTED "GraphicIsInverted" +#define UNO_NAME_TRANSPARENCY "Transparency" +#define UNO_NAME_REDLINE_AUTHOR "RedlineAuthor" +#define UNO_NAME_REDLINE_DATE_TIME "RedlineDateTime" +#define UNO_NAME_REDLINE_COMMENT "RedlineComment" +#define UNO_NAME_REDLINE_DESCRIPTION "RedlineDescription" +#define UNO_NAME_REDLINE_TYPE "RedlineType" +#define UNO_NAME_REDLINE_SUCCESSOR_DATA "RedlineSuccessorData" +#define UNO_NAME_REDLINE_IDENTIFIER "RedlineIdentifier" +#define UNO_NAME_IS_IN_HEADER_FOOTER "IsInHeaderFooter" +#define UNO_NAME_START_REDLINE "StartRedline" +#define UNO_NAME_END_REDLINE "EndRedline" +#define UNO_NAME_REDLINE_START "RedlineStart" +#define UNO_NAME_REDLINE_END "RedlineEnd" +#define UNO_NAME_REDLINE_TEXT "RedlineText" +#define UNO_NAME_REDLINE_DISPLAY_TYPE "RedlineDisplayType" +#define UNO_NAME_FORBIDDEN_CHARACTERS "ForbiddenCharacters" +#define UNO_NAME_RUBY_BASE_TEXT "RubyBaseText" +#define UNO_NAME_RUBY_TEXT "RubyText" +#define UNO_NAME_RUBY_ADJUST "RubyAdjust" +#define UNO_NAME_RUBY_CHAR_STYLE_NAME "RubyCharStyleName" +#define UNO_NAME_RUBY_IS_ABOVE "RubyIsAbove" +#define UNO_NAME_RUBY_POSITION "RubyPosition" +#define UNO_NAME_FOOTNOTE_HEIGHT "FootnoteHeight" +#define UNO_NAME_FOOTNOTE_LINE_WEIGHT "FootnoteLineWeight" +#define UNO_NAME_FOOTNOTE_LINE_COLOR "FootnoteLineColor" +#define UNO_NAME_FOOTNOTE_LINE_RELATIVE_WIDTH "FootnoteLineRelativeWidth" +#define UNO_NAME_FOOTNOTE_LINE_ADJUST "FootnoteLineAdjust" +#define UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE "FootnoteLineTextDistance" +#define UNO_NAME_FOOTNOTE_LINE_DISTANCE "FootnoteLineDistance" +#define UNO_NAME_CHAR_ROTATION "CharRotation" +#define UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE "CharRotationIsFitToLine" +#define UNO_NAME_CHAR_SCALE_WIDTH "CharScaleWidth" +#define UNO_NAME_TAB_STOP_DISTANCE "TabStopDistance" +#define UNO_NAME_IS_WIDTH_RELATIVE "IsWidthRelative" +#define UNO_NAME_CHAR_RELIEF "CharRelief" +#define UNO_NAME_IS_HIDDEN "IsHidden" +#define UNO_NAME_IS_CONDITION_TRUE "IsConditionTrue" +#define UNO_NAME_TWO_DIGIT_YEAR "TwoDigitYear" +#define UNO_NAME_PROTECTION_KEY "ProtectionKey" +#define UNO_NAME_REDLINE_PROTECTION_KEY "RedlineProtectionKey" +#define UNO_NAME_AUTOMATIC_DISTANCE "AutomaticDistance" +#define UNO_NAME_AUTOMATIC_CONTROL_FOCUS "AutomaticControlFocus" +#define UNO_NAME_APPLY_FORM_DESIGN_MODE "ApplyFormDesignMode" +#define UNO_NAME_LOCALE "Locale" +#define UNO_NAME_SORT_ALGORITHM "SortAlgorithm" +#define UNO_NAME_FRAME_HEIGHT_ABSOLUTE "FrameHeightAbsolute" +#define UNO_NAME_FRAME_HEIGHT_PERCENT "FrameHeightPercent" +#define UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT "FrameIsAutomaticHeight" +#define UNO_NAME_FRAME_WIDTH_ABSOLUTE "FrameWidthAbsolute" +#define UNO_NAME_FRAME_WIDTH_PERCENT "FrameWidthPercent" + +// names for FillAttributes from SVX +#define UNO_NAME_SW_FILLBMP_LOGICAL_SIZE UNO_NAME_FILLBMP_LOGICAL_SIZE +#define UNO_NAME_SW_FILLBMP_OFFSET_X UNO_NAME_FILLBMP_OFFSET_X +#define UNO_NAME_SW_FILLBMP_OFFSET_Y UNO_NAME_FILLBMP_OFFSET_Y +#define UNO_NAME_SW_FILLBMP_POSITION_OFFSET_X UNO_NAME_FILLBMP_POSITION_OFFSET_X +#define UNO_NAME_SW_FILLBMP_POSITION_OFFSET_Y UNO_NAME_FILLBMP_POSITION_OFFSET_Y +#define UNO_NAME_SW_FILLBMP_RECTANGLE_POINT UNO_NAME_FILLBMP_RECTANGLE_POINT +#define UNO_NAME_SW_FILLBMP_SIZE_X UNO_NAME_FILLBMP_SIZE_X +#define UNO_NAME_SW_FILLBMP_SIZE_Y UNO_NAME_FILLBMP_SIZE_Y +#define UNO_NAME_SW_FILLBMP_STRETCH UNO_NAME_FILLBMP_STRETCH +#define UNO_NAME_SW_FILLBMP_TILE UNO_NAME_FILLBMP_TILE +#define UNO_NAME_SW_FILLBMP_MODE UNO_NAME_FILLBMP_MODE +#define UNO_NAME_SW_FILLCOLOR UNO_NAME_FILLCOLOR +#define UNO_NAME_SW_FILLBACKGROUND UNO_NAME_FILLBACKGROUND +#define UNO_NAME_SW_FILLBITMAP UNO_NAME_FILLBITMAP +#define UNO_NAME_SW_FILLBITMAPURL UNO_NAME_FILLBITMAPURL +#define UNO_NAME_SW_FILLBITMAPNAME UNO_NAME_FILLBITMAPNAME +#define UNO_NAME_SW_FILLGRADIENTSTEPCOUNT UNO_NAME_FILLGRADIENTSTEPCOUNT +#define UNO_NAME_SW_FILLGRADIENT UNO_NAME_FILLGRADIENT +#define UNO_NAME_SW_FILLGRADIENTNAME UNO_NAME_FILLGRADIENTNAME +#define UNO_NAME_SW_FILLHATCH UNO_NAME_FILLHATCH +#define UNO_NAME_SW_FILLHATCHNAME UNO_NAME_FILLHATCHNAME +#define UNO_NAME_SW_FILLSTYLE UNO_NAME_FILLSTYLE +#define UNO_NAME_SW_FILL_TRANSPARENCE UNO_NAME_FILL_TRANSPARENCE +#define UNO_NAME_SW_FILLTRANSPARENCEGRADIENT UNO_NAME_FILLTRANSPARENCEGRADIENT +#define UNO_NAME_SW_FILLTRANSPARENCEGRADIENTNAME UNO_NAME_FILLTRANSPARENCEGRADIENTNAME +#define UNO_NAME_SW_FILLCOLOR_2 UNO_NAME_FILLCOLOR_2 + +#define UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE "HeaderFillBitmapLogicalSize" +#define UNO_NAME_HEADER_FILLBMP_OFFSET_X "HeaderFillBitmapOffsetX" +#define UNO_NAME_HEADER_FILLBMP_OFFSET_Y "HeaderFillBitmapOffsetY" +#define UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X "HeaderFillBitmapPositionOffsetX" +#define UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y "HeaderFillBitmapPositionOffsetY" +#define UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT "HeaderFillBitmapRectanglePoint" +#define UNO_NAME_HEADER_FILLBMP_SIZE_X "HeaderFillBitmapSizeX" +#define UNO_NAME_HEADER_FILLBMP_SIZE_Y "HeaderFillBitmapSizeY" +#define UNO_NAME_HEADER_FILLBMP_STRETCH "HeaderFillBitmapStretch" +#define UNO_NAME_HEADER_FILLBMP_TILE "HeaderFillBitmapTile" +#define UNO_NAME_HEADER_FILLBMP_MODE "HeaderFillBitmapMode" +#define UNO_NAME_HEADER_FILLCOLOR "HeaderFillColor" +#define UNO_NAME_HEADER_FILLBACKGROUND "HeaderFillBackground" +#define UNO_NAME_HEADER_FILLBITMAP "HeaderFillBitmap" +#define UNO_NAME_HEADER_FILLBITMAPNAME "HeaderFillBitmapName" +#define UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT "HeaderFillGradientStepCount" +#define UNO_NAME_HEADER_FILLGRADIENT "HeaderFillGradient" +#define UNO_NAME_HEADER_FILLGRADIENTNAME "HeaderFillGradientName" +#define UNO_NAME_HEADER_FILLHATCH "HeaderFillHatch" +#define UNO_NAME_HEADER_FILLHATCHNAME "HeaderFillHatchName" +#define UNO_NAME_HEADER_FILLSTYLE "HeaderFillStyle" +#define UNO_NAME_HEADER_FILL_TRANSPARENCE "HeaderFillTransparence" +#define UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT "HeaderFillTransparenceGradient" +#define UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME "HeaderFillTransparenceGradientName" +#define UNO_NAME_HEADER_FILLCOLOR_2 "HeaderFillColor2" + +#define UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE "FooterFillBitmapLogicalSize" +#define UNO_NAME_FOOTER_FILLBMP_OFFSET_X "FooterFillBitmapOffsetX" +#define UNO_NAME_FOOTER_FILLBMP_OFFSET_Y "FooterFillBitmapOffsetY" +#define UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X "FooterFillBitmapPositionOffsetX" +#define UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y "FooterFillBitmapPositionOffsetY" +#define UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT "FooterFillBitmapRectanglePoint" +#define UNO_NAME_FOOTER_FILLBMP_SIZE_X "FooterFillBitmapSizeX" +#define UNO_NAME_FOOTER_FILLBMP_SIZE_Y "FooterFillBitmapSizeY" +#define UNO_NAME_FOOTER_FILLBMP_STRETCH "FooterFillBitmapStretch" +#define UNO_NAME_FOOTER_FILLBMP_TILE "FooterFillBitmapTile" +#define UNO_NAME_FOOTER_FILLBMP_MODE "FooterFillBitmapMode" +#define UNO_NAME_FOOTER_FILLCOLOR "FooterFillColor" +#define UNO_NAME_FOOTER_FILLBACKGROUND "FooterFillBackground" +#define UNO_NAME_FOOTER_FILLBITMAP "FooterFillBitmap" +#define UNO_NAME_FOOTER_FILLBITMAPNAME "FooterFillBitmapName" +#define UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT "FooterFillGradientStepCount" +#define UNO_NAME_FOOTER_FILLGRADIENT "FooterFillGradient" +#define UNO_NAME_FOOTER_FILLGRADIENTNAME "FooterFillGradientName" +#define UNO_NAME_FOOTER_FILLHATCH "FooterFillHatch" +#define UNO_NAME_FOOTER_FILLHATCHNAME "FooterFillHatchName" +#define UNO_NAME_FOOTER_FILLSTYLE "FooterFillStyle" +#define UNO_NAME_FOOTER_FILL_TRANSPARENCE "FooterFillTransparence" +#define UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT "FooterFillTransparenceGradient" +#define UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME "FooterFillTransparenceGradientName" +#define UNO_NAME_FOOTER_FILLCOLOR_2 "FooterFillColor2" + +#define UNO_NAME_PARA_STYLEHEADING "ParaStyleHeading" +#define UNO_NAME_PARA_STYLELEVEL1 "ParaStyleLevel1" +#define UNO_NAME_PARA_STYLELEVEL10 "ParaStyleLevel10" +#define UNO_NAME_PARA_STYLELEVEL2 "ParaStyleLevel2" +#define UNO_NAME_PARA_STYLELEVEL3 "ParaStyleLevel3" +#define UNO_NAME_PARA_STYLELEVEL4 "ParaStyleLevel4" +#define UNO_NAME_PARA_STYLELEVEL5 "ParaStyleLevel5" +#define UNO_NAME_PARA_STYLELEVEL6 "ParaStyleLevel6" +#define UNO_NAME_PARA_STYLELEVEL7 "ParaStyleLevel7" +#define UNO_NAME_PARA_STYLELEVEL8 "ParaStyleLevel8" +#define UNO_NAME_PARA_STYLELEVEL9 "ParaStyleLevel9" +#define UNO_NAME_PARA_STYLESEPARATOR "ParaStyleSeparator" +#define UNO_NAME_MACRO_LIBRARY "MacroLibrary" +#define UNO_NAME_CELL_NAME "CellName" +#define UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES "ParaUserDefinedAttributes" +#define UNO_NAME_MERGE_LAST_PARA "MergeLastPara" +#define UNO_NAME_WRITING_MODE "WritingMode" +#define UNO_NAME_GRID_COLOR "GridColor" +#define UNO_NAME_GRID_LINES "GridLines" +#define UNO_NAME_GRID_BASE_HEIGHT "GridBaseHeight" +#define UNO_NAME_GRID_RUBY_HEIGHT "GridRubyHeight" +#define UNO_NAME_GRID_MODE "GridMode" +#define UNO_NAME_GRID_RUBY_BELOW "RubyBelow" +#define UNO_NAME_GRID_PRINT "GridPrint" +#define UNO_NAME_GRID_DISPLAY "GridDisplay" +#define UNO_NAME_SNAP_TO_GRID "SnapToGrid" +#define UNO_NAME_DONT_BALANCE_TEXT_COLUMNS "DontBalanceTextColumns" +#define UNO_NAME_IS_CURRENTLY_VISIBLE "IsCurrentlyVisible" +#define UNO_NAME_ANCHOR_POSITION "AnchorPosition" +#define UNO_NAME_TEXT_READING "TextReading" +#define UNO_NAME_PRIMARY_KEY_READING "PrimaryKeyReading" +#define UNO_NAME_SECONDARY_KEY_READING "SecondaryKeyReading" +#define UNO_NAME_BACK_GRAPHIC_TRANSPARENCY "BackGraphicTransparency" +#define UNO_NAME_BACK_COLOR_R_G_B "BackColorRGB" +#define UNO_NAME_BACK_COLOR_TRANSPARENCY "BackColorTransparency" +#define UNO_NAME_HEADER_DYNAMIC_SPACING "HeaderDynamicSpacing" +#define UNO_NAME_FOOTER_DYNAMIC_SPACING "FooterDynamicSpacing" +#define UNO_NAME_BASIC_LIBRARIES "BasicLibraries" +#define UNO_NAME_IS_FIXED_LANGUAGE "IsFixedLanguage" +#define UNO_NAME_SELECTION "Selection" +#define UNO_NAME_RESULT_SET "ResultSet" +#define UNO_NAME_CONNECTION "ActiveConnection" +#define UNO_NAME_MODEL "Model" +#define UNO_NAME_DATA_SOURCE_NAME "DataSourceName" +#define UNO_NAME_FILTER "Filter" +#define UNO_NAME_DOCUMENT_URL "DocumentURL" +#define UNO_NAME_OUTPUT_URL "OutputURL" +#define UNO_NAME_OUTPUT_TYPE "OutputType" +#define UNO_NAME_ESCAPE_PROCESSING "EscapeProcessing" +#define UNO_NAME_SINGLE_PRINT_JOBS "SinglePrintJobs" +#define UNO_NAME_FILE_NAME_FROM_COLUMN "FileNameFromColumn" +#define UNO_NAME_FILE_NAME_PREFIX "FileNamePrefix" +#define UNO_NAME_CHAR_STYLE_NAMES "CharStyleNames" +#define UNO_NAME_DAD_COMMAND "Command" /* DAD = DataAccessDescriptor (see com.sun.star.sdb.DataAccessDescriptor) */ +#define UNO_NAME_DAD_COMMAND_TYPE "CommandType" +#define UNO_NAME_CLSID "CLSID" +#define UNO_NAME_COMPONENT "Component" +#define UNO_NAME_SECT_LEFT_MARGIN "SectionLeftMargin" +#define UNO_NAME_SECT_RIGHT_MARGIN "SectionRightMargin" +#define UNO_NAME_PARA_IS_CONNECT_BORDER "ParaIsConnectBorder" +#define UNO_NAME_ITEMS "Items" +#define UNO_NAME_SELITEM "SelectedItem" +#define UNO_NAME_IS_SPLIT_ALLOWED "IsSplitAllowed" +#define UNO_NAME_CHAR_HIDDEN "CharHidden" +#define UNO_NAME_IS_FOLLOWING_TEXT_FLOW "IsFollowingTextFlow" +#define UNO_NAME_WIDTH_TYPE "WidthType" +#define UNO_NAME_SCRIPT_URL "ScriptURL" +#define UNO_NAME_RUNTIME_UID "RuntimeUID" +#define UNO_NAME_COLLAPSING_BORDERS "CollapsingBorders" +#define UNO_NAME_WRAP_INFLUENCE_ON_POSITION "WrapInfluenceOnPosition" +#define UNO_NAME_DATA_BASE_URL "DataBaseURL" +#define UNO_NAME_TRANSFORMATION_IN_HORI_L2R "TransformationInHoriL2R" +#define UNO_NAME_POSITION_LAYOUT_DIR "PositionLayoutDir" +#define UNO_NAME_NUMBERING_IS_OUTLINE "NumberingIsOutline" +#define UNO_NAME_STARTPOSITION_IN_HORI_L2R "StartPositionInHoriL2R" +#define UNO_NAME_ENDPOSITION_IN_HORI_L2R "EndPositionInHoriL2R" +#define UNO_NAME_SUBJECT "Subject" +#define UNO_NAME_ADDRESS_FROM_COLUMN "AddressFromColumn" +#define UNO_NAME_SEND_AS_HTML "SendAsHTML" +#define UNO_NAME_SEND_AS_ATTACHMENT "SendAsAttachment" +#define UNO_NAME_MAIL_BODY "MailBody" +#define UNO_NAME_ATTACHMENT_NAME "AttachmentName" +#define UNO_NAME_ATTACHMENT_FILTER "AttachmentFilter" +#define UNO_NAME_PRINT_OPTIONS "PrintOptions" +#define UNO_NAME_SAVE_AS_SINGLE_FILE "SaveAsSingleFile" +#define UNO_NAME_SAVE_FILTER "SaveFilter" +#define UNO_NAME_COPIES_TO "CopiesTo" +#define UNO_NAME_BLIND_COPIES_TO "BlindCopiesTo" +#define UNO_NAME_IN_SERVER_PASSWORD "InServerPassword" +#define UNO_NAME_OUT_SERVER_PASSWORD "OutServerPassword" +#define UNO_NAME_SAVE_FILTER_OPTIONS "SaveFilterOptions" +#define UNO_NAME_SAVE_FILTER_DATA "SaveFilterData" +#define UNO_NAME_LOCK_UPDATES "LockUpdates" +#define UNO_NAME_PAGE_COUNT "PageCount" +#define UNO_NAME_LINE_COUNT "LineCount" +#define UNO_NAME_IS_CONSTANT_SPELLCHECK "IsConstantSpellcheck" +#define UNO_NAME_IS_HIDE_SPELL_MARKS "IsHideSpellMarks" /* deprecated #i91949 */ + +#define UNO_NAME_IS_FIELD_USED "IsFieldUsed" +#define UNO_NAME_IS_FIELD_DISPLAYED "IsFieldDisplayed" +#define UNO_NAME_BUILDID "BuildId" +#define UNO_NAME_PARA_STYLE_CONDITIONS "ParaStyleConditions" +#define UNO_NAME_ROLE "Role" +#define UNO_NAME_FIELD_CODE "FieldCode" +#define UNO_NAME_HAS_VALID_SIGNATURES "HasValidSignatures" +#define UNO_NAME_CHAR_AUTO_STYLE_NAME "CharAutoStyleName" +#define UNO_NAME_PARA_AUTO_STYLE_NAME "ParaAutoStyleName" +#define UNO_NAME_LAYOUT_SIZE "LayoutSize" +#define UNO_NAME_HELP "Help" +#define UNO_NAME_TOOLTIP "Tooltip" +#define UNO_NAME_DIALOG_LIBRARIES "DialogLibraries" +#define UNO_NAME_HEADER_ROW_COUNT "HeaderRowCount" +#define UNO_NAME_INPUT "Input" +#define UNO_NAME_ROW_SPAN "RowSpan" +#define UNO_NAME_POSITION_AND_SPACE_MODE "PositionAndSpaceMode" +#define UNO_NAME_LABEL_FOLLOWED_BY "LabelFollowedBy" +#define UNO_NAME_LISTTAB_STOP_POSITION "ListtabStopPosition" +#define UNO_NAME_FIRST_LINE_INDENT "FirstLineIndent" +#define UNO_NAME_INDENT_AT "IndentAt" +#define UNO_NAME_GRID_BASE_WIDTH "GridBaseWidth" +#define UNO_NAME_GRID_SNAP_TO_CHARS "GridSnapToChars" +#define UNO_NAME_GRID_STANDARD_PAGE_MODE "StandardPageMode" +#define UNO_NAME_TABLE_BORDER_DISTANCES "TableBorderDistances" +#define UNO_NAME_LIST_ID "ListId" +#define UNO_NAME_DEFAULT_LIST_ID "DefaultListId" +#define UNO_NAME_STREAM_NAME "StreamName" +#define UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE "ContinueingPreviousSubTree" +#define UNO_NAME_PARA_LIST_LABEL_STRING "ListLabelString" +#define UNO_NAME_PARA_LIST_AUTO_FORMAT "ListAutoFormat" +#define UNO_NAME_CHAR_OVERLINE "CharOverline" +#define UNO_NAME_CHAR_OVERLINE_COLOR "CharOverlineColor" +#define UNO_NAME_CHAR_OVERLINE_HAS_COLOR "CharOverlineHasColor" +#define UNO_NAME_OUTLINE_LEVEL "OutlineLevel" +#define UNO_NAME_DESCRIPTION "Description" +#define UNO_NAME_META "InContentMetadata" +#define UNO_NAME_IS_TEMPLATE "IsTemplate" +#define UNO_NAME_VBA_DOCOBJ "VBAGlobalConstantName" +#define UNO_NAME_NESTED_TEXT_CONTENT "NestedTextContent" +#define UNO_NAME_SEPARATOR_LINE_STYLE "SeparatorLineStyle" +#define UNO_NAME_FOOTNOTE_LINE_STYLE "FootnoteLineStyle" +#define UNO_NAME_EMBEDDED_OBJECT "EmbeddedObject" +#define UNO_NAME_RSID "Rsid" +#define UNO_NAME_PARRSID "ParRsid" +#define UNO_NAME_DRAW_ASPECT "DrawAspect" +#define UNO_NAME_VISIBLE_AREA_WIDTH "VisibleAreaWidth" +#define UNO_NAME_VISIBLE_AREA_HEIGHT "VisibleAreaHeight" + +#define UNO_NAME_LINE_STYLE "LineStyle" +#define UNO_NAME_LINE_WIDTH "LineWidth" + +#define UNO_NAME_PARA_CONTEXT_MARGIN "ParaContextMargin" +#define UNO_NAME_PARAGRAPH_STYLE_NAME "ParagraphStyleName" +#define UNO_NAME_FIRST_IS_SHARED "FirstIsShared" +#define UNO_NAME_HEADER_TEXT_FIRST "HeaderTextFirst" +#define UNO_NAME_FOOTER_TEXT_FIRST "FooterTextFirst" +#define UNO_NAME_INITIALS "Initials" +#define UNO_NAME_TABLE_BORDER2 "TableBorder2" +#define UNO_NAME_REPLACEMENT_GRAPHIC "ReplacementGraphic" +#define UNO_NAME_HIDDEN "Hidden" +#define UNO_NAME_DEFAULT_PAGE_MODE "DefaultPageMode" +#define UNO_NAME_CHAR_SHADING_VALUE "CharShadingValue" +#define UNO_NAME_PARA_INTEROP_GRAB_BAG "ParaInteropGrabBag" +#define UNO_NAME_CHAR_LEFT_BORDER "CharLeftBorder" +#define UNO_NAME_CHAR_RIGHT_BORDER "CharRightBorder" +#define UNO_NAME_CHAR_TOP_BORDER "CharTopBorder" +#define UNO_NAME_CHAR_BOTTOM_BORDER "CharBottomBorder" +#define UNO_NAME_CHAR_BORDER_DISTANCE "CharBorderDistance" +#define UNO_NAME_CHAR_LEFT_BORDER_DISTANCE "CharLeftBorderDistance" +#define UNO_NAME_CHAR_RIGHT_BORDER_DISTANCE "CharRightBorderDistance" +#define UNO_NAME_CHAR_TOP_BORDER_DISTANCE "CharTopBorderDistance" +#define UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE "CharBottomBorderDistance" +#define UNO_NAME_CHAR_SHADOW_FORMAT "CharShadowFormat" +#define UNO_NAME_SHADOW_TRANSPARENCE "ShadowTransparence" +#define UNO_NAME_DOC_INTEROP_GRAB_BAG "InteropGrabBag" +#define UNO_NAME_FRAME_INTEROP_GRAB_BAG "FrameInteropGrabBag" +#define UNO_NAME_CHAR_HIGHLIGHT "CharHighlight" +#define UNO_NAME_STYLE_INTEROP_GRAB_BAG "StyleInteropGrabBag" +#define UNO_NAME_CHAR_INTEROP_GRAB_BAG "CharInteropGrabBag" +#define UNO_NAME_TEXT_VERT_ADJUST "TextVerticalAdjust" +#define UNO_NAME_CELL_INTEROP_GRAB_BAG "CellInteropGrabBag" +#define UNO_NAME_ROW_INTEROP_GRAB_BAG "RowInteropGrabBag" +#define UNO_NAME_TABLE_INTEROP_GRAB_BAG "TableInteropGrabBag" + +#define UNO_NAME_TABLE_FIRST_ROW_END_COLUMN "FirstRowEndColumn" +#define UNO_NAME_TABLE_FIRST_ROW_START_COLUMN "FirstRowStartColumn" +#define UNO_NAME_TABLE_LAST_ROW_END_COLUMN "LastRowEndColumn" +#define UNO_NAME_TABLE_LAST_ROW_START_COLUMN "LastRowStartColumn" + +#define UNO_NAME_RESOLVED "Resolved" +#define UNO_NAME_ALLOW_OVERLAP "AllowOverlap" +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoredline.hxx b/sw/inc/unoredline.hxx new file mode 100644 index 000000000..e32f181fe --- /dev/null +++ b/sw/inc/unoredline.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOREDLINE_HXX +#define INCLUDED_SW_INC_UNOREDLINE_HXX + +#include <svl/listener.hxx> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include "unotext.hxx" +#include "ndindex.hxx" + +class SwRangeRedline; + +/** + * SwXRedlineText provides an XText which may be used to write + * directly into a redline node. It got implemented to enable XML + * import of redlines and should not be used directly via the API. + */ +class SwXRedlineText final : + public SwXText, + public cppu::OWeakObject, + public css::container::XEnumerationAccess +{ + SwNodeIndex aNodeIndex; + virtual const SwStartNode *GetStartNode() const override; + +public: + SwXRedlineText(SwDoc* pDoc, const SwNodeIndex& aNodeIndex); + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) throw() override {OWeakObject::acquire();} + virtual void SAL_CALL release( ) throw() override {OWeakObject::release();} + + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + //XText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; + + //XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; + + //XElementAccess (via XEnumerationAccess) + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; +}; + +typedef cppu::WeakImplHelper<css::container::XEnumerationAccess> SwXRedlineBaseClass; + +class SwXRedline final + : public SwXRedlineBaseClass + , public SwXText + , public SvtListener +{ + SwDoc* pDoc; + SwRangeRedline* pRedline; +public: + SwXRedline(SwRangeRedline& rRedline, SwDoc& rDoc); + virtual ~SwXRedline() override; + + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) throw() override {OWeakObject::acquire();} + virtual void SAL_CALL release( ) throw() override {OWeakObject::release();} + + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + //XText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + const SwRangeRedline* GetRedline() const {return pRedline;} + virtual void Notify( const SfxHint& ) override; +}; + +namespace sw +{ + struct SW_DLLPUBLIC FindRedlineHint final: SfxHint + { + const SwRangeRedline& m_rRedline; + SwXRedline** m_ppXRedline; + FindRedlineHint(const SwRangeRedline& rRedline, SwXRedline** ppXRedline) : m_rRedline(rRedline), m_ppXRedline(ppXRedline) {} + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoredlines.hxx b/sw/inc/unoredlines.hxx new file mode 100644 index 000000000..b27488926 --- /dev/null +++ b/sw/inc/unoredlines.hxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOREDLINES_HXX +#define INCLUDED_SW_INC_UNOREDLINES_HXX + +#include <sal/config.h> + +#include "docary.hxx" +#include "unocoll.hxx" +#include "unobaseclass.hxx" +#include <svl/listener.hxx> +#include <com/sun/star/container/XEnumerationAccess.hpp> + +class SwRangeRedline; +namespace com::sun::star::beans { class XPropertySet; } + +typedef +cppu::WeakImplHelper +< + css::container::XIndexAccess, + css::container::XEnumerationAccess, + css::lang::XServiceInfo +> +SwRedlinesBaseClass; +class SwXRedlines final : public SwRedlinesBaseClass, + public SwUnoCollection +{ + virtual ~SwXRedlines() override; +public: + SwXRedlines(SwDoc* pDoc); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XEnumerationAccess - was: XParagraphEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + static css::beans::XPropertySet* GetObject( SwRangeRedline& rRedline, SwDoc& rDoc ); +}; + +class SwXRedlineEnumeration final + : public SwSimpleEnumeration_Base + , public SvtListener +{ + SwDoc* pDoc; + SwRedlineTable::size_type nCurrentIndex; + + virtual ~SwXRedlineEnumeration() override; +public: + SwXRedlineEnumeration(SwDoc& rDoc); + + //XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements() override; + virtual css::uno::Any SAL_CALL nextElement() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + virtual void Notify( const SfxHint& ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx new file mode 100644 index 000000000..c1bba2b64 --- /dev/null +++ b/sw/inc/unosett.hxx @@ -0,0 +1,308 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOSETT_HXX +#define INCLUDED_SW_INC_UNOSETT_HXX + +#include "swtypes.hxx" +#include <com/sun/star/text/XTextColumns.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/style/VerticalAlignment.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> +#include <tools/color.hxx> +#include "unobaseclass.hxx" + +class SwDoc; +class SwFormatCol; +class SwDocShell; +class SwNumRule; +class SwNumFormat; +class SfxItemPropertySet; +namespace com::sun::star::beans { struct PropertyValue; } + +class SwXFootnoteProperties final : public cppu::WeakAggImplHelper2 +< + css::beans::XPropertySet, + css::lang::XServiceInfo +> +{ + SwDoc* m_pDoc; + const SfxItemPropertySet* m_pPropertySet; + + virtual ~SwXFootnoteProperties() override; +public: + SwXFootnoteProperties(SwDoc* pDoc); + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + void Invalidate() {m_pDoc = nullptr;} +}; + +class SwXEndnoteProperties final : public cppu::WeakAggImplHelper2 +< + css::beans::XPropertySet, + css::lang::XServiceInfo +> +{ + SwDoc* m_pDoc; + const SfxItemPropertySet* m_pPropertySet; + + virtual ~SwXEndnoteProperties() override; +public: + SwXEndnoteProperties(SwDoc* pDoc); + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + void Invalidate() {m_pDoc = nullptr;} +}; + +class SwXLineNumberingProperties final : public cppu::WeakAggImplHelper2 +< + css::beans::XPropertySet, + css::lang::XServiceInfo +> +{ + SwDoc* m_pDoc; + const SfxItemPropertySet* m_pPropertySet; + + virtual ~SwXLineNumberingProperties() override; +public: + SwXLineNumberingProperties(SwDoc* pDoc); + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + void Invalidate() {m_pDoc = nullptr;} +}; + +class SwXNumberingRules : public cppu::WeakAggImplHelper5 +< + css::container::XIndexReplace, + css::lang::XUnoTunnel, + css::beans::XPropertySet, + css::container::XNamed, + css::lang::XServiceInfo +> +{ +private: + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + OUString m_sNewCharStyleNames[MAXLEVEL]; + OUString m_sNewBulletFontNames[MAXLEVEL]; + OUString m_sCreatedNumRuleName; //connects to a numbering in SwDoc + SwDoc* m_pDoc; + SwDocShell* m_pDocShell; // Only if used as chapter numbering. + SwNumRule* m_pNumRule; + const SfxItemPropertySet* m_pPropertySet; + bool m_bOwnNumRuleCreated; +protected: + virtual ~SwXNumberingRules() override; + +public: + SwXNumberingRules(SwDocShell& rDocSh); // chapter numbering + SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc = nullptr); // NumRule for paragraphs, numbering styles + SwXNumberingRules(SwDoc& rDoc); //create a new instance + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XNamed + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName(const OUString& Name_) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + css::uno::Sequence< css::beans::PropertyValue> + GetNumberingRuleByIndex(const SwNumRule& rNumRule, sal_Int32 nIndex)const; + /// @throws css::uno::RuntimeException + /// @throws css::lang::IllegalArgumentException + void SetNumberingRuleByIndex(SwNumRule& rNumRule, + const css::uno::Sequence< css::beans::PropertyValue>& rProperties, sal_Int32 nIndex); + + const OUString* GetNewCharStyleNames() const {return m_sNewCharStyleNames;} + const OUString* GetBulletFontNames() const {return m_sNewBulletFontNames;} + const SwNumRule* GetNumRule() const {return m_pNumRule;} + + static bool isInvalidStyle(const OUString &rName); + void Invalidate() {m_pDocShell = nullptr;} + const OUString& GetCreatedNumRuleName() const {return m_sCreatedNumRuleName;} + + static css::uno::Sequence<css::beans::PropertyValue> GetPropertiesForNumFormat( + const SwNumFormat& rFormat, OUString const& rCharFormatName, + OUString const* pHeadingStyleName, OUString const & referer); + static void SetPropertiesToNumFormat( + SwNumFormat & aFormat, + OUString & rCharStyleName, + OUString *const pBulletFontName, + OUString *const pHeadingStyleName, + OUString *const pParagraphStyleName, + SwDoc *const pDoc, + css::uno::Sequence<css::beans::PropertyValue> const& rProperties); + +}; + +class SwXChapterNumbering final : public SwXNumberingRules +{ + + virtual ~SwXChapterNumbering() override; +public: + SwXChapterNumbering(SwDocShell& rDocSh); + + using SwXNumberingRules::Invalidate; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXTextColumns final : public cppu::WeakAggImplHelper4 +< + + css::lang::XUnoTunnel, + css::beans::XPropertySet, + css::text::XTextColumns, + css::lang::XServiceInfo +> +{ + sal_Int32 m_nReference; + css::uno::Sequence< css::text::TextColumn> m_aTextColumns; + bool m_bIsAutomaticWidth; + sal_Int32 m_nAutoDistance; + + const SfxItemPropertySet* m_pPropSet; + + //separator line + sal_Int32 m_nSepLineWidth; + Color m_nSepLineColor; + sal_Int8 m_nSepLineHeightRelative; + css::style::VerticalAlignment m_nSepLineVertAlign; + bool m_bSepLineIsOn; + sal_Int8 m_nSepLineStyle; + + + virtual ~SwXTextColumns() override; +public: + SwXTextColumns(); + SwXTextColumns(const SwFormatCol& rFormatCol); + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XTextColumns + virtual sal_Int32 SAL_CALL getReferenceValue( ) override; + virtual sal_Int16 SAL_CALL getColumnCount( ) override; + virtual void SAL_CALL setColumnCount( sal_Int16 nColumns ) override; + virtual css::uno::Sequence< css::text::TextColumn > SAL_CALL getColumns( ) override; + virtual void SAL_CALL setColumns( const css::uno::Sequence< css::text::TextColumn >& Columns ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + sal_Int32 GetSepLineWidth() const {return m_nSepLineWidth;} + Color GetSepLineColor() const {return m_nSepLineColor;} + sal_Int8 GetSepLineHeightRelative() const {return m_nSepLineHeightRelative;} + css::style::VerticalAlignment GetSepLineVertAlign() const {return m_nSepLineVertAlign;} + bool GetSepLineIsOn() const {return m_bSepLineIsOn;} + sal_Int8 GetSepLineStyle() const {return m_nSepLineStyle;} + + bool IsAutomaticWidth() const {return m_bIsAutomaticWidth;} +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unosrch.hxx b/sw/inc/unosrch.hxx new file mode 100644 index 000000000..ac8623160 --- /dev/null +++ b/sw/inc/unosrch.hxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOSRCH_HXX +#define INCLUDED_SW_INC_UNOSRCH_HXX + +#include <com/sun/star/util/XPropertyReplace.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase.hxx> +#include <rtl/ustring.hxx> +#include <memory> + +class SfxItemPropertySet; +class SwSearchProperties_Impl; +class SfxItemSet; + +namespace i18nutil { + struct SearchOptions2; +} + +class SwXTextSearch final : public cppu::WeakImplHelper +< + css::util::XPropertyReplace, + css::lang::XServiceInfo, + css::lang::XUnoTunnel +> +{ + friend class SwXTextDocument; + + OUString m_sSearchText; + OUString m_sReplaceText; + + std::unique_ptr<SwSearchProperties_Impl> m_pSearchProperties; + std::unique_ptr<SwSearchProperties_Impl> m_pReplaceProperties; + + const SfxItemPropertySet* m_pPropSet; + bool m_bAll : 1; + bool m_bWord : 1; + bool m_bBack : 1; + bool m_bExpr : 1; + bool m_bCase : 1; + bool m_bStyles:1; + bool m_bSimilarity : 1; + bool m_bLevRelax :1; + sal_Int16 m_nLevExchange; + sal_Int16 m_nLevAdd; + sal_Int16 m_nLevRemove; + + bool m_bIsValueSearch :1; + + virtual ~SwXTextSearch() override; +public: + SwXTextSearch(); + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XSearchDescriptor + virtual OUString SAL_CALL getSearchString( ) override; + virtual void SAL_CALL setSearchString( const OUString& aString ) override; + + //XReplaceDescriptor + virtual OUString SAL_CALL getReplaceString() override; + virtual void SAL_CALL setReplaceString(const OUString& aReplaceString) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XPropertyReplace + virtual sal_Bool SAL_CALL getValueSearch() override; + virtual void SAL_CALL setValueSearch(sal_Bool ValueSearch_) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getSearchAttributes() override; + virtual void SAL_CALL setSearchAttributes(const css::uno::Sequence< css::beans::PropertyValue >& aSearchAttribs) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getReplaceAttributes() override; + virtual void SAL_CALL setReplaceAttributes(const css::uno::Sequence< css::beans::PropertyValue >& aSearchAttribs) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + void FillSearchItemSet(SfxItemSet& rSet) const; + void FillReplaceItemSet(SfxItemSet& rSet) const; + + bool HasSearchAttributes() const; + bool HasReplaceAttributes() const; + + void FillSearchOptions( i18nutil::SearchOptions2& rSearchOpt ) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx new file mode 100644 index 000000000..2b29d2aa6 --- /dev/null +++ b/sw/inc/unostyle.hxx @@ -0,0 +1,396 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOSTYLE_HXX +#define INCLUDED_SW_INC_UNOSTYLE_HXX + +#include <svl/listener.hxx> +#include <svl/style.hxx> +#include "unocoll.hxx" +#include "tblafmt.hxx" +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/style/XStyleLoader.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <cppuhelper/implbase.hxx> + +#include <com/sun/star/style/XAutoStyleFamily.hpp> +#include <com/sun/star/style/XAutoStyles.hpp> +#include <com/sun/star/style/XAutoStyle.hpp> + +#include "istyleaccess.hxx" +#include <memory> +#include <map> + +namespace com::sun::star::document { class XEventsSupplier; } + +class SwDocShell; +class SwAutoStylesEnumImpl; +class SfxItemSet; + +class SwXStyleFamilies final : public cppu::WeakImplHelper +< + css::container::XIndexAccess, + css::container::XNameAccess, + css::lang::XServiceInfo, + css::style::XStyleLoader +>, + public SwUnoCollection +{ + SwDocShell* m_pDocShell; + + std::map<SfxStyleFamily, css::uno::Reference<css::container::XNameContainer>> m_vFamilies; + + virtual ~SwXStyleFamilies() override; +public: + SwXStyleFamilies(SwDocShell& rDocShell); + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XStyleLoader + virtual void SAL_CALL loadStylesFromURL(const OUString& rURL, const css::uno::Sequence< css::beans::PropertyValue >& aOptions) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getStyleLoaderOptions() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + static css::uno::Reference<css::style::XStyle> CreateStyle(SfxStyleFamily eFamily, SwDoc& rDoc); + // FIXME: This is very ugly as is the whole conditional paragraph style + // hackety. Should be folded into CreateStyle hopefully one day + static css::uno::Reference<css::style::XStyle> CreateStyleCondParagraph(SwDoc& rDoc); +}; + +namespace sw +{ + class ICoreFrameStyle + { + public: + virtual void SetItem(sal_uInt16 eAtr, const SfxPoolItem& rItem) =0; + virtual const SfxPoolItem* GetItem(sal_uInt16 eAtr) =0; + virtual css::document::XEventsSupplier& GetEventsSupplier() =0; + virtual ~ICoreFrameStyle() {}; + }; +} + +// access to all automatic style families +class SwXAutoStyles final : + public cppu::WeakImplHelper< css::style::XAutoStyles >, + public SwUnoCollection +{ + SwDocShell *m_pDocShell; + css::uno::Reference< css::style::XAutoStyleFamily > m_xAutoCharStyles; + css::uno::Reference< css::style::XAutoStyleFamily > m_xAutoRubyStyles; + css::uno::Reference< css::style::XAutoStyleFamily > m_xAutoParaStyles; + virtual ~SwXAutoStyles() override; + +public: + SwXAutoStyles(SwDocShell& rDocShell); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + +}; + +// access to a family of automatic styles (character or paragraph or ...) +class SwXAutoStyleFamily final : public cppu::WeakImplHelper< css::style::XAutoStyleFamily >, public SvtListener +{ + SwDocShell *m_pDocShell; + IStyleAccess::SwAutoStyleFamily m_eFamily; + + +public: + SwXAutoStyleFamily(SwDocShell* pDocShell, IStyleAccess::SwAutoStyleFamily eFamily); + virtual ~SwXAutoStyleFamily() override; + + //XAutoStyleFamily + virtual css::uno::Reference< css::style::XAutoStyle > SAL_CALL insertStyle( const css::uno::Sequence< css::beans::PropertyValue >& Values ) override; + + //XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + virtual void Notify( const SfxHint&) override; +}; + +class SwXAutoStylesEnumerator final : public cppu::WeakImplHelper< css::container::XEnumeration >, public SvtListener +{ + std::unique_ptr<SwAutoStylesEnumImpl> m_pImpl; +public: + SwXAutoStylesEnumerator( SwDoc* pDoc, IStyleAccess::SwAutoStyleFamily eFam ); + virtual ~SwXAutoStylesEnumerator() override; + + //XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements( ) override; + virtual css::uno::Any SAL_CALL nextElement( ) override; + + virtual void Notify( const SfxHint&) override; +}; + +// an automatic style +class SwXAutoStyle final : public cppu::WeakImplHelper +< + css::beans::XPropertySet, + css::beans::XPropertyState, + css::style::XAutoStyle +>, + public SvtListener +{ +private: + std::shared_ptr<SfxItemSet> mpSet; + IStyleAccess::SwAutoStyleFamily meFamily; + SwDoc& mrDoc; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + css::uno::Sequence< css::uno::Any > GetPropertyValues_Impl( const css::uno::Sequence< OUString >& aPropertyNames ); + +public: + + SwXAutoStyle( SwDoc* pDoc, std::shared_ptr<SfxItemSet> const & pInitSet, IStyleAccess::SwAutoStyleFamily eFam ); + virtual ~SwXAutoStyle() override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + //XMultiPropertyStates + virtual void SAL_CALL setAllPropertiesToDefault( ) override; + virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + // Special + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getProperties() override; + + virtual void Notify( const SfxHint& ) override; + +}; + +typedef std::map<OUString, sal_Int32> CellStyleNameMap; + +/// A text table style is a UNO API wrapper for a SwTableAutoFormat +class SwXTextTableStyle final : public cppu::WeakImplHelper +< + css::style::XStyle, + css::beans::XPropertySet, + css::container::XNameContainer, + css::lang::XServiceInfo +> +{ + SwDocShell* m_pDocShell; + SwTableAutoFormat* m_pTableAutoFormat; + /// Stores SwTableAutoFormat when this is not a physical style. + std::unique_ptr<SwTableAutoFormat> m_pTableAutoFormat_Impl; + /// If true, then it points to a core object, if false, then this is a created, but not-yet-inserted format. + bool m_bPhysical; + + enum { + FIRST_ROW_STYLE = 0, + LAST_ROW_STYLE, + FIRST_COLUMN_STYLE, + LAST_COLUMN_STYLE, + EVEN_ROWS_STYLE, + ODD_ROWS_STYLE, + EVEN_COLUMNS_STYLE, + ODD_COLUMNS_STYLE, + BODY_STYLE, + BACKGROUND_STYLE, + // loext namespace + FIRST_ROW_START_COLUMN_STYLE, + FIRST_ROW_END_COLUMN_STYLE, + LAST_ROW_START_COLUMN_STYLE, + LAST_ROW_END_COLUMN_STYLE, + FIRST_ROW_EVEN_COLUMN_STYLE, + LAST_ROW_EVEN_COLUMN_STYLE, + STYLE_COUNT + }; + + /// Fills m_aCellStyles with SwXTextCellStyles pointing to children of this style. + void UpdateCellStylesMapping(); + static const CellStyleNameMap& GetCellStyleNameMap(); + css::uno::Reference<css::style::XStyle> m_aCellStyles[STYLE_COUNT]; +public: + SwXTextTableStyle(SwDocShell* pDocShell, SwTableAutoFormat* pTableAutoFormat); + /// Create non physical style + SwXTextTableStyle(SwDocShell* pDocShell, const OUString& rTableAutoFormatName); + + /// This function looks for a SwTableAutoFormat with given name. Returns nullptr if could not be found. + static SwTableAutoFormat* GetTableAutoFormat(SwDocShell* pDocShell, const OUString& sName); + /// Returns box format assigned to this style + SwTableAutoFormat* GetTableFormat(); + void SetPhysical(); + + //XStyle + virtual sal_Bool SAL_CALL isUserDefined() override; + virtual sal_Bool SAL_CALL isInUse() override; + virtual OUString SAL_CALL getParentStyle() override; + virtual void SAL_CALL setParentStyle(const OUString& aParentStyle ) override; + + //XNamed + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName(const OUString& rName) override; + + //XPropertySet + virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const css::uno::Any& aValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override; + virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener) override; + virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& aListener) override; + virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override; + virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& rName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& rName) override; + + //XNameContainer + virtual void SAL_CALL insertByName(const OUString& rName, const css::uno::Any& aElement) override; + virtual void SAL_CALL replaceByName(const OUString& rName, const css::uno::Any& aElement) override; + virtual void SAL_CALL removeByName(const OUString& rName) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + static css::uno::Reference<css::style::XStyle> CreateXTextTableStyle(SwDocShell* pDocShell, const OUString& rTableAutoFormatName); +}; + +/// A text cell style is a UNO API wrapper for a SwBoxAutoFormat core class +class SwXTextCellStyle final : public cppu::WeakImplHelper +< + css::style::XStyle, + css::beans::XPropertySet, + css::beans::XPropertyState, + css::lang::XServiceInfo +> +{ + SwDocShell* m_pDocShell; + SwBoxAutoFormat* m_pBoxAutoFormat; + /// Stores SwBoxAutoFormat when this is not a physical style. + std::shared_ptr<SwBoxAutoFormat> m_pBoxAutoFormat_Impl; + OUString m_sParentStyle; + OUString m_sName; + /// If true, then it points to a core object, if false, then this is a created, but not-yet-inserted format. + bool m_bPhysical; + + public: + SwXTextCellStyle(SwDocShell* pDocShell, SwBoxAutoFormat* pBoxAutoFormat, const OUString& sParentStyle); + /// Create non physical style + SwXTextCellStyle(SwDocShell* pDocShell, const OUString& sName); + + /** + * This function looks for a SwBoxAutoFormat with given name. Parses the name and returns parent name. + * @param pDocShell pointer to a SwDocShell. + * @param sName Name of a SwBoxAutoFormat to look for. + * @param pParentName Optional output. Pointer to an OUString where parsed parent name will be returned. + * @return Pointer to a SwBoxAutoFormat, nullptr if not found. + */ + static SwBoxAutoFormat* GetBoxAutoFormat(SwDocShell* pDocShell, const OUString& sName, OUString* pParentName); + /// returns box format assigned to this style + SwBoxAutoFormat* GetBoxFormat(); + /// Sets the address of SwBoxAutoFormat this style is bound to. Usable only when style is physical. + void SetBoxFormat(SwBoxAutoFormat* pBoxFormat); + void SetPhysical(); + bool IsPhysical() const; + + //XStyle + virtual sal_Bool SAL_CALL isUserDefined() override; + virtual sal_Bool SAL_CALL isInUse() override; + virtual OUString SAL_CALL getParentStyle() override; + virtual void SAL_CALL setParentStyle(const OUString& aParentStyle ) override; + + //XNamed + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName(const OUString& sName) override; + + //XPropertySet + virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const css::uno::Any& aValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override; + virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener) override; + virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& aListener) override; + virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override; + virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override; + + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString& PropertyName) override; + virtual css::uno::Sequence<css::beans::PropertyState> SAL_CALL getPropertyStates(const css::uno::Sequence< OUString >& aPropertyName) override; + virtual void SAL_CALL setPropertyToDefault(const OUString& PropertyName) override; + virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString& aPropertyName) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + static css::uno::Reference<css::style::XStyle> CreateXTextCellStyle(SwDocShell* pDocShell, const OUString& sName); +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx new file mode 100644 index 000000000..7ec4121a9 --- /dev/null +++ b/sw/inc/unotbl.hxx @@ -0,0 +1,516 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOTBL_HXX +#define INCLUDED_SW_INC_UNOTBL_HXX + +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/util/XSortable.hpp> +#include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/text/XTextTableCursor.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/sheet/XCellRangeData.hpp> +#include <com/sun/star/table/XAutoFormattable.hpp> + +#include <cppuhelper/implbase.hxx> + +#include <comphelper/uno3.hxx> + +#include <svl/listener.hxx> + +#include "TextCursorHelper.hxx" +#include "unotext.hxx" +#include "frmfmt.hxx" +#include "unocrsr.hxx" + +class SwTable; +class SwTableBox; +class SwTableLine; +class SwTableCursor; +class SfxItemPropertySet; + +typedef +cppu::WeakImplHelper +< + css::table::XCell, + css::lang::XServiceInfo, + css::beans::XPropertySet, + css::container::XEnumerationAccess +> +SwXCellBaseClass; +class SwXCell final : public SwXCellBaseClass, + public SwXText, + public SvtListener +{ + friend void sw_setString( SwXCell &rCell, const OUString &rText, + bool bKeepNumberFormat ); + friend void sw_setValue( SwXCell &rCell, double nVal ); + + const SfxItemPropertySet* m_pPropSet; + SwTableBox* m_pBox; // only set in non-XML import + const SwStartNode* m_pStartNode; // only set in XML import + SwFrameFormat* m_pTableFormat; + + // table position where pBox was found last + size_t m_nFndPos; + css::uno::Reference<css::text::XText> m_xParentText; + static size_t const NOTFOUND = SAL_MAX_SIZE; + + virtual const SwStartNode *GetStartNode() const override; + + virtual css::uno::Reference< css::text::XTextCursor > + CreateCursor() override; + + bool IsValid() const; + + virtual ~SwXCell() override; + + virtual void Notify(const SfxHint&) override; + +public: + SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, size_t nPos); + SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode); // XML import interface + + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) throw() override; + virtual void SAL_CALL release( ) throw() override; + + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + //XCell + virtual OUString SAL_CALL getFormula( ) override; + virtual void SAL_CALL setFormula( const OUString& aFormula ) override; + virtual double SAL_CALL getValue( ) override; + /// @throws css::uno::RuntimeException + double getValue( ) const + { return const_cast<SwXCell*>(this)->getValue(); }; + virtual void SAL_CALL setValue( double nValue ) override; + virtual css::table::CellContentType SAL_CALL getType( ) override; + virtual sal_Int32 SAL_CALL getError( ) override; + + //XText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > & aTextPosition) override; + virtual void SAL_CALL setString(const OUString& aString) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + //XEnumerationAccess - was: XParagraphEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + SwTableBox* GetTableBox() const { return m_pBox; } + static SwXCell* CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr ); + SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox); + SwFrameFormat* GetFrameFormat() const { return m_pTableFormat; } + double GetForcedNumericalValue() const; + css::uno::Any GetAny() const; +}; + +class SwXTextTableRow final + : public cppu::WeakImplHelper<css::beans::XPropertySet, css::lang::XServiceInfo> + , public SvtListener +{ + SwFrameFormat* m_pFormat; + SwTableLine* pLine; + const SfxItemPropertySet* m_pPropSet; + + SwFrameFormat* GetFrameFormat() { return m_pFormat; } + const SwFrameFormat* GetFrameFormat() const { return m_pFormat; } + virtual ~SwXTextTableRow() override; + +public: + SwXTextTableRow(SwFrameFormat* pFormat, SwTableLine* pLine); + + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + static SwTableLine* FindLine(SwTable* pTable, SwTableLine const * pLine); + + void Notify(const SfxHint&) override; +}; + +typedef cppu::WeakImplHelper< + css::text::XTextTableCursor, + css::lang::XServiceInfo, + css::beans::XPropertySet> SwXTextTableCursor_Base; +class SW_DLLPUBLIC SwXTextTableCursor final + : public SwXTextTableCursor_Base + , public SvtListener + , public OTextCursorHelper +{ + SwFrameFormat* m_pFrameFormat; + const SfxItemPropertySet* m_pPropSet; + +public: + SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const* pBox); + SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection); + DECLARE_XINTERFACE() + + //XTextTableCursor + virtual OUString SAL_CALL getRangeName() override; + virtual sal_Bool SAL_CALL gotoCellByName( const OUString& aCellName, sal_Bool bExpand ) override; + virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual sal_Bool SAL_CALL goUp( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual sal_Bool SAL_CALL goDown( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual void SAL_CALL gotoStart( sal_Bool bExpand ) override; + virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) override; + virtual sal_Bool SAL_CALL mergeRange() override; + virtual sal_Bool SAL_CALL splitRange( sal_Int16 Count, sal_Bool Horizontal ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + + // ITextCursorHelper + virtual const SwPaM* GetPaM() const override; + virtual SwPaM* GetPaM() override; + virtual const SwDoc* GetDoc() const override; + virtual SwDoc* GetDoc() override; + + virtual void Notify( const SfxHint& ) override; + + const SwUnoCursor& GetCursor() const; + SwUnoCursor& GetCursor(); + sw::UnoCursorPointer m_pUnoCursor; + SwFrameFormat* GetFrameFormat() const { return m_pFrameFormat; } +}; + +struct SwRangeDescriptor +{ + sal_Int32 nTop; + sal_Int32 nLeft; + sal_Int32 nBottom; + sal_Int32 nRight; + + void Normalize(); +}; + +class SAL_DLLPUBLIC_RTTI SwXTextTable final : public cppu::WeakImplHelper +< + css::text::XTextTable, + css::lang::XServiceInfo, + css::table::XCellRange, + css::chart::XChartDataArray, + css::beans::XPropertySet, + css::container::XNamed, + css::table::XAutoFormattable, + css::util::XSortable, + css::lang::XUnoTunnel, + css::sheet::XCellRangeData +> +{ +private: + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + SwXTextTable(); + SwXTextTable(SwFrameFormat& rFrameFormat); + virtual ~SwXTextTable() override; + +public: + static css::uno::Reference<css::text::XTextTable> + CreateXTextTable(SwFrameFormat * pFrameFormat); + + SW_DLLPUBLIC static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + SW_DLLPUBLIC static void GetCellPosition(const OUString& rCellName, sal_Int32& o_rColumn, sal_Int32& o_rRow); + + SW_DLLPUBLIC SwFrameFormat* GetFrameFormat(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + + //XTextTable + virtual void SAL_CALL initialize( sal_Int32 nRows, sal_Int32 nColumns ) override; + virtual css::uno::Reference< css::table::XTableRows > SAL_CALL getRows( ) override; + virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL getColumns( ) override; + virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByName( const OUString& aCellName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getCellNames( ) override; + virtual css::uno::Reference< css::text::XTextTableCursor > SAL_CALL createCursorByCellName( const OUString& aCellName ) override; + + //XTextContent + virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override; + + //XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; + + //XCellRange + virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override; + virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) override; + virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByName( const OUString& aRange ) override; + + //XChartDataArray + virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData( ) override; + virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions( ) override; + virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions( ) override; + virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override; + + //XChartData + virtual void SAL_CALL addChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; + virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; + virtual double SAL_CALL getNotANumber( ) override; + virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override; + + //XSortable + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL createSortDescriptor() override; + virtual void SAL_CALL sort(const css::uno::Sequence< css::beans::PropertyValue >& xDescriptor) override; + + //XAutoFormattable + virtual void SAL_CALL autoFormat(const OUString& aName) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XNamed + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName(const OUString& Name_) override; + + //XCellRangeData + virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray( ) override; + virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXCellRange final : public cppu::WeakImplHelper +< + css::table::XCellRange, + css::lang::XServiceInfo, + css::lang::XUnoTunnel, + css::beans::XPropertySet, + css::chart::XChartDataArray, + css::util::XSortable, + css::sheet::XCellRangeData +> +{ +private: + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + SwXCellRange(const sw::UnoCursorPointer& pCursor, SwFrameFormat& rFrameFormat, SwRangeDescriptor const & rDesc); + virtual ~SwXCellRange() override; + +public: + static ::rtl::Reference<SwXCellRange> CreateXCellRange( + const sw::UnoCursorPointer& pCursor, SwFrameFormat& rFrameFormat, + SwRangeDescriptor const & rDesc); + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + void SetLabels(bool bFirstRowAsLabel, bool bFirstColumnAsLabel); + + std::vector<css::uno::Reference<css::table::XCell>> GetCells(); + + const SwUnoCursor* GetTableCursor() const; + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XCellRange + virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override; + virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) override; + virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByName( const OUString& aRange ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const css::uno::Any& aValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XChartData + virtual void SAL_CALL addChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; + virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; + virtual double SAL_CALL getNotANumber( ) override; + virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override; + + //XChartDataArray + virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData( ) override; + virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions( ) override; + virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions( ) override; + virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override; + + //XSortable + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL createSortDescriptor() override; + virtual void SAL_CALL sort(const css::uno::Sequence< css::beans::PropertyValue >& xDescriptor) override; + + //XCellRangeData + virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray( ) override; + virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXTableRows final : public cppu::WeakImplHelper +< + css::table::XTableRows, + css::lang::XServiceInfo +> +{ + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + SwFrameFormat* GetFrameFormat(); + const SwFrameFormat* GetFrameFormat() const { return const_cast<SwXTableRows*>(this)->GetFrameFormat(); } + virtual ~SwXTableRows() override; + +public: + SwXTableRows(SwFrameFormat& rFrameFormat); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XTableRows + virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; + virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + +class SwXTableColumns final : public cppu::WeakImplHelper +< + css::table::XTableColumns, + css::lang::XServiceInfo +> +{ +private: + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + SwFrameFormat* GetFrameFormat() const; + + virtual ~SwXTableColumns() override; +public: + SwXTableColumns(SwFrameFormat& rFrameFormat); + + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XTableColumns + virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; + virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + +int sw_CompareCellRanges( + const OUString &rRange1StartCell, const OUString &rRange1EndCell, + const OUString &rRange2StartCell, const OUString &rRange2EndCell, + bool bCmpColsFirst ); + +void sw_NormalizeRange( OUString &rCell1, OUString &rCell2 ); + +OUString sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow ); + +int sw_CompareCellsByColFirst( const OUString &rCellName1, const OUString &rCellName2 ); + +int sw_CompareCellsByRowFirst( const OUString &rCellName1, const OUString &rCellName2 ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx new file mode 100644 index 000000000..14d61a548 --- /dev/null +++ b/sw/inc/unotext.hxx @@ -0,0 +1,239 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOTEXT_HXX +#define INCLUDED_SW_INC_UNOTEXT_HXX + +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/text/XTextCopy.hpp> +#include <com/sun/star/text/XTextRangeCompare.hpp> +#include <com/sun/star/text/XRelativeTextContentInsert.hpp> +#include <com/sun/star/text/XRelativeTextContentRemove.hpp> +#include <com/sun/star/text/XTextAppendAndConvert.hpp> + +#include "unobaseclass.hxx" + +namespace com::sun::star { + namespace text { + class XTextContent; + class XText; + } +} + +class SwDoc; +class SwStartNode; +class SwPaM; + +class SwXText + : public css::lang::XTypeProvider + , public css::lang::XUnoTunnel + , public css::beans::XPropertySet + , public css::text::XTextAppendAndConvert + , public css::text::XTextCopy + , public css::text::XTextRangeCompare + , public css::text::XRelativeTextContentInsert + , public css::text::XRelativeTextContentRemove +{ + +private: + + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + virtual void PrepareForAttach( + css::uno::Reference< css::text::XTextRange > & xRange, + SwPaM const & rPam); + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::RuntimeException + virtual bool CheckForOwnMemberMeta( + const SwPaM & rPam, const bool bAbsorb); + +protected: + + bool IsValid() const; + void Invalidate(); + void SetDoc(SwDoc *const pDoc); + + virtual ~SwXText(); + +public: /*not protected because C++ is retarded*/ + virtual const SwStartNode *GetStartNode() const; + +public: + + SwXText(SwDoc *const pDoc, const CursorType eType); + + const SwDoc* GetDoc() const; + SwDoc* GetDoc(); + + /// @throws css::uno::RuntimeException + virtual css::uno::Reference< css::text::XTextCursor > + CreateCursor(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( + const css::uno::Type& rType) override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > + SAL_CALL getTypes() override; + + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( + const css::uno::Sequence< sal_Int8 >& rIdentifier) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue( + const OUString& rPropertyName, + const css::uno::Any& rValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue( + const OUString& rPropertyName) override; + virtual void SAL_CALL addPropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< + css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL removePropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL addVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; + virtual void SAL_CALL removeVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; + + // XTextRange + virtual css::uno::Reference< css::text::XText > + SAL_CALL getText() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString(const OUString& rString) override; + + // XSimpleText + virtual void SAL_CALL insertString( + const css::uno::Reference< css::text::XTextRange > & xRange, + const OUString& aString, sal_Bool bAbsorb) override; + virtual void SAL_CALL insertControlCharacter( + const css::uno::Reference< css::text::XTextRange > & xRange, + sal_Int16 nControlCharacter, sal_Bool bAbsorb) override; + + // XText + virtual void SAL_CALL insertTextContent( + const css::uno::Reference< css::text::XTextRange > & xRange, + const css::uno::Reference< css::text::XTextContent > & xContent, + sal_Bool bAbsorb) override; + virtual void SAL_CALL removeTextContent( + const css::uno::Reference< css::text::XTextContent > & xContent) override; + + // XParagraphAppend + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL + finishParagraph( + const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL + finishParagraphInsert( + const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, + const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override; + + // XTextPortionAppend + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL + appendTextPortion( + const OUString& rText, + const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override; + + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL + insertTextPortion( + const OUString& rText, + const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, + const css::uno::Reference< css::text::XTextRange >& rTextRange) override; + + // XTextContentAppend + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL + appendTextContent( + const css::uno::Reference< css::text::XTextContent >& xTextContent, + const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL + insertTextContentWithProperties( + const css::uno::Reference< css::text::XTextContent >& xTextContent, + const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, + const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override; + + // XTextConvert + virtual css::uno::Reference< css::text::XTextContent > SAL_CALL + convertToTextFrame( + const css::uno::Reference< css::text::XTextRange >& xStart, + const css::uno::Reference< css::text::XTextRange >& xEnd, + const css::uno::Sequence< css::beans::PropertyValue >& xFrameProperties) override; + virtual css::uno::Reference< + css::text::XTextTable > SAL_CALL + convertToTable( + css::uno::Sequence< + css::uno::Sequence< + css::uno::Sequence< + css::uno::Reference< + css::text::XTextRange > > > > const& + rTableRanges, + css::uno::Sequence< + css::uno::Sequence< + css::uno::Sequence< + css::beans::PropertyValue > > > const& + rCellProperties, + css::uno::Sequence< + css::uno::Sequence< + css::beans::PropertyValue > > const& + rRowProperties, + css::uno::Sequence< + css::beans::PropertyValue > const& + rTableProperties) override; + + // XTextCopy + virtual void SAL_CALL copyText( + const css::uno::Reference< css::text::XTextCopy >& xSource ) override; + + // XTextRangeCompare + sal_Int16 SAL_CALL compareRegionStarts( + const css::uno::Reference< css::text::XTextRange >& xR1, + const css::uno::Reference< css::text::XTextRange >& xR2) override; + sal_Int16 SAL_CALL compareRegionEnds( + const css::uno::Reference< css::text::XTextRange >& xR1, + const css::uno::Reference< css::text::XTextRange >& xR2) override; + + // XRelativeTextContentInsert + virtual void SAL_CALL insertTextContentBefore( + const css::uno::Reference< css::text::XTextContent>& xNewContent, + const css::uno::Reference< css::text::XTextContent>& xSuccessor) override; + virtual void SAL_CALL insertTextContentAfter( + const css::uno::Reference< css::text::XTextContent>& xNewContent, + const css::uno::Reference< css::text::XTextContent>& xPredecessor) override; + + // XRelativeTextContentRemove + virtual void SAL_CALL removeTextContentBefore( + const css::uno::Reference< css::text::XTextContent>& xSuccessor) override; + virtual void SAL_CALL removeTextContentAfter( + const css::uno::Reference< css::text::XTextContent>& xPredecessor) override; +}; + +#endif // INCLUDED_SW_INC_UNOTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotextbodyhf.hxx b/sw/inc/unotextbodyhf.hxx new file mode 100644 index 000000000..5b3c518e7 --- /dev/null +++ b/sw/inc/unotextbodyhf.hxx @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOTEXTBODYHF_HXX +#define INCLUDED_SW_INC_UNOTEXTBODYHF_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> + +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implbase2.hxx> + +#include "unotext.hxx" + +class SwDoc; +class SwFrameFormat; +class SwXTextCursor; + +typedef ::cppu::WeakAggImplHelper2 +< css::lang::XServiceInfo +, css::container::XEnumerationAccess +> SwXBodyText_Base; + +class SwXBodyText final + : public SwXBodyText_Base + , public SwXText +{ + + virtual ~SwXBodyText() override; + +public: + + SwXBodyText(SwDoc *const pDoc); + + SwXTextCursor * CreateTextCursor(const bool bIgnoreTables = false); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( + const css::uno::Type& rType) override; + virtual void SAL_CALL acquire() throw() override { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw() override { OWeakObject::release(); } + + // XAggregation + virtual css::uno::Any SAL_CALL queryAggregation( + const css::uno::Type& rType) override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > + SAL_CALL getTypes() override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL + getImplementationId() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createEnumeration() override; + + // XSimpleText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL + createTextCursor() override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL + createTextCursorByRange( + const css::uno::Reference< css::text::XTextRange > & xTextPosition) override; + +}; + +typedef ::cppu::WeakImplHelper +< css::lang::XServiceInfo +, css::container::XEnumerationAccess +> SwXHeadFootText_Base; + +class SwXHeadFootText final + : public SwXHeadFootText_Base + , public SwXText +{ + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + virtual const SwStartNode *GetStartNode() const override; + virtual css::uno::Reference< css::text::XTextCursor > + CreateCursor() override; + + virtual ~SwXHeadFootText() override; + + SwXHeadFootText(SwFrameFormat & rHeadFootFormat, const bool bIsHeader); + +public: + + static css::uno::Reference< css::text::XText > + CreateXHeadFootText(SwFrameFormat & rHeadFootFormat, const bool bIsHeader); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( + const css::uno::Type& rType) override; + virtual void SAL_CALL acquire() throw() override { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw() override { OWeakObject::release(); } + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > + SAL_CALL getTypes() override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL + getImplementationId() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createEnumeration() override; + + // XSimpleText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL + createTextCursor() override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL + createTextCursorByRange( + const css::uno::Reference< css::text::XTextRange > & xTextPosition) override; + +}; + +#endif // INCLUDED_SW_INC_UNOTEXTBODYHF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx new file mode 100644 index 000000000..25cdb7d10 --- /dev/null +++ b/sw/inc/unotextcursor.hxx @@ -0,0 +1,262 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOTEXTCURSOR_HXX +#define INCLUDED_SW_INC_UNOTEXTCURSOR_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/util/XSortable.hpp> +#include <com/sun/star/document/XDocumentInsertable.hpp> +#include <com/sun/star/text/XSentenceCursor.hpp> +#include <com/sun/star/text/XWordCursor.hpp> +#include <com/sun/star/text/XParagraphCursor.hpp> +#include <com/sun/star/text/XRedline.hpp> +#include <com/sun/star/text/XMarkingAccess.hpp> + +#include <cppuhelper/implbase.hxx> + +#include <comphelper/uno3.hxx> + +#include "unobaseclass.hxx" +#include "TextCursorHelper.hxx" + +class SwDoc; +struct SwPosition; +class SwUnoCursor; + +typedef ::cppu::WeakImplHelper +< css::lang::XServiceInfo +, css::beans::XPropertySet +, css::beans::XPropertyState +, css::beans::XMultiPropertySet +, css::beans::XMultiPropertyStates +, css::container::XEnumerationAccess +, css::container::XContentEnumerationAccess +, css::util::XSortable +, css::document::XDocumentInsertable +, css::text::XSentenceCursor +, css::text::XWordCursor +, css::text::XParagraphCursor +, css::text::XRedline +, css::text::XMarkingAccess +> SwXTextCursor_Base; + +class SwXTextCursor final + : public SwXTextCursor_Base + , public OTextCursorHelper +{ + +private: + + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + virtual ~SwXTextCursor() override; + +public: + + SwXTextCursor( + SwDoc & rDoc, + css::uno::Reference< css::text::XText > const& xParent, + const CursorType eType, + SwPosition const& rPos, + SwPosition const*const pMark = nullptr); + SwXTextCursor( + css::uno::Reference< css::text::XText > const& xParent, + SwPaM const& rSourceCursor, + const CursorType eType = CursorType::All); + + SwUnoCursor& GetCursor(); + bool IsAtEndOfMeta() const; + + void DeleteAndInsert(OUString const& rText, + const bool bForceExpandHints); + + // OTextCursorHelper + virtual const SwPaM* GetPaM() const override; + virtual SwPaM* GetPaM() override; + virtual const SwDoc* GetDoc() const override; + virtual SwDoc* GetDoc() override; + + DECLARE_XINTERFACE() + + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( + const css::uno::Sequence< sal_Int8 >& rIdentifier) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue( + const OUString& rPropertyName, + const css::uno::Any& rValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue( + const OUString& rPropertyName) override; + virtual void SAL_CALL addPropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< + css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL removePropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< + css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL addVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< + css::beans::XVetoableChangeListener >& xListener) override; + virtual void SAL_CALL removeVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< + css::beans::XVetoableChangeListener >& xListener) override; + + // XPropertyState + virtual css::beans::PropertyState SAL_CALL + getPropertyState(const OUString& rPropertyName) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL + getPropertyStates( + const css::uno::Sequence< OUString >& rPropertyNames) override; + virtual void SAL_CALL setPropertyToDefault( + const OUString& rPropertyName) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( + const OUString& rPropertyName) override; + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( + const css::uno::Sequence< OUString >& aPropertyNames, + const css::uno::Sequence< css::uno::Any >& aValues ) override; + + virtual css::uno::Sequence< css::uno::Any > SAL_CALL + getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + virtual void SAL_CALL addPropertiesChangeListener( + const css::uno::Sequence< OUString >& aPropertyNames, + const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + virtual void SAL_CALL removePropertiesChangeListener( + const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + virtual void SAL_CALL firePropertiesChangeEvent( + const css::uno::Sequence< OUString >& aPropertyNames, + const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + // XMultiPropertyStates + virtual void SAL_CALL setAllPropertiesToDefault() override; + virtual void SAL_CALL setPropertiesToDefault( + const css::uno::Sequence< OUString >& rPropertyNames) override; + virtual css::uno::Sequence< css::uno::Any > + SAL_CALL getPropertyDefaults( + const css::uno::Sequence< OUString >& rPropertyNames) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createEnumeration() override; + + // XContentEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createContentEnumeration(const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getAvailableServiceNames() override; + + // XSortable + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL + createSortDescriptor() override; + virtual void SAL_CALL sort( + const css::uno::Sequence< css::beans::PropertyValue >& xDescriptor) override; + + // XDocumentInsertable + virtual void SAL_CALL insertDocumentFromURL( + const OUString& rURL, + const css::uno::Sequence< css::beans::PropertyValue >& rOptions) override; + + // XTextRange + virtual css::uno::Reference< css::text::XText > + SAL_CALL getText() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString(const OUString& rString) override; + + // XTextCursor + virtual void SAL_CALL collapseToStart() override; + virtual void SAL_CALL collapseToEnd() override; + virtual sal_Bool SAL_CALL isCollapsed() override; + virtual sal_Bool SAL_CALL goLeft(sal_Int16 nCount, sal_Bool bExpand) override; + virtual sal_Bool SAL_CALL goRight(sal_Int16 nCount, sal_Bool bExpand) override; + virtual void SAL_CALL gotoStart(sal_Bool bExpand) override; + virtual void SAL_CALL gotoEnd(sal_Bool bExpand) override; + virtual void SAL_CALL gotoRange( + const css::uno::Reference< css::text::XTextRange >& xRange, + sal_Bool bExpand) override; + + // XWordCursor + virtual sal_Bool SAL_CALL isStartOfWord() override; + virtual sal_Bool SAL_CALL isEndOfWord() override; + virtual sal_Bool SAL_CALL gotoNextWord(sal_Bool bExpand) override; + virtual sal_Bool SAL_CALL gotoPreviousWord(sal_Bool bExpand) override; + virtual sal_Bool SAL_CALL gotoEndOfWord(sal_Bool bExpand) override; + virtual sal_Bool SAL_CALL gotoStartOfWord(sal_Bool bExpand) override; + + // XSentenceCursor + virtual sal_Bool SAL_CALL isStartOfSentence() override; + virtual sal_Bool SAL_CALL isEndOfSentence() override; + virtual sal_Bool SAL_CALL gotoNextSentence(sal_Bool Expand) override; + virtual sal_Bool SAL_CALL gotoPreviousSentence(sal_Bool Expand) override; + virtual sal_Bool SAL_CALL gotoStartOfSentence(sal_Bool Expand) override; + virtual sal_Bool SAL_CALL gotoEndOfSentence(sal_Bool Expand) override; + + // XParagraphCursor + virtual sal_Bool SAL_CALL isStartOfParagraph() override; + virtual sal_Bool SAL_CALL isEndOfParagraph() override; + virtual sal_Bool SAL_CALL gotoStartOfParagraph(sal_Bool Expand) override; + virtual sal_Bool SAL_CALL gotoEndOfParagraph(sal_Bool Expand) override; + virtual sal_Bool SAL_CALL gotoNextParagraph(sal_Bool Expand) override; + virtual sal_Bool SAL_CALL gotoPreviousParagraph(sal_Bool Expand) override; + + // XRedline + virtual void SAL_CALL makeRedline( + const OUString& rRedlineType, + const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties) override; + + //XMarkingAccess + virtual void SAL_CALL invalidateMarkings(::sal_Int32 nType) override; + +}; + +#endif // INCLUDED_SW_INC_UNOTEXTCURSOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx new file mode 100644 index 000000000..41a69049f --- /dev/null +++ b/sw/inc/unotextrange.hxx @@ -0,0 +1,216 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UNOTEXTRANGE_HXX +#define INCLUDED_SW_INC_UNOTEXTRANGE_HXX + +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XRedline.hpp> + +#include <cppuhelper/implbase.hxx> + +#include "pam.hxx" +#include "unobaseclass.hxx" + +class SwDoc; +class SwUnoCursor; +class SwFrameFormat; + +class SW_DLLPUBLIC SwUnoInternalPaM final + : public SwPaM +{ + +private: + SwUnoInternalPaM(const SwUnoInternalPaM&) = delete; + +public: + SwUnoInternalPaM(SwDoc& rDoc); + virtual ~SwUnoInternalPaM() override; + + SwUnoInternalPaM& operator=(const SwPaM& rPaM); +}; + +namespace sw { + + void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget); + + SW_DLLPUBLIC bool XTextRangeToSwPaM(SwUnoInternalPaM& rToFill, + const css::uno::Reference< css::text::XTextRange > & xTextRange); + + css::uno::Reference< css::text::XText > + CreateParentXText(SwDoc & rDoc, const SwPosition& rPos); + + bool GetDefaultTextContentValue(css::uno::Any& rAny, + const OUString& rPropertyName, sal_uInt16 nWID = 0); + +} // namespace sw + +typedef ::cppu::WeakImplHelper +< css::lang::XUnoTunnel +, css::lang::XServiceInfo +, css::beans::XPropertySet +, css::beans::XPropertyState +, css::container::XEnumerationAccess +, css::container::XContentEnumerationAccess +, css::text::XTextRange +, css::text::XRedline +> SwXTextRange_Base; + +class SW_DLLPUBLIC SwXTextRange final + : public SwXTextRange_Base +{ + +private: + + friend class SwXText; + + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + enum RangePosition + { + RANGE_IN_TEXT, // "ordinary" css::text::TextRange + RANGE_IN_CELL, // position created with a cell that has no uno object + RANGE_IS_TABLE, // anchor of a table + }; + + void SetPositions(SwPaM const& rPam); + //TODO: new exception type for protected content + /// @throws css::uno::RuntimeException + void DeleteAndInsert( + const OUString& rText, const bool bForceExpandHints); + void Invalidate(); + + virtual ~SwXTextRange() override; + +public: + + SwXTextRange(SwPaM const & rPam, + const css::uno::Reference< css::text::XText > & xParent, + const enum RangePosition eRange = RANGE_IN_TEXT); + // only for RANGE_IS_TABLE + SwXTextRange(SwFrameFormat& rTableFormat); + + const SwDoc& GetDoc() const; + SwDoc& GetDoc(); + bool GetPositions(SwPaM & rToFill) const; + + static css::uno::Reference< css::text::XTextRange > CreateXTextRange( + SwDoc & rDoc, + const SwPosition& rPos, const SwPosition *const pMark); + + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( + const css::uno::Sequence< sal_Int8 >& rIdentifier) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( + const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue( + const OUString& rPropertyName, + const css::uno::Any& rValue) override; + virtual css::uno::Any SAL_CALL getPropertyValue( + const OUString& rPropertyName) override; + virtual void SAL_CALL addPropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL removePropertyChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; + virtual void SAL_CALL addVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; + virtual void SAL_CALL removeVetoableChangeListener( + const OUString& rPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; + + // XPropertyState + virtual css::beans::PropertyState SAL_CALL + getPropertyState(const OUString& rPropertyName) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL + getPropertyStates( + const css::uno::Sequence< OUString >& rPropertyNames) override; + virtual void SAL_CALL setPropertyToDefault( + const OUString& rPropertyName) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( + const OUString& rPropertyName) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createEnumeration() override; + + // XContentEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL + createContentEnumeration(const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL + getAvailableServiceNames() override; + + // XTextRange + virtual css::uno::Reference< css::text::XText > + SAL_CALL getText() override; + virtual css::uno::Reference< + css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< + css::text::XTextRange > SAL_CALL getEnd() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString(const OUString& rString) override; + + // XRedline + virtual void SAL_CALL makeRedline( + const OUString& rRedlineType, + const css::uno::Sequence< css::beans::PropertyValue >& RedlineProperties) override; + +}; + +typedef ::cppu::WeakImplHelper +< css::lang::XUnoTunnel +, css::lang::XServiceInfo +, css::container::XIndexAccess +> SwXTextRanges_Base; + +struct SwXTextRanges : public SwXTextRanges_Base +{ + virtual SwUnoCursor* GetCursor() =0; + static SwXTextRanges* Create(SwPaM* const pCursor); + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); +}; + +#endif // INCLUDED_SW_INC_UNOTEXTRANGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx new file mode 100644 index 000000000..8c6a13585 --- /dev/null +++ b/sw/inc/unotxdoc.hxx @@ -0,0 +1,626 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_UNOTXDOC_HXX +#define INCLUDED_SW_INC_UNOTXDOC_HXX + +#include "swdllapi.h" +#include <sfx2/sfxbasemodel.hxx> + +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/style/XAutoStylesSupplier.hpp> +#include <com/sun/star/document/XLinkTargetSupplier.hpp> +#include <com/sun/star/document/XRedlinesSupplier.hpp> +#include <com/sun/star/text/XNumberingRulesSupplier.hpp> +#include <com/sun/star/text/XFootnotesSupplier.hpp> +#include <com/sun/star/text/XEndnotesSupplier.hpp> +#include <com/sun/star/text/XTextSectionsSupplier.hpp> +#include <com/sun/star/text/XLineNumberingProperties.hpp> +#include <com/sun/star/text/XChapterNumberingSupplier.hpp> +#include <com/sun/star/text/XPagePrintable.hpp> +#include <com/sun/star/text/XTextFieldsSupplier.hpp> +#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> +#include <com/sun/star/text/XDocumentIndexesSupplier.hpp> +#include <com/sun/star/text/XBookmarksSupplier.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> +#include <com/sun/star/text/XReferenceMarksSupplier.hpp> +#include <com/sun/star/text/XTextFramesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/util/XReplaceable.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/util/XLinkUpdate.hpp> +#include <com/sun/star/view/XRenderable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/xforms/XFormsSupplier.hpp> +#include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp> +#include <com/sun/star/document/XDocumentLanguages.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <o3tl/deleter.hxx> +#include <rtl/ref.hxx> +#include <svx/fmdmod.hxx> +#include <editeng/UnoForbiddenCharsTable.hxx> +#include <cppuhelper/implbase.hxx> +#include <vcl/ITiledRenderable.hxx> +#include <com/sun/star/tiledrendering/XTiledRenderable.hpp> +#include <com/sun/star/text/XPasteBroadcaster.hpp> + +#include "unobaseclass.hxx" +#include "viewopt.hxx" + +#include <deque> + +class SwDoc; +class SwDocShell; +class UnoActionContext; +class SwXBodyText; +class SwXDrawPage; +class SwUnoCursor; +class SwXDocumentPropertyHelper; +class SfxViewFrame; +class SfxViewShell; +class SwPrintUIOptions; +class SwPrintData; +class SwRenderData; +class SwViewShell; +class SfxItemPropertySet; +namespace com::sun::star::container { class XNameContainer; } +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::lang { struct Locale; } +namespace com::sun::star::uno { class XAggregation; } + +namespace com::sun::star::util { class XReplaceDescriptor; } + +typedef cppu::WeakImplHelper +< + css::text::XTextDocument, + css::text::XLineNumberingProperties, + css::text::XChapterNumberingSupplier, + css::text::XNumberingRulesSupplier, + css::text::XFootnotesSupplier, + css::text::XEndnotesSupplier, + css::util::XReplaceable, + css::text::XPagePrintable, + css::text::XReferenceMarksSupplier, + css::text::XTextTablesSupplier, + css::text::XTextFramesSupplier, + css::text::XBookmarksSupplier, + css::text::XTextSectionsSupplier, + css::text::XTextGraphicObjectsSupplier, + css::text::XTextEmbeddedObjectsSupplier, + css::text::XTextFieldsSupplier, + css::style::XStyleFamiliesSupplier, + css::style::XAutoStylesSupplier, + css::lang::XServiceInfo, + css::drawing::XDrawPageSupplier, + css::drawing::XDrawPagesSupplier, + css::text::XDocumentIndexesSupplier, + css::beans::XPropertySet, + css::beans::XPropertyState, + css::document::XLinkTargetSupplier, + css::document::XRedlinesSupplier, + css::util::XRefreshable, + css::util::XLinkUpdate, + css::view::XRenderable, + css::xforms::XFormsSupplier, + css::text::XFlatParagraphIteratorProvider, + css::document::XDocumentLanguages, + css::util::XCloneable, + css::text::XPasteBroadcaster +> +SwXTextDocumentBaseClass; + +class SW_DLLPUBLIC SwXTextDocument final : public SwXTextDocumentBaseClass, + public SvxFmMSFactory, + public SfxBaseModel, + public vcl::ITiledRenderable, + public css::tiledrendering::XTiledRenderable +{ +private: + class Impl; + ::sw::UnoImplPtr<Impl> m_pImpl; + + std::deque<std::unique_ptr<UnoActionContext, o3tl::default_delete<UnoActionContext>>> maActionArr; + + const SfxItemPropertySet* pPropSet; + + SwDocShell* pDocShell; + bool bObjectValid; + + SwXDrawPage* pDrawPage; + css::uno::Reference< css::drawing::XDrawPage > mxXDrawPage; + + css::uno::Reference< css::text::XText > xBodyText; + SwXBodyText* pBodyText; + css::uno::Reference< css::uno::XAggregation > xNumFormatAgg; + + css::uno::Reference< css::container::XIndexAccess > mxXNumberingRules; + css::uno::Reference< css::container::XIndexAccess > mxXFootnotes; + css::uno::Reference< css::beans::XPropertySet > mxXFootnoteSettings; + css::uno::Reference< css::container::XIndexAccess > mxXEndnotes; + css::uno::Reference< css::beans::XPropertySet > mxXEndnoteSettings; + css::uno::Reference< css::container::XNameAccess > mxXReferenceMarks; + css::uno::Reference< css::container::XEnumerationAccess > mxXTextFieldTypes; + css::uno::Reference< css::container::XNameAccess > mxXTextFieldMasters; + css::uno::Reference< css::container::XNameAccess > mxXTextSections; + css::uno::Reference< css::container::XNameAccess > mxXBookmarks; + css::uno::Reference< css::container::XNameAccess > mxXTextTables; + css::uno::Reference< css::container::XNameAccess > mxXTextFrames; + css::uno::Reference< css::container::XNameAccess > mxXGraphicObjects; + css::uno::Reference< css::container::XNameAccess > mxXEmbeddedObjects; + css::uno::Reference< css::container::XNameAccess > mxXStyleFamilies; + mutable css::uno::Reference< css::style::XAutoStyles > mxXAutoStyles; + css::uno::Reference< css::container::XIndexReplace > mxXChapterNumbering; + css::uno::Reference< css::container::XIndexAccess > mxXDocumentIndexes; + + css::uno::Reference< css::beans::XPropertySet > mxXLineNumberingProperties; + css::uno::Reference< css::container::XNameAccess > mxLinkTargetSupplier; + css::uno::Reference< css::container::XEnumerationAccess > mxXRedlines; + + //temporary frame to enable PDF export if no valid view is available + SfxViewFrame* m_pHiddenViewFrame; + rtl::Reference<SwXDocumentPropertyHelper> mxPropertyHelper; + + std::unique_ptr<SwPrintUIOptions> m_pPrintUIOptions; + std::unique_ptr<SwRenderData> m_pRenderData; + + void GetNumberFormatter(); + + css::uno::Reference<css::uno::XInterface> create( + OUString const & rServiceName, + css::uno::Sequence<css::uno::Any> const * arguments); + + // used for XRenderable implementation + SfxViewShell * GuessViewShell( /* out */ bool &rbIsSwSrcView, const css::uno::Reference< css::frame::XController >& rController = css::uno::Reference< css::frame::XController >() ); + SwDoc * GetRenderDoc( SfxViewShell *&rpView, const css::uno::Any& rSelection, bool bIsPDFExport ); + SfxViewShell * GetRenderView( bool &rbIsSwSrcView, const css::uno::Sequence< css::beans::PropertyValue >& rxOptions, bool bIsPDFExport ); + + OUString maBuildId; + + // boolean for XPagePrintable + // set in XPagePrintable::printPages(..) to indicate that the PagePrintSettings + // has to be applied in XRenderable::getRenderer(..) through which the printing + // is implemented. + bool bApplyPagePrintSettingsFromXPagePrintable; + + using SfxBaseModel::addEventListener; + using SfxBaseModel::removeEventListener; + + /** abstract SdrModel provider */ + virtual SdrModel& getSdrModelFromUnoModel() const override; + + virtual ~SwXTextDocument() override; +public: + SwXTextDocument(SwDocShell* pShell); + + void NotifyRefreshListeners(); + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) throw() override; + virtual void SAL_CALL release( ) throw() override; + + //XWeak + virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter( ) override; + + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + //XTextDocument + virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override; + virtual void SAL_CALL reformat() override; + + //XModel + virtual sal_Bool SAL_CALL attachResource( const OUString& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override; + virtual OUString SAL_CALL getURL( ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs( ) override; + virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) override; + virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) override; + virtual void SAL_CALL lockControllers( ) override; + virtual void SAL_CALL unlockControllers( ) override; + virtual sal_Bool SAL_CALL hasControllersLocked( ) override; + virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController( ) override; + virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController ) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection( ) override; + + //XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; + + //XCloseable + virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) override; + + //XLineNumberingProperties + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getLineNumberingProperties() override; + + //XChapterNumberingSupplier + virtual css::uno::Reference< css::container::XIndexReplace > SAL_CALL getChapterNumberingRules() override; + + //XNumberingRulesSupplier + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getNumberingRules() override; + + //XFootnotesSupplier + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getFootnotes() override; + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFootnoteSettings() override; + + //XEndnotesSupplier + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getEndnotes() override; + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEndnoteSettings() override; + + //XReplaceable + virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor() override; + virtual sal_Int32 SAL_CALL replaceAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override; + + //XSearchable + virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL createSearchDescriptor() override; + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL findAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findFirst(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL findNext(const css::uno::Reference< css::uno::XInterface > & xStartAt, const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override; + + //XPagePrintable + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPagePrintSettings() override; + virtual void SAL_CALL setPagePrintSettings(const css::uno::Sequence< css::beans::PropertyValue >& aSettings) override; + virtual void SAL_CALL printPages(const css::uno::Sequence< css::beans::PropertyValue >& xOptions) override; + + //XReferenceMarksSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getReferenceMarks() override; + + // css::text::XTextFieldsSupplier + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTextFields() override; + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFieldMasters() override; + + // css::text::XTextEmbeddedObjectsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getEmbeddedObjects() override; + + // css::text::XBookmarksSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks() override; + + // css::text::XTextSectionsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextSections() override; + + // css::text::XTextTablesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextTables() override; + + // css::text::XTextGraphicObjectsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGraphicObjects() override; + + // css::text::XTextFramesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFrames() override; + + //XStyleFamiliesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getStyleFamilies() override; + + //XAutoStylesSupplier + virtual css::uno::Reference< css::style::XAutoStyles > SAL_CALL getAutoStyles( ) override; + + //XMultiServiceFactory + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString& ServiceSpecifier) override; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString& ServiceSpecifier, + const css::uno::Sequence< css::uno::Any >& Arguments) override; + virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // css::drawing::XDrawPageSupplier + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override; + + // css::drawing::XDrawPagesSupplier + virtual css::uno::Reference< css::drawing::XDrawPages > SAL_CALL getDrawPages() override; + + // css::text::XDocumentIndexesSupplier + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDocumentIndexes() override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& rPropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& rPropertyNames ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& rPropertyName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& rPropertyName ) override; + + //XLinkTargetSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override; + + //XRedlinesSupplier + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getRedlines( ) override; + + // css::util::XRefreshable + virtual void SAL_CALL refresh() override; + virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) override; + virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > & l) override; + + // css::util::XLinkUpdate, + virtual void SAL_CALL updateLinks( ) override; + + // css::view::XRenderable + virtual sal_Int32 SAL_CALL getRendererCount( const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override; + virtual void SAL_CALL render( sal_Int32 nRenderer, const css::uno::Any& aSelection, const css::uno::Sequence< css::beans::PropertyValue >& xOptions ) override; + + // css::xforms::XFormsSupplier + virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getXForms( ) override; + + // css::document::XDocumentLanguages + virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getDocumentLanguages( ::sal_Int16 nScriptTypes, ::sal_Int16 nCount ) override; + + // css::text::XFlatParagraphIteratorProvider: + virtual css::uno::Reference< css::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic ) override; + + // css::util::XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // css::text::XPasteBroadcaster + void SAL_CALL addPasteEventListener( + const ::css::uno::Reference<::css::text::XPasteListener>& xListener) override; + void SAL_CALL removePasteEventListener( + const ::css::uno::Reference<::css::text::XPasteListener>& xListener) override; + + /// @see vcl::ITiledRenderable::paintTile(). + virtual void paintTile( VirtualDevice &rDevice, + int nOutputWidth, + int nOutputHeight, + int nTilePosX, + int nTilePosY, + long nTileWidth, + long nTileHeight ) override; + /// @see vcl::ITiledRenderable::getDocumentSize(). + virtual Size getDocumentSize() override; + /// @see vcl::ITiledRenderable::setPart(). + virtual void setPart(int nPart) override; + /// @see vcl::ITiledRenderable::getParts(). + virtual int getParts() override; + /// @see vcl::ITiledRenderable::getPart(). + virtual int getPart() override; + /// @see vcl::ITiledRenderable::getPartName(). + virtual OUString getPartName(int nPart) override; + /// @see vcl::ITiledRenderable::getPartHash(). + virtual OUString getPartHash(int nPart) override; + /// @see vcl::ITiledRenderable::getDocWindow(). + virtual VclPtr<vcl::Window> getDocWindow() override; + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). + virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) override; + /// @see vcl::ITiledRenderable::postKeyEvent(). + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) override; + /// @see vcl::ITiledRenderable::postMouseEvent(). + virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) override; + /// @see vcl::ITiledRenderable::setTextSelection(). + virtual void setTextSelection(int nType, int nX, int nY) override; + /// @see vcl::ITiledRenderable::getSelection(). + virtual css::uno::Reference<css::datatransfer::XTransferable> getSelection() override; + /// @see vcl::ITiledRenderable::setGraphicSelection(). + virtual void setGraphicSelection(int nType, int nX, int nY) override; + /// @see vcl::ITiledRenderable::resetSelection(). + virtual void resetSelection() override; + /// @see vcl::ITiledRenderable::getPartPageRectangles(). + virtual OUString getPartPageRectangles() override; + /// @see vcl::ITiledRenderable::setClipboard(). + virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override; + /// @see vcl::ITiledRenderable::isMimeTypeSupported(). + virtual bool isMimeTypeSupported() override; + /// @see vcl::ITiledRenderable::setClientVisibleArea(). + virtual void setClientVisibleArea(const tools::Rectangle& rRectangle) override; + /// @see vcl::ITiledRenderable::setClientZoom. + virtual void setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_) override; + /// @see vcl::ITiledRenderable::getPointer(). + virtual PointerStyle getPointer() override; + /// @see vcl::ITiledRenderable::getTrackedChanges(). + OUString getTrackedChanges() override; + /// @see vcl::ITiledRenderable::getTrackedChangeAuthors(). + OUString getTrackedChangeAuthors() override; + + OUString getRulerState() override; + /// @see vcl::ITiledRenderable::getPostIts(). + OUString getPostIts() override; + + /// @see vcl::ITiledRenderable::executeFromFieldEvent(). + virtual void executeFromFieldEvent(const StringMap& aArguments) override; + + // css::tiledrendering::XTiledRenderable + virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) override; + + void Invalidate(); + void Reactivate(SwDocShell* pNewDocShell); + SwXDocumentPropertyHelper * GetPropertyHelper (); + bool IsValid() const {return bObjectValid;} + + void InitNewDoc(); + + SwUnoCursor* CreateCursorForSearch(css::uno::Reference< css::text::XTextCursor > & xCursor); + SwUnoCursor* FindAny(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc, + css::uno::Reference< css::text::XTextCursor > & xCursor, bool bAll, + sal_Int32& nResult, + css::uno::Reference< css::uno::XInterface > const & xLastResult); + + SwDocShell* GetDocShell() {return pDocShell;} +}; + +class SwXLinkTargetSupplier final : public cppu::WeakImplHelper +< + css::container::XNameAccess, + css::lang::XServiceInfo +> +{ + SwXTextDocument* pxDoc; + OUString sTables; + OUString sFrames; + OUString sGraphics; + OUString sOLEs; + OUString sSections; + OUString sOutlines; + OUString sBookmarks; + +public: + SwXLinkTargetSupplier(SwXTextDocument& rxDoc); + virtual ~SwXLinkTargetSupplier() override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + void Invalidate() {pxDoc = nullptr;} +}; + +class SwXLinkNameAccessWrapper final : public cppu::WeakImplHelper +< + css::beans::XPropertySet, + css::container::XNameAccess, + css::lang::XServiceInfo, + css::document::XLinkTargetSupplier +> +{ + css::uno::Reference< css::container::XNameAccess > xRealAccess; + const SfxItemPropertySet* pPropSet; + const OUString sLinkSuffix; + const OUString sLinkDisplayName; + SwXTextDocument* pxDoc; + +public: + SwXLinkNameAccessWrapper(css::uno::Reference< css::container::XNameAccess > const & xAccess, + const OUString& rLinkDisplayName, const OUString& sSuffix); + SwXLinkNameAccessWrapper(SwXTextDocument& rxDoc, + const OUString& rLinkDisplayName, const OUString& sSuffix); + virtual ~SwXLinkNameAccessWrapper() override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XLinkTargetSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +}; + +class SwXOutlineTarget final : public cppu::WeakImplHelper +< + css::beans::XPropertySet, + css::lang::XServiceInfo +> +{ + const SfxItemPropertySet* pPropSet; + OUString sOutlineText; + +public: + SwXOutlineTarget(const OUString& rOutlineText); + virtual ~SwXOutlineTarget() override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + +enum class SwCreateDrawTable { + Dash = 1, Gradient, Hatch, Bitmap, TransGradient, Marker, Defaults +}; + +class SwXDocumentPropertyHelper : public SvxUnoForbiddenCharsTable +{ + css::uno::Reference < css::uno::XInterface > xDashTable; + css::uno::Reference < css::uno::XInterface > xGradientTable; + css::uno::Reference < css::uno::XInterface > xHatchTable; + css::uno::Reference < css::uno::XInterface > xBitmapTable; + css::uno::Reference < css::uno::XInterface > xTransGradientTable; + css::uno::Reference < css::uno::XInterface > xMarkerTable; + css::uno::Reference < css::uno::XInterface > xDrawDefaults; + + SwDoc* m_pDoc; +public: + SwXDocumentPropertyHelper(SwDoc& rDoc); + virtual ~SwXDocumentPropertyHelper() override; + css::uno::Reference<css::uno::XInterface> GetDrawTable(SwCreateDrawTable nWhich); + void Invalidate(); + + virtual void onChange() override; +}; + +// The class SwViewOptionAdjust_Impl is used to adjust the SwViewOption of +// the current SwViewShell so that fields are not printed as commands and +// hidden characters are always invisible. Hidden text and place holders +// should be printed according to the current print options. +// After printing the view options are restored +class SwViewOptionAdjust_Impl +{ + SwViewShell * m_pShell; + SwViewOption m_aOldViewOptions; +public: + SwViewOptionAdjust_Impl( SwViewShell& rSh, const SwViewOption &rViewOptions ); + ~SwViewOptionAdjust_Impl(); + void AdjustViewOptions( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF ); + bool checkShell( const SwViewShell& rCompare ) const + { return &rCompare == m_pShell; } + void DontTouchThatViewShellItSmellsFunny() { m_pShell = nullptr; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx new file mode 100644 index 000000000..c297ef013 --- /dev/null +++ b/sw/inc/usrfld.hxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_USRFLD_HXX +#define INCLUDED_SW_INC_USRFLD_HXX + +#include "swdllapi.h" +#include "fldbas.hxx" + +class SfxPoolItem; +class SwCalc; +class SwDoc; + +/** + * The shared part of a user field. + * + * Tracks the value, but conversion between the float and string representation + * always happens with the system locale. + */ +class SW_DLLPUBLIC SwUserFieldType final : public SwValueFieldType +{ + bool m_bValidValue : 1; + bool m_bDeleted : 1; + /// Float value type. + double m_nValue; + OUString m_aName; + /// String value type. + OUString m_aContent; + sal_uInt16 m_nType; + +public: + SwUserFieldType( SwDoc* pDocPtr, const OUString& ); + + virtual OUString GetName() const override; + virtual std::unique_ptr<SwFieldType> Copy() const override; + + OUString Expand(sal_uInt32 nFormat, sal_uInt16 nSubType, LanguageType nLng); + + OUString GetContent( sal_uInt32 nFormat = 0 ); + void SetContent( const OUString& rStr, sal_uInt32 nFormat = 0 ); + + inline bool IsValid() const; + + double GetValue(SwCalc& rCalc); // Recalculate member nValue. + inline double GetValue() const; + inline void SetValue(const double nVal); + + inline sal_uInt16 GetType() const; + inline void SetType(sal_uInt16); + + bool IsDeleted() const { return m_bDeleted; } + void SetDeleted( bool b ) { m_bDeleted = b; } + + virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override; + virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + +private: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override; +}; + +inline bool SwUserFieldType::IsValid() const + { return m_bValidValue; } + +inline double SwUserFieldType::GetValue() const + { return m_nValue; } + +inline void SwUserFieldType::SetValue(const double nVal) + { m_nValue = nVal; } + +inline sal_uInt16 SwUserFieldType::GetType() const + { return m_nType; } + +inline void SwUserFieldType::SetType(sal_uInt16 nSub) +{ + m_nType = nSub; + EnableFormat(!(nSub & nsSwGetSetExpType::GSE_STRING)); +} + +/** + * The non-shared part of a user field. + * + * Tracks the number format and the language, conversion between the float and + * string representation is independent from the system locale. + */ +class SwUserField final : public SwValueField +{ + sal_uInt16 m_nSubType; + + virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; + virtual std::unique_ptr<SwField> Copy() const override; + +public: + SwUserField(SwUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat); + + virtual sal_uInt16 GetSubType() const override; + virtual void SetSubType(sal_uInt16 nSub) override; + + virtual double GetValue() const override; + virtual void SetValue( const double& rVal ) override; + + virtual OUString GetFieldName() const override; + + // Name cannot be changed. + virtual OUString GetPar1() const override; + + // Content. + virtual OUString GetPar2() const override; + virtual void SetPar2(const OUString& rStr) override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhichId ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhichId ) override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#endif // INCLUDED_SW_INC_USRFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/utlui.hrc b/sw/inc/utlui.hrc new file mode 100644 index 000000000..3d356fc9b --- /dev/null +++ b/sw/inc/utlui.hrc @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_UTLUI_HRC +#define INCLUDED_SW_INC_UTLUI_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* RID_SHELLRES_AUTOFMTSTRS[] = +{ + NC_("RID_SHELLRES_AUTOFMTSTRS", "Remove empty paragraphs"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Use replacement table"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Correct TWo INitial CApitals"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Capitalize first letter of sentences"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace \"standard\" quotes with %1custom%2 quotes"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace Custom Styles"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Bullets replaced"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Automatic _underline_"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Automatic *bold*"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace 1/2 ... with ½ ..."), + NC_("RID_SHELLRES_AUTOFMTSTRS", "URL recognition"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace dashes"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Replace 1st... with 1^st..."), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine single line paragraphs"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body\" Style"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Hanging indent\" Style"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Text body indent\" Style"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Heading $(ARG1)\" Style"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Set \"Bullet\" or \"Numbering\" Style"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Combine paragraphs"), + NC_("RID_SHELLRES_AUTOFMTSTRS", "Add non breaking space") +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx new file mode 100644 index 000000000..2a7bc89ab --- /dev/null +++ b/sw/inc/view.hxx @@ -0,0 +1,700 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_VIEW_HXX +#define INCLUDED_SW_INC_VIEW_HXX + +#include <vcl/timer.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/objsh.hxx> +#include <editeng/svxenum.hxx> +#include <sfx2/zoomitem.hxx> +#include <svx/ruler.hxx> +#include <svx/fmshell.hxx> +#include <svx/svdobj.hxx> +#include <svl/style.hxx> +#include "swdllapi.h" +#include "swtypes.hxx" +#include "shellid.hxx" + +class SwTextFormatColl; +class SwPageDesc; +class SwFrameFormat; +class SwCharFormat; +class SwNumRule; +class SwGlossaryHdl; +class SwDrawBase; +class SvxLRSpaceItem; +class SwDocShell; +class SwScrollbar; +class SvBorder; +class Ruler; +class SvxSearchItem; +class SearchAttrItemList; +class SvxSearchDialog; +class SdrView; +class SdrPageView; +class SwEditWin; +class SwWrtShell; +class SwView_Impl; +struct SwSearchOptions; +class CommandEvent; +class InsCaptionOpt; +class SvGlobalName; +class SvtAccessibilityOptions; +class SwTransferable; +class SwMailMergeConfigItem; +class SwTextNode; // #i23726# +class SwFormatClipboard; +struct SwConversionArgs; +class GraphicFilter; +class SwPostItMgr; +enum class SotExchangeDest; +class SwCursorShell; +enum class SvxSearchCmd; +enum class SelectionType : sal_Int32; + +namespace com::sun::star::view { class XSelectionSupplier; } +namespace sfx2 { class FileDialogHelper; } +namespace sw::mark { class IFieldmark; } + +const long nLeftOfst = -370; +const long nScrollX = 30; +const long nScrollY = 30; + +#define MINZOOM 20 +#define MAXZOOM 600 + +#define MAX_MARKS 5 + +enum class ShellMode +{ + Text, + Frame, + Graphic, + Object, + Draw, + DrawForm, + DrawText, + Bezier, + ListText, + TableText, + TableListText, + Media, + ExtrudedCustomShape, + FontWork, + PostIt +}; + +// apply a template +struct SwApplyTemplate +{ + union + { + SwTextFormatColl* pTextColl; + SwPageDesc* pPageDesc; + SwFrameFormat* pFrameFormat; + SwCharFormat* pCharFormat; + SwNumRule* pNumRule; + } aColl; + + SfxStyleFamily eType; + sal_uInt16 nColor; + SwFormatClipboard* m_pFormatClipboard; + size_t nUndo; //< The initial undo stack depth. + + SwApplyTemplate() : + eType(SfxStyleFamily::None), + nColor(0), + m_pFormatClipboard(nullptr), + nUndo(0) + { + aColl.pTextColl = nullptr; + } +}; + +class SwView; + +// manage connection and disconnection of SwView and SwDocShell +class SwViewGlueDocShell +{ +private: + SwView& m_rView; +public: + SwViewGlueDocShell(SwView& rView, SwDocShell& rDocSh); + ~SwViewGlueDocShell(); +}; + +// view of a document +class SW_DLLPUBLIC SwView: public SfxViewShell +{ + friend class SwHHCWrapper; + friend class SwHyphWrapper; + friend class SwView_Impl; + friend class SwClipboardChangeListener; + + // search & replace + static SvxSearchItem *s_pSrchItem; + + static sal_uInt16 m_nMoveType; // for buttons below the scrollbar (viewmdi) + static sal_Int32 m_nActMark; // current jump mark for unknown mark + + static bool s_bExtra; + static bool s_bFound; + static bool s_bJustOpened; + + static SearchAttrItemList* s_pSearchList; + static SearchAttrItemList* s_pReplaceList; + + Timer m_aTimer; // for delayed ChgLnks during an action + OUString m_sSwViewData, + //and the new cursor position if the user double click in the PagePreview + m_sNewCursorPos; + // to support keyboard the number of the page to go to can be set too + sal_uInt16 m_nNewPage; + + sal_uInt16 m_nOldPageNum; + OUString m_sOldSectionName; + + Point m_aTabColFromDocPos; // moving table columns out of the document + SwTextNode * m_pNumRuleNodeFromDoc; // Moving indent of numrule #i23726# + + Size m_aDocSz; // current document size + tools::Rectangle m_aVisArea; // visible region + + VclPtr<SwEditWin> m_pEditWin; + std::unique_ptr<SwWrtShell> m_pWrtShell; + std::unique_ptr<SwViewGlueDocShell> m_xGlueDocShell; + + SfxShell *m_pShell; // current SubShell at the dispatcher + FmFormShell *m_pFormShell; // DB-FormShell + + std::unique_ptr<SwView_Impl> m_pViewImpl; // Impl-data for UNO + Basic + + VclPtr<SwScrollbar> m_pHScrollbar, // MDI control elements + m_pVScrollbar; + + bool m_bHScrollbarEnabled; + bool m_bVScrollbarEnabled; + + VclPtr<vcl::Window> m_pScrollFill; // dummy window for filling the lower right edge + // when both scrollbars are active + + VclPtr<SvxRuler> m_pHRuler, + m_pVRuler; + + std::unique_ptr<SwGlossaryHdl> m_pGlosHdl; // handle text block + std::unique_ptr<SwDrawBase> m_pDrawActual; + + const SwFrameFormat *m_pLastTableFormat; + + std::unique_ptr<SwFormatClipboard> m_pFormatClipboard; //holds data for format paintbrush + + std::unique_ptr<SwPostItMgr> m_pPostItMgr; + + SelectionType m_nSelectionType; + sal_uInt16 m_nPageCnt; + + // current draw mode + sal_uInt16 m_nDrawSfxId; + OUString m_sDrawCustom; //some drawing types are marked with strings! + sal_uInt16 m_nFormSfxId; + SotExchangeDest m_nLastPasteDestination; + + // save the border distance status from SwView::StateTabWin to re-use it in SwView::ExecTabWin() + sal_uInt16 m_nLeftBorderDistance; + sal_uInt16 m_nRightBorderDistance; + + SvxSearchCmd m_eLastSearchCommand; + + bool m_bWheelScrollInProgress; + + bool m_bCenterCursor : 1, + m_bTopCursor : 1, + m_bTabColFromDoc : 1, + m_bTabRowFromDoc : 1, + m_bSetTabColFromDoc : 1 , + m_bSetTabRowFromDoc : 1, + m_bAttrChgNotified : 1, + m_bAttrChgNotifiedWithRegistrations : 1, + m_bVerbsActive : 1, + m_bDrawRotate : 1, + m_bDrawSelMode : 1, + m_bShowAtResize : 1, + m_bInOuterResizePixel : 1, + m_bInInnerResizePixel : 1, + m_bPasteState : 1, + m_bPasteSpecialState : 1, + m_bInMailMerge : 1, + m_bInDtor : 1, //detect destructor to prevent creating of sub shells while closing + m_bOldShellWasPagePreview : 1, + m_bIsPreviewDoubleClick : 1, // #i114045# + m_bMakeSelectionVisible : 1; // transport the bookmark selection + bool m_bInitOnceCompleted = false; + + /// LibreOfficeKit has to force the page size for PgUp/PgDown + /// functionality based on the user's view, instead of using the m_aVisArea. + SwTwips m_nLOKPageUpDownOffset; + + // methods for searching + // set search context + SAL_DLLPRIVATE bool SearchAndWrap(bool bApi); + SAL_DLLPRIVATE bool SearchAll(); + SAL_DLLPRIVATE sal_uLong FUNC_Search( const SwSearchOptions& rOptions ); + SAL_DLLPRIVATE void Replace(); + + bool IsDocumentBorder(); + + SAL_DLLPRIVATE bool IsTextTool() const; + + DECL_DLLPRIVATE_LINK( TimeoutHdl, Timer*, void ); + + inline long GetXScroll() const; + inline long GetYScroll() const; + SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const; + SAL_DLLPRIVATE void CalcPt( Point* pPt,const tools::Rectangle& rRect, + sal_uInt16 nRangeX, + sal_uInt16 nRangeY); + + SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips& rOff) const; + SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const; + + // scrollbar movements + SAL_DLLPRIVATE bool PageUp(); + SAL_DLLPRIVATE bool PageDown(); + SAL_DLLPRIVATE bool PageUpCursor(bool bSelect); + SAL_DLLPRIVATE bool PageDownCursor(bool bSelect); + SAL_DLLPRIVATE void PhyPageUp(); + SAL_DLLPRIVATE void PhyPageDown(); + + SAL_DLLPRIVATE void CreateScrollbar( bool bHori ); + DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar*, void ); + DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar*, void ); + SAL_DLLPRIVATE bool UpdateScrollbars(); + DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void ); + SAL_DLLPRIVATE void CalcVisArea( const Size &rPixelSz ); + + // linguistics functions + SAL_DLLPRIVATE void HyphenateDocument(); + SAL_DLLPRIVATE bool IsDrawTextHyphenate(); + SAL_DLLPRIVATE void HyphenateDrawText(); + SAL_DLLPRIVATE void StartThesaurus(); + + // text conversion + SAL_DLLPRIVATE void StartTextConversion( LanguageType nSourceLang, LanguageType nTargetLang, const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive ); + + // used for spell checking and text conversion + SAL_DLLPRIVATE void SpellStart( SvxSpellArea eSpell, bool bStartDone, + bool bEndDone, SwConversionArgs *pConvArgs ); + SAL_DLLPRIVATE void SpellEnd( SwConversionArgs const *pConvArgs ); + + SAL_DLLPRIVATE void HyphStart( SvxSpellArea eSpell ); + SAL_DLLPRIVATE void SpellContext(bool bOn = true) + { m_bCenterCursor = bOn; } + + // for readonly switching + SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + SAL_DLLPRIVATE void CheckReadonlyState(); + SAL_DLLPRIVATE void CheckReadonlySelection(); + + // method for rotating PageDesc + SAL_DLLPRIVATE void SwapPageMargin(const SwPageDesc&, SvxLRSpaceItem& rLR); + + SAL_DLLPRIVATE void SetZoom_( const Size &rEditSz, + SvxZoomType eZoomType, + short nFactor, + bool bViewOnly); + SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill ); + + SAL_DLLPRIVATE void ShowAtResize(); + + SAL_DLLPRIVATE virtual void Move() override; + +public: // #i123922# Needs to be called from a 2nd place now as a helper method + SAL_DLLPRIVATE bool InsertGraphicDlg( SfxRequest& ); + +protected: + + SwView_Impl* GetViewImpl() {return m_pViewImpl.get();} + + void ImpSetVerb( SelectionType nSelType ); + + SelectionType GetSelectionType() const { return m_nSelectionType; } + void SetSelectionType(SelectionType nSet) { m_nSelectionType = nSet;} + + // for SwWebView + void SetShell( SfxShell* pS ) { m_pShell = pS; } + void SetFormShell( FmFormShell* pSh ) { m_pFormShell = pSh; } + + virtual void SelectShell(); + + virtual void Activate(bool) override; + virtual void Deactivate(bool) override; + virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override; + virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) override; + + const SwFrameFormat* GetLastTableFrameFormat() const {return m_pLastTableFormat;} + void SetLastTableFrameFormat(const SwFrameFormat* pSet) {m_pLastTableFormat = pSet;} + + // form letter execution + void GenerateFormLetter(bool bUseCurrentDocument); + + using SfxShell::GetDispatcher; + +public: + SFX_DECL_VIEWFACTORY(SwView); + SFX_DECL_INTERFACE(SW_VIEWSHELL) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SfxDispatcher &GetDispatcher(); + + void GotFocus() const; + virtual SdrView* GetDrawView() const override; + virtual bool HasUIFeature(SfxShellFeature nFeature) const override; + virtual void ShowCursor( bool bOn = true ) override; + virtual ErrCode DoVerb( long nVerb ) override; + + virtual sal_uInt16 SetPrinter( SfxPrinter* pNew, + SfxPrinterChangeFlags nDiff = SFX_PRINTER_ALL) override; + ShellMode GetShellMode() const; + + css::view::XSelectionSupplier* GetUNOObject(); + + OUString GetSelectionTextParam( bool bCompleteWords, + bool bEraseTrail ); + virtual bool HasSelection( bool bText = true ) const override; + virtual OUString GetSelectionText( bool bCompleteWords = false ) override; + virtual bool PrepareClose( bool bUI = true ) override; + virtual void MarginChanged() override; + + // replace word/selection with text from the thesaurus + // (this code has special handling for "in word" character) + void InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection ); + bool IsValidSelectionForThesaurus() const; + OUString GetThesaurusLookUpText( bool bSelection ) const; + + // immediately switch shell -> for GetSelectionObject + void StopShellTimer(); + + SwWrtShell& GetWrtShell () const { return *m_pWrtShell; } + SwWrtShell* GetWrtShellPtr() const { return m_pWrtShell.get(); } + + SwEditWin &GetEditWin() { return *m_pEditWin; } + const SwEditWin &GetEditWin () const { return *m_pEditWin; } + +#if defined(_WIN32) || defined UNX + void ScannerEventHdl(); +#endif + + // hand the handler for text blocks to the shell; create if applicable + SwGlossaryHdl* GetGlosHdl(); + + const tools::Rectangle& GetVisArea() const { return m_aVisArea; } + + bool IsScroll(const tools::Rectangle& rRect) const; + void Scroll( const tools::Rectangle& rRect, + sal_uInt16 nRangeX = USHRT_MAX, + sal_uInt16 nRangeY = USHRT_MAX); + + long SetVScrollMax(long lMax); + long SetHScrollMax(long lMax); + + void SpellError(LanguageType eLang); + bool ExecSpellPopup( const Point& rPt ); + void ExecSmartTagPopup( const Point& rPt ); + + DECL_LINK( OnlineSpellCallback, SpellCallbackInfo&, void ); + bool ExecDrwTextSpellPopup(const Point& rPt); + + void SetTabColFromDocPos( const Point &rPt ) { m_aTabColFromDocPos = rPt; } + void SetTabColFromDoc( bool b ) { m_bTabColFromDoc = b; } + bool IsTabColFromDoc() const { return m_bTabColFromDoc; } + void SetTabRowFromDoc( bool b ) { m_bTabRowFromDoc = b; } + bool IsTabRowFromDoc() const { return m_bTabRowFromDoc; } + + void SetNumRuleNodeFromDoc( SwTextNode * pNumRuleNode ) + { m_pNumRuleNodeFromDoc = pNumRuleNode; } + + void DocSzChgd( const Size& rNewSize ); + const Size& GetDocSz() const { return m_aDocSz; } + void SetVisArea( const tools::Rectangle&, bool bUpdateScrollbar = true); + void SetVisArea( const Point&, bool bUpdateScrollbar = true); + void CheckVisArea(); + + void RecheckBrowseMode(); + static SvxSearchDialog* GetSearchDialog(); + + static sal_uInt16 GetMoveType(); + static void SetMoveType(sal_uInt16 nSet); + DECL_LINK( MoveNavigationHdl, void*, void ); + static void SetActMark(sal_Int32 nSet); + + bool HandleWheelCommands( const CommandEvent& ); + + // insert frames + void InsFrameMode(sal_uInt16 nCols); + + void SetZoom( SvxZoomType eZoomType, short nFactor = 100, bool bViewOnly = false); + virtual void SetZoomFactor( const Fraction &rX, const Fraction & ) override; + + void SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly = false ); + + void ShowHScrollbar(bool bShow); + bool IsHScrollbarVisible()const; + + void ShowVScrollbar(bool bShow); + bool IsVScrollbarVisible()const; + + void EnableHScrollbar(bool bEnable); + void EnableVScrollbar(bool bEnable); + + void CreateVRuler(); + void KillVRuler(); + void CreateTab(); + void KillTab(); + + bool StatVRuler() const { return m_pVRuler->IsVisible(); } + void ChangeVRulerMetric(FieldUnit eUnit); + void GetVRulerMetric(FieldUnit& rToFill) const; + + SvxRuler& GetHRuler() { return *m_pHRuler; } + SvxRuler& GetVRuler() { return *m_pVRuler; } + void InvalidateRulerPos(); + void ChangeTabMetric(FieldUnit eUnit); + void GetHRulerMetric(FieldUnit& rToFill) const; + + // Handler + void Execute(SfxRequest&); + void ExecLingu(SfxRequest&); + void ExecDlg(SfxRequest const &); + void ExecDlgExt(SfxRequest const &); + void ExecColl(SfxRequest const &); + void ExecutePrint(SfxRequest&); + void ExecDraw(SfxRequest&); + void ExecTabWin(SfxRequest const &); + void ExecuteStatusLine(SfxRequest&); + DECL_LINK( ExecRulerClick, Ruler *, void ); + void ExecSearch(SfxRequest&); + void ExecViewOptions(SfxRequest &); + + virtual bool IsConditionalFastCall( const SfxRequest &rReq ) override; + + void StateViewOptions(SfxItemSet &); + void StateSearch(SfxItemSet &); + void GetState(SfxItemSet&); + void StateStatusLine(SfxItemSet&); + void UpdateWordCount(SfxShell*, sal_uInt16); + void ExecFormatFootnote(); + void ExecNumberingOutline(SfxItemPool &); + + // functions for drawing + void SetDrawFuncPtr(std::unique_ptr<SwDrawBase> pFuncPtr); + SwDrawBase* GetDrawFuncPtr() const { return m_pDrawActual.get(); } + void GetDrawState(SfxItemSet &rSet); + void ExitDraw(); + bool IsDrawRotate() const { return m_bDrawRotate; } + void FlipDrawRotate() { m_bDrawRotate = !m_bDrawRotate; } + bool IsDrawSelMode() const { return m_bDrawSelMode; } + void SetSelDrawSlot(); + void FlipDrawSelMode() { m_bDrawSelMode = !m_bDrawSelMode; } + void NoRotate(); // turn off rotate mode + bool EnterDrawTextMode(const Point& aDocPos); + /// Same as EnterDrawTextMode(), but takes an SdrObject instead of guessing it by document position. + bool EnterShapeDrawTextMode(SdrObject* pObject); + void LeaveDrawCreate() { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom.clear();} + bool IsDrawMode() const { return (m_nDrawSfxId != USHRT_MAX || m_nFormSfxId != USHRT_MAX); } + bool IsFormMode() const; + bool IsBezierEditMode() const; + bool AreOnlyFormsSelected() const; + bool HasOnlyObj(SdrObject const *pSdrObj, SdrInventor eObjInventor) const; + bool BeginTextEdit( SdrObject* pObj, SdrPageView* pPV=nullptr, + vcl::Window* pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false ); + bool isSignatureLineSelected() const; + bool isSignatureLineSigned() const; + bool isQRCodeSelected() const; + + void StateTabWin(SfxItemSet&); + + // attributes have changed + DECL_LINK( AttrChangedNotify, LinkParamNone*, void ); + + // form control has been activated + DECL_LINK( FormControlActivated, LinkParamNone*, void ); + + // edit links + void EditLinkDlg(); + void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId = nullptr); + void InsertCaption(const InsCaptionOpt *pOpt); + + // Async call by Core + void UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr); + + OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr); + + /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea. + void ForcePageUpDownOffset(SwTwips nTwips) + { + m_nLOKPageUpDownOffset = nTwips; + } + + // hand over Shell + SfxShell *GetCurShell() { return m_pShell; } + SwDocShell *GetDocShell(); + inline const SwDocShell *GetDocShell() const; + virtual FmFormShell *GetFormShell() override { return m_pFormShell; } + virtual const FmFormShell *GetFormShell() const override { return m_pFormShell; } + + // so that in the SubShells' DTors m_pShell can be reset if applicable + void ResetSubShell() { m_pShell = nullptr; } + + virtual void WriteUserData(OUString &, bool bBrowse = false) override; + virtual void ReadUserData(const OUString &, bool bBrowse = false) override; + virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override; + virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override; + + void SetCursorAtTop( bool bFlag, bool bCenter = false ) + { m_bTopCursor = bFlag; m_bCenterCursor = bCenter; } + + bool JumpToSwMark( const OUString& rMark ); + + long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName, + const OUString& rFilterName, sal_Int16 nVersion = 0 ); + + void ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem ); + long InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion ); + DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper *, void ); + + // status methods for clipboard. + // Status changes now notified from the clipboard. + bool IsPasteAllowed(); + bool IsPasteSpecialAllowed(); + bool IsPasteSpreadsheet(bool bHasOwnTableCopied); + + // Enable mail merge - mail merge field dialog enabled + void EnableMailMerge(); + //apply Accessibility options + void ApplyAccessibilityOptions(SvtAccessibilityOptions const & rAccessibilityOptions); + + SwView(SfxViewFrame* pFrame, SfxViewShell*); + virtual ~SwView() override; + + void NotifyDBChanged(); + + SfxObjectShellLock CreateTmpSelectionDoc(); + + void AddTransferable(SwTransferable& rTransferable); + + // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active + // or to support printing + void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rConfigItem); + std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() const; + std::shared_ptr<SwMailMergeConfigItem> EnsureMailMergeConfigItem(const SfxItemSet* pArgs = nullptr); + + void ExecFormatPaintbrush(SfxRequest const &); + void StateFormatPaintbrush(SfxItemSet &); + + // public for D&D + ErrCode InsertGraphic( const OUString &rPath, const OUString &rFilter, + bool bLink, GraphicFilter *pFlt ); + + void ExecuteScan( SfxRequest& rReq ); + + SwPostItMgr* GetPostItMgr() { return m_pPostItMgr.get();} + const SwPostItMgr* GetPostItMgr() const { return m_pPostItMgr.get();} + + // exhibition hack (MA,MBA) + void SelectShellForDrop(); + + void UpdateDocStats(); + + // methods for printing + SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override; + SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override; + SAL_DLLPRIVATE virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& rSet) override; + static SvxSearchItem* GetSearchItem() { return s_pSrchItem; } + /// See SfxViewShell::getPart(). + int getPart() const override; + /// See SfxViewShell::dumpAsXml(). + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + void SetRedlineAuthor(const OUString& rAuthor); + const OUString& GetRedlineAuthor() const; + /// See SfxViewShell::NotifyCursor(). + void NotifyCursor(SfxViewShell* pViewShell) const override; + void ShowUIElement(const OUString& sElementURL) const; + + + enum CachedStringID + { + OldGrfCat, + OldTabCat, + OldFrameCat, + OldDrwCat, + CachedStrings + }; + + OUString m_StringCache[CachedStrings]; + + const OUString& GetCachedString(CachedStringID id) + { + return m_StringCache[id]; + } + + void SetCachedString(CachedStringID id, const OUString& sStr) + { + m_StringCache[id] = sStr; + } + + const OUString& GetOldGrfCat(); + void SetOldGrfCat(const OUString& sStr); + const OUString& GetOldTabCat(); + void SetOldTabCat(const OUString& sStr); + const OUString& GetOldFrameCat(); + void SetOldFrameCat(const OUString& sStr); + const OUString& GetOldDrwCat(); + void SetOldDrwCat(const OUString& sStr); +}; + +inline long SwView::GetXScroll() const +{ + return (m_aVisArea.GetWidth() * nScrollX) / 100; +} + +inline long SwView::GetYScroll() const +{ + return (m_aVisArea.GetHeight() * nScrollY) / 100; +} + +inline const SwDocShell *SwView::GetDocShell() const +{ + return const_cast<SwView*>(this)->GetDocShell(); +} + +std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet &rOptions, + bool bPreview); + +extern bool bDocSzUpdated; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx new file mode 100644 index 000000000..f5add2b72 --- /dev/null +++ b/sw/inc/viewopt.hxx @@ -0,0 +1,672 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_SW_INC_VIEWOPT_HXX +#define INCLUDED_SW_INC_VIEWOPT_HXX + +#include <config_feature_desktop.h> + +#include <tools/gen.hxx> +#include <tools/color.hxx> + +#include <sfx2/zoomitem.hxx> +#include "swdllapi.h" + +class SwRect; +namespace vcl { class Window; } +class OutputDevice; +class SwDocShell; +namespace svtools{ class ColorConfig;} +enum class SwFillMode; + +enum class ViewOptFlags1 : sal_uInt32 { + UseHeaderFooterMenu = 0x00000001, + Tab = 0x00000002, + Blank = 0x00000004, + HardBlank = 0x00000008, + Paragraph = 0x00000010, + Linebreak = 0x00000020, + Pagebreak = 0x00000040, + Columnbreak = 0x00000080, + SoftHyph = 0x00000100, + Bookmarks = 0x00000200, + Ref = 0x00000400, + FieldName = 0x00000800, + Postits = 0x00004000, + FieldHidden = 0x00008000, + CharHidden = 0x00010000, + Graphic = 0x00020000, + Table = 0x00040000, + Draw = 0x00080000, + Control = 0x00100000, + Crosshair = 0x00400000, + Snap = 0x00800000, + Synchronize = 0x01000000, + GridVisible = 0x02000000, + OnlineSpell = 0x04000000, + ShowInlineTooltips = 0x10000000, //tooltips on tracked changes + ViewMetachars = 0x20000000, + Pageback = 0x40000000, +}; +namespace o3tl { + template<> struct typed_flags<ViewOptFlags1> : is_typed_flags<ViewOptFlags1, 0x77dfcfff> {}; +} + +enum class ViewOptCoreFlags2 { + BlackFont = 0x0001, + HiddenPara = 0x0002, + SmoothScroll = 0x0004, + CursorInProt = 0x0008, + PdfExport = 0x0010, + Printing = 0x0020, +}; +namespace o3tl { + template<> struct typed_flags<ViewOptCoreFlags2> : is_typed_flags<ViewOptCoreFlags2, 0x003f> {}; +}; + +enum class ViewOptFlags2 { + HRuler = 0x00000400, + VScrollbar = 0x00000800, + HScrollbar = 0x00001000, + VRuler = 0x00004000, + AnyRuler = 0x00008000, + Modified = 0x00010000, + KeepAspectRatio = 0x00020000, + GrfKeepZoom = 0x00040000, + ContentTips = 0x00100000, + ScrollbarTips = 0x00400000, + PrintFormat = 0x00800000, + ShadowCursor = 0x01000000, + VRulerRight = 0x02000000, + ResolvedPostits = 0x04000000, +}; +namespace o3tl { + template<> struct typed_flags<ViewOptFlags2> : is_typed_flags<ViewOptFlags2, 0x07d7dc00> {}; +}; + +// Table background. +#define TBL_DEST_CELL 0 +#define TBL_DEST_ROW 1 +#define TBL_DEST_TBL 2 + +// Appearance flags. +enum class ViewOptFlags { + NONE = 0x0000, + DocBoundaries = 0x0001, + ObjectBoundaries = 0x0002, + TableBoundaries = 0x0004, + IndexShadings = 0x0008, + Links = 0x0010, + VisitedLinks = 0x0020, + FieldShadings = 0x0040, + SectionBoundaries = 0x0080, + Shadow = 0x0100, +}; +namespace o3tl { + template<> struct typed_flags<ViewOptFlags> : is_typed_flags<ViewOptFlags, 0x01ff> {}; +} + +class SW_DLLPUBLIC SwViewOption +{ + static Color s_aDocColor; // color of document boundaries + static Color s_aDocBoundColor; // color of document boundaries + static Color s_aObjectBoundColor; // color of object boundaries + static Color s_aAppBackgroundColor; // application background + static Color s_aTableBoundColor; // color of table boundaries + static Color s_aFontColor; + static Color s_aIndexShadingsColor; // background color of indexes + static Color s_aLinksColor; + static Color s_aVisitedLinksColor; + static Color s_aDirectCursorColor; + static Color s_aTextGridColor; + static Color s_aSpellColor; // mark color of online spell checking + static Color s_aSmarttagColor; + static Color s_aFieldShadingsColor; + static Color s_aSectionBoundColor; + static Color s_aPageBreakColor; + static Color s_aScriptIndicatorColor; + static Color s_aShadowColor; + static Color s_aHeaderFooterMarkColor; + + static ViewOptFlags s_nAppearanceFlags; + static sal_uInt16 s_nPixelTwips;// 1 Pixel == ? Twips + + OUString m_sSymbolFont; // Symbolfont. + ViewOptFlags1 m_nCoreOptions; // Bits for SwViewShell. + ViewOptCoreFlags2 m_nCore2Options; // Bits for SwViewShell. + ViewOptFlags2 m_nUIOptions; // UI-Bits + Color m_aRetouchColor; // DefaultBackground for BrowseView + Size m_aSnapSize; // Describes horizontal and vertical snap. + sal_uInt16 mnViewLayoutColumns; // # columns for edit view + short m_nDivisionX; // Grid division. + short m_nDivisionY; + sal_uInt8 m_nPagePreviewRow; // Page Preview Row/Columns. + sal_uInt8 m_nPagePreviewCol; // Page Preview Row/Columns. + SwFillMode m_nShadowCursorFillMode; // FillMode for ShadowCursor. + bool m_bReadonly : 1; // Readonly-Doc. + bool m_bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents). + bool m_bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings. + bool m_bSelectionInReadonly : 1; // Determines whether selection is switched on in readonly documents. + bool mbFormView : 1; + bool mbBrowseMode : 1; + bool mbBookView : 1; // View mode for page preview. + bool mbViewLayoutBookMode : 1; // Book view mode for edit view. + bool mbHideWhitespaceMode : 1; // Hide header, footer, and pagebreak. + bool m_bShowPlaceHolderFields : 1; // Only used in printing! + mutable bool m_bIdle; + + // Scale + sal_uInt16 m_nZoom; // In percent. + SvxZoomType m_eZoom; // 'enum' for zoom. + + sal_uInt8 m_nTableDestination; // Destination for table background. + +#ifdef DBG_UTIL + // Corresponds to statements in ui/config/cfgvw.src. + bool m_bTest1 :1; // Test-flag "Layout not loading" + bool m_bTest2 :1; // Test-flag "WYSIWYG++" + bool m_bTest3 :1; // Test-flag "" + bool m_bTest4 :1; // Test-flag "WYSIWYG debug" + bool m_bTest5 :1; // Test-flag "No idle format" + bool m_bTest6 :1; // Test-flag "No screen adj" + bool m_bTest7 :1; // Test-flag "win format" + bool m_bTest8 :1; // Test-flag "" + bool m_bTest10 :1; // Test-Flag "Format by Input" +#endif + +public: + SwViewOption(); // CTOR + SwViewOption(const SwViewOption&); + ~SwViewOption(); + + static void Init( vcl::Window const *pWin ); // Initializing of static data. + + ViewOptFlags1 GetCoreOptions() const {return m_nCoreOptions;} + inline void SetUIOptions( const SwViewOption& ); + + // Options from nCoreOptions + bool IsIdle() const + { return m_bIdle; } + + // Logically this is a const function since it does not modify the viewoptions + // but only effects idle formatting. Of course that member is already implement + // in the wrong place here... Also currently there are many const modifying casts in the code + // just to call this function on otherwise const objects. Thus declaring it as const now. + void SetIdle( bool b ) const + { m_bIdle = b; } + + bool IsTab(bool bHard = false) const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Tab) && + ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } + void SetTab( bool b ) + { SetCoreOption(b, ViewOptFlags1::Tab); } + + bool IsBlank(bool bHard = false) const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Blank) && + ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } + void SetBlank( bool b ) + { SetCoreOption(b, ViewOptFlags1::Blank); } + + bool IsHardBlank() const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::HardBlank); } + void SetHardBlank( bool b ) + { SetCoreOption(b, ViewOptFlags1::HardBlank); } + + bool IsParagraph(bool bHard = false) const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Paragraph) && + ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } + void SetParagraph( bool b ) + { SetCoreOption(b, ViewOptFlags1::Paragraph); } + + void SetShowBookmarks(bool const b) + { + SetCoreOption(b, ViewOptFlags1::Bookmarks); + } + bool IsShowBookmarks(bool const bHard = false) const + { + return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Bookmarks) + && (bHard || (m_nCoreOptions & ViewOptFlags1::ViewMetachars)); + } + + bool IsLineBreak(bool bHard = false) const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Linebreak) && + ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } + void SetLineBreak( bool b ) + { SetCoreOption(b, ViewOptFlags1::Linebreak); } + + void SetPageBreak( bool b ) + { SetCoreOption(b, ViewOptFlags1::Pagebreak); } + + void SetColumnBreak( bool b) + { SetCoreOption(b, ViewOptFlags1::Columnbreak); } + + bool IsSoftHyph() const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::SoftHyph); } + void SetSoftHyph( bool b ) + { SetCoreOption(b, ViewOptFlags1::SoftHyph); } + + bool IsFieldName() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldName); } + void SetFieldName( bool b ) + { SetCoreOption(b, ViewOptFlags1::FieldName); } + + bool IsPostIts() const + { return bool(m_nCoreOptions & ViewOptFlags1::Postits); } + void SetPostIts( bool b ) + { SetCoreOption(b, ViewOptFlags1::Postits); } + + bool IsResolvedPostIts() const + { return bool(m_nUIOptions & ViewOptFlags2::ResolvedPostits); } + void SetResolvedPostIts( bool b ) + { SetUIOption(b, ViewOptFlags2::ResolvedPostits); } + + static void PaintPostIts( OutputDevice *pOut, const SwRect &rRect, + bool bIsScript ); + static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut ); + + //show/hide tooltips on tracked changes + bool IsShowInlineTooltips() const + { return bool(m_nCoreOptions & ViewOptFlags1::ShowInlineTooltips); } + void SetShowInlineTooltips( bool b ) + { SetCoreOption(b, ViewOptFlags1::ShowInlineTooltips); } + + //show/hide interactive header/footer on top/bottom of pages + bool IsUseHeaderFooterMenu() const + { return bool(m_nCoreOptions & ViewOptFlags1::UseHeaderFooterMenu ); } + void SetUseHeaderFooterMenu( bool b ) + { SetCoreOption(b, ViewOptFlags1::UseHeaderFooterMenu); } + + bool IsShowHiddenChar(bool bHard = false) const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::CharHidden) && + ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } + + void SetShowHiddenChar( bool b ) + { SetCoreOption(b, ViewOptFlags1::CharHidden); } + + bool IsShowHiddenField() const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldHidden); } + void SetShowHiddenField( bool b ) + { SetCoreOption(b, ViewOptFlags1::FieldHidden); } + + bool IsGraphic() const + { return bool(m_nCoreOptions & ViewOptFlags1::Graphic); } + void SetGraphic( bool b ) + { SetCoreOption(b, ViewOptFlags1::Graphic); } + + bool IsPageBack() const + { return bool(m_nCoreOptions & ViewOptFlags1::Pageback); } + void SetPageBack( bool b ) + { SetCoreOption(b, ViewOptFlags1::Pageback); } + + bool IsTable() const + { return bool(m_nCoreOptions & ViewOptFlags1::Table); } + void SetTable( bool b ) + { SetCoreOption(b, ViewOptFlags1::Table); } + + bool IsDraw() const + { return bool(m_nCoreOptions & ViewOptFlags1::Draw); } + void SetDraw( bool b ) + { SetCoreOption(b, ViewOptFlags1::Draw); } + + bool IsControl() const + { return bool(m_nCoreOptions & ViewOptFlags1::Control); } + void SetControl( bool b ) + { SetCoreOption(b, ViewOptFlags1::Control); } + + bool IsSnap() const + { return bool(m_nCoreOptions & ViewOptFlags1::Snap); } + void SetSnap( bool b ) + { SetCoreOption(b, ViewOptFlags1::Snap); } + + void SetSnapSize( Size const &rSz ){ m_aSnapSize = rSz; } + const Size &GetSnapSize() const { return m_aSnapSize; } + + bool IsGridVisible() const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::GridVisible); } + void SetGridVisible( bool b ) + { SetCoreOption(b, ViewOptFlags1::GridVisible); } + + bool IsOnlineSpell() const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::OnlineSpell); } + void SetOnlineSpell( bool b ); + + bool IsViewMetaChars() const + { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::ViewMetachars); } + void SetViewMetaChars( bool b) + { SetCoreOption(b, ViewOptFlags1::ViewMetachars); } + + bool IsSynchronize() const + { return bool(m_nCoreOptions & ViewOptFlags1::Synchronize); } + void SetSynchronize( bool b ) + { SetCoreOption(b, ViewOptFlags1::Synchronize); } + + bool IsCrossHair() const + { return bool(m_nCoreOptions & ViewOptFlags1::Crosshair); } + void SetCrossHair( bool b ) + { SetCoreOption(b, ViewOptFlags1::Crosshair); } + + // Options from nCore2Options + bool IsBlackFont() const + {return bool(m_nCore2Options & ViewOptCoreFlags2::BlackFont); } + + void SetBlackFont(bool b) + { SetCore2Option(b, ViewOptCoreFlags2::BlackFont); } + + bool IsShowHiddenPara() const + {return bool(m_nCore2Options & ViewOptCoreFlags2::HiddenPara); } + + void SetShowHiddenPara(bool b) + { SetCore2Option(b, ViewOptCoreFlags2::HiddenPara); } + + bool IsSmoothScroll() const + {return bool(m_nCore2Options & ViewOptCoreFlags2::SmoothScroll); } + + void SetSmoothScroll(bool b) + { SetCore2Option(b, ViewOptCoreFlags2::SmoothScroll); } + + bool IsCursorInProtectedArea() const + {return bool(m_nCore2Options & ViewOptCoreFlags2::CursorInProt); } + + void SetCursorInProtectedArea(bool b) + { SetCore2Option(b, ViewOptCoreFlags2::CursorInProt); } + + static bool IsIgnoreProtectedArea(); + + bool IsPDFExport() const + {return bool(m_nCore2Options & ViewOptCoreFlags2::PdfExport); } + + void SetPDFExport(bool b) + { SetCore2Option(b, ViewOptCoreFlags2::PdfExport); } + + bool IsPrinting() const + {return bool(m_nCore2Options & ViewOptCoreFlags2::Printing); } + + void SetPrinting(bool b) + { SetCore2Option(b, ViewOptCoreFlags2::Printing); } + + void SetCore2Option(bool b, ViewOptCoreFlags2 f) + { + if (b) + m_nCore2Options |= f; + else + m_nCore2Options &= ~f; + } + void SetCoreOption(bool b, ViewOptFlags1 f) + { + if (b) + m_nCoreOptions |= f; + else + m_nCoreOptions &= ~f; + } + + short GetDivisionX() const { return m_nDivisionX; } + void SetDivisionX( short n ){ m_nDivisionX = n; } + short GetDivisionY() const { return m_nDivisionY; } + void SetDivisionY( short n ){ m_nDivisionY = n; } + + // Default margin left and above document: 284 twips == 5.0 mm. + static constexpr sal_uInt16 defDocumentBorder = 284; + // Default gap between pages: 284 twips == 5.0 mm. + static constexpr sal_uInt16 defGapBetweenPages = 284; + // Minimum edge-to-text distance: 22 twips == 0.4 mm. + static constexpr sal_uInt16 minGapBetweenPages = 22; + + sal_uInt16 GetDocumentBorder() const { return IsWhitespaceHidden() ? minGapBetweenPages : defDocumentBorder; } + sal_uInt16 GetGapBetweenPages() const { return IsWhitespaceHidden() ? minGapBetweenPages : defGapBetweenPages; } + + sal_uInt8 GetPagePrevRow() const { return m_nPagePreviewRow; } + void SetPagePrevRow( sal_uInt8 n ) { m_nPagePreviewRow = n; } + sal_uInt8 GetPagePrevCol() const { return m_nPagePreviewCol; } + void SetPagePrevCol( sal_uInt8 n ) { m_nPagePreviewCol = n; } + bool IsReadonly() const { return m_bReadonly; } + void SetReadonly(bool bSet) { m_bReadonly = bSet; } + + bool IsSelectionInReadonly() const {return m_bSelectionInReadonly;} + void SetSelectionInReadonly(bool bSet) {m_bSelectionInReadonly = bSet;} + + bool IsFormView() const { return mbFormView; } + void SetFormView( bool bSet ) { mbFormView = bSet; } + + bool getBrowseMode() const { return mbBrowseMode; } + void setBrowseMode(bool bSet) { mbBrowseMode = bSet; } + bool IsPagePrevBookview() const { return mbBookView; } + void SetPagePrevBookview(bool bSet) { mbBookView = bSet; } + + static bool IsAutoCompleteWords(); + + bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode; } + void SetViewLayoutBookMode( bool bNew ) { mbViewLayoutBookMode = bNew; } + sal_uInt16 GetViewLayoutColumns() const { return mnViewLayoutColumns; } + void SetViewLayoutColumns( sal_uInt16 nNew ) { mnViewLayoutColumns = nNew; } + bool IsHideWhitespaceMode() const { return mbHideWhitespaceMode; } + void SetHideWhitespaceMode( bool bMode ) { mbHideWhitespaceMode = bMode; } + + /// The rules that allow for hiding whitespace. + bool CanHideWhitespace() const { return !IsMultipageView(); } + bool IsWhitespaceHidden() const { return IsHideWhitespaceMode() && !IsMultipageView(); } + bool IsMultipageView() const { return IsViewLayoutBookMode() || + GetViewLayoutColumns() == 0; } + +#ifdef DBG_UTIL + // Correspond to statements in ui/config/cfgvw.src. + bool IsTest1() const { return m_bTest1; } + bool IsTest2() const { return m_bTest2; } + bool IsTest3() const { return m_bTest3; } + bool IsTest4() const { return m_bTest4; } + bool IsTest5() const { return m_bTest5; } + bool IsTest6() const { return m_bTest6; } + bool IsTest7() const { return m_bTest7; } + bool IsTest8() const { return m_bTest8; } + bool IsTest10() const { return m_bTest10; } +#endif + + sal_uInt16 GetZoom() const { return m_nZoom; } + void SetZoom( sal_uInt16 n ){ m_nZoom = n; } + + static void DrawRect( OutputDevice* pOut, const SwRect &rRect, ::Color nCol ); + static void DrawRectPrinter( OutputDevice* pOut, const SwRect& rRect ); + + SwViewOption& operator=( const SwViewOption &rOpt ); + + // Compare methods. + bool IsEqualFlags ( const SwViewOption &rOpt ) const; + inline bool operator == ( const SwViewOption &rOpt ) const; + bool operator != ( const SwViewOption &rOpt ) const { return !(*this == rOpt); } + + // Options from nUIOptions + bool IsViewVScrollBar() const + { +#if HAVE_FEATURE_DESKTOP + return bool(m_nUIOptions & ViewOptFlags2::VScrollbar); +#else + return false; +#endif + } + bool IsViewHScrollBar() const + { +#if HAVE_FEATURE_DESKTOP + return bool(m_nUIOptions & ViewOptFlags2::HScrollbar); +#else + return false; +#endif + } + bool IsKeepRatio() const + { return bool(m_nUIOptions & ViewOptFlags2::KeepAspectRatio); } + bool IsGrfKeepZoom() const + { return bool(m_nUIOptions & ViewOptFlags2::GrfKeepZoom); } + bool IsShowContentTips() const + { return bool(m_nUIOptions & ViewOptFlags2::ContentTips); } + bool IsPrtFormat() const + { return bool(m_nUIOptions & ViewOptFlags2::PrintFormat); } + bool IsShowScrollBarTips() const + { return bool(m_nUIOptions & ViewOptFlags2::ScrollbarTips); } + + SvxZoomType GetZoomType() const { return m_eZoom; } + + sal_uInt8 GetTableDest() const { return m_nTableDestination; } + + void SetViewVScrollBar(bool b) + { SetUIOption(b, ViewOptFlags2::VScrollbar); } + void SetViewHScrollBar(bool b) + { SetUIOption(b, ViewOptFlags2::HScrollbar); } + void SetKeepRatio (bool b) + { SetUIOption(b, ViewOptFlags2::KeepAspectRatio); } + void SetGrfKeepZoom (bool b) + { SetUIOption(b, ViewOptFlags2::GrfKeepZoom); } + void SetShowContentTips( bool b) + { SetUIOption(b, ViewOptFlags2::ContentTips); } + void SetPrtFormat( bool b) + { SetUIOption(b, ViewOptFlags2::PrintFormat); } + void SetShowScrollBarTips( bool b) + { SetUIOption(b, ViewOptFlags2::ScrollbarTips); } + void SetUIOption( bool b, ViewOptFlags2 f) + { + if (b) + m_nUIOptions |= f; + else + m_nUIOptions &= ~f; + } + + void SetZoomType (SvxZoomType eZoom_){ m_eZoom = eZoom_; } + void SetTableDest( sal_uInt8 nNew ) { m_nTableDestination = nNew; } + + const OUString& GetSymbolFont() const {return m_sSymbolFont;} + void SetSymbolFont(const OUString& sSet) {m_sSymbolFont = sSet;} + + const Color& GetRetoucheColor() const { return m_aRetouchColor;} + void SetRetoucheColor(const Color&r) { m_aRetouchColor = r; } + + bool IsViewAnyRuler() const + { +#if HAVE_FEATURE_DESKTOP + return bool(m_nUIOptions & ViewOptFlags2::AnyRuler); +#else + return false; +#endif + } + void SetViewAnyRuler(bool bSet) + { SetUIOption(bSet, ViewOptFlags2::AnyRuler);} + + bool IsViewHRuler(bool bDirect = false) const + { +#if HAVE_FEATURE_DESKTOP + return bDirect + ? bool(m_nUIOptions & ViewOptFlags2::HRuler) + : !m_bReadonly && (m_nUIOptions & (ViewOptFlags2::AnyRuler|ViewOptFlags2::HRuler)) == (ViewOptFlags2::AnyRuler|ViewOptFlags2::HRuler); +#else + (void) bDirect; + return false; +#endif + } + void SetViewHRuler (bool b) + { SetUIOption(b, ViewOptFlags2::HRuler ); } + + bool IsViewVRuler(bool bDirect = false) const + { +#if HAVE_FEATURE_DESKTOP + return bDirect + ? bool(m_nUIOptions & ViewOptFlags2::VRuler) + : !m_bReadonly && (m_nUIOptions & (ViewOptFlags2::AnyRuler|ViewOptFlags2::VRuler)) == (ViewOptFlags2::AnyRuler|ViewOptFlags2::VRuler); +#else + (void) bDirect; + return false; +#endif + } + void SetViewVRuler (bool b) + { SetUIOption(b, ViewOptFlags2::VRuler); } + + // ShadowCursor, switch on/off, get/set color/mode. + bool IsShadowCursor() const + { return bool(m_nUIOptions & ViewOptFlags2::ShadowCursor); } + void SetShadowCursor(bool b) + { SetUIOption(b, ViewOptFlags2::ShadowCursor); } + + //move vertical ruler to the right + bool IsVRulerRight() const + { return bool(m_nUIOptions & ViewOptFlags2::VRulerRight); } + void SetVRulerRight(bool b) + { SetUIOption(b, ViewOptFlags2::VRulerRight); } + + bool IsStarOneSetting() const {return m_bStarOneSetting; } + void SetStarOneSetting(bool bSet) {m_bStarOneSetting = bSet; } + + bool IsPagePreview() const {return m_bIsPagePreview; } + void SetPagePreview(bool bSet) { m_bIsPagePreview= bSet; } + + SwFillMode GetShdwCursorFillMode() const { return m_nShadowCursorFillMode; } + void SetShdwCursorFillMode( SwFillMode nMode ) { m_nShadowCursorFillMode = nMode; }; + + bool IsShowPlaceHolderFields() const { return m_bShowPlaceHolderFields; } + void SetShowPlaceHolderFields(bool bSet) { m_bShowPlaceHolderFields = bSet; } + + static Color& GetDocColor(); + static Color& GetDocBoundariesColor(); + static Color& GetAppBackgroundColor(); + static Color& GetObjectBoundariesColor(); + static Color& GetTableBoundariesColor(); + static Color& GetIndexShadingsColor(); + static Color& GetLinksColor(); + static Color& GetVisitedLinksColor(); + static Color& GetDirectCursorColor(); + static Color& GetTextGridColor(); + static Color& GetSpellColor(); + static Color& GetSmarttagColor(); + static Color& GetShadowColor(); + static Color& GetFontColor(); + static Color& GetFieldShadingsColor(); + static Color& GetSectionBoundColor(); + static Color& GetPageBreakColor(); + static Color& GetHeaderFooterMarkColor(); + + static bool IsAppearanceFlag(ViewOptFlags nFlag); + + static bool IsDocBoundaries() {return IsAppearanceFlag(ViewOptFlags::DocBoundaries);} + static bool IsObjectBoundaries() {return IsAppearanceFlag(ViewOptFlags::ObjectBoundaries);} + static bool IsTableBoundaries() {return IsAppearanceFlag(ViewOptFlags::TableBoundaries );} + static bool IsIndexShadings() {return IsAppearanceFlag(ViewOptFlags::IndexShadings );} + static bool IsLinks() {return IsAppearanceFlag(ViewOptFlags::Links );} + static bool IsVisitedLinks() {return IsAppearanceFlag(ViewOptFlags::VisitedLinks );} + static bool IsFieldShadings() {return IsAppearanceFlag(ViewOptFlags::FieldShadings);} + static bool IsSectionBoundaries() {return IsAppearanceFlag(ViewOptFlags::SectionBoundaries);} + static bool IsShadow() {return IsAppearanceFlag(ViewOptFlags::Shadow );} + + static void SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig = false); + + static void SetDocBoundaries(bool bSet) {SetAppearanceFlag(ViewOptFlags::DocBoundaries, bSet);} + + static void ApplyColorConfigValues(const svtools::ColorConfig& rConfig); +}; + +inline bool SwViewOption::operator==( const SwViewOption &rOpt ) const +{ + return IsEqualFlags( rOpt ) && m_nZoom == rOpt.GetZoom(); +} + +inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt ) +{ + m_nUIOptions = rVOpt.m_nUIOptions; + m_nTableDestination = rVOpt.m_nTableDestination; + m_nShadowCursorFillMode = rVOpt.m_nShadowCursorFillMode; +} + +// Helper function for checking HTML-capabilities. +SW_DLLPUBLIC sal_uInt16 GetHtmlMode(const SwDocShell*); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx new file mode 100644 index 000000000..fe3fee74b --- /dev/null +++ b/sw/inc/viewsh.hxx @@ -0,0 +1,619 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_VIEWSH_HXX +#define INCLUDED_SW_INC_VIEWSH_HXX + +#include "swdllapi.h" +#include "swtypes.hxx" +#include "ring.hxx" +#include "swrect.hxx" +#include <memory> +#include <stack> +#include <vcl/mapmod.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/lazydelete.hxx> +#include <vcl/window.hxx> + +namespace com::sun::star::accessibility { class XAccessible; } +class SwDoc; +class IDocumentSettingAccess; +class IDocumentDeviceAccess; +class IDocumentMarkAccess; +class IDocumentDrawModelAccess; +class IDocumentRedlineAccess; +class IDocumentLayoutAccess; +class IDocumentContentOperations; +class IDocumentStylePoolAccess; +class IDocumentStatistics; +class IDocumentUndoRedo; +class IDocumentListItems; +class IDocumentOutlineNodes; +class SfxPrinter; +class SwRootFrame; +class SwNodes; +class SdrView; +class SfxItemPool; +class SfxViewShell; +class SwViewOption; +class SwViewShellImp; +class SwPrintData; +struct ShellResource; +class SwRegionRects; +class SvtAccessibilityOptions; +class SwPagePreviewLayout; +class SwTextFrame; + +struct SwAccessibilityOptions; +namespace vcl { class Region; } +class SwPostItMgr; +class SdrPaintWindow; +class SwAccessibleMap; +enum class Orientation; + +namespace vcl +{ + typedef OutputDevice RenderContext; +} + +// Define for flags needed in ctor or layers below. +// Currently the Preview flag is needed for DrawPage. +#define VSHELLFLAG_ISPREVIEW (long(0x1)) +#define VSHELLFLAG_SHARELAYOUT (long(0x2)) +typedef std::shared_ptr<SwRootFrame> SwRootFramePtr; + +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell> +{ + friend void SetOutDev( SwViewShell *pSh, OutputDevice *pOut ); + friend void SetOutDevAndWin( SwViewShell *pSh, OutputDevice *pOut, + vcl::Window *pWin, sal_uInt16 nZoom ); + + friend class SwViewShellImp; + friend class SwLayIdle; + + // For setting visible area for page preview paint. + friend class SwPagePreviewLayout; + + // Set SwVisArea in order to enable clean formatting before printing. + friend void SetSwVisArea( SwViewShell *pSh, const SwRect & ); + + std::unique_ptr<BitmapEx> m_xReplaceBmp; ///< replaced display of still loaded images + std::unique_ptr<BitmapEx> m_xErrorBmp; ///< error display of missed images + + static bool mbLstAct; // true if EndAction of last Shell + // i.e. if the EndActions of the other + // Shells on the document are through. + + Point maPrtOffset; // Offset for Printer, + // non-printable margin. + Size maBrowseBorder; // Border for frame documents. + SwRect maInvalidRect; + + SfxViewShell *mpSfxViewShell; + std::unique_ptr<SwViewShellImp> + mpImp; // Core-internals of SwViewShell. + // The pointer is never 0. + + VclPtr<vcl::Window> mpWin; ///< = 0 during printing or pdf export + VclPtr<OutputDevice> mpOut; ///< Window, Printer, VirtDev, ... + + std::unique_ptr<SwViewOption> mpOpt; + std::unique_ptr<SwAccessibilityOptions> mpAccOptions; + + bool mbDocSizeChgd :1; // For DocChgNotify(): Announce new DocSize + // at EndAction to DocMDI. + bool mbPaintWorks :1; // Normal Painting if true, + // remember Paint if false. + bool mbPaintInProgress :1; // Block any double paint. + bool mbViewLocked :1; // Lock visible range; + // in this case MakeVisible is ineffectual. + bool mbInEndAction :1; // Avoid problems, cf. viewsh.cxx. + bool mbPreview :1; // If true it is a Preview-SwViewShell. + bool mbFrameView :1; // If true it is a (HTML-)Frame. + bool mbEnableSmooth :1; // Disable SmoothScroll, e.g. for drag + // of scrollbars. + bool mbEndActionByVirDev:1; // Paints from EndAction always via virtual device + // (e.g. when browsing). + bool mbShowHeaderSeparator:1; ///< Flag to say that we are showing the header control + bool mbShowFooterSeparator:1; ///< Flag to say that we are showing the footer control + bool mbHeaderFooterEdit:1; ///< Flag to say that we are editing header or footer (according to the bShow(Header|Footer)Separator above) + + // boolean, indicating that class in constructor. + bool mbInConstructor:1; + + SdrPaintWindow* mpTargetPaintWindow; + VclPtr<OutputDevice> mpBufferedOut; + + SwRootFramePtr mpLayout; + + // Initialization; called by the diverse constructors. + SAL_DLLPRIVATE void Init( const SwViewOption *pNewOpt ); + + inline void ResetInvalidRect(); + + + + SAL_DLLPRIVATE void PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect&); // Collect values for painting of desktop + // and calling. + // PaintDesktop split. This pars is also used by PreviewPage. + SAL_DLLPRIVATE void PaintDesktop_(const SwRegionRects &rRegion); + + SAL_DLLPRIVATE bool CheckInvalidForPaint( const SwRect & ); // Direct Paint or rather + // trigger an action. + + SAL_DLLPRIVATE void PrepareForPrint( const SwPrintData &rOptions, bool bIsPDFExport = false ); + + SAL_DLLPRIVATE void ImplApplyViewOptions( const SwViewOption &rOpt ); + +protected: + static ShellResource* mpShellRes; ///< Resources for the Shell. + static vcl::DeleteOnDeinit< VclPtr<vcl::Window> > mpCareWindow; ///< Avoid this window. + static vcl::DeleteOnDeinit< std::shared_ptr<weld::Window> > mpCareDialog; ///< Avoid this window. + + SwRect maVisArea; ///< The modern version of VisArea. + tools::Rectangle maLOKVisibleArea;///< The visible area in the LibreOfficeKit client. + rtl::Reference<SwDoc> mxDoc; ///< The document; never 0. + + sal_uInt16 mnStartAction; ///< != 0 if at least one Action is active. + sal_uInt16 mnLockPaint; ///< != 0 if Paint is locked. + bool mbSelectAll; ///< Special select all mode: whole document selected, even if doc starts with table. + + /// The virtual device we paint to will end up on the screen. + bool mbOutputToWindow; + +public: + + SwViewShellImp *Imp() { return mpImp.get(); } + const SwViewShellImp *Imp() const { return mpImp.get(); } + + const SwNodes& GetNodes() const; + + // After change of printer; by Doc. + void InitPrt( OutputDevice *pOutDev ); + + // Bracketing of actions belonging together. + inline void StartAction(); + void ImplStartAction(); + inline void EndAction( const bool bIdleEnd = false ); + void ImplEndAction( const bool bIdleEnd ); + sal_uInt16 ActionCount() const { return mnStartAction; } + bool ActionPend() const { return mnStartAction != 0; } + bool IsInEndAction() const { return mbInEndAction; } + + void SetEndActionByVirDev( bool b ) { mbEndActionByVirDev = b; } + bool IsEndActionByVirDev() const { return mbEndActionByVirDev; } + + // The ActionCount for all Shells is temporarily set to zero and then + // restored at the RootFrame via UNO. + void SetRestoreActions(sal_uInt16 nSet); + sal_uInt16 GetRestoreActions() const; + + bool HasInvalidRect() const { return maInvalidRect.HasArea(); } + void ChgHyphenation() { Reformat(); } + void ChgNumberDigits(); + + bool AddPaintRect( const SwRect &rRect ); + + void InvalidateWindows( const SwRect &rRect ); + + /// Invalidates complete Layout (ApplyViewOption). + void Reformat(); + + // #i72754# set of Pre/PostPaints with lock counter and initial target OutDev +protected: + std::stack<vcl::Region> mPrePostPaintRegions; // acts also as a lock counter (empty == not locked) + VclPtr<OutputDevice> mpPrePostOutDev; + MapMode maPrePostMapMode; +public: + void PrePaint(); + void DLPrePaint2(const vcl::Region& rRegion); + void DLPostPaint2(bool bPaintFormLayer); + const MapMode& getPrePostMapMode() const { return maPrePostMapMode; } + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect); + + /** Paint tile. + + Sets the pOut so that the rRect is always painted over the entire + pOut, ie. starts in 0,0 and ends in width/height. + */ + void PaintTile(VirtualDevice &rDevice, int contextWidth, int contextHeight, int tilePosX, int tilePosY, long tileWidth, long tileHeight); + + bool IsPaintInProgress() const { return mbPaintInProgress; } + bool IsDrawingLayerPaintInProgress() const { return !mPrePostPaintRegions.empty(); } + + // Notification that visible area has been changed. + // VisArea is reset, after that scrolling takes place. + // The passed rect is situated on pixel borders + // in order to avoid pixel errors when scrolling. + virtual void VisPortChgd( const SwRect & ); + bool SmoothScroll( long lXDiff, long lYDiff, const tools::Rectangle* );//Browser + void EnableSmooth( bool b ) { mbEnableSmooth = b; } + + const SwRect& VisArea() const; + + /// The visible area in the client (set by setClientVisibleArea). + const tools::Rectangle & getLOKVisibleArea() const { return maLOKVisibleArea; } + void setLOKVisibleArea(const tools::Rectangle& rArea) { maLOKVisibleArea = rArea; } + + // If necessary scroll until passed Rect is situated in visible sector. + void MakeVisible( const SwRect & ); + + // At nearest occasion pass new document size to UI. + void SizeChgNotify(); + void UISizeNotify(); // Passing of current size. + + Point GetPagePos( sal_uInt16 nPageNum ) const; + + sal_uInt16 GetNumPages() const; // Ask count of current pages from layout. + bool IsDummyPage( sal_uInt16 nPageNum ) const; // An empty page? + + // Invalidate first visible page for all Shells in ring. + void SetFirstVisPageInvalid(); + + SwRootFrame *GetLayout() const; + bool IsNewLayout() const; // Has Layout been loaded or created? + + Size GetDocSize() const; // Get document size. + + virtual void CalcLayout(); // Force complete formatting of layout. + + sal_uInt16 GetPageCount() const; + + Size GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const; + + SwDoc *GetDoc() const { return mxDoc.get(); } //Never 0. + + /** Provides access to the document setting interface + */ + const IDocumentSettingAccess& getIDocumentSettingAccess() const; + IDocumentSettingAccess& getIDocumentSettingAccess(); + + /** Provides access to the document device interface + */ + const IDocumentDeviceAccess& getIDocumentDeviceAccess() const; + IDocumentDeviceAccess& getIDocumentDeviceAccess(); + + /** Provides access to the document bookmark interface + */ + const IDocumentMarkAccess* getIDocumentMarkAccess() const; + IDocumentMarkAccess* getIDocumentMarkAccess(); + + /** Provides access to the document draw model interface + */ + const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const; + IDocumentDrawModelAccess& getIDocumentDrawModelAccess(); + + /** Provides access to the document redline interface + */ + const IDocumentRedlineAccess& getIDocumentRedlineAccess() const; + IDocumentRedlineAccess& getIDocumentRedlineAccess(); + + /** Provides access to the document layout interface + */ + const IDocumentLayoutAccess& getIDocumentLayoutAccess() const; + IDocumentLayoutAccess& getIDocumentLayoutAccess(); + + /** Provides access to the content operations interface + */ + IDocumentContentOperations& getIDocumentContentOperations(); + + /** Provides access to the document style pool interface + */ + IDocumentStylePoolAccess& getIDocumentStylePoolAccess(); + + /** Provides access to the document statistics interface + */ + const IDocumentStatistics& getIDocumentStatistics() const; + + /** Provides access to the document undo/redo interface + */ + IDocumentUndoRedo const& GetIDocumentUndoRedo() const; + IDocumentUndoRedo & GetIDocumentUndoRedo(); + + const IDocumentListItems* getIDocumentListItemsAccess() const; + const IDocumentOutlineNodes* getIDocumentOutlineNodesAccess() const; + + // 1. GetRefDev: Either the printer or the virtual device from the doc + // 2. GetWin: Available if we not printing + // 3. GetOut: Printer, Window or Virtual device + vcl::RenderContext& GetRefDev() const; + vcl::Window* GetWin() const { return mpWin; } + vcl::RenderContext* GetOut() const { return mpOut; } + + void SetWin(vcl::Window* win) { mpWin = win; } + void SetOut(vcl::RenderContext* pOut) { mpOut = pOut; } + static bool IsLstEndAction() { return SwViewShell::mbLstAct; } + + // Change of all page descriptors. + void ChgAllPageOrientation( Orientation eOri ); + void ChgAllPageSize( Size const &rSz ); + + // Printing of one page. + // bIsPDFExport == true is: do PDF Export (no printing!) + bool PrintOrPDFExport( OutputDevice *pOutDev, + SwPrintData const& rPrintData, + sal_Int32 nRenderer, /* offset in vector of pages to print */ + bool bIsPDFExport ); + + // Printing of one brochure page. + void PrintProspect( OutputDevice *pOutDev, const SwPrintData &rPrintData, + sal_Int32 nRenderer /* offset in vector of page pairs for prospect printing */ ); + + // Printing for OLE 2.0. + static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions, + vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ); + + // Fill temporary doc with selected text for Print or PDF export. + void FillPrtDoc( SwDoc* pPrtDoc, const SfxPrinter* pPrt ); + + // Called internally for Shell. Formats pages. + void CalcPagesForPrint( sal_uInt16 nMax ); + + // All about fields. + void UpdateFields(bool bCloseDB = false); + bool IsAnyFieldInDoc() const; + // Update all charts, for that exists any table. + void UpdateAllCharts(); + bool HasCharts() const; + + // DOCUMENT COMPATIBILITY FLAGS START + + // Add or maximize paragraph spacing? + void SetParaSpaceMax( bool bNew ); + + // Add or maximize paragraph spacing? + void SetParaSpaceMaxAtPages( bool bNew ); + + // Compatible behaviour of tabs. + void SetTabCompat( bool bNew ); + + // Font metric attribute "External Leading" should be considered. + void SetAddExtLeading( bool bNew ); + + // Formatting by virtual device or printer. + void SetUseVirDev( bool bNew ); + + // Adding paragraph and table spacing at bottom + // of table cells. + void SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells ); + + // Former formatting of text lines with + // proportional line spacing or not. + void SetUseFormerLineSpacing( bool _bUseFormerLineSpacing ); + + // Former object positioning. + void SetUseFormerObjectPositioning( bool _bUseFormerObjPos ); + + void SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos ); + + void SetUseFormerTextWrapping( bool _bUseFormerTextWrapping ); + + void SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak ); + + void SetProtectForm( bool _bProtectForm ); + + void SetMsWordCompTrailingBlanks( bool _bMsWordCompTrailingBlanks ); + + void SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys); + + void SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara); + + // DOCUMENT COMPATIBILITY FLAGS END + + // Calls Idle-formatter of Layout. + void LayoutIdle(); + + const SwViewOption *GetViewOptions() const { return mpOpt.get(); } + virtual void ApplyViewOptions( const SwViewOption &rOpt ); + void SetUIOptions( const SwViewOption &rOpt ); + virtual void SetReadonlyOption(bool bSet); // Set readonly-bit of ViewOptions. + void SetPDFExportOption(bool bSet); // Set/reset PDF export mode. + void SetPrtFormatOption(bool bSet); // Set PrtFormat-Bit of ViewOptions. + void SetReadonlySelectionOption(bool bSet); // Change the selection mode in readonly docs. + + const SwAccessibilityOptions* GetAccessibilityOptions() const { return mpAccOptions.get();} + + static void SetShellRes( ShellResource* pRes ) { mpShellRes = pRes; } + static ShellResource* GetShellRes(); + + static weld::Window* CareChildWin(SwViewShell const & rVSh); + static void SetCareDialog(const std::shared_ptr<weld::Window>& rNew); + static weld::Window* GetCareDialog(SwViewShell const & rVSh) + { return (*mpCareDialog.get()) ? mpCareDialog.get()->get() : CareChildWin(rVSh); } + + SfxViewShell *GetSfxViewShell() const { return mpSfxViewShell; } + void SetSfxViewShell(SfxViewShell *pNew) { mpSfxViewShell = pNew; } + + // Selection of Draw Engine has been changed. + virtual void DrawSelChanged(); + + SwPagePreviewLayout* PagePreviewLayout(); + + /** adjust view options for page preview + + Because page preview should show the document as it is printed - + page preview is print preview -, the view options are adjusted to the + same as for printing. + + @param _rPrintOptions + input parameter - constant reference to print options, to which the + view option will be adjusted. + */ + void AdjustOptionsForPagePreview( SwPrintData const& rPrintOptions ); + + bool IsViewLocked() const { return mbViewLocked; } + void LockView( bool b ) { mbViewLocked = b; } + + inline void LockPaint(); + void ImplLockPaint(); + inline void UnlockPaint( bool bVirDev = false ); + void ImplUnlockPaint( bool bVirDev ); + bool IsPaintLocked() const { return mnLockPaint != 0; } + + // Get/set DrawView and PageView. + bool HasDrawView() const; + void MakeDrawView(); + + // Are we dragging draw shapes around. + bool HasDrawViewDrag() const; + + // DrawView may be used at UI. + SdrView *GetDrawView(); + const SdrView *GetDrawView() const { return const_cast<SwViewShell*>(this)->GetDrawView(); } + + // Take care that MarkList is up-to-date in any case (Bug 57153). + SdrView *GetDrawViewWithValidMarkList(); + + // Query attribute pool. + inline const SfxItemPool& GetAttrPool() const; + SfxItemPool& GetAttrPool(); + + bool IsPreview() const { return mbPreview; } + + bool IsFrameView() const { return mbFrameView; } + + // Invalidates pages and contents. + // When bSizeChanged==true, adds/removes + // headers and footers as necessary. + void InvalidateLayout(bool bSizeChanged); + + const Size& GetBrowseBorder() const; + sal_Int32 GetBrowseWidth() const; + void SetBrowseBorder( const Size& rNew ); + + css::uno::Reference< css::accessibility::XAccessible > CreateAccessible(); + + css::uno::Reference< css::accessibility::XAccessible > CreateAccessiblePreview(); + + void ShowPreviewSelection( sal_uInt16 nSelPage ); + void InvalidateAccessibleFocus(); + + // Apply Accessibility options. + void ApplyAccessibilityOptions(SvtAccessibilityOptions const & rAccessibilityOptions); + + /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs + + @param _pFromTextFrame + input parameter - paragraph frame, for which the relation CONTENT_FLOWS_FROM + has to be invalidated. + If NULL, no CONTENT_FLOWS_FROM relation has to be invalidated + + @param _pToTextFrame + input parameter - paragraph frame, for which the relation CONTENT_FLOWS_TO + has to be invalidated. + If NULL, no CONTENT_FLOWS_TO relation has to be invalidated + */ + void InvalidateAccessibleParaFlowRelation( const SwTextFrame* _pFromTextFrame, + const SwTextFrame* _pToTextFrame ); + + /** invalidate text selection for paragraphs + */ + void InvalidateAccessibleParaTextSelection(); + + /** invalidate attributes for paragraphs and paragraph's characters + + usage also for changes of the attributes of + paragraph's characters. + + @param rTextFrame + input parameter - paragraph frame, whose attributes have changed + */ + void InvalidateAccessibleParaAttrs( const SwTextFrame& rTextFrame ); + + SwAccessibleMap* GetAccessibleMap(); + + SwViewShell( SwViewShell&, vcl::Window *pWin, OutputDevice *pOut = nullptr, + long nFlags = 0 ); + SwViewShell( SwDoc& rDoc, vcl::Window *pWin, + const SwViewOption *pOpt, OutputDevice *pOut = nullptr, + long nFlags = 0 ); + virtual ~SwViewShell() override; + + sal_Int32 GetPageNumAndSetOffsetForPDF( OutputDevice& rOut, const SwRect& rRect ) const; + + bool IsInConstructor() const { return mbInConstructor; } + + const BitmapEx& GetReplacementBitmap(bool bIsErrorState); + void DeleteReplacementBitmaps(); + + const SwPostItMgr* GetPostItMgr() const { return const_cast<SwViewShell*>(this)->GetPostItMgr(); } + SwPostItMgr* GetPostItMgr(); + + /// Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags + void ToggleHeaderFooterEdit(); + /// Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags + bool IsHeaderFooterEdit() const { return mbHeaderFooterEdit; } + bool IsShowHeaderFooterSeparator( FrameControlType eControl ) { return (eControl == FrameControlType::Header)? mbShowHeaderSeparator: mbShowFooterSeparator; } + virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow ); + bool IsSelectAll() const { return mbSelectAll; } + + void setOutputToWindow(bool bOutputToWindow); + bool isOutputToWindow() const; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +// manages global ShellPointer +class CurrShell +{ +public: + SwViewShell *pPrev; + SwRootFrame *pRoot; + + CurrShell( SwViewShell *pNew ); + ~CurrShell(); +}; + +inline void SwViewShell::ResetInvalidRect() +{ + maInvalidRect.Clear(); +} + +inline void SwViewShell::StartAction() +{ + if ( !mnStartAction++ ) + ImplStartAction(); +} +inline void SwViewShell::EndAction( const bool bIdleEnd ) +{ + if( 0 == (mnStartAction - 1) ) + ImplEndAction( bIdleEnd ); + --mnStartAction; +} + +inline void SwViewShell::LockPaint() +{ + if ( !mnLockPaint++ ) + ImplLockPaint(); +} +inline void SwViewShell::UnlockPaint( bool bVirDev ) +{ + if ( 0 == --mnLockPaint ) + ImplUnlockPaint( bVirDev ); +} +inline const SfxItemPool& SwViewShell::GetAttrPool() const +{ + return const_cast<SwViewShell*>(this)->GetAttrPool(); +} + +#endif // INCLUDED_SW_INC_VIEWSH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx new file mode 100644 index 000000000..36cf0ceb8 --- /dev/null +++ b/sw/inc/viscrs.hxx @@ -0,0 +1,212 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_VISCRS_HXX +#define INCLUDED_SW_INC_VISCRS_HXX + +#include <config_feature_desktop.h> + +#include <vcl/cursor.hxx> +#include "swcrsr.hxx" +#include "swrect.hxx" +#include "swregion.hxx" +#include "swdllapi.h" + +namespace sdr::overlay { class OverlayObject; } + +class SwCursorShell; +class SfxViewShell; + +// From here classes/methods for non-text cursor. + +class SW_DLLPUBLIC SwVisibleCursor +{ + friend void InitCore(); + friend void FinitCore(); + + bool m_bIsVisible; + bool m_bIsDragCursor; + + vcl::Cursor m_aTextCursor; + const SwCursorShell* m_pCursorShell; + + /// For LibreOfficeKit only - remember what page we were at the last time. + sal_uInt16 m_nPageLastTime; + +public: + SwVisibleCursor( const SwCursorShell * pCShell ); + ~SwVisibleCursor(); + + void Show(); + void Hide(); + + bool IsVisible() const { return m_bIsVisible; } + void SetDragCursor( bool bFlag = true ) { m_bIsDragCursor = bFlag; } + void SetPosAndShow(SfxViewShell const * pViewShell); + const vcl::Cursor& GetTextCursor() const; +}; + +// From here classes/methods for selections. + +namespace sw::overlay { class OverlayRangesOutline; } +class MapMode; + +class SwSelPaintRects : public SwRects +{ + friend void InitCore(); + friend void FinitCore(); + + static long s_nPixPtX, s_nPixPtY; + static MapMode *s_pMapMode; + + const SwCursorShell* m_pCursorShell; + +#if HAVE_FEATURE_DESKTOP || defined(ANDROID) + std::unique_ptr<sdr::overlay::OverlayObject> m_pCursorOverlay; +#endif + + bool m_bShowTextInputFieldOverlay; + std::unique_ptr<sw::overlay::OverlayRangesOutline> m_pTextInputFieldOverlay; + + void HighlightInputField(); + +public: + SwSelPaintRects( const SwCursorShell& rCSh ); + virtual ~SwSelPaintRects(); + + virtual void FillRects() = 0; + /// Fill rStart and rEnd with a rectangle that represents the start and end for selection handles. + virtual void FillStartEnd(SwRect& rStart, SwRect& rEnd) const = 0; + + // #i75172# in SwCursorShell::CreateCursor() the content of SwSelPaintRects is exchanged. To + // make a complete swap access to m_pCursorOverlay is needed there + void swapContent(SwSelPaintRects& rSwap); + + void Show(std::vector<OString>* pSelectionRectangles = nullptr); + void Hide(); + void Invalidate( const SwRect& rRect ); + + void SetShowTextInputFieldOverlay( const bool bShow ) + { + m_bShowTextInputFieldOverlay = bShow; + } + + const SwCursorShell* GetShell() const { return m_pCursorShell; } + // check current MapMode of the shell and set possibly the static members. + // Optional set the parameters pX, pY + static void Get1PixelInLogic( const SwViewShell& rSh, + long* pX = nullptr, long* pY = nullptr ); +}; + +class SW_DLLPUBLIC SwShellCursor : public virtual SwCursor, public SwSelPaintRects +{ +private: + // Document positions of start/end characters of a SSelection. + Point m_MarkPt; + Point m_PointPt; + const SwPosition* m_pInitialPoint; // For assignment of GetPoint() to m_PointPt. + + using SwCursor::UpDown; + +public: + SwShellCursor( const SwCursorShell& rCursorSh, const SwPosition &rPos ); + SwShellCursor( const SwCursorShell& rCursorSh, const SwPosition &rPos, + const Point& rPtPos, SwPaM* pRing ); + // note: *intentionally* links the new shell cursor into the old one's Ring + SwShellCursor( SwShellCursor& ); + virtual ~SwShellCursor() override; + + virtual void FillRects() override; // For Table- and normal cursors. + /// @see SwSelPaintRects::FillStartEnd(), override for text selections. + virtual void FillStartEnd(SwRect& rStart, SwRect& rEnd) const override; + + void Show(SfxViewShell const * pViewShell); // Update and display all selections. + void Hide(); // Hide all selections. + void Invalidate( const SwRect& rRect ); + + const Point& GetPtPos() const { return (SwPaM::GetPoint() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetPtPos() { return (SwPaM::GetPoint() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + const Point& GetMkPos() const { return (SwPaM::GetMark() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetMkPos() { return (SwPaM::GetMark() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + const Point& GetSttPos() const { return (SwPaM::Start() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetSttPos() { return (SwPaM::Start() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + const Point& GetEndPos() const { return (SwPaM::End() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + Point& GetEndPos() { return (SwPaM::End() == m_pInitialPoint) ? m_PointPt : m_MarkPt; } + + virtual void SetMark() override; + + virtual SwCursor* Create( SwPaM* pRing = nullptr ) const override; + + virtual short MaxReplaceArived() override; //returns RET_YES/RET_CANCEL/RET_NO + virtual void SaveTableBoxContent( const SwPosition* pPos ) override; + + bool UpDown( bool bUp, sal_uInt16 nCnt ); + + // true: Cursor can be set to this position. + virtual bool IsAtValidPos( bool bPoint = true ) const override; + + virtual bool IsReadOnlyAvailable() const override; + + SwShellCursor* GetNext() { return dynamic_cast<SwShellCursor *>(GetNextInRing()); } + const SwShellCursor* GetNext() const { return dynamic_cast<SwShellCursor const *>(GetNextInRing()); } + SwShellCursor* GetPrev() { return dynamic_cast<SwShellCursor *>(GetPrevInRing()); } + const SwShellCursor* GetPrev() const { return dynamic_cast<SwShellCursor const *>(GetPrevInRing()); } +}; + +class SwShellTableCursor final : public virtual SwShellCursor, public virtual SwTableCursor +{ + /// Left edge of the selection start (top left cell). + SwRect m_aStart; + /// Right edge of the selection end (bottom right cell). + SwRect m_aEnd; + // The Selection has the same order as the table boxes, i.e. + // if something is deleted from the one array at a certain position + // it has to be deleted from the other one as well!! + +public: + SwShellTableCursor( const SwCursorShell& rCursorSh, const SwPosition& rPos ); + SwShellTableCursor( const SwCursorShell& rCursorSh, + const SwPosition &rMkPos, const Point& rMkPt, + const SwPosition &rPtPos, const Point& rPtPt ); + virtual ~SwShellTableCursor() override; + + virtual void FillRects() override; // For table and normal cursor. + /// @see SwSelPaintRects::FillStartEnd(), override for table selections. + virtual void FillStartEnd(SwRect& rStart, SwRect& rEnd) const override; + + // Check if SPoint is within table SSelection. + bool IsInside( const Point& rPt ) const; + + virtual void SetMark() override; + virtual SwCursor* Create( SwPaM* pRing = nullptr ) const override; + + virtual short MaxReplaceArived() override; //returns RET_YES/RET_CANCEL/RET_NO + virtual void SaveTableBoxContent( const SwPosition* pPos ) override; + + // true: Cursor can be set to this position. + virtual bool IsAtValidPos( bool bPoint = true ) const override; + + SwShellTableCursor* GetNext() { return dynamic_cast<SwShellTableCursor *>(GetNextInRing()); } + const SwShellTableCursor* GetNext() const { return dynamic_cast<SwShellTableCursor const *>(GetNextInRing()); } + SwShellTableCursor* GetPrev() { return dynamic_cast<SwShellTableCursor *>(GetPrevInRing()); } + const SwShellTableCursor* GetPrev() const { return dynamic_cast<SwShellTableCursor const *>(GetPrevInRing()); } +}; + +#endif // INCLUDED_SW_INC_VISCRS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/wdocsh.hxx b/sw/inc/wdocsh.hxx new file mode 100644 index 000000000..37424d0fb --- /dev/null +++ b/sw/inc/wdocsh.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_SW_INC_WDOCSH_HXX +#define INCLUDED_SW_INC_WDOCSH_HXX +#include "swdllapi.h" +#include "docsh.hxx" + +class SW_DLLPUBLIC SwWebDocShell : public SwDocShell +{ + sal_uInt16 m_nSourcePara; ///< Active line in source view. + +public: + // But implement yourself. + SFX_DECL_INTERFACE(SW_WEBDOCSHELL) + SFX_DECL_OBJECTFACTORY(); + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + +public: + SwWebDocShell(); + virtual ~SwWebDocShell() override; + + virtual void FillClass( SvGlobalName * pClassName, + SotClipboardFormatId * pClipFormat, + OUString * pLongUserName, + sal_Int32 nFileFormat, + bool bTemplate = false ) const override; + sal_uInt16 GetSourcePara()const { return m_nSourcePara; } + void SetSourcePara(sal_uInt16 nSet) { m_nSourcePara = nSet; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |