Kaydet (Commit) 3c9660f9 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Ashod Nakashian

LOK: support for ordering/moving parts

Currently reordering of slides is only supported
for presentations, although it is provisioned for
spreadsheets as well.

Change-Id: I6c35066d6a5ef7586d34a8e8b89db69a20b86572
Reviewed-on: https://gerrit.libreoffice.org/69612Reviewed-by: 's avatarAshod Nakashian <ashnakash@gmail.com>
Tested-by: 's avatarAshod Nakashian <ashnakash@gmail.com>
üst a3c88955
......@@ -2669,9 +2669,10 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct _LibreOfficeKitDocumentClass, moveSelectedParts));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), sizeof(struct _LibreOfficeKitDocumentClass));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
......
......@@ -684,6 +684,7 @@ static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis);
static int doc_getPart(LibreOfficeKitDocument* pThis);
static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect);
static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart);
static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode);
static void doc_paintTile(LibreOfficeKitDocument* pThis,
......@@ -835,6 +836,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->getPart = doc_getPart;
m_pDocumentClass->setPart = doc_setPart;
m_pDocumentClass->selectPart = doc_selectPart;
m_pDocumentClass->moveSelectedParts = doc_moveSelectedParts;
m_pDocumentClass->getPartName = doc_getPartName;
m_pDocumentClass->setPartMode = doc_setPartMode;
m_pDocumentClass->paintTile = doc_paintTile;
......@@ -2265,6 +2267,22 @@ static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect
pDoc->selectPart( nPart, nSelect );
}
static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate)
{
SolarMutexGuard aGuard;
if (gImpl)
gImpl->maLastExceptionMsg.clear();
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
{
gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
return;
}
pDoc->moveSelectedParts(nPosition, bDuplicate);
}
static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis)
{
SolarMutexGuard aGuard;
......
......@@ -363,6 +363,9 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::selectPart().
void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
/// @see lok::Document::moveSelectedParts().
void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
......
......@@ -628,6 +628,14 @@ public:
mpDoc->pClass->selectPart(mpDoc, nPart, nSelect);
}
/// Moves the selected pages/slides to a new position.
/// nPosition is the new position where the selection
/// should go. bDuplicate when true will copy instead of move.
void moveSelectedParts(int nPosition, bool bDuplicate)
{
mpDoc->pClass->moveSelectedParts(mpDoc, nPosition, bDuplicate);
}
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
......
......@@ -327,6 +327,12 @@ public:
*/
virtual void selectPart(int /*nPart*/, int /*nSelect*/) {}
/**
* Move selected pages/slides to a new position.
* nPosition: the new position to move to.
* bDuplicate: to copy (true), or to move (false).
*/
virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
};
} // namespace vcl
......
......@@ -267,6 +267,8 @@ public:
virtual OUString getPostIts() override;
/// @see vcl::ITiledRenderable::selectPart().
virtual void selectPart(int nPart, int nSelect) override;
/// @see vcl::ITiledRenderable::moveSelectedParts().
virtual void moveSelectedParts(int nPosition, bool bDuplicate) override;
/// @see vcl::ITiledRenderable::getPartInfo().
virtual OUString getPartInfo(int nPart) override;
......
......@@ -2298,6 +2298,13 @@ void SdXImpressDocument::selectPart(int nPart, int nSelect)
pViewSh->SelectPage(nPart, nSelect);
}
void SdXImpressDocument::moveSelectedParts(int nPosition, bool bDuplicate)
{
// Duplicating is currently unsupported.
if (!bDuplicate)
mpDoc->MovePages(nPosition);
}
OUString SdXImpressDocument::getPartInfo(int nPart)
{
DrawViewShell* pViewSh = GetViewShell();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment