sd: add uno command for inserting a canvas page
Executing `.uno:InsertCanvasPage` will insert a page of size 5m x 5m at the last page. Signed-off-by: Mohit Marathe <mohit.marathe@collabora.com> Change-Id: Ic6c9237e9e763de7f1e32d4d1a95c56c0e4ed5a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192319 Reviewed-by: Michael Stahl <michael.stahl@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit 90d410298855a0e1c5d125685e80a0803809dc7c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196680
This commit is contained in:
@@ -846,6 +846,14 @@
|
||||
<value>1</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name=".uno:InsertCanvasSlide" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">New Canvas Slide</value>
|
||||
</prop>
|
||||
<prop oor:name="Properties" oor:type="xs:int">
|
||||
<value>1</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name=".uno:ImportFromFile" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">Insert Page from File...</value>
|
||||
|
||||
@@ -346,6 +346,7 @@
|
||||
#define SID_NOTES_MASTER_MODE (SID_SD_START+350)
|
||||
// FREE
|
||||
#define SID_INSERTPAGE_QUICK (SID_SD_START+352)
|
||||
#define SID_INSERT_CANVAS_SLIDE (SID_SD_START+353)
|
||||
// FREE
|
||||
#define SID_INSERT_FLD_PAGE_TITLE (SID_SD_START+356)
|
||||
#define SID_INSERT_FLD_DATE_VAR (SID_SD_START+357)
|
||||
|
||||
@@ -999,6 +999,9 @@ public:
|
||||
bool bIsPageObj,
|
||||
const sal_Int32 nInsertPosition);
|
||||
|
||||
|
||||
SAL_DLLPRIVATE sal_uInt16 InsertCanvasPage ();
|
||||
|
||||
/** return the document fonts for latin, cjk and ctl according to the current
|
||||
languages set at this document */
|
||||
SAL_DLLPRIVATE void getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont );
|
||||
|
||||
@@ -122,6 +122,7 @@ friend class sd::UndoAttrObject;
|
||||
rtl_TextEncoding meCharSet; ///< Text encoding
|
||||
sal_uInt16 mnPaperBin; ///< PaperBin
|
||||
SdPageLink* mpPageLink; ///< Page link (at left sides only)
|
||||
bool mbIsCanvasPage; ///< whether the page is a canvas page
|
||||
|
||||
// PDF link annotations for read-only pdfium
|
||||
std::vector<std::pair<basegfx::B2DRectangle, OUString>> maLinkAnnotations;
|
||||
@@ -400,6 +401,9 @@ public:
|
||||
|
||||
static sal_uInt16 mnLastPageId;
|
||||
|
||||
bool IsCanvasPage() const { return mbIsCanvasPage; }
|
||||
void SetCanvasPage() { mbIsCanvasPage = true; }
|
||||
|
||||
private:
|
||||
bool mbIsPrecious;
|
||||
|
||||
|
||||
@@ -328,6 +328,11 @@ interface SlideSorterView
|
||||
ExecMethod = ExecMovePageLast ;
|
||||
StateMethod = GetStateMovePageLast ;
|
||||
]
|
||||
SID_INSERT_CANVAS_SLIDE
|
||||
[
|
||||
ExecMethod = FuTemporary ;
|
||||
StateMethod = GetMenuState ;
|
||||
]
|
||||
}
|
||||
|
||||
shell SlideSorterController
|
||||
|
||||
@@ -160,6 +160,11 @@ interface DrawView
|
||||
ExecMethod = FuTemporary ;
|
||||
StateMethod = GetMenuState ;
|
||||
]
|
||||
SID_INSERT_CANVAS_SLIDE
|
||||
[
|
||||
ExecMethod = FuTemporary ;
|
||||
StateMethod = GetMenuState ;
|
||||
]
|
||||
SID_HYPERLINK_SETLINK // ole : no, status : no
|
||||
[
|
||||
ExecMethod = FuTemporary ;
|
||||
|
||||
@@ -1673,6 +1673,23 @@ SfxVoidItem InsertPage SID_INSERTPAGE
|
||||
GroupId = SfxGroupId::Insert;
|
||||
]
|
||||
|
||||
SfxVoidItem InsertCanvasSlide SID_INSERT_CANVAS_SLIDE
|
||||
()
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
ReadOnlyDoc = FALSE,
|
||||
Toggle = FALSE,
|
||||
Container = FALSE,
|
||||
RecordAbsolute = FALSE,
|
||||
RecordPerSet;
|
||||
|
||||
AccelConfig = TRUE,
|
||||
MenuConfig = TRUE,
|
||||
ToolBoxConfig = TRUE,
|
||||
GroupId = SfxGroupId::Insert;
|
||||
]
|
||||
|
||||
SfxVoidItem InsertPageField SID_INSERT_FLD_PAGE
|
||||
()
|
||||
[
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <DrawDocShell.hxx>
|
||||
|
||||
#include "PageListWatcher.hxx"
|
||||
#include <strings.hxx>
|
||||
#include <unokywds.hxx>
|
||||
|
||||
using namespace ::sd;
|
||||
@@ -1444,6 +1445,22 @@ void SdDrawDocument::SetupNewPage (
|
||||
}
|
||||
}
|
||||
|
||||
sal_uInt16 SdDrawDocument::InsertCanvasPage()
|
||||
{
|
||||
sal_uInt16 nLastPageNum = GetSdPageCount(PageKind::Standard);
|
||||
SdPage* pLastStandardPage = GetSdPage(nLastPageNum - 1, PageKind::Standard);
|
||||
|
||||
sal_uInt16 nCanvasPageNum = CreatePage(pLastStandardPage, PageKind::Standard, u"Canvas Page"_ustr, u"Canvas notes page"_ustr, AutoLayout::AUTOLAYOUT_NONE, AutoLayout::AUTOLAYOUT_NONE, false, true, pLastStandardPage->GetPageNum() + 2);
|
||||
|
||||
SdPage* pCanvasPage = GetSdPage(nCanvasPageNum, PageKind::Standard);
|
||||
|
||||
const Size aCanvasSize(500000, 500000);
|
||||
|
||||
ResizeCurrentPage(pCanvasPage, aCanvasSize, PageKind::Standard);
|
||||
|
||||
return pCanvasPage->GetPageNum() / 2;
|
||||
}
|
||||
|
||||
sd::UndoManager* SdDrawDocument::GetUndoManager() const
|
||||
{
|
||||
return mpDocSh ? dynamic_cast< sd::UndoManager* >(mpDocSh->GetUndoManager()) : nullptr;
|
||||
|
||||
@@ -248,6 +248,20 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
|
||||
rRequest.Done();
|
||||
break;
|
||||
|
||||
case SID_INSERT_CANVAS_SLIDE:
|
||||
{
|
||||
SdDrawDocument* pDoc = pShell->GetDoc();
|
||||
sal_uInt16 nCanvasPageIndex = pDoc->InsertCanvasPage();
|
||||
SdPage* pCanvasPage = static_cast<SdPage*>(pDoc->GetPage(nCanvasPageIndex));
|
||||
|
||||
view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
|
||||
PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
|
||||
mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
|
||||
mrSlideSorter.GetController().GetPageSelector().SelectPage(pCanvasPage);
|
||||
rRequest.Done();
|
||||
}
|
||||
break;
|
||||
|
||||
case SID_DELETE_PAGE:
|
||||
case SID_DELETE_MASTER_PAGE:
|
||||
case SID_DELETE: // we need SID_CUT to handle the delete key
|
||||
|
||||
@@ -1399,6 +1399,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|
||||
rReq.Done ();
|
||||
}
|
||||
break;
|
||||
case SID_INSERT_CANVAS_SLIDE:
|
||||
{
|
||||
sal_uInt16 nCanvasPageIndex = GetDoc()->InsertCanvasPage();
|
||||
Cancel(); // Don't know what this does
|
||||
SwitchPage(nCanvasPageIndex);
|
||||
rReq.Done();
|
||||
}
|
||||
break;
|
||||
|
||||
case SID_DUPLICATE_PAGE:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user