blob: 90535c6d66aa5e6b6148a3fcf93e483dbf4d6711 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "uiobject.hxx"
#include "Window.hxx"
#include "DrawViewShell.hxx"
ImpressWindowUIObject::ImpressWindowUIObject(VclPtr<sd::Window> xWindow):
WindowUIObject(xWindow),
mxWindow(xWindow)
{
}
StringMap ImpressWindowUIObject::get_state()
{
StringMap aMap = WindowUIObject::get_state();
aMap["SelectedText"] = getViewShell()->GetSelectionText();
aMap["CurrentSlide"] = OUString::number(getViewShell()->GetCurPageId());
return aMap;
}
void ImpressWindowUIObject::execute(const OUString& rAction,
const StringMap& rParameters)
{
if (rAction == "SET")
{
if (rParameters.find("ZOOM") != rParameters.end())
{
auto itr = rParameters.find("ZOOM");
OUString aVal = itr->second;
sal_Int32 nVal = aVal.toInt32();
getViewShell()->SetZoom(nVal);
}
}
else if (rAction == "GOTO")
{
if (rParameters.find("PAGE") != rParameters.end())
{
auto itr = rParameters.find("PAGE");
OUString aVal = itr->second;
sal_Int32 nVal = aVal.toInt32();
getViewShell()->SwitchPage(nVal);
}
}
WindowUIObject::execute(rAction, rParameters);
}
OUString ImpressWindowUIObject::get_name() const
{
return OUString("ImpressWindowUIObject");
}
std::unique_ptr<UIObject> ImpressWindowUIObject::create(vcl::Window* pWindow)
{
sd::Window* pWin = dynamic_cast<sd::Window*>(pWindow);
assert(pWin);
return std::unique_ptr<UIObject>(new ImpressWindowUIObject(pWin));
}
sd::DrawViewShell* ImpressWindowUIObject::getViewShell()
{
sd::DrawViewShell* pViewShell = dynamic_cast<sd::DrawViewShell*>(mxWindow->GetViewShell());
assert(pViewShell);
return pViewShell;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|