summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx18
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitEnums.h19
-rw-r--r--include/sfx2/sfxsids.hrc2
-rw-r--r--include/svtools/ruler.hxx1
-rw-r--r--include/svx/ruler.hxx9
-rw-r--r--include/svx/svxids.hrc1
-rw-r--r--include/vcl/ITiledRenderable.hxx9
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx1
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx8
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx2
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv.ui14
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx16
-rw-r--r--sfx2/source/appl/appuno.cxx2
-rw-r--r--svtools/source/control/ruler.cxx5
-rw-r--r--svx/sdi/svx.sdi18
-rw-r--r--svx/source/dialog/svxruler.cxx13
-rw-r--r--sw/inc/unotxdoc.hxx3
-rw-r--r--sw/sdi/_viewsh.sdi4
-rw-r--r--sw/source/uibase/inc/swruler.hxx2
-rw-r--r--sw/source/uibase/misc/swruler.cxx33
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx19
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx8
22 files changed, 202 insertions, 5 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c713b4b3831a..fca53b297529 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -65,6 +65,7 @@
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
#include <svx/strings.hrc>
+#include <svx/ruler.hxx>
#include <svx/svxids.hrc>
#include <svx/ucsubset.hxx>
#include <vcl/svapp.hxx>
@@ -805,6 +806,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
case LOK_CALLBACK_CURSOR_VISIBLE:
case LOK_CALLBACK_SET_PART:
case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
+ case LOK_CALLBACK_RULER_UPDATE:
{
removeAll([type] (const queue_type::value_type& elem) { return (elem.first == type); });
}
@@ -2044,6 +2046,18 @@ static char* getPostItsPos(LibreOfficeKitDocument* pThis)
return strdup(aComments.toUtf8().getStr());
}
+static char* getRulerState(LibreOfficeKitDocument* pThis)
+{
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (!pDoc)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+ return nullptr;
+ }
+ OUString state = pDoc->getRulerState();
+ return strdup(state.toUtf8().getStr());
+}
+
static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode)
{
SolarMutexGuard aGuard;
@@ -2651,6 +2665,10 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
{
return getPostItsPos(pThis);
}
+ else if (aCommand == ".uno:RulerState")
+ {
+ return getRulerState(pThis);
+ }
else if (aCommand.startsWith(aViewRowColumnHeaders))
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 300b71bb01ff..c3b71f3f1aad 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -504,7 +504,24 @@ typedef enum
/**
* The text content of the address field in Calc.
*/
- LOK_CALLBACK_CELL_ADDRESS = 34
+ LOK_CALLBACK_CELL_ADDRESS = 34,
+ /**
+ * The key ruler related properties on change are reported by this.
+ *
+ * The payload format is:
+ *
+ * {
+ * "margin1": "...",
+ * "margin2": "...",
+ * "leftOffset": "...",
+ * "pageOffset": "...",
+ * "pageWidth": "...",
+ * "unit": "..."
+ * }
+ *
+ * Here all aproperties are same as described in svxruler.
+ */
+ LOK_CALLBACK_RULER_UPDATE = 35
}
LibreOfficeKitCallbackType;
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index d8703674810e..ea38db1e3cea 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -541,6 +541,8 @@
#define SID_COMP_BIBLIOGRAPHY (SID_SVX_START + 880)
#define SID_ADDRESS_DATA_SOURCE (SID_SVX_START + 934)
#define SID_OPEN_SMARTTAGOPTIONS (SID_SVX_START + 1062)
+#define SID_RULER_MARGIN1 (SID_SVX_START + 1063)
+#define SID_RULER_MARGIN2 (SID_SVX_START + 1064)
#define FID_SVX_START (SID_LIB_START + 500)
#define FID_SEARCH_NOW (FID_SVX_START + 2)
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index e95febf8fabd..affdebf10099 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -773,6 +773,7 @@ public:
void SetMargin2() { SetMargin2( 0, RulerMarginStyle::Invisible ); }
void SetMargin2( long nPos, RulerMarginStyle nMarginStyle = RulerMarginStyle::Sizeable );
long GetMargin2() const;
+ long GetPageWidth() const;
void SetLeftFrameMargin( long nPos );
void SetRightFrameMargin( long nPos );
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx
index 2fef8b7fb7c9..02baa710d2c8 100644
--- a/include/svx/ruler.hxx
+++ b/include/svx/ruler.hxx
@@ -41,6 +41,12 @@ class SvxObjectItem;
class SfxBoolItem;
struct SvxRuler_Impl;
+enum class RulerChangeType
+{
+ MARGIN1,
+ MARGIN2
+};
+
enum class SvxRulerDragFlags
{
NONE = 0x00,
@@ -250,7 +256,6 @@ protected:
bool bForceDontConsiderHidden = false,
sal_uInt16 nAct=USHRT_MAX ) const;
long CalcPropMaxRight(sal_uInt16 nCol = USHRT_MAX) const;
- long GetPageWidth() const;
public:
@@ -273,6 +278,8 @@ public:
//#i24363# tab stops relative to indent
void SetTabsRelativeToIndent( bool bRel );
+ void SetValues(RulerChangeType type, long value);
+ long GetPageWidth() const;
};
#endif
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 2c37e45b9c21..157eb35431f1 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -234,6 +234,7 @@
// CAUTION! Range <64 .. 67> used by EditEngine (!)
+#define SID_RULER_CHANGE_STATE ( SID_SVX_START + 78 )
#define SID_RULER_NULL_OFFSET ( SID_SVX_START + 79 )
#define SID_RULER_BORDERS ( SID_SVX_START + 80 )
#define SID_RULER_OBJECT ( SID_SVX_START + 81 )
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 1689eee3543d..7b0720a429b7 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -13,6 +13,7 @@
#include <LibreOfficeKit/LibreOfficeKitTypes.h>
#include <tools/gen.hxx>
+#include <svx/ruler.hxx>
#include <vcl/pointr.hxx>
#include <vcl/virdev.hxx>
#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
@@ -220,8 +221,14 @@ public:
{
return OUString();
}
-};
+ /// Implementation for
+ /// lok::Document::getCommandValues(".uno:RulerState");
+ virtual OUString getRulerState()
+ {
+ return OUString();
+ }
+};
} // namespace vcl
#endif // INCLUDED_VCL_ITILEDRENDERABLE_HXX
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
index 0da85fd89e65..f94ef776b6d2 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx
@@ -103,6 +103,7 @@ gtv_main_toolbar_init(GtvMainToolbar* toolbar)
gtk_builder_add_callback_symbol(builder.get(), "doCopy", G_CALLBACK(doCopy));
gtk_builder_add_callback_symbol(builder.get(), "doPaste", G_CALLBACK(doPaste));
gtk_builder_add_callback_symbol(builder.get(), "createView", G_CALLBACK(createView));
+ gtk_builder_add_callback_symbol(builder.get(), "getRulerState", G_CALLBACK(getRulerState));
gtk_builder_add_callback_symbol(builder.get(), "unoCommandDebugger", G_CALLBACK(unoCommandDebugger));
gtk_builder_add_callback_symbol(builder.get(), "toggleEditing", G_CALLBACK(toggleEditing));
gtk_builder_add_callback_symbol(builder.get(), "changePartMode", G_CALLBACK(changePartMode));
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index 3c9ee3e405f2..9e0b575dcdd5 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -133,6 +133,14 @@ void createView(GtkWidget* pButton, gpointer /*pItem*/)
gtv_application_window_create_view_from_window(GTV_APPLICATION_WINDOW(window));
}
+void getRulerState(GtkWidget* pButton, gpointer /*pItem*/)
+{
+ const std::string type = ".uno:RulerState";
+ GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(pButton));
+ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
+ pDocument->pClass->getCommandValues(pDocument, type.c_str());
+}
+
static void removeUnoParam(GtkWidget* pWidget, gpointer userdata)
{
GtkWidget* pParamAreaBox = GTK_WIDGET(userdata);
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
index a19a7b5cd744..2f9948fe61d7 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx
@@ -20,6 +20,8 @@ void doPaste(GtkWidget* pButton, gpointer /*pItem*/);
void createView(GtkWidget* pButton, gpointer /*pItem*/);
+void getRulerState(GtkWidget* pButton, gpointer /*pItem*/);
+
void unoCommandDebugger(GtkWidget* pButton, gpointer /* pItem */);
void toggleEditing(GtkWidget* pButton, gpointer /*pItem*/);
diff --git a/libreofficekit/qa/gtktiledviewer/gtv.ui b/libreofficekit/qa/gtktiledviewer/gtv.ui
index e27f79714a4b..eacec33b2d1b 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv.ui
+++ b/libreofficekit/qa/gtktiledviewer/gtv.ui
@@ -486,6 +486,20 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkToolButton" id="btn_rulerstate">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">.uno:UpdateRuler</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">text-x-generic</property>
+ <signal name="clicked" handler="getRulerState" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
</object>
<object class="GtkToolbar" id="toolbar2">
<property name="visible">True</property>
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 37932525596c..3d4b0fa8279d 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -278,6 +278,7 @@ enum
TEXT_SELECTION,
PASSWORD_REQUIRED,
COMMENT,
+ RULER,
LAST_SIGNAL
};
@@ -433,6 +434,8 @@ callbackTypeToString (int nType)
return "LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED";
case LOK_CALLBACK_COMMENT:
return "LOK_CALLBACK_COMMENT";
+ case LOK_CALLBACK_RULER_UPDATE:
+ return "LOK_CALLBACK_RULER_UPDATE";
}
g_assert(false);
return nullptr;
@@ -1422,6 +1425,9 @@ callback (gpointer pData)
case LOK_CALLBACK_COMMENT:
g_signal_emit(pCallback->m_pDocView, doc_view_signals[COMMENT], 0, pCallback->m_aPayload.c_str());
break;
+ case LOK_CALLBACK_RULER_UPDATE:
+ g_signal_emit(pCallback->m_pDocView, doc_view_signals[RULER], 0, pCallback->m_aPayload.c_str());
+ break;
default:
g_assert(false);
break;
@@ -3208,6 +3214,16 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
g_cclosure_marshal_generic,
G_TYPE_NONE, 1,
G_TYPE_STRING);
+
+ doc_view_signals[RULER] =
+ g_signal_new("ruler",
+ G_TYPE_FROM_CLASS(pGObjectClass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ nullptr, nullptr,
+ g_cclosure_marshal_generic,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
}
SAL_DLLPUBLIC_EXPORT GtkWidget*
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index d4d7cfbc9ab5..352dbcfb5511 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -88,6 +88,8 @@ SfxFormalArgument const aFormalArgs[] = {
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "VersionMajor", SID_DOCINFO_MAJOR },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterOptions", SID_FILE_FILTEROPTIONS },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterName", SID_FILTER_NAME },
+ { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Margin1", SID_RULER_MARGIN1 },
+ { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Margin2", SID_RULER_MARGIN2 },
// { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FileName", SID_FILE_NAME },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "URL", SID_FILE_NAME },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "OpenFlags", SID_OPTIONS },
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 8392ba2fd678..f4deadc572e1 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -2678,6 +2678,11 @@ void Ruler::SetTextRTL(bool bRTL)
}
+long Ruler::GetPageWidth() const
+{
+ return mpData->nPageWidth;
+}
+
long Ruler::GetPageOffset() const
{
return mpData->nPageOff;
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index b3583814bb40..ead2a6047ef3 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -7101,6 +7101,24 @@ SvxProtectItem RulerProtect SID_RULER_PROTECT
GroupId = SfxGroupId::View;
]
+SfxVoidItem RulerChangeState SID_RULER_CHANGE_STATE
+(SfxStringItem Margin1 SID_RULER_MARGIN1, SfxStringItem Margin2 SID_RULER_MARGIN2)
+[
+ AutoUpdate = FALSE,
+ FastCall = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
SfxVoidItem SbaExecuteSql SID_FM_EXECUTE
()
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index a506345821c3..01b6a2370323 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -37,6 +37,7 @@
#include <editeng/tstpitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/protitem.hxx>
+#include <comphelper/lok.hxx>
#include <svx/svdtrans.hxx>
@@ -3613,4 +3614,14 @@ void SvxRuler::SetTabsRelativeToIndent( bool bRel )
mxRulerImpl->bIsTabsRelativeToIndent = bRel;
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+void SvxRuler::SetValues(RulerChangeType type, long diffValue)
+{
+ if (diffValue == 0)
+ return;
+
+ if (type == RulerChangeType::MARGIN1)
+ AdjustMargin1(diffValue);
+ else if (type == RulerChangeType::MARGIN2)
+ SetMargin2( GetMargin2() - diffValue);
+ ApplyMargins();
+} \ No newline at end of file
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 9316b919137e..797aec9512fa 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -64,6 +64,7 @@
#include <rtl/ref.hxx>
#include <svl/itemprop.hxx>
#include <svx/fmdmod.hxx>
+#include <svx/ruler.hxx>
#include <editeng/UnoForbiddenCharsTable.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase.hxx>
@@ -423,6 +424,8 @@ public:
OUString getTrackedChanges() override;
/// @see vcl::ITiledRenderable::getTrackedChangeAuthors().
OUString getTrackedChangeAuthors() override;
+
+ OUString getRulerState() override;
/// @see vcl::ITiledRenderable::getPostIts().
OUString getPostIts() override;
// css::tiledrendering::XTiledRenderable
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 62e67f6b0d5c..d6ba21022c0e 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -235,6 +235,10 @@ interface BaseTextEditView
StateMethod = StateTabWin ;
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
+ SID_RULER_CHANGE_STATE
+ [
+ ExecMethod = ExecTabWin ;
+ ]
SID_RULER_BORDERS // status()
[
ExecMethod = ExecTabWin ;
diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx
index c8f1deb12842..7821d3f89281 100644
--- a/sw/source/uibase/inc/swruler.hxx
+++ b/sw/source/uibase/inc/swruler.hxx
@@ -41,6 +41,7 @@ public:
* \param rRect ignored
*/
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ const std::string CreateJsonNotification();
protected:
SwViewShell * mpViewShell; //< Shell to check if there is any comments on doc and their visibility
@@ -50,6 +51,7 @@ protected:
int mnFadeRate; //< From 0 to 100. 0 means not highlighted.
ScopedVclPtr<VirtualDevice> maVirDev; //< VirtualDevice of this window. Just for convenience.
+ void NotifyKit();
/**
* Callback function to handle a mouse button down event.
*
diff --git a/sw/source/uibase/misc/swruler.cxx b/sw/source/uibase/misc/swruler.cxx
index c1c28dd50d9f..5c33febef4bc 100644
--- a/sw/source/uibase/misc/swruler.cxx
+++ b/sw/source/uibase/misc/swruler.cxx
@@ -24,9 +24,11 @@
#include <vcl/window.hxx>
#include <vcl/settings.hxx>
#include "strings.hrc"
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <boost/property_tree/json_parser.hpp>
#define CONTROL_BORDER_WIDTH 1
-
#define CONTROL_LEFT_OFFSET 6
#define CONTROL_RIGHT_OFFSET 3
#define CONTROL_TOP_OFFSET 4
@@ -246,12 +248,41 @@ void SwCommentRuler::MouseButtonDown( const MouseEvent& rMEvt )
Invalidate();
}
+const std::string SwCommentRuler::CreateJsonNotification()
+{
+ boost::property_tree::ptree jsonNotif;
+
+ jsonNotif.put("margin1", convertTwipToMm100(GetMargin1()));
+ jsonNotif.put("margin2", convertTwipToMm100(GetMargin2()));
+ jsonNotif.put("leftOffset", convertTwipToMm100(GetNullOffset()));
+ jsonNotif.put("pageOffset", convertTwipToMm100(GetPageOffset()));
+ jsonNotif.put("pageWidth", convertTwipToMm100(GetPageWidth()));
+
+ RulerUnitData aUnitData = GetCurrentRulerUnit();
+ jsonNotif.put("unit", aUnitData.aUnitStr);
+
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, jsonNotif);
+ std::string aPayload = aStream.str();
+ return aPayload;
+}
+
+void SwCommentRuler::NotifyKit()
+{
+ if (!comphelper::LibreOfficeKit::isActive())
+ return;
+
+ const std::string test = CreateJsonNotification();
+ mpViewShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_RULER_UPDATE, test.c_str());
+}
+
void SwCommentRuler::Update()
{
tools::Rectangle aPreviousControlRect = GetCommentControlRegion();
SvxRuler::Update();
if (aPreviousControlRect != GetCommentControlRegion())
Invalidate();
+ NotifyKit();
}
void SwCommentRuler::UpdateCommentHelpText()
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 84b1af29a751..ad92a7ae6e21 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -52,6 +52,7 @@
#include "wview.hxx"
#include "fmtcol.hxx"
#include "section.hxx"
+#include "swruler.hxx"
#include "ndtxt.hxx"
#include "pam.hxx"
@@ -801,6 +802,24 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
rSh.SetAttrItem( aULSpace );
}
break;
+
+ case SID_RULER_CHANGE_STATE:
+ {
+ const SfxPoolItem *pMargin1, *pMargin2;
+ if ( pReqArgs &&
+ pReqArgs->GetItemState(SID_RULER_MARGIN1,true,&pMargin1) == SfxItemState::SET )
+ {
+ const OUString ratio = static_cast<const SfxStringItem*>(pMargin1)->GetValue();
+ GetHRuler().SetValues(RulerChangeType::MARGIN1, GetHRuler().GetPageWidth() * ratio.toFloat());
+ }
+ else if ( pReqArgs &&
+ pReqArgs->GetItemState(SID_RULER_MARGIN2,true,&pMargin2) == SfxItemState::SET )
+ {
+ const OUString ratio = static_cast<const SfxStringItem*>(pMargin2)->GetValue();
+ GetHRuler().SetValues(RulerChangeType::MARGIN2, GetHRuler().GetPageWidth() * ratio.toFloat());
+ }
+ }
+ break;
case SID_RULER_BORDERS_VERTICAL:
case SID_RULER_BORDERS:
if ( pReqArgs )
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index c3afd987974f..cc765f88feab 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -130,6 +130,8 @@
#include <comphelper/storagehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <unotools/saveopt.hxx>
+#include "swruler.hxx"
+
#include <EnhancedPDFExportHelper.hxx>
#include <numrule.hxx>
@@ -3255,6 +3257,12 @@ OUString SwXTextDocument::getTrackedChangeAuthors()
return SW_MOD()->GetRedlineAuthorInfo();
}
+OUString SwXTextDocument::getRulerState()
+{
+ SwView* pView = pDocShell->GetView();
+ return OUString::fromUtf8((dynamic_cast<SwCommentRuler&>(pView->GetHRuler())).CreateJsonNotification().c_str());
+}
+
OUString SwXTextDocument::getPostIts()
{
SolarMutexGuard aGuard;