[Libreoffice-commits] core.git: Branch 'feature/calctiledrendering3' - 4 commits - desktop/source include/LibreOfficeKit include/vcl libreofficekit/qa libreofficekit/source sc/inc sc/source sd/source sw/inc sw/source
Andrzej Hunt
andrzej.hunt at collabora.com
Tue Jul 8 08:31:34 PDT 2014
desktop/source/lib/init.cxx | 47 ++++++++++++++++----
include/LibreOfficeKit/LibreOfficeKit.h | 3 -
include/LibreOfficeKit/LibreOfficeKit.hxx | 9 ++-
include/LibreOfficeKit/LibreOfficeKitGtk.h | 7 ++
include/vcl/ITiledRenderable.hxx | 16 ++++++
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 34 ++++++++++++++
libreofficekit/source/gtk/lokdocview.c | 17 +++++++
sc/inc/docuno.hxx | 3 +
sc/source/ui/unoobj/docuno.cxx | 18 +++++++
sd/source/ui/inc/unomodel.hxx | 18 +++++++
sd/source/ui/unoidl/unomodel.cxx | 35 ++++++++++++++
sw/inc/unotxdoc.hxx | 3 +
sw/source/uibase/uno/unotxdoc.cxx | 15 ++++++
13 files changed, 212 insertions(+), 13 deletions(-)
New commits:
commit 9403558ae247b1783d9149edc4e89772a8883658
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Tue Jul 8 16:41:56 2014 +0200
Add Tiled Rendering outline to sd.
Change-Id: I810d827f330690f8071b662b9ddd05cc41655a71
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index f9fafdd..6887663 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -45,6 +45,8 @@
#include <sfx2/sfxbasemodel.hxx>
#include <svx/fmdmod.hxx>
+#include <vcl/ITiledRenderable.hxx>
+
#include <editeng/unoipset.hxx>
#include <comphelper/servicehelper.hxx>
@@ -76,7 +78,8 @@ class SdXImpressDocument : public SfxBaseModel, // implements SfxListener, OWEAK
public ::com::sun::star::lang::XServiceInfo,
public ::com::sun::star::ucb::XAnyCompareFactory,
public ::com::sun::star::presentation::XHandoutMasterSupplier,
- public ::com::sun::star::view::XRenderable
+ public ::com::sun::star::view::XRenderable,
+ public ::vcl::ITiledRenderable
{
friend class SdDrawPagesAccess;
friend class SdMasterPagesAccess;
@@ -218,6 +221,19 @@ public:
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ // ITiledRenderable
+ virtual void paintTile( VirtualDevice& rDevice,
+ int nOutputWidth,
+ int nOutputHeight,
+ int nTilePosX,
+ int nTilePosY,
+ long nTileWidth,
+ long nTileHeight ) SAL_OVERRIDE;
+ virtual Size getDocumentSize() SAL_OVERRIDE;
+ virtual void setPart( int nPart ) SAL_OVERRIDE;
+ virtual int getPart() SAL_OVERRIDE;
+ virtual int getParts() SAL_OVERRIDE;
+
// XComponent
/** This dispose implementation releases the resources held by the
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index bc970e9..3320236 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2185,6 +2185,41 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
}
}
+void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
+ int nOutputWidth, int nOutputHeight,
+ int nTilePosX, int nTilePosY,
+ long nTileWidth, long nTileHeight )
+{
+ (void) rDevice;
+ (void) nOutputWidth;
+ (void) nOutputHeight;
+ (void) nTilePosX;
+ (void) nTilePosY;
+ (void) nTileWidth;
+ (void) nTileHeight;
+}
+
+void SdXImpressDocument::setPart( int nPart )
+{
+ (void) nPart;
+}
+
+int SdXImpressDocument::getParts()
+{
+ return 1;
+}
+
+int SdXImpressDocument::getPart()
+{
+ return 0;
+}
+
+Size SdXImpressDocument::getDocumentSize()
+{
+ return Size( 100, 100 );
+}
+
+
uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
{
uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
commit 1f574485de6d685ffa59e6cf6d09b4533e764f4b
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Tue Jul 8 15:32:46 2014 +0200
Add part selector to gtktiledviewer.
Change-Id: I569c8f0ebf4476c0a247cde15a263d1db956a14b
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3a232e8..194c5fa 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -117,6 +117,30 @@ void changeQuadView( GtkWidget* /*pButton*/, gpointer /* pItem */ )
}
}
+void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
+{
+ char sText[10];
+ for ( int i = 0; i < lok_docview_get_parts(pView); i++ )
+ {
+ sprintf( sText, "%i", i+1 );
+ gtk_combo_box_text_append_text( pSelector, sText );
+ }
+ gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 );
+}
+
+void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
+{
+ int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) );
+
+ fprintf( stderr, "we have part %i\n", nPart );
+ // We don't really care about the quad view for now -- it's only purpose
+ // is to check that the edges of tiles aren't messed up, and no real
+ // reason to maintain it to be able to show other document parts etc.
+ if ( pDocView )
+ {
+ lok_docview_set_part( LOK_DOCVIEW(pDocView), nPart );
+ }
+}
int main( int argc, char* argv[] )
{
@@ -165,6 +189,15 @@ int main( int argc, char* argv[] )
GtkToolItem* pSeparator1 = gtk_separator_tool_item_new();
gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator1, -1);
+ GtkToolItem* pPartSelectorToolItem = gtk_tool_item_new();
+ GtkWidget* pComboBox = gtk_combo_box_text_new();
+ gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox );
+ gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 );
+ g_signal_connect( G_OBJECT(pComboBox), "changed", G_CALLBACK(changePart), NULL );
+
+ GtkToolItem* pSeparator2 = gtk_separator_tool_item_new();
+ gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
+
GtkToolItem* pEnableQuadView = gtk_toggle_tool_button_new();
gtk_tool_button_set_label( GTK_TOOL_BUTTON(pEnableQuadView), "Use Quad View" );
gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pEnableQuadView, -1 );
@@ -181,6 +214,7 @@ int main( int argc, char* argv[] )
pFileName = argv[2];
lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] );
+ populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) );
gtk_main();
commit 0e249618295b7ddb314165fe5c83fae2fdbcc46a
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Tue Jul 8 15:32:20 2014 +0200
LOK DocView: implement part selection.
Change-Id: I2e16ca9d2d5fcd25b0435f1b9b0fbcb52b92e012
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index f160925..37d21f0 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -58,8 +58,13 @@ void lok_docview_set_zoom (LOKDocView* pDocView,
float fZoom);
float lok_docview_get_zoom (LOKDocView* pDocView);
+int lok_docview_get_parts (LOKDocView* pDocView);
+int lok_docview_get_part (LOKDocView* pDocView);
+void lok_docview_set_part (LOKDocView* pDocView,
+ int nPart);
+
#ifdef __cplusplus
}
#endif
-#endif
\ No newline at end of file
+#endif
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 12b004e08..4c12777 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -174,4 +174,21 @@ SAL_DLLPUBLIC_EXPORT float lok_docview_get_zoom ( LOKDocView* pDocView )
return pDocView->fZoom;
}
+SAL_DLLPUBLIC_EXPORT int lok_docview_get_parts( LOKDocView* pDocView )
+{
+ return pDocView->pDocument->pClass->getNumberOfParts( pDocView->pDocument );
+}
+
+SAL_DLLPUBLIC_EXPORT int lok_docview_get_part( LOKDocView* pDocView )
+{
+ return pDocView->pClass->getPart( pDocView->pDocument );
+}
+
+SAL_DLLPUBLIC_EXPORT void lok_docview_set_part( LOKDocView* pDocView, int nPart)
+{
+ pDocView->pDocument->pClass->setPart( pDocView->pDocument, nPart );
+ renderDocument( pDocView );
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 624ce90f86ea9a3aec0ec87a998c6ce75ab59327
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Tue Jul 8 15:23:06 2014 +0200
Add get/setPart to ITiledRenderable, and implement for sw/sc.
Change-Id: Iec3d6374f029149cadf8fb9c9b16fec90146c31e
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0f72bd6..e1931b5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -181,7 +181,8 @@ extern "C"
static void doc_destroy(LibreOfficeKitDocument* pThis);
static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions);
static LibreOfficeKitDocumentType doc_getDocumentType(LibreOfficeKitDocument* pThis);
-static int doc_getNumberOfParts(LibreOfficeKitDocument* pThis);
+static int doc_getParts(LibreOfficeKitDocument* pThis);
+static int doc_getPart(LibreOfficeKitDocument* pThis);
static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
void doc_paintTile(LibreOfficeKitDocument* pThis,
unsigned char* pBuffer,
@@ -210,7 +211,8 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
m_pDocumentClass->destroy = doc_destroy;
m_pDocumentClass->saveAs = doc_saveAs;
m_pDocumentClass->getDocumentType = doc_getDocumentType;
- m_pDocumentClass->getNumberOfParts = doc_getNumberOfParts;
+ m_pDocumentClass->getParts = doc_getParts;
+ m_pDocumentClass->getPart = doc_getPart;
m_pDocumentClass->setPart = doc_setPart;
m_pDocumentClass->paintTile = doc_paintTile;
m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -420,17 +422,46 @@ static LibreOfficeKitDocumentType doc_getDocumentType (LibreOfficeKitDocument* p
return LOK_DOCTYPE_OTHER;
}
-static int doc_getNumberOfParts (LibreOfficeKitDocument* pThis)
+static int doc_getParts (LibreOfficeKitDocument* pThis)
{
- (void) pThis;
- // Assume writer document for now.
- return 1;
+ LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+ ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+ if (!pDoc)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ return 0;
+ }
+
+ return pDoc->getParts();
+}
+
+static int doc_getPart (LibreOfficeKitDocument* pThis)
+{
+ LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+ ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+ if (!pDoc)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ return 0;
+ }
+
+ return pDoc->getPart();
}
static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart)
{
- (void) pThis;
- (void) nPart;
+ LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+ ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+ if (!pDoc)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ return;
+ }
+
+ pDoc->setPart( nPart );
}
void doc_paintTile (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index ba4319f..675eabc 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -77,8 +77,9 @@ struct _LibreOfficeKitDocumentClass
// Part refers to either indivual sheets in a Spreadsheet, or slides
// in a Slideshow, and has no relevance for wrtier documents.
- int (*getNumberOfParts) (LibreOfficeKitDocument* pThis);
+ int (*getParts) (LibreOfficeKitDocument* pThis);
+ int (*getPart) (LibreOfficeKitDocument* pThis);
void (*setPart) (LibreOfficeKitDocument* pThis,
int nPart);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 427ea83..8ec9674 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -49,9 +49,14 @@ public:
return mpDoc->pClass->getDocumentType(mpDoc);
}
- inline int getNumberOfParts()
+ inline int getParts()
{
- return mpDoc->pClass->getNumberOfParts(mpDoc);
+ return mpDoc->pClass->getParts(mpDoc);
+ }
+
+ inline int getPart()
+ {
+ return mpDoc->pClass->getPart(mpDoc);
}
inline void setPart(int nPart)
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index fecfd6c..f5ce44a 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -41,6 +41,22 @@ public:
*/
virtual Size getDocumentSize() = 0;
+ /**
+ * Set the document "part", i.e. slide for a slideshow, and
+ * tab for a spreadsheet.
+ */
+ virtual void setPart( int nPart ) = 0;
+
+ /**
+ * Get the number of parts -- see setPart for further details.
+ */
+ virtual int getParts() = 0;
+
+ /**
+ * Get the currently displayed/selected part -- see setPart for further
+ * details.
+ */
+ virtual int getPart() = 0;
};
} // namespace vcl
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 27575fe..932017d 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -363,6 +363,9 @@ public:
long nTileWidth,
long nTileHeight ) SAL_OVERRIDE;
virtual Size getDocumentSize() SAL_OVERRIDE;
+ virtual void setPart( int nPart ) SAL_OVERRIDE;
+ virtual int getPart() SAL_OVERRIDE;
+ virtual int getParts() SAL_OVERRIDE;
};
class ScDrawPagesObj : public cppu::WeakImplHelper2<
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ca18caa..d4c14cf 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -461,6 +461,24 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
nTilePosX, nTilePosY, nTileWidth, nTileHeight );
}
+void ScModelObj::setPart( int nPart )
+{
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ pViewData->SetTabNo( nPart );
+}
+
+int ScModelObj::getParts()
+{
+ ScDocument& rDoc = pDocShell->GetDocument();
+ return rDoc.GetTableCount();
+}
+
+int ScModelObj::getPart()
+{
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ return pViewData->GetTabNo();
+}
+
Size ScModelObj::getDocumentSize()
{
// There seems to be no clear way of getting the grid window for this
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index a48a8f3..1318071 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -439,6 +439,9 @@ public:
long nTileWidth,
long nTileHeight ) SAL_OVERRIDE;
virtual Size getDocumentSize() SAL_OVERRIDE;
+ virtual void setPart( int nPart ) SAL_OVERRIDE;
+ virtual int getPart() SAL_OVERRIDE;
+ virtual int getParts() SAL_OVERRIDE;
void Invalidate();
void Reactivate(SwDocShell* pNewDocShell);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b61eb77..e6c2fc1 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3137,6 +3137,21 @@ Size SwXTextDocument::getDocumentSize()
return pViewShell->GetDocSize();
}
+void SwXTextDocument::setPart( int /*nPart*/ )
+{
+}
+
+void SwXTextDocument::getPart()
+{
+ return 0;
+}
+
+int SwXTextDocument::getParts()
+{
+ // For now we treat the document as one large piece.
+ return 1;
+}
+
void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
{
return SwXTextDocumentBaseClass::operator new(t);
More information about the Libreoffice-commits
mailing list