[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 3 commits - include/tools sd/source sw/source tools/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Feb 17 07:34:23 PST 2015
include/tools/gen.hxx | 5 +++++
sd/source/ui/inc/ViewShell.hxx | 9 +++++++++
sd/source/ui/inc/Window.hxx | 2 ++
sd/source/ui/inc/unomodel.hxx | 4 +++-
sd/source/ui/unoidl/unomodel.cxx | 6 ++++++
sd/source/ui/view/sdwindow.cxx | 10 ++++++++++
sd/source/ui/view/viewshel.cxx | 14 ++++++++++++++
sw/source/core/crsr/viscrs.cxx | 17 +++++++----------
sw/source/uibase/docvw/edtwin.cxx | 7 +------
tools/source/generic/gen.cxx | 7 +++++++
10 files changed, 64 insertions(+), 17 deletions(-)
New commits:
commit 0a0afddf84b968e1715b2681b270cbc93c65a220
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Feb 17 16:31:30 2015 +0100
sd: initial ViewShell::libreOfficeKitCallback()
With this, typing into an empty document + pressing Esc makes those
typed characters visible.
Change-Id: I57d05f40d1bb6afa2b8c68ce1d10906203aa4bc8
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index b4bd333..e5f082c 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -23,6 +23,7 @@
#include <rtl/ref.hxx>
#include <vcl/field.hxx>
+#include <vcl/ITiledRenderable.hxx>
#include <sfx2/viewsh.hxx>
#include <vcl/prntypes.hxx>
#include <svtools/transfer.hxx>
@@ -443,6 +444,11 @@ public:
SdPage* pPage,
const sal_Int32 nInsertPosition = -1);
+ /// The actual implementation of the vcl::ITiledRenderable::registerCallback() API for Impress.
+ void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
+ /// Invokes the registered callback, if there are any.
+ void libreOfficeKitCallback(int nType, const char* pPayload) const;
+
class Implementation;
protected:
@@ -576,6 +582,9 @@ private:
/** Create the rulers.
*/
void SetupRulers (void);
+
+ LibreOfficeKitCallback mpLibreOfficeKitCallback;
+ void* mpLibreOfficeKitData;
};
SdrView* ViewShell::GetDrawView (void) const
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 043d742..fbeb73a 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -240,8 +240,10 @@ public:
virtual OUString getPartName( int nPart ) SAL_OVERRIDE;
virtual void setPartMode( LibreOfficeKitPartMode ePartMode ) SAL_OVERRIDE;
- /// @see ITiledRenderable::initializeForTiledRendering().
+ /// @see vcl::ITiledRenderable::initializeForTiledRendering().
virtual void initializeForTiledRendering() SAL_OVERRIDE;
+ /// @see vcl::ITiledRenderable::registerCallback().
+ virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
// XComponent
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b935089..76717a5 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2354,6 +2354,12 @@ void SdXImpressDocument::initializeForTiledRendering()
mpDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_VIEWSHELL0, SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
}
+void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData)
+{
+ SolarMutexGuard aGuard;
+ mpDocShell->GetViewShell()->registerLibreOfficeKitCallback(pCallback, pData);
+}
+
uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
{
uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 3ee8790..8222f38 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -992,6 +992,7 @@ void Window::LogicInvalidate(const ::vcl::Region* pRegion)
sRectangle = "EMPTY";
else
sRectangle = pRegion->GetBoundRect().toString();
+ mpViewShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
} // end of namespace sd
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 83dc9ca..f728131 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -137,6 +137,8 @@ ViewShell::ViewShell( SfxViewFrame*, vcl::Window* pParentWindow, ViewShellBase&
: SfxShell(&rViewShellBase)
, mbCenterAllowed(bAllowCenter)
, mpParentWindow(pParentWindow)
+, mpLibreOfficeKitCallback(0)
+, mpLibreOfficeKitData(0)
{
construct();
}
@@ -1448,6 +1450,18 @@ void ViewShell::NotifyAccUpdate( )
GetViewShellBase().GetDrawController().NotifyAccUpdate();
}
+void ViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData)
+{
+ mpLibreOfficeKitCallback = pCallback;
+ mpLibreOfficeKitData = pData;
+}
+
+void ViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const
+{
+ if (mpLibreOfficeKitCallback)
+ mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData);
+}
+
} // end of namespace sd
//===== ViewShellObjectBarFactory =============================================
commit 89dcde8f10b1c196fe6cdb9663d9ece69f4fb90a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Feb 17 16:00:00 2015 +0100
sd: initial Window::LogicInvalidate()
Change-Id: I070e5ccac61061730f5d0fecfc197d9fb88dca51
diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
index 3eb247a..9055037 100644
--- a/sd/source/ui/inc/Window.hxx
+++ b/sd/source/ui/inc/Window.hxx
@@ -192,6 +192,8 @@ protected:
OUString GetSurroundingText() const SAL_OVERRIDE;
Selection GetSurroundingTextSelection() const SAL_OVERRIDE;
+ /// @see OutputDevice::LogicInvalidate().
+ void LogicInvalidate(const ::vcl::Region* pRegion) SAL_OVERRIDE;
};
} // end of namespace sd
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 880c82d..3ee8790 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -985,6 +985,15 @@ Selection Window::GetSurroundingTextSelection() const
}
}
+void Window::LogicInvalidate(const ::vcl::Region* pRegion)
+{
+ OString sRectangle;
+ if (!pRegion)
+ sRectangle = "EMPTY";
+ else
+ sRectangle = pRegion->GetBoundRect().toString();
+}
+
} // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1a33747910e9e5696df1ff0c73a9b6136a719b12
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Feb 17 15:28:31 2015 +0100
Add Rectangle::toString()
There were already 5 versions of this in sw, 4 for SwRect, one for
Rectangle.
Change-Id: Icf8c78f9973d940a4d180b6f52dda9ea1be86c14
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index e8ad8fe..b17cb19 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -27,6 +27,10 @@
#include <cstdlib>
class SvStream;
+namespace rtl
+{
+ class OString;
+}
enum TriState { TRISTATE_FALSE, TRISTATE_TRUE, TRISTATE_INDET };
@@ -436,6 +440,7 @@ public:
void setY( long n ) { nBottom += n-nTop; nTop = n; }
void setWidth( long n ) { nRight = nLeft + n; }
void setHeight( long n ) { nBottom = nTop + n; }
+ rtl::OString toString() const;
private:
long nLeft;
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 46b740b..0803ae2 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -179,9 +179,8 @@ void SwVisCrsr::_SetPosAndShow()
if (m_pCrsrShell->isTiledRendering())
{
- std::stringstream ss;
- ss << aRect.Width() << ", " << aRect.Height() << ", " << aRect.Left() << ", " << aRect.Top();
- OString sRect = ss.str().c_str();
+ Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height());
+ OString sRect = aSVRect.toString();
m_pCrsrShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr());
}
@@ -343,13 +342,11 @@ void SwSelPaintRects::Show()
// client side.
const SwShellCrsr* pCursor = GetShell()->getShellCrsr(false);
SwRect aStartRect = lcl_getLayoutRect(pCursor->GetSttPos(), *pCursor->Start());
- std::stringstream ss;
- ss << aStartRect.Width() << ", " << aStartRect.Height() << ", " << aStartRect.Left() << ", " << aStartRect.Top();
- GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, ss.str().c_str());
+ OString sRect = aStartRect.SVRect().toString();
+ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr());
SwRect aEndRect = lcl_getLayoutRect(pCursor->GetEndPos(), *pCursor->End());
- ss.str("");
- ss << aEndRect.Width() << ", " << aEndRect.Height() << ", " << aEndRect.Left() << ", " << aEndRect.Top();
- GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, ss.str().c_str());
+ sRect = aEndRect.SVRect().toString();
+ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr());
}
std::stringstream ss;
@@ -358,7 +355,7 @@ void SwSelPaintRects::Show()
const SwRect& rRect = (*this)[i];
if (i)
ss << "; ";
- ss << rRect.Width() << ", " << rRect.Height() << ", " << rRect.Left() << ", " << rRect.Top();
+ ss << rRect.SVRect().toString().getStr();
}
OString sRect = ss.str().c_str();
GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 53a1abb..9fb33c8 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6234,12 +6234,7 @@ void SwEditWin::LogicInvalidate(const vcl::Region* pRegion)
if (!pRegion)
sRectangle = "EMPTY";
else
- {
- std::stringstream ss;
- Rectangle aRectangle = pRegion->GetBoundRect();
- ss << aRectangle.getWidth() << ", " << aRectangle.getHeight() << ", " << aRectangle.getX() << ", " << aRectangle.getY();
- sRectangle = ss.str().c_str();
- }
+ sRectangle = pRegion->GetBoundRect().toString();
m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index cc64f8f..e2a61c5 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -195,4 +195,11 @@ SvStream& WriteRectangle( SvStream& rOStream, const Rectangle& rRect )
return rOStream;
}
+OString Rectangle::toString() const
+{
+ std::stringstream ss;
+ ss << getWidth() << ", " << getHeight() << ", " << getX() << ", " << getY();
+ return ss.str().c_str();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list